Tredan Posted June 4, 2007 Share Posted June 4, 2007 This code is not working for some reason. <?php $page = $_POST["page"]; $go="123abc" if (file_exists($go && ".php") && $page==$go) { unlink($go & ".php"); header("Location: gm6togm5.zip") ; } else echo "Wrong reg code, or reg code used already." ?> Error given. Parse error: syntax error, unexpected T_IF in /home/murtagh/public_html/aljk/go.php on line 4 Im new to php just started can someone help me? Quote Link to comment https://forums.phpfreaks.com/topic/54157-solved-cant-figure-this-out/ Share on other sites More sharing options...
kenrbnsn Posted June 4, 2007 Share Posted June 4, 2007 You forgot the semi-colon at the end of this line: <?php $go="123abc" ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/54157-solved-cant-figure-this-out/#findComment-267747 Share on other sites More sharing options...
Tredan Posted June 4, 2007 Author Share Posted June 4, 2007 You forgot the semi-colon at the end of this line: <?php $go="123abc" ?> Ken Heh i cant believe i missed that thanks Quote Link to comment https://forums.phpfreaks.com/topic/54157-solved-cant-figure-this-out/#findComment-267751 Share on other sites More sharing options...
Tredan Posted June 4, 2007 Author Share Posted June 4, 2007 Now that worked but even though the file exists it doesn't goto the download ??? Quote Link to comment https://forums.phpfreaks.com/topic/54157-solved-cant-figure-this-out/#findComment-267757 Share on other sites More sharing options...
chigley Posted June 4, 2007 Share Posted June 4, 2007 && ".php" How does that work? Quote Link to comment https://forums.phpfreaks.com/topic/54157-solved-cant-figure-this-out/#findComment-267759 Share on other sites More sharing options...
Tredan Posted June 4, 2007 Author Share Posted June 4, 2007 && ".php" How does that work? I have tried like +".php" and many many other things i dont know how it works lol. Quote Link to comment https://forums.phpfreaks.com/topic/54157-solved-cant-figure-this-out/#findComment-267764 Share on other sites More sharing options...
kenrbnsn Posted June 4, 2007 Share Posted June 4, 2007 The string concatenation operator is the period: <?php $str = "test"; $str2 = $str . ".php"; echo $str2; // outputs the string 'test.php'; ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/54157-solved-cant-figure-this-out/#findComment-267780 Share on other sites More sharing options...
per1os Posted June 4, 2007 Share Posted June 4, 2007 if (file_exists($go . ".php") && $page==$go) { unlink($go . ".php"); In PHP the equivilent to javascripts concat (+) and .NETs concat (&) is the period (.) as seen above. Quote Link to comment https://forums.phpfreaks.com/topic/54157-solved-cant-figure-this-out/#findComment-267782 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.