Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/articles/php-tutorials/)
-   -   Login and Logout using Sessions and Cookies (http://www.go4expert.com/articles/login-logout-using-sessions-cookies-t361/)

shabbir 26Sep2011 13:13

Re: Login and Logout using Sessions and Cookies
 
Quote:

Originally Posted by shellz (Post 87311)
Hi Mr Shabbir..
I'm really new in php.. i've tried this code, but it doesn't work.. Can you please help me?
Thanks..:nice:

Can you say what did not work?

shellz 30Sep2011 10:30

Re: Login and Logout using Sessions and Cookies
 
I am trying to make a login form and i've tried the coding that u gave... But it doesn't work.. Everytime I try to run the program "Parse error: syntax error, unexpected $end in C:\xampp\htdocs\login.php on line 89" always comes out.. i change the document of index into index1 as i also have another document in htdocs folder, but i also change the script in login.php
Code:

if ($username=="" or $password=="" )
        {
                echo "<h1>Username or password is blank</h1>";
                clearsessionscookies();
                header("location: login.php?returnurl=$returnurl");
        }
        else
        {
                if(confirmuser($username,md5($password))) // As pointed out by asgard2005
                {
                        createsessions($username,$password);
                        if ($returnurl<>"")
                                header("location: $returnurl");
                        else
                        {
                                header("Location: index1.php"); (this one from index.php into index1.php)
                        }
                }
                else
                {
                        echo "<h1>Invalid Username and/Or password</h1>";
                        clearsessionscookies();
                        header("location: login.php?returnurl=$returnurl");
                }
        }
        break;
case "logout":
        clearsessionscookies();
        header("location: index1.php"); (from index.php into index1.php)
        break;

Does it gives any effect? thanks for your explanation..

bobwarner01 19Oct2011 12:19

Re: Login and Logout using Sessions and Cookies
 
Sessions and Cookies are really nice interesting topic to cover. Thanks for sharing mate. Actually i was searching the coding that you given, But now its all clear. I found 2-3 but was not applicable

iMustBeAlien 9Nov2011 14:04

Re: Login and Logout using Sessions and Cookies
 
so cool explained... happy to read it ,thanx for this bro


All times are GMT +5.5. The time now is 05:54.