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
https://forums.phpfreaks.com/topic/15482-setcookie-problem/
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
https://forums.phpfreaks.com/topic/15482-setcookie-problem/#findComment-62845
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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