Jump to content

Problem with Session_start(); * Solved


Drezard

Recommended Posts

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]

<?php
if (isset($_SESSION['userinfo']{
session_start();
$user = $_SESSION['userinfo'];
setcookie('user', $user, time()+36000*24*365);
session_destroy();
}
?>

<head>

</head>

<body>

<?php

if (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

You should always place you session_start(); before anything else. So this is what it should look like.

[code=php:0]
<?php
session_start();
if (isset($_SESSION['userinfo'])) { //this is were you missed two ))
[/code]

Hope this helps,
Tom

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.