Jump to content

setcookie problem


brob

Recommended Posts

hi here is my code

[code]import_request_variables("gP","");

$md5pass = md5($password);

include('db_stu_connect.php');

$getusername = mysql_query("select email1,passw_c from contacts_cstm,contacts where contacts.id = contacts_cstm.id_c and email1 = '$username' and contacts_cstm.passw_c = '$md5pass'");
$gotusername = mysql_fetch_row($getusername);

if ($gotusername[0] != "")
{
$username = $gotusername[0];

setcookie ("dbghstudent", "$username",0,"/");

?>
<script language="JavaScript">
parent.location='http://www.site.net/other_pages/test.php';
</script>
<?php
}
else
{[/code]

and for some reason it isn't setting the cookie can anyone see a reason for this?

Thanks
Link to comment
Share on other sites

hi thanks for the reply,

It still doesn't seem to work even though I have set the time for an hour ahead i.e.

[code]setcookie ("dbghstudent", "$username",time()+36000,"/");[/code]

any ideas why this is?

For some reason its just not setting the cookie.
Link to comment
Share on other sites

hi this is the code in full

[code]
<?php
import_request_variables("gP","");

$md5pass = md5($password);

include('db_stu_connect.php');

$getusername = mysql_query("select email1,passw_c from contacts_cstm,contacts where contacts.id = contacts_cstm.id_c and email1 = '$username' and contacts_cstm.passw_c = '$md5pass'");
$gotusername = mysql_fetch_row($getusername);

if ($gotusername[0] != "")
{
$username = $gotusername[0];

setcookie ("dbghstudent", "$username",time()+36000,"/");

?>
<script language="JavaScript">
parent.location='http://www.site.net/other_pages/test.php';
</script>
<?php
}
else
{
?>
sorry invalid login
<?
if ($gotusername[0] == "")
{
echo '<p><font color="#FF0000">Invalid username and/or password. Please try again.</font></p>';
}

?>
[/code]

I have used this system on another site and it worked but for this site it seems to fail
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.