Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble Identifying a Full System Path

Status
Not open for further replies.

minhtam2448

Technical User
Jan 4, 2008
8
US
The current script I found on the internet involves the following variable

# $DATA_PATH is the FULL system path to the directory where
# your survey data files are stored. Your web server must have
# permission to write to and create files in this directory

$DATA_PATH= "/usr/local/apache/share/xmylittlenet/cgi-bin/survey"

Now, the thing is, I don't know what the formula for a typical system path is. Can anybody help me out?
 
I don't think I understand your question.

Where is your "survey" data at currently?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
From what I know, the path ends with saimoearena.com/cgi-bin/survey , where saimoearena.com is the website itself. That was also my first guess as to the system path, but it did not work out.
 
when you ftp/telnet to your server type pwd (if it's unix/linux) to see your full path.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
Okay, I did that, and I end up with /home/minhtam2448/saimoearena.com/cgi-bin/survey , but the following subroutine still gives me a !-e for file existence:

sub check_files{

$DATA_FILE="$DATA_PATH/$SURVEY_NAME\.srv";

$LOG_FILE="$DATA_PATH/$SURVEY_NAME\.log";

if ( !-e $DATA_FILE){

print "Content-type: text/html\n\n Data File is Missing!\n";

exit;

}

if ( !-w $DATA_FILE){

print "Content-type: text/html\n\n Data File Cannot be Written to!\n";

exit;

}

if ( !-e "$LOG_FILE" && $USE_LOGGING == 1){

open(OP,">>$LOG_FILE");

close(OP);

}

if ( !-w "$DATA_PATH/$SURVEY_NAME\.log" && $USE_LOGGING == 1){

print "Content-type: text/html\n\n Log File Cannot be Written to!\n";

exit;

}

}

So, if the case that the path is right, then I am assuming the $SURVEY_NAME variable is the one at fault, but I can't seem to find the logical error (or if there even is one) for this.

I'll leave the subroutine for decoding variables here:

sub decode_vars

{

$i=0;

if ( $ENV{'REQUEST_METHOD'} eq "GET")

{

$temp=$ENV{'QUERY_STRING'};

}

else

{

read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});

}

@pairs=split(/&/,$temp);

foreach $item(@pairs)

{

($key,$content)=split(/=/,$item,2);

$content=~tr/+/ /;

$content=~s/%(..)/pack("c",hex($1))/ge;

$content=~s/\0//g;

$key=~s/\0//g;

$content=~s/\012//gs;

$content=~s/\015/ /gs;

$fields{$key}=$content;

}

if ($fields{'survey_name'}=~/^([-\@\w.]+)$/){

$SURVEY_NAME=$fields{'survey_name'};

}

else {exit;}

$fields{'comments'}=~s/\t/ /g;

$fields{'email'}=&valid_address($fields{'email'});

}

The thing is, I don't know how to solve this file existing problem...
 
Does the survey file need to exist first?

you might change this

print "Content-type: text/html\n\n Data File is Missing!\n";

to this


print "Content-type: text/html\n\n Data File is Missing! DATEFILE=$DATA_FILE\n";

to get more info

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top