Php mysql未从表单中记录
你好,我做了一个从图片主机站点转储链接的表单。我的问题是,如果我在数据库中添加这种格式的链接Php mysql未从表单中记录,php,mysql,Php,Mysql,你好,我做了一个从图片主机站点转储链接的表单。我的问题是,如果我在数据库中添加这种格式的链接 <a href='http://mysite.gr/img-53206dec0261b.html'><img src='http://www.mystie/upload/small/2014/03/12/53206dec0216e.jpg' alt='image' /></a> sql不进行注册。如果链接是这样的格式工作 <a href='http://
<a href='http://mysite.gr/img-53206dec0261b.html'><img src='http://www.mystie/upload/small/2014/03/12/53206dec0216e.jpg' alt='image' /></a>
sql不进行注册。如果链接是这样的格式工作
<a href='http://mysite.gr/img-53206dec0261b.jpg'><img src='http://www.mystie/upload/small/2014/03/12/53206dec0216e.jpg' alt='image' /></a>
这是我在process.php中使用的代码
<?php
//MySQL Database Connect
include 'dbinfo.php';
$text = trim($_POST['links']);
foreach(explode("\n", $text) as $line) {
$quotes = array("/\"/","/<a href/","/border=0/","/<\/a>/");
$replacements = array("","mysql_query(\"INSERT INTO images (code) VALUES ('<a href","width=253 height=183 border=0","</a>')\");");
$newlinks = preg_replace($quotes, $replacements, $line);
eval("$newlinks");
}
?>
我简直吓坏了。哈哈@JohnConde@user3413055从哪里开始。。。mysql\u查询已弃用,不应使用。而是使用mysqli或PDO。您将$\u POST变量直接放入SQL查询中,甚至不需要转义字符串。您正在使用eval(),这应该像瘟疫一样避免,更糟糕的是,您正在将$\u POST值直接放入eval()中。Thanx mike我知道脚本与信息非常匹配