草庐IT

my_param

全部标签

php - mysqli_stmt_bind_param SQL注入(inject)

使用preparedstatements和mysqli_stmt_bind_param是否还有注入(inject)风险?例如:$malicious_input='bob";droptableusers';mysqli_stmt_bind_param($stmt,'s',$malicious_input);在幕后,mysqli_stmt_bind_param将此查询字符串传递给mysql:SET@username="bob";droptableusers";或者它是否通过API执行SET命令,或者使用某种类型的保护来防止这种情况发生? 最佳答案

PHP bind_params 为空

如果该变量存在,我正在尝试将参数绑定(bind)到INSERTINTOMySQLi准备语句,否则插入null。这是我拥有的,但它不起作用:if(!empty($name)){$result->bind_param('ss',$name,$url_friendly_name);}else{$result->bind_param('ss',null,null);}if(!empty($description)){$result->bind_param('s',$description);}else{$result->bind_param('s',null);}有没有人知道这样做的更好方法,

php - openssl_verify() : supplied key param cannot be coerced into a public key for a . pem 文件

当前正在尝试读取.pem公钥以通过openssl对其进行验证。/***Checkwhetherthesignedmessagesentbackbytheserveris*correctornot.*/functioncheck($str,$MAC){$fp=fopen(dirname(__FILE__).'/rsa_public_key.pem','r');$cert=fread($fp,8192);fclose($fp);$pubkeyid=openssl_get_publickey($cert);returnopenssl_verify($str,$MAC,$pubkeyid);}

php - 是否可以将 bind_param 用于 ORDER BY?

这个问题在这里已经有了答案:CanIparameterizethetablenameinapreparedstatement?(2个答案)关闭3年前。在我看来,我有一个类似这样的查询:$sort=isset($sort)?sanitize($_sort):'id';if($result=$link->prepare("SELECTid,priceFROMitemsORDERBY?")){$result->bind_param("s",$sort);$result->execute();etc...}当我在不设置排序变量的情况下运行此代码块时,它运行时不会出现与在ORDERBY子句中使用

mysqli - php5.3 - mysqli_stmt :bind_params with call_user_func_array warnings

这个问题在这里已经有了答案:关闭10年前。PossibleDuplicate:Isitpossibletopassparametersbyreferenceusingcall_user_func_array()?我有以下代码行在PHP5.1中有效,但在PHP5.3中无效。$input=array('ss','john','programmer');call_user_func_array(array($mysqli_stmt,'bind_param'),$input);在PHP5.3中,我收到以下警告消息:Warning:Parameter2tomysqli_stmt::bind_pa

PHP fatal error : I'm trying to implement a Form\AbstractType in my Symfony2 application

我收到以下错误:Fatalerror:DeclarationofBean\OauthServerBundle\Form\Type\AuthorizeFormType::buildForm()mustbecompatiblewithSymfony\Component\Form\FormTypeInterface::buildForm(Symfony\Component\Form\FormBuilderInterface$builder,array$options)insrc/Bean/OauthServerBundle/Form/Type/AuthorizeFormType.phponl

php - Zend 框架 : The requested URL/my/path was not found on this server

我是ZendFramework的新手。我使用ZendFramework编写了一个简单的Web服务,它返回模拟XML数据,模块结构如下:AppNameapplicationconfigsapplication.inimodulesdefault.....apicontrollerCatalogController.phpviewlibrarypublic.htaccessindex.phptests在本地主机(windows7)中,这些是有效的:http://localhosthttp://localhost/api/cataloghttp://localhost/default在我的生

php - 如何在 PHP 中运行 bind_param() 语句?

我正在尝试使以下代码工作,但我无法访问execute()行。$mysqli=$this->ConnectLowPrivileges();echo'Connected';$stmt=$mysqli->prepare("SELECT`name`,`lastname`FROM`tblStudents`WHERE`idStudent`=?");echo'Preparedandbindingparameters';$stmt->bind_param('i',2);echo'Readytoexecute'if($stmt->execute()){echo'Executing..';}}else{e

php - 使用一个具有可变数量输入变量的 bind_param()

我尝试像这样使用变量绑定(bind):$stmt=$mysqli->prepare("UPDATEmytableSETmyvar1=?,myvar2=...WHEREid=?")){$stmt->bind_param("ss...",$_POST['myvar1'],$_POST['myvar2']...);但是一些$_POST['...']可能是空的,所以我不想在数据库中更新它们。考虑空$_POST['...']的所有不同组合是不切实际的,虽然我可以根据需要构建字符串“UPDATEmytableSET...”,但bind_param()是不同的野兽。我可以尝试将其调用构建为字符串并在

MySQL my.cnf 文件 - 找到没有前面组的选项

我正在尝试远程连接到我在Ubuntu中的数据库,但在尝试mysql-uroot-p时收到错误消息:Foundoptionwithoutprecedinggroupinconfigfile:/etc/mysql/my.cnfatline:1my.cnf看起来像:[mysqld]user=mysqlsocket=/var/run/mysqld/mysqld.sockport=3306basedir=/usrdatadir=/var/lib/mysqltmpdir=/tmpbind-address=0.0.0.0key_buffer=16Mmax_allowed_packet=16Mthre