tyrisia Posted July 21, 2007 Share Posted July 21, 2007 Hi All, I'm having a bit of trouble with a session script, basically there is a function within a for loop that protects the target of the link it produces. Instead of creating the link it produces something a bit like: &entries=/linksout.php?PHPSESSID=b7ed5961a8bce563faa7a1307d04ff82&sitelokaction=getfiled&sitelokfile=night.swf&auth=90af7e3077a5d19fcce57d6785aef52f/night.swfloop series track 1& Here's the code: $DBConn = mysql_connect($DBhost,$DBuser,$DBpass) or die("Error in GuestBook Application: " . mysql_error()); // Select mySQL Database mysql_select_db($DBName, $DBConn) or die("Error in GuestBook Application: " . mysql_error()); $sql = "SELECT * FROM $table WHERE Username LIKE '%$user%' ORDER BY date"; $alltracks = mysql_query($sql, $DBConn) or die("Error in GuestBook Application: " . mysql_error()); $numalltracks = mysql_num_rows($alltracks); print '<br>&entries='; if($numalltracks == 0) { print "No tracks purchased yet"; } else { for ($i=0; $i<$numalltracks; $i++) { $name = mysql_result($alltracks, $i, 'title'); $link = mysql_result($alltracks, $i, 'link'); $date = mysql_result($alltracks, $i, 'date'); // echo '<a href=\"' . siteloklink($link,1) . '\">' . $name . '</a>'; print '<a href="' . (siteloklink($link,1)) . '">' . $name . '</a>'; } }print "&"; Hope someone can help here, it's got me baffled.. Quote Link to comment Share on other sites More sharing options...
tyrisia Posted July 21, 2007 Author Share Posted July 21, 2007 Anybody? Please:) Quote Link to comment Share on other sites More sharing options...
dbo Posted July 22, 2007 Share Posted July 22, 2007 You didn't really ask a question. Please explain what you're trying to accomplish. Quote Link to comment Share on other sites More sharing options...
tyrisia Posted July 22, 2007 Author Share Posted July 22, 2007 Ok, what I want to know is how do I get my function (siteloklink($link,1)) to produce the relevant hyperlink for each row of the array outputted from the database, instead of printing (or echoing) the function's result in whole, but not allowing me to link to the file defined in the function? Quote Link to comment Share on other sites More sharing options...
simon551 Posted July 22, 2007 Share Posted July 22, 2007 what does this: print '<a href="' . (siteloklink($link,1)) . '">' . $name . '</a>'; produce? Quote Link to comment Share on other sites More sharing options...
tyrisia Posted July 22, 2007 Author Share Posted July 22, 2007 that line of code produces the following: &entries=/linksout.php?PHPSESSID=4cdb784562751c9ea1a522a61bdd5434&sitelokaction=getfiled&sitelokfile=night.swf&auth=0f0177eaba5a7cd7c57786b6418620b7/night.swfloop series track 1[/url]& Quote Link to comment Share on other sites More sharing options...
tyrisia Posted July 23, 2007 Author Share Posted July 23, 2007 by the way the function that is causing the problem resides in a seperate script that is included at the top of the current php page. can someone help me out here please? Quote Link to comment Share on other sites More sharing options...
trq Posted July 23, 2007 Share Posted July 23, 2007 Can we see the siteloklink function? Quote Link to comment Share on other sites More sharing options...
tyrisia Posted July 23, 2007 Author Share Posted July 23, 2007 Here it is: function siteloklink($fname,$dialog) { global $thispage,$SiteKey,$NoExtraPath; // See if location specified $auth=md5(session_id().$fname.$SiteKey); $link=$thispage."?PHPSESSID=".session_id()."&sitelokaction="; if ($dialog==0) $link.="getfile"; else $link.="getfiled"; $link.="&sitelokfile=".$fname; $link.="&auth=".$auth; $fname=strtok($fname,":"); if ($NoFilename!=1) $link.="/".$fname; print($link); } Quote Link to comment Share on other sites More sharing options...
tyrisia Posted July 30, 2007 Author Share Posted July 30, 2007 anybody? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.