私は以下のようなログインコードを持っています:
<?php
session_start();
if (isset($_GET['action']) && $_GET['action']=='logout' ){
session_destroy();
header('location:index.php');
exit();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="css/login_style.css" />
<link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/>
<script src="js/jquery-1.6.min.js" type="text/javascript"></script>
<script src="js/languages/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
<title>Login</title>
<style>
a:hover{
cursor:pointer;
text-decoration:none;
}
</style>
<script>
$(document).ready(function(){
$("#myform").validationEngine();
});
</script>
</head>
<body>
<div class="form_controller">
<form action="index.php" method="post" id="myform" name="log">
<table style=" margin-left: 164px; margin-top:86px;width: 292px;">
<tr>
<td style="color:#30a3b8;">Identifiant:</td><td><input type="text" name="text_username" class="validate[required]" style="border:1px solid #c9bbbb; height:20px; width:180px;"/></td>
</tr>
<tr>
<td style="color:#30a3b8;"><br />Mot de passe: </td>
<td><input type="password" name="text_password" class="validate[required] TextInput" style=" margin-top:20px;border:1px solid #c9bbbb; height:20px; width:180px;"/><br /></td>
</tr>
</table>
<table style="margin-top:50px; margin-left:197px;">
<tr>
<td></td>
<td><input type="submit" name="tbn_submit" class="btnValider" value="Valider" style=""/> <input type="reset" class="btnValider" value="Annuler" /></td>
</tr>
</table>
<table style="text-align:left; margin-top:-22px;">
<tr>
<td colspan="2"><a href="register.php" style=" text-decoration:none; color:#30a3b8;" id="NewUser">Nouvel utilisateur?</a></td>
</tr>
</table>
</form>
<?php
include('include/encriptUrl.php');
include ('include/connectdb.php');
if(isset($_POST['tbn_submit'])){
$username = $_POST['text_username'];
$password = $_POST['text_password'];
$query = "SELECT * FROM tblusers WHERE `user_username`='".$username."' AND user_password='".$password."'";
$res = mysql_query($query) or die (mysql_error());
if($res){
if(mysql_num_rows($res)){
$user = mysql_fetch_assoc($res);
$_SESSION['username'] = $user['user_username'];
$_SESSION['password'] = $user['user_username'];
if($user['user_possition'] == "Admin"){
echo '<script type="text/javascript">window.location = "view_form.php"</script>';
}
else if($user['user_possition'] == "User"){
echo '<script type="text/javascript">window.location = "view_edit_uid.php?uid='.encode5t($user['user_id']).'"</script>';
}
else if($user['user_possition'] == "R1"){
echo '<script type="text/javascript">window.location = "view_form_res1.php"</script>';
}
else if($user['user_possition'] == "R2"){
echo '<script type="text/javascript">window.location = "view_form_res2.php"</script>';
}
}
else {
echo '<script>alert("Invalid identifiant ou votre mot de passe.");</script>';
}
}
}
?>
</div>
</body>
</html>
問題:
上記のコードに従ってログインすると、ユーザーのセッションを取得するためにセッションを使用しますが、ローカルではうまく機能しますが、サーバーにアップロードすると、警告メッセージが表示されWarning: session_start() [function.session-start]: open(c:/wamp/tmp/sess_2m7odit3i1mprbmk1qg5b3j701, O_RDWR) failed: No such file or directory (2) in /homepages/0/d315362104/htdocs/demo/segpp/index.php on line 2
、. これを修正する方法がわかりません。Warning: Unknown: open(c:/wamp/tmp/sess_2m7odit3i1mprbmk1qg5b3j701, O_RDWR) failed: No such file or directory (2) in Unknown on line 0
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (c:/wamp/tmp) in Unknown on line 0
誰でも私を助けてください、ありがとう。