0

I have problem with login system, in windows it works, but in linux session has not start, after login they navigate to page, but page is clear becouse session is not started.

<?php
$con=mysql_connect("localhost", "root", "") or die("Cannot connect to databases!");
mysql_select_db("registered_users",$con);
$lietotajs = $_POST['login_lietotajvards'];
$parole = MD5($_POST['login_parole']);
$query=mysql_query("SELECT * FROM users WHERE lietotajvards='$lietotajs' and parole='$parole' LIMIT 1");
$row=mysql_num_rows($query);
if ($row == 1){
    session_start();
    $a=mysql_fetch_array($query);
    $_SESSION['user']=$a['vards'];
    $_SESSION['login_lietotajvards'] = $_POST['login_lietotajvards'];
    $_SESSION['epasts'] = $a['epasts'];
    $_SESSION['uzvards'] = $a['uzvards'];
    $_SESSION['vards'] = $a['vards'];
    $_SESSION['talrunis'] = $a['talrunis'];

    echo '
        <script type="text/javascript">
            window.location.href = "panel.php";
        </script>
    ';
}else{
    echo "
        <script type=\"text/javascript\">
            window.location.href = \"../mani-sludinajumi.php\";
            alert('Lietotājvārds vai parole ir nepareiza, Mēģiniet vēlreiz! Vai arī jūs nēsat vēl šeit reģistrējies!');
        </script>
    ";
}
?>
4

1 回答 1

0

始终在文件开头开始会话..

<?php
session_start();
$con=mysql_connect("localhost", "root", "") or die("Cannot connect to databases!");
mysql_select_db("registered_users",$con);

//other code
于 2013-11-05T16:25:48.303 回答