Jump to content

cookie can't be set


confirmation

Recommended Posts

<?php
if(isset($_POST['login']) AND isset($_POST['password'])){
    $username = addslashes($_POST['login']);
    $username = htmlspecialchars($username);
    $password = addslashes($_POST['password']);
    $password = htmlspecialchars($password);
    $passwordm = md5($password);
    $passwordmd5xx = "XXXXXXXXXX".$passwordm;
    if(!empty($username) AND !empty($password)){

        include('../includes/functions.php');

        $query  =   mysql_query("SELECT * FROM `users` 
                                WHERE user_login='".$username."' 
                                AND user_pass='".$passwordm."' 
                                AND user_status='1'") or die ("Query failed");

        $counts = mysql_num_rows($query);

        if($counts == 0){ include('index.php');
        }else{
            $rows = mysql_fetch_array($query);


            setcookie("user_id",$rows['user_id'],time()+14400);
            setcookie("user_pass",$passwordmd5xx,time()+14400);



            echo "<META HTTP-EQUIV='refresh' CONTENT='1; URL=tools.php'>";
            mysql_close($connectdb);
        }
    }else{
    include('index.php');
    }
}else{
include('index.php');
}
?>

 

 

i'm using this code to connect into my panel administration... for some reason there is no cookies set when i'm try to login... ( no cookies => no login ) when i debug the $_COOKIE it return an empty array !! this code work just fine in localhost and the stranger thing it work also in another web server, but not in this web server that i'm using actually... i can't understand where is the problem :confused:  ?! any suggestion are welcome :happy-04:

 

thank you

Link to comment
https://forums.phpfreaks.com/topic/276612-cookie-cant-be-set/
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.