Drezard Posted September 16, 2006 Share Posted September 16, 2006 Heres the error:[QUOTE]Parse error: syntax error, unexpected ';' in C:\Program Files\xampp\htdocs\login_sucess.php on line 3[/QUOTE]Heres my code:[CODE]<?phpif (isset($_SESSION['userinfo']{session_start();$user = $_SESSION['userinfo'];setcookie('user', $user, time()+36000*24*365);session_destroy();}?><head></head><body><?phpif (isset($_COOKIE['user'])) {echo "Login Complete, Welcome $user";}if (!isset($_SESSION['userinfo'] (?> <meta http-equiv="refresh" content="0;url=login_form.php">;<?php }?></body></html>[/CODE]Whats wrong with this code?- Cheers, Daniel Link to comment https://forums.phpfreaks.com/topic/21017-problem-with-session_start-solved/ Share on other sites More sharing options...
tomfmason Posted September 17, 2006 Share Posted September 17, 2006 You should always place you session_start(); before anything else. So this is what it should look like.[code=php:0]<?phpsession_start();if (isset($_SESSION['userinfo'])) { //this is were you missed two ))[/code]Hope this helps,Tom Link to comment https://forums.phpfreaks.com/topic/21017-problem-with-session_start-solved/#findComment-93297 Share on other sites More sharing options...
Drezard Posted September 17, 2006 Author Share Posted September 17, 2006 Forgot that rule.Thanks, Daniel Link to comment https://forums.phpfreaks.com/topic/21017-problem-with-session_start-solved/#findComment-93309 Share on other sites More sharing options...
imartin Posted September 17, 2006 Share Posted September 17, 2006 there may be times when Session_start(); wont be the very first bit of code, the important thing is that it comes before anything that will be printed to the file after processing. Link to comment https://forums.phpfreaks.com/topic/21017-problem-with-session_start-solved/#findComment-93351 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.