dpt62283 2014-09-16 15:37
浏览 32
已采纳

登录不起作用 - 注册工作正常

I'm trying to get a simple login page, user inputs their details and goes to the main.php page.

Here's the code http://pastebin.com/M4LZdcBt

Steps

-Go to localhost/game -Enter username/password from database -I would like to go to the main page I have set up -Instead I get the error message "You need to be logged in to view this page!" which is set to show if the user doesn't have a session, but the code says it should give them a session?

Here is validation code, it is on my main.php page

<?php
session_start();
include("header.php");

if(!isset($_SESSION['uid'])){
echo "You must be logged in to view this page!";
}else{
?>
  • 写回答

2条回答 默认 最新

  • dongwu3596 2014-09-17 09:29
    关注

    ANSWER BY ANDREWSI

    @RyanMcKenna - thanks for updating the question. Now - you're checking to see if $_SESSION['uid'] is set; but your code isn't setting that, just $_SESSION['username'] – andrewsi 15 hours ago

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了