我正在使用 php 脚本进行登录,该脚本在我的 localhost(apache2,OS:ubuntu) 上完全正常工作,但当我将其放到网上时却无法正常工作
这里附上php代码
<?php
include('config.php');
session_start();
if($_SERVER["REQUEST_METHOD"]=="POST")
{
$myusername=addslashes($_POST['user_name']);
$mypassword=addslashes($_POST['pass_word']);
$mypassword=md5($mypassword);
$sql="select id from userinformation2 WHERE username='$myusername' and password='$mypassword' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
$active=$row['active'];
$count=mysql_num_rows($result);
if($count==1)
{
session_register("myusername");
$_SESSION['login_user']=$myusername;
header("location:welcome.php");
}
else
{
$error="name and password is invalid";
echo $error;
}
}
?>