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?
If statement help please.
Hello on my site I have 2 content boxes. 1 is for the main content (which is the biggest one) and the second one is for a sub navigation (which is a small box). I am trying to write an IF statement so
db entry based on primary key
My "topics" table contains 10 entires*--------------*topicid topic------*--------------* 01 Bye 02 Hi 03 Hello..... 10 Morning*--------------*<?php
Pulling out some result data from MYSQL
Hey Guys, I've built a PHP page that has a for just imagine something like registration form, So obviously it posts data into my table in my DB, So Now what I’m trying to do is creating a form
Need understanding of this bit of code
Code: <?php // WHERE clause filters $arrSQLFilters = array(); // whether or not zip codes table needs to be included $boolIncludeZipCodes = false; // Zipcode filter
Not capturing all the information we require in the form.......
Hi Guys,I was wondering if you would share some more of your knowledge today, I'm hoping it will be quite a simple answer for you but one that is boggling us here! ;-)We have an html form that users
MSSQL/PHP
I am tryint to setup a webapplication developed in PHP, Apache2.0 and SQLServer2000 as backend which is running smoothly on a system in UK. I got the code and database backup from the Production
Get last modified date of web page
Hai All, In php how can i get last modified date of a give web page . I have tried to get last modified from the header but for some pages the server of that webpage doesn't returns lastmodified
wav to mp3 + goDaddy
I need to convert wav files to mp3s. From what I have found so far one way to do it is to have my PHP script call exec to some mp3 encoder on my host's server. I am using a GoDaddy shared Linux
foreach result into a single variable
Hi,I have this code... Code: [Select]foreach ($_POST['Interests'] as $interest => $value) { echo "Interests: $interest; Value: $value";}How do I store the multiple results in a
Could Someone Please Debug This?
I was wondering if someone could debug this script for me. I realize it's not the tidest script (and probably not the most efficiant in the world) but it was quite late when I wrote it and I can't be