设置Cookies不起作用

时间:2017-04-11 14:33:38

标签: php cookies session-cookies setcookie

昨天我的饼干设置得很好,但今天,饼干根本没有设置,我没有改变任何东西,注意:我正在使用自定义版本的sql thingy。

<?php
include($_SERVER['DOCUMENT_ROOT'].'/phpAlphaDB/core.php');
 include('../config.php');
 error_reporting(0);
 db_create('xenozweb-users');

session_start();
 if (isset($_POST['login'])) {
  //write post data in variables
  $username = $_POST['username'];
  $password = md5($_POST['password']);
  $results = db_read('xenozweb-users', 'username='.$username, 'username password ');
  foreach ($results as $result) {
   $data_username = db_column($result, 0);
   $data_password = db_column($result, 1);
   $data_role = db_column($result, 2);
   if ($data_password !== "") { break; }
  }
  if ($data_username == $username && $data_password == $password) {
            setcookie('xenozweb_id1', $data_username, time() + (40000 * 3), "/");
            setcookie('xenozweb_id2', $data_password, time() + (40000 * 3), "/");
            header("Location: https://xenozweb.tk/loggedin.php");
  } else {
   echo '<script>alert("Invalid username or password.");</script>';
  }
 }
?>

我收到以下警告:

  

警告:strpos():第181行/var/www/html/phpAlphaDB/core.php中的空针

     

警告:无法修改标题信息 - 已在第19行的/var/www/html/login/index.php中发送的标题(由/var/www/html/phpAlphaDB/core.php:181开始输出)< / p>      

警告:无法修改标题信息 - 已在第20行的/var/www/html/login/index.php中发送的标题(由/var/www/html/phpAlphaDB/core.php:181开始输出)< / p>      

警告:无法修改标题信息 - 已在第21行的/var/www/html/login/index.php中发送的标题(由/var/www/html/phpAlphaDB/core.php:181开始输出)< / p>

0 个答案:

没有答案
相关问题