Session and location:url not work


#1

hello,
my website in localhost work but when i upload all file to dreamhost not work can you help me?

<?php
include ('header.php');
date_default_timezone_set('Asia/Baghdad');
$user_ip = $_SERVER['REMOTE_ADDR'];
?>


<body>

<div class="header">
<div class="logo">
</div>
</div>
<div class="container">
<div class="well row">
<div class="text_serewe"><h2>چونەژورەوە</h2></div>
<p>
<?php
error_reporting(1);
ini_set('display_errors', 1);
include('paiwandy.php');
if(isset($_POST['submit'])){

$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);
if(empty($username) || empty($password)){
echo '<alert class="alert-error">پێویستە ناوی بەکارهێنەر و وشەی نهێنی بنوسرێت.</alert>';
}
else{

 $sql = "SELECT id, username, password, Bash_id, qonax_id, user_full_name, dasalat FROM users WHERE username = '$username' AND password = '$password' AND logged_in = 0 LIMIT 1";
         $result = mysql_query($sql) or die(mysql_error());
 				if(mysql_num_rows($result)>=1){
                 while($row = mysql_fetch_array($result)){
                 session_start();
                 $_SESSION['username']=$row['username'];
                 $_SESSION['password']=$row['password'];
                 $_SESSION['user_id']=$row['id'];
                 $_SESSION['Bash_id']=$row['Bash_id'];
                 $_SESSION['qonax_id']=$row['qonax_id'];
                 $_SESSION['user_full_name']=$row['user_full_name'];
                 $_SESSION['dasalat']=$row['dasalat'];
                
                 $user_id = $row['id'];
                 $Bash_id = $row['Bash_id'];
                 $dasalat = $row['dasalat'];
               
                 mysql_query("UPDATE users SET logged_in = 1 WHERE id = '$user_id'") or die(mysql_error());                  
                 header('Location:'.$domain.'main_page.php', true); 
//echo "<script type='text/javascript'> document.location = 'main_page.php'; </script>";
 					//if ($dasalat == 2){
 					//echo '<meta http-equiv="refresh" content="0;URL=main_page.php">';
 					//}					
 					//	elseif ($dasalat == 1){
 					//echo '<meta http-equiv="refresh" content="0;URL=2.php">';		
 					//	}						
                 //echo $_SESSION['user_full_name'].'</br>';          
                         
         }
 }else{

                 //die();
                 header('Location:login.php?peyam=buLY7T7rVFgXRmgx');

         //die(mysql_error());
         //echo '<alert class="alert-error">هەڵەیەک ڕوویدا، تکایە بەڕێوەبەر ئاگادار بکەوە و هەڵەی ژمارە ٢٧ ی پێبدە.</alert>';
         //echo '<alert class="alert-error">هەروەها دڵنیابە کە لە ٢ کۆمپیوتەرەوە لە هەمان کاتدا لە ژوورەوە نیت</alert>';
         }
 }
} // کۆتایی Submit
?>
</p>
<div>
<?php if(isset($_GET['peyam'])){
$peyam = $_GET['peyam'];
if($peyam == "buLY7T7rVFgXRmgx"){
echo'<div class="alert alert-error"><h3>وشەی نهێنی یان بەکارهێنەر هەڵەیە ، یاخود پێشتر لەژورەوە بویت.</h3></div>';
}
}

?>
</div>
<form action="login.php" name="login" method="post" class="form-inline well">
<label for="username"> ناوی بەکارهێنەر:</label>
<input type="text" name="username" placeholder="تکایە نازناو بنووسە" required>
<label for="username">وشەی نهێنی:</label>
<input type="password" name="password" placeholder="تکایە وشەی نهێنی بنووسە" required>

<button name="submit" type="submit" class="btn btn-primary btn-medium">چــونەژورەوە</button>
</form>
<div class="alert alert-info">بۆهەر پرسیارێک پەیوەندی بکە بەم ژمارانەی خوارەوە:</br></br>

0770-152-8825
</br>
</br>
0750-147-3884
</div>

</div><!-- Well Row -->
</div> <!-- Conatiner -->


<?php
include('xwarewe.php');
?>```

#2

can you be more specific please? What error do you get? Where do you see the error? What do you see in the logs?


#3

when i clicked to login not work redirect to main_page.php
header('Location:'.$domain.'main_page.php', true);


#4

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.