0
我有一个问题,其中运行两次的php页面,但它通过代理服务器连接时只运行两次。如果用户没有通过代理进行连接,此代码运行良好。php通过代理连接时运行两次
我该如何解决这个问题,让它只运行一次,无论是通过代理连接还是不连接?
此php代码在Drupal CMS页面内运行,但独立于Drupal。用户通过单击超链接进入该页面。
是我使用标题将用户重定向到另一页?
<?php
$userId = 0;
$userId = $_GET["userId"];
$userEmail = 0;
$userEmail = $_GET["userEmail"];
$userName = 0;
$userName = $_GET["userName"];
//connect to the database
$con = mysql_connect("HOSTNAME","USERNAME","PASSWORD");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
else
{
//echo "Connected.";
//echo "<br>";
}
mysql_select_db("formredirectdata", $con);
$userId = intval($userId);
mysql_query("INSERT INTO webforms
(userid, formisactive, formname, formtitle, shortdesc, confirmationlink) VALUES('$userId', '1', 'Form Name', 'Form Title', 'Short Description', 'Confirmation Link') ")
or die(mysql_error());
$newformnum = mysql_insert_id();
$recipientname = 0;
$recipientemail = 0;
$recipientname = "default" . $newformnum;
$recipientemail = $userEmail;
//send to the next script
header('Location: addtriggernewform.php?formnum2=' . $newformnum . '&recipientemail=' . $recipientemail . '&operator=(default)&inputname=(default)&triggervalue=(default)&userName=' . $userName);
?>
您正在将一个GET参数直接包含到SQL查询中。这是不好的,你打算开放[SQL注入](http://stackoverflow.com/questions/60174/how-to-prevent-sql-injection-in-php)。 – 2013-02-26 04:16:51
你的addtriggernewform.php是否有重定向到当前页面?删除它并尝试。我只在你的脚本中看到这个可能的原因... – 2013-02-26 04:18:50
Addtriggernewform在此之前重定向页面。 – mnutsch 2013-02-26 05:36:51