我几乎可以肯定我在这里遗漏了一些非常愚蠢的东西,但我越看越生气。
当我执行 follow.php 时,没有任何东西被插入到数据库中,也没有错误。在任何人说之前。是的,我知道这里有 SQL 注入漏洞。这是未完成的代码!
配置.php:
session_start();
$mysql_hostname = "XXXX";
$mysql_user = "XXXX";
$mysql_password = "XXXX";
$mysql_database = "XXXX";
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password)
or die("Opps something went wrong");
mysql_select_db($mysql_database, $bd) or die("Opps something went wrong");
跟随.php:
session_start();
include('config.php');
$user_check=$_SESSION['login_user'];
$tagID=$_POST['id'];
$recID="select UserID from useradmin where username='$user_check' ";
$updatesql="INSERT INTO following (RecID, followID) VALUES ($recID, $tagID)";
mysql_select_db($mysql_database, $bd) or die("Opps some thing went wrong");
mysql_query($updatesql, $bd)
更多信息。我的插入语句的输出是:
INSERT INTO following (RecID, followID) VALUES (, 100006)
所以 $recid 没有被填充......