Jump to content

COOKIES


Daney11

Recommended Posts

<?php

include_once('settings.php'); // This Includes The Settings Of The Website
include_once('functions.php'); // This Includes The Functions Of The Website
include_once('team.php'); // This Includes The Team Information Of The Website

if (isset($_POST['submitted'])) {

$errors = array();

if (empty($_POST['member_email'])) {
$errors[] = 'You Forgot To Enter Your Email Address';
} else {
$member_email = escape_data($_POST['member_email']);
}

if (empty($_POST['member_password'])) {
$errors[] = 'You Forgot To Enter Your Password';
} else {
$member_password = escape_data($_POST['member_password']);
}

if (empty($errors)) {

$query = 'SELECT * FROM members '."where member_email='$member_email'" . "and member_password='$member_password'" . "and member_teamid='$team_url'" . "and member_active='Yes'";
$result = mysql_query($query) or die(mysql_error());
$loginrow = mysql_fetch_array($result);

if (mysql_num_rows($result) >0 )

{

setcookie ('member_id', $loginrow['member_id'], time()+3600);
setcookie ('member_teamid', $loginrow['member_teamid'], time()+3600);
setcookie ('member_username', $loginrow['member_username'], time()+3600);
setcookie ('member_nation', $loginrow['member_nation'], time()+3600);
setcookie ('valid_user', $loginrow['member_email'], time()+3600);

} else {

} 

} else {

$errors[] =  'Both dnt match';

}

} else {

$errors[] = NULL;

}

if (!empty($errors)) {

foreach ($errors as $msg) {

echo $msg;

}

}

if (isset($_COOKIE['valid_user'])) {

echo "lal";

} else {

echo "LOL";

}
?>
<form method="post" action="logina.php">
<table width="100%" cellpadding="0" cellspacing="0" border="0" height="60">
<tr> 
<td width="50%" height="20" valign="middle"> <strong>Username:</strong></td>
<td width="50%" height="20" valign="middle"><input class="loginform" type="text" name="member_email"></td>
</tr>
<tr> 
<td width="50%" height="20" valign="middle"> <strong>Password:</strong></td>
<td width="50%" height="20" valign="middle"><input class="loginform" type="password" name="member_password"></td>
</tr>
<tr> 
<td width="50%" height="20" valign="middle"> <strong><a href="forgot_password.php">Forgot Password?</a></strong></td>
<td width="50%" height="20" valign="middle"><input class="loginform" type="submit" value="Login"><input type="hidden" name="submitted" value="true"></td>
</tr> 
</table>
</form>

 

hey guys, im using the above login code but the cookies are not setting.

Link to comment
https://forums.phpfreaks.com/topic/96171-cookies/
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.