Hi!
I validate a user and set a cookie woht the following sentence:
setcookie("usNick",$nickN,time()+7776000);
setcookie("usPass",$passN,time()+7776000);
then I want to validate if the cookie is set with the following
sentence and it seems to enter in the "else", so the cookie was not
established.
if(isset($HTTP_COOKIE_VARS["usNick"]) &&
isset($HTTP_COOKIE_VARS["usPass"]))
{
$result = mysql_query("SELECT * FROM usuarios WHERE nick='".
$HTTP_COOKIE_VARS["usNick"]."' AND password='".
$HTTP_COOKIE_VARS["usPass"]."'");
}
else
{
setcookie("usNick","x",time()-3600);
setcookie("usPass","x",time()-3600);
}
Can anyone help me with this? I mena, setting the cookie correctly
Regards,
Ezequiel 1 1554
zek2005 <es*******@gmail.comwrote:
Hi!
I validate a user and set a cookie woht the following sentence:
setcookie("usNick",$nickN,time()+7776000);
setcookie("usPass",$passN,time()+7776000);
then I want to validate if the cookie is set with the following
sentence and it seems to enter in the "else", so the cookie was not
established.
if(isset($HTTP_COOKIE_VARS["usNick"]) &&
isset($HTTP_COOKIE_VARS["usPass"]))
{
$result = mysql_query("SELECT * FROM usuarios WHERE nick='".
$HTTP_COOKIE_VARS["usNick"]."' AND password='".
$HTTP_COOKIE_VARS["usPass"]."'");
}
else
{
setcookie("usNick","x",time()-3600);
setcookie("usPass","x",time()-3600);
}
Can anyone help me with this? I mena, setting the cookie correctly
First of all: never, never, never, never save a password in a cookie.
Second: use $_COOKIE.
Third: the cookie will only be set for future request, this request was
made without a cookie, so even if you set a cookie now it won't show up in
the $_COOKIE array automagically.
I suspect your more helped by just using sessions:
<http://www.php.net/session>
--
Rik Wasmus This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Satinderpal Singh |
last post by:
Hi everyone,
We are using HttpWebRequest to create a request to a URI, which requires us
to login first. In order to process all the transactions, first we have to
login and get the cookie value...
|
by: pwldev |
last post by:
Sorry if this isn't a good place for this question.
I have a problem with losing cookie values whenever a user's local machine
date/time is behind the date & time of the IIS machine. The login...
|
by: Syed Ghayas |
last post by:
Hi,
I've been having problem writing a cookie. Everything goes ok but when I
supply the .Path property to "/" It just write the cookie when there is no
cookie present, but when I try to update the...
|
by: Christoph Pieper |
last post by:
Hi,
we've the following problem :
We have an asp-application which sets the cookie on first login. The cookie
will never be touched during user access. The user can work the whole day,
but...
|
by: Michal A. Valasek |
last post by:
Hello,
I have problem deleting cookies and cookies values (using framework version
1.1 on W2003).
When I try to remove entire cookie, by calling
Response.Cookies.Remove("Test"), nothing...
|
by: ElmoWatson |
last post by:
I tried on the Security newgroup, as well as other places, and haven't
gotten an answer yet - - I'm pulling my hair out over this one.
I'm trying to get Forms Authentication working.....I can get...
|
by: Satinderpal Singh |
last post by:
Hi everyone,
We are using HttpWebRequest to create a request to a URI, which requires us to login first. In order to process all the transactions, first we have to login and get the cookie value...
|
by: rss |
last post by:
SUMMARY:
==========
I am unable to pass along a simple Cookie obtained from a HttpWebRequest
call (Machine A's ASP.NET app) so that another Web Server (Machine B)
recongnizes the cookie.
I...
|
by: Bill Nicholson |
last post by:
Maybe I don't understand cookies correctly. When some visits my site
and logs in, they get a cookie that stores their login information.
When they come back, that info is read from the cookie and...
|
by: sewen |
last post by:
Dear all,
I got a problem when i tried to access cookie in my project.
There are 2 pages in the project:a.aspx and b.aspx.
In a.aspx,i put the fololowing scripts:
function SetCookie(name,value
{...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |