Page 1 of 1

login script using cookies. page does't redirect

Posted: Mon Mar 14, 2011 2:48 am
by lonely
Hi all,
I am a beginner PHP programmer. when i click on login button. it pass the url "http://localhost/mylibrary/index.php?co ... login=true" instead of redirect to Home.php
config file is included..to conn with mysql. & store pwd in MD5.
1. login form.
<form name="login_form" action="<?php echo $PHP_SELF; ?>?cookie_set=true&login=true" method="post">

2.Index.php
if ($cookie_set==true)
{
if ($login==true)
{
// Making sure the form is not blank
if ($username==true && $password==true)
{
// Setting login cookie
// Encripting the password with MD5
$password = MD5($password);

setcookie("MyLibrary[username]", $username);
setcookie("MyLibrary[password]", $password);
header ("Location: $PHP_SELF?module=home");
exit;
}

plz help me.

Re: login script using cookies. page does't redirect

Posted: Mon Mar 14, 2011 11:52 am
by social_experiment

Code: Select all

if ($cookie_set==true)
{
if ($login==true)
To access values from the query string use $_GET, i.e $_GET['cookie_set'] & $_GET['login'] (unless you are already doing it.)

Re: login script using cookies. page does't redirect

Posted: Tue Mar 15, 2011 12:57 am
by lonely
Thank you very much brother....... :) it was my silly mistake :banghead:
:offtopic: