session_start();
$user= $_GET['user'];
$password = $_GET['password'];
if ($user && $password)
{
try
{
login($user,$password);
$_SESSION['valid_user'] = $user;
}
catch(Exception $e)
{
echo 'You could not be logged in.
You must be logged in to view this page.';
exit;
}
}function login($user, $password)
{
$link= mysql_connect('localhost','root','225201')or die('could not connect:'.mysql_error()); mysql_select_db('forum') or die('could not select database');
$result =mysql_query("select * from forum
where user='$user'
and passward = sha1('$password')");
if (!$result)
throw new Exception('Could not log you in.');
if (mysql_num_rows($result)>0)
return true;
else
throw new Exception('Could not log you in.');
}
我一用sha1()加密后,登录老提示'You could not be logged in.
You must be logged in to view this page这个错误。不用sha1就可以了。求助
$user= $_GET['user'];
$password = $_GET['password'];
if ($user && $password)
{
try
{
login($user,$password);
$_SESSION['valid_user'] = $user;
}
catch(Exception $e)
{
echo 'You could not be logged in.
You must be logged in to view this page.';
exit;
}
}function login($user, $password)
{
$link= mysql_connect('localhost','root','225201')or die('could not connect:'.mysql_error()); mysql_select_db('forum') or die('could not select database');
$result =mysql_query("select * from forum
where user='$user'
and passward = sha1('$password')");
if (!$result)
throw new Exception('Could not log you in.');
if (mysql_num_rows($result)>0)
return true;
else
throw new Exception('Could not log you in.');
}
我一用sha1()加密后,登录老提示'You could not be logged in.
You must be logged in to view this page这个错误。不用sha1就可以了。求助
解决方案 »
- 看到很多的资料写nginx+php都要用到php-fpm,请问nginx不能直接和php-cgi通信吗?如何配置呢?
- php 连sql server,取id的问题,在线等
- 郁闷!mysql乱码了!全是问号
- 急,帮帮忙
- PHP有木有2个十六进制数加减的函数?
- 如何用命令 把数据入库。
- (2)请“ xuzuning(唠叨)”兄弟进来领剩余200分,顺便表达谢意!(300分求解关于php.ini的问题,已经解决,同时感谢参与者)
- 谁那里有站内搜索的码啊?急~~~~~~~~~~~~进来给个建议
- 为什么fopen函数失效?
- p怎么判断没行输出加class样式
- 请教如何调用类里COOKIE值
- 怎么取出 <33> 中间的这个 33值?
('','$user',sha1('$passwd'), '$email')";我在入库时加密了吧