Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

40 users online



Doesnt set the cookies

Doesnt set the cookies

Currently viewing this thread: 1 (0 members and 1 guests)


Dexxaboy

Dexxaboy

Neverside Newbie
Status: Offline!

Doesnt set the cookies

PHP:


<?
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 |

epyon

epyon

16, staying Asian.
Status: Offline!

$_POST[] is for info passed from forms.
you want $_COOKIE[]

___________________

http://whatpulse.bounceme.net/sig/epyon.png

Will742

Will742

Status: Offline!

I believe the POSTs are coming from a form.

Dexxaboy

Dexxaboy

Neverside Newbie
Status: Offline!
Quote:

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>

PHP:


<?
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 |

epyon

epyon

16, staying Asian.
Status: Offline!

ok, then how are you displaying the cookies?

___________________

http://whatpulse.bounceme.net/sig/epyon.png

Acecool

Acecool

Status: Offline!

$_COOKIE is for cookies
$_POST is for forms
$_GET is for urls
$_SERVER is for super globals

etc etc..

use $_COOKIE

___________________

http://www.acecoolco.com/avs/Acecoolco_com_Stats_Signature.php
If you plan on contacting me, please read this: Legal Terms & Conditions

Dexxaboy

Dexxaboy

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 |

epyon

epyon

16, staying Asian.
Status: Offline!

but how do you know the cookies are not being set?
do echo $_COOKIE['id']; and see what shows.

___________________

http://whatpulse.bounceme.net/sig/epyon.png

Dabu

Dabu

Status: Offline!

[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.

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0097 seconds.