
December 23rd, 2003
09:56 AM
Neverside Newbie
Status: Offline!
Doesnt set the cookies
<?
ob_start();
include("../database/colors.db.php"); ?>
<?php
$user = 'user'; //The username you want
$pass = 'pass'; //The password you want
$iduser = $_POST['id'];
$idpass = $_POST['pass'];
if(($iduser == $user) && ($idpass == $pass))
{
setcookie('id',$user,time()+3600);
setcookie('pass',$pass,time()+3600);
echo ("<script>window.location = '../admin.php'</script>");
}
else
{
echo ("Wrong Password/Username!");
}
ob_end_flush();
?>
it doenst set the cookies :-/
___________________
| Lunar Poll | Dexxaboys Site |

December 23rd, 2003
01:27 PM
16, staying Asian.
Status: Offline!
$_POST[] is for info passed from forms.
you want $_COOKIE[]
___________________


December 23rd, 2003
06:35 PM
I believe the POSTs are coming from a form.

December 24th, 2003
10:12 AM
Neverside Newbie
Status: Offline!
Originally posted by Will742
I believe the POSTs are coming from a form.
yes, here is both the form and php script
<form action="actions/access.php" method="POST">
Username:<br><input type="text" name="id"><br>
Password:<br><input type="password" name="pass"><br>
<input type="submit" name="login" value="Login">
</form>
<?
ob_start();
include("../database/colors.db.php"); ?>
<?php
$user = 'user'; //The username you want
$pass = 'pass'; //The password you want
$iduser = $_POST['id'];
$idpass = $_POST['pass'];
if(($iduser == $user) && ($idpass == $pass))
{
setcookie('id',$user,time()+3600);
setcookie('pass',$pass,time()+3600);
echo ("<script>window.location = '../admin.php'</script>");
}
else
{
echo ("Wrong Password/Username!");
}
ob_end_flush();
?>
___________________
| Lunar Poll | Dexxaboys Site |

December 24th, 2003
01:36 PM
16, staying Asian.
Status: Offline!
ok, then how are you displaying the cookies?
___________________


December 24th, 2003
02:23 PM
$_COOKIE is for cookies
$_POST is for forms
$_GET is for urls
$_SERVER is for super globals
etc etc..
use $_COOKIE
___________________

If you plan on contacting me, please read this: Legal Terms & Conditions

December 24th, 2003
05:03 PM
Neverside Newbie
Status: Offline!
sorry, but im new at this. :confused:
my thought is: if the password & username is correct a cookie will be created with that info...
___________________
| Lunar Poll | Dexxaboys Site |

December 24th, 2003
10:22 PM
16, staying Asian.
Status: Offline!
but how do you know the cookies are not being set?
do echo $_COOKIE['id']; and see what shows.
___________________


December 24th, 2003
11:41 PM
[QUOTE][i]Originally posted by epyon[/i]
[B]but how do you know the cookies are not being set?
do echo $_COOKIE['id']; and see what shows. [/B][/QUOTE]
or you could just run an if statement with the isset function.