如何在php中获取用户的详细信息
我用PHP开发了一个PayPal集成页面。付款和成功页面也在工作,但我没有收到用户电子邮件 home.php页面如何在php中获取用户的详细信息,php,mysqli,paypal,Php,Mysqli,Paypal,我用PHP开发了一个PayPal集成页面。付款和成功页面也在工作,但我没有收到用户电子邮件 home.php页面 <?php ob_start(); session_start(); require_once 'dbconfig.php'; error_reporting(0); // if session is not set this will redirect to login page if( !isset($_SESSIO
<?php
ob_start();
session_start();
require_once 'dbconfig.php';
error_reporting(0);
// if session is not set this will redirect to login page
if( !isset($_SESSION['user_id']) ) {
header("Location: index");
exit;
}
$user_id=$_SESSION['user_id'];
$row=mysqli_fetch_array(mysqli_query($conn,"select *from `at_reg_user`
where `email`='$user_id'"));
$name=$row['fname'].' ' .$row['lname'];
?>
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="YYHR897NQVQCY">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
我认为,您的MySQL查询中存在语法错误。请看您的查询的结尾。我想只有一个引号不见了。这是您的查询:
$row = mysqli_fetch_array(mysqli_query($conn, "select * from `at_reg_user` where `email`='$user_id"));
尝试此查询:
$row = mysqli_fetch_array(mysqli_query($conn, "select * from `at_reg_user` where `email`='$user_id'"));
提示:未经测试。
我认为你应该重写你的整个代码,使它安全。它充满了漏洞。我建议查看PayPal的。它更安全,因为您不依赖$\u获取数据。。。。你把paypal整合到一个安全性不足的网站上?!伙计,我真的建议你删除这个功能。。。了解SQL注入以及如何防止它们。事实上,每个人都可以在几秒钟内入侵你的整个网站。使用预先准备好的语句,不要将GET或POST变量直接放在查询中!尤其是当你处理贝宝的时候!!!!对不起,这让我发疯了。。。你在那里做的事太危险了!!你可能会因为这些事情陷入大麻烦…@Twinfriends我想我必须学习PDO和MySQLIY一起准备任务你把事情搞混了。准备好的陈述是一种确保查询安全的方法。PDO和mysqli是查询数据库的两个不同驱动程序。所以,要么用PDO驱动程序学习准备好的语句,要么用mysqli驱动程序学习准备好的语句,但是没有“PDO用mysqli准备语句”——这是不存在的。不能同时使用PDO和mysqli。
$row = mysqli_fetch_array(mysqli_query($conn, "select * from `at_reg_user` where `email`='$user_id'"));