Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.