hey people.
this is my 1st time to get this error.
i usually save cookies using this code:

<?php
$time = time()+60*60*6;
// the time is saved for 6 hours
// then save the cookie with the $id data
setcookie("ln", $id, $time);
?>

but with my new website. nothing is happening!!!
i am using a .htaccess, so can it be the reason??
this is the .htaccess data:

# Awah Dot Biz ---  htaccess file
# Made to control my site
# Made in 06/04/2011 at 00:57 am
# by Awah 
# Email : awah@awah.biz
# site : http://www.awah.biz
# the coder and designer of awah Dot Biz
<Files "htaccess_dist">
    order allow,deny
    deny from all
</Files>

# Don't listing directory
Options -Indexes

# Follow symbolic links
Options +FollowSymLinks

# Default handler
DirectoryIndex index.php

# Turn on expiry
<IfModule mod_expires.c>
	ExpiresActive On
	ExpiresDefault "access plus 10 years"
</IfModule>

# php 5, apache 1 and 2
<IfModule mod_php5.c>
	# default memory limit to 64Mb
	php_value memory_limit 64M
	# to make sure register global is off
	php_value register_globals 0
	# max post size to 8Mb
	php_value post_max_size 8388608
	# upload size limit to 5Mb	
	php_value upload_max_filesize 102428800
</IfModule>

# Turn on mod_gzip if available
<IfModule mod_gzip.c>
	mod_gzip_on yes
    mod_gzip_dechunk yes
    mod_gzip_keep_workfiles No
    mod_gzip_minimum_file_size 1000
    mod_gzip_maximum_file_size 1000000
    mod_gzip_maximum_inmem_size 1000000
    mod_gzip_item_include mime ^text/.* 
    mod_gzip_item_include mime ^application/javascript$
    mod_gzip_item_include mime ^application/x-javascript$
    # Exclude old browsers and images since IE has trouble with this
    mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
    mod_gzip_item_exclude mime ^image/.*
</IfModule>
## Apache2 deflate support if available
<IfModule mod_deflate.c>
	AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
	BrowserMatch ^Mozilla/4 gzip-only-text/html
	BrowserMatch ^Mozilla/4\.[0678] no-gzip
	BrowserMatch \bMSIE !no-gzip

<IfModule mod_headers.c>	
	Header append Vary User-Agent env=!dont-vary
</IfModule>	
	
	# The following is to disable compression for actions. The reason being is that these
	# may offer direct downloads which (since the initial request comes in as text/html and headers
	# get changed in the script) get double compressed and become unusable when downloaded by IE.
	SetEnvIfNoCase Request_URI action\/* no-gzip dont-vary
	SetEnvIfNoCase Request_URI actions\/* no-gzip dont-vary
	
</IfModule>

# Configure ETags
<FilesMatch "\.(jpg|jpeg|gif|png|mp3|flv|mov|avi|3pg|html|htm|swf)$">
	FileETag MTime Size
</FilesMatch>

please people. i reviewed my code more than once and nothing is wrong. this is my login script:

<?php
error_reporting(-1);
if(isset($_COOKIE['ln']))
{
echo '<script type="text/javascript">window.location = "../home.php";</script>';
}
else
{
if(!isset($_POST['email']))
{
echo '
<script type="text/javascript"> alert("please fill the form");
window.location="index.php";</script>';
}
else
{
//here the login code
$email = $_POST['email'];
$password = $_POST['password'];
$password = md5($password);
include_once "../engine/db/main.php";
$db = new db();
$db->connect();
$db->select("awah7870_users");
$email = mysql_real_escape_string($email);
$q = mysql_query("SELECT * FROM `all` WHERE email = '$email' AND password = '$password'");
if(!$q)
{
echo 'Sorry, an Error has occured while we are trying to log you in. The Adiministrations System is being notified with this error and we are already trying to fix the error. Please Try again Laiter';
            echo mysql_error();
			$message =  "ERROR HAS OCCURED WHILE THE USER \" ".$email." \" was trying to login with the password \" ".$password." \" in the following link: http://awah.biz/login/login.php witht the ollowing error:".mysql_error()." ";
			$title = "Login Error";
			$headers = "FROM: the AZONE NOTIICATION SYSTEM";
			mail("errors@awah.biz", $title, $message, $headers);
			
}
else
{
if(mysql_num_rows($q) == 0)
{
echo "Sorry, we couldnt found your Email or Password in our databases. please try again";
}
else if(mysql_num_rows($q) >= 1)
{
while($row = mysql_fetch_array($q))
{
$id = $row['id'];
}
$time = time()+60*60*6;
setcookie("ln", $id, $time);
echo '
<script type="text/javascript">window.location = "../home.php"; </script>';
}}}}

my erroro_reporting is set to -1 so i have to see all the errors and i disabled the redirect function to see if there is any error but i didnt see any error.\

i used another script to see if the cookies are set . the script is :

<?php
if(isset($_COOKIE['logedin']))
{
echo $_COOKIE['logedin'];
}
else
{
echo "<BR>\$_COOKIE['logedin'] is not set";
}
// the ln cookie
if(isset($_COOKIE['ln']))
{
echo "<BR?\$_COOKIE['ln'] is set<BR>";
echo $_COOKIE['ln'];
}
else
{
echo "<BR>\$_COOKIE['ln'] is not set";
}

this thing is killing me!
please tell me what to correct.

note: my database connection is correct and all the database variables are set and working fine. i tested the id that is grabbed from the db and it was fine!

no 1 knows the answer?

i made it1!!!!!1
it is working perfectly now!!!
it is because the cookies permissions were blocked by the .htaccess i guess
so i just changes the directory and i meoved everything to the main drectory so that the cookie become available for the whole site!
thanks anyway

Member Avatar for diafol

> no 1 knows the answer?

You bump after only 2 hours. That's a sure fire way of not getting an answer. Glad you solved it yourself.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.