理解一行关于连接的PHP代码 [英] To understand a line of PHP code about a connection

查看:136
本文介绍了理解一行关于连接的PHP代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码中的connection()是什么?



p>

  if($ user-> connection($ email,$ password)){
}






让我们假设 connection()是伪码。
pg_prepare 和pg_execute足以创建连接?






这行代码导致我在逐个会话>生成登录系统。随后,SOers在我的代码中指出了严重的sequrity漏洞。



我找不到函数的解释connection()
代码似乎是伪代码给我,因为连接没有任何属性到数据库,例如



如何形成连接

  $ result = pg_prepare($ dbconn,query22,SELECT passhash_md5 FROM users 
WHERE email = $ 1;);
$ passhash_md5 = pg_execute($ dbconn,query22,array($ _ REQUEST ['email']));


解决方案

$ user是类的实例。 p>

连接是该类中的一种方法。



$ mail& $ password是该方法的参数。



这对数组没有任何意义。您的意思是:

  $ foo = array(key=>value); 

也许这可以帮助你:
http://www.webstockbox.com/php/7-tutorials- on-how-to-create-a-php-login-system /


What is connection() in the following code?

Code which I do understand completely

if($user->connection($email,$password)){
}


Let's assume connection() is pseudo-code. Is the pg_prepare and pg_execute` enough to create the connection?


The line caused me to omit the use of its main code in generating a login system. Subsequently, SOers pointed out severe sequrity holes in my code.

I could not find the explanation for the function connection(). The code seems to be pseudo-code to me, since the connection does not have any attributes to the database, for instance by

Example of how the connection should be formed

     $result = pg_prepare($dbconn, "query22", "SELECT passhash_md5 FROM users
         WHERE email=$1;");                                             
     $passhash_md5 = pg_execute($dbconn, "query22", array($_REQUEST['email']));                 

解决方案

$user is an instance of a class.

connection is a method in that class.

$mail & $password are parameters to that method.

This has nothing todo with arrays. what you mean would be:

$foo = array("key" => "value");

maybe this can help you: http://www.webstockbox.com/php/7-tutorials-on-how-to-create-a-php-login-system/

这篇关于理解一行关于连接的PHP代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆