基本上,我有一个.htaccess
文件,php_value session.auto_start
设置为1
. 所以我的会话将从任何文件开始。
但是,现在我的/functions
文件夹中有一个脚本,但它给出了关于权限的错误,/tmp
导致虽然它不使用、启动或对会话执行任何操作。"Failed to write session data"
然而,这会产生一个错误,对我来说,它似乎找不到/tmp
我拥有的文件夹。直接在我的根文件夹 ( /
) 中的文件没有这个问题。我也尝试设置to
的权限,但无济于事。/tmp
777
提前致谢
我得到的错误
Warning: Unknown: open(/tmp/sess_cfed7db100fd58b62eaca2a519ebaf7a, O_RDWR) failed: Permission denied (13) 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 (/tmp) in Unknown on line 0
脚本本身:
<?php
define ('INCLUDE_CHECK',true);
require('connect.php'); //This file doesn't use any sessions as well
if(isset($_POST['signupemail'])){
$email = mysqli_real_escape_string($link, $_POST['signupemail']);
$thearray = mysqli_fetch_array(mysqli_query($link, "SELECT COUNT(*) FROM `users` WHERE email=\"".$email."\""));
if($thearray[0] > 0){
echo '"This emailaddress is already in use"';
exit;
}
echo "true";
} else if(isset($_POST['uname'])){
if(!preg_match('/^[a-zA-Z0-9_-]{3,16}$/ ',$_POST['uname'])){
echo '"<small>Please only use alphanumeric characters, underscores and hyphens</small>"';
exit;
}
$uname = mysqli_real_escape_string($link, $_POST['uname']);
$thearray = mysqli_fetch_array(mysqli_query($link, "SELECT COUNT(*) FROM `users` WHERE uname=\"".$uname."\""));
$forbiddennames = array(1 => 'super-user','superuser', 'root', 'admin', 'administrator', 'system', 'website', 'site', 'owner', 'manager', 'founder','moderator');
if(in_array(strtolower($_POST['uname']), $forbiddennames)) {
echo '"'.$_POST['uname'].' is a forbidden username"';
exit;
}
if($thearray[0] > 0){
echo '"This username is already in use, please choose another"';
exit;
}
echo "true";
}
?>
当我手动浏览到我的脚本时出现错误,因此没有$_POST
设置任何参数。我使用这个脚本来验证一个人的电子邮件和/或密码,当检查时,它会停止,不知道如何处理结果(通过 获得AJAX
)。