I'm currently playing around with a user system with login and registration. I'm trying to use cookies to log the user in but the cookie either doesn't set or it sets after I travel through a few pages. Also, when I use isset($_COOKIE(name)) it sometimes doesn't return that it is set even though it is.
login.php (the username and password request page which I am currently using to display if a cookie is set)
Code: <?php
if (isset($_COOKIE["grocerycookie"]))
{
$username = $_COOKIE["grocerycookie"];
echo "You are logged in, <b>$username</b><br />";
}
else
{
echo "You have not been logged in.";
}
?>
login2.php (sets the cookie)
Code: <?php
mysql_connect("*", "*", "*") or die(mysql_error());
mysql_select_db("*") or die(mysql_error());
$username = strtolower($_POST['username']);
$password = $_POST['password'];
$data = mysql_query("SELECT * FROM * WHERE username='$username'") or die(mysql_error());
while($info = mysql_fetch_array($data))
{
if ($password == $info['password'])
{
setcookie("grocerycookie", $username, time()+3600);
}
}
Am I setting the cookie wrong or checking for it wrong?
Disabling SAP menu
How do I disable SAP menu for all the users and just restrict them to User Menu in SAP ECC 6.0?
Validating time
Hi Guyswhat do you think of the following approach to validate a 24hour time:http://snipplr.com/view/23007/validate-time/Are there any better approaches ?
Reading waves
Hi,I am trying to find a way of finding the highs and lows on a graph line, the line points will be given in the form (x,y). Does anyone know a way to do this or a tutorial that will show me how to do
I need help with formatting date from mysql! with php!
Hello guys*Note: this is a php question not MySQL question, please do not move it to mysql section! Thank you.anyway, I have a record from the database as 2009-12-31 23:59:59I needed to when ever I
PHP SUBMIT
Code: <input name="doLogin" type="image" src="images/loginsubmit.jpg" id="doLogin3" value="Login">ON FIREFOX it works finebut on
Serial number of exernal hard disk/Thumbdrive
Hi guys,
function to return url
Hi,Can you guys help me giving a function that takes all the contents in a particular field and returns text and url seperately...For instance,Go:here is the linkwww.google.comit takes all the
gettext translates ALWAYS?
I'm using gettext with the new version of XAMPP (5.3.0) on Windows Seven RTM (build 7600)gettext-support is enabled.It used to work perfectly a few weeks ago.I'm not quite sure what changed this. Be
Something Non-Traditional. Can we solve?
I have an idea for an application here. It's mostly flash, but it couldn't work without a somewhat non-traditional php functionality.here's the thing:I want to have a function which returns an
Struct/union and scope problem!
HI all , I have