<?php
// Inialize session
session_start();
// Check, if username session is NOT set then this page will jump to login page
if (!isset($_SESSION['username'])) {
header('Location: index.php');
}
$online = rand(12,200);
if($_GET['pass'] == "changethis"){
?>
<font color="00c000">
<html>
<head>
<title>Premium Girls ~ Logged in</title>
</head>
<body>
<p align="right">Online Users:<?php echo "$online"; ?></p><br>
<body bgcolor="#004000">
<center><img src="/logo.gif"></img>
<p>Welcome to the Admin Panel, <?php echo $_SESSION['username']; ?>.
<br>
<form method="post" action="newuser.php"><br>
<center>Create a new user:<br></center>
Username:<input type="text" name="username"><br>
Password:<input type="password" name="password"><br>
<input type=submit value="Create new user">
</form>
<br><br>
<div id=footer align=center>Please note we are currently under setup.</div>
</body>
</html></font>
<?php
}else{
?>
<font color="00c000">
<html>
<head>
<title>Premium Girls ~ Payment Processor</title>
</head>
<body>
<p align="right">Online Users:<?php echo "$online"; ?></p><br>
<body bgcolor="#004000">
<center><img src="/logo.gif"></img>
<p>Welcome to the Logged in screen, <?php echo $_SESSION['username']; ?>. Below you will see all the payments linked to your model name.</p>
<?php
$con = mysql_connect("localhost","devacc_yourmum","changeme123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("devacc_models", $con);
$uid = $_SESSION['username'];
$result = mysql_query("SELECT * FROM payments WHERE model = {$_SESSION['username']}");
echo "<table border='1'>
<tr>
<th>Name</th>
<th>Payment ID</th>
<th>Address</th>
<th>Nickname</th>
<th>Email</th>
<th>Skype</th>
<th>CardType</th>
<th>Model Name</th>
<th>Country</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['Payment ID'] . "</td>";
echo "<td>" . $row['Address'] . "</td>";
echo "<td>" . $row['Nickname'] . "</td>";
echo "<td>" . $row['Email'] . "</td>";
echo "<td>" . $row['Skype'] . "</td>";
echo "<td>" . $row['cardtype'] . "</td>";
echo "<td>" . $row['model'] . "</td>";
echo "<td>" . $row['country'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
<br><br><br><br><br><br>
<div id=footer align=center>Please note we are currently under setup.</div>
</body>
</html></font>
<?php
}
?>
以上是我的代码,不幸的是给了我一个错误。它应该使用模型用户名从数据库中的支付表中提取所有信息,所以如果我使用用户名“Bradandrews4”登录并且有人从我这里购买了一个节目,那SELECT * FROM payments WHERE model = bradandrews4
将是 bradandrews4 因为那是我登录时使用的用户名。要输出我的用户名,我可以使用 $uid 或 $_SESSION['username'] 但是我不确定如何将其放入查询中,然后将其放入表中。任何帮助将非常感激 :)
-布拉德