我已经在这个问题上工作了很长一段时间并且做了研究,但我什么也没做
可以找到特定于我的问题。我正在为我的每个用户建立一个个人资料页面,他们
在我们的网站上注册。在此注册期间,用户添加配置文件数据以及
个人资料图片。用户登录正常并正确显示所有内容,但在显示时
uploadimage 它返回上传文件的名称,而不是实际的图像;
Profile Page for testuser</br>
Username: testuser</br>
Name: testuser</br>
Birthdate: January Day, 1980</br>
Member Role: Tester</br>
Genre: cool stuff</br>
Personal Details</br>
E-mail: test@yahoo.com</br>
Profile Image: pic.jpg</br>
Location: test, California 90100</br>
登录代码如下。请帮忙!
<?php
$img_url = "uploads";
//loginscript.php
//check if variables were received
if(($_POST['username']!=NULL) && ($_POST['password']!=NULL)):
//if yes, proceed with script
//get POST variables and use md5 for password encryption
$uname = $_POST['username'];
$pass = $_POST['password'];
//connect to database
$link = dbconnect();
//check username validity
$validUser = checkUsername($uname);
//throw error on invalid username
if(!$validUser){
die('The specified user does not exist!');
}
//compare username/password
$sql = "SELECT COUNT(*) FROM tbldatabase WHERE username = '$uname' AND password = $pass'";
$query = mysql_query($sql);
if(!$query){ die('MySQL failed with error: '.mysql_error()); }
//throw error on username/pass mismatch
if(!mysql_result($query,0,0)){
//if result < 1, username/password mismatch
die('The password entered does not match test');
}
//validation successful, login (or just display info)
$sql = "SELECT ID FROM tbldatabase WHERE username = '$uname'";
$query = mysql_query($sql);
if(!$query){ die('MySQL failed with error: '.mysql_error()); }
$UID = mysql_result($query,0,0);
$data = getTableData('tbldatabase',$UID);
$uInfo = mysql_fetch_array($data, MYSQL_BOTH);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=$uInfo['username'] ?>'s Page</title>
<style type="text/css">
#apDiv1 {
position: absolute;
width: 200px;
height: 115px;
z-index: 1;
}
#apDiv2 {
position: absolute;
width: 200px;
height: 115px;
z-index: 1;
}
</style>
</head>
<body>
<?php ?> <b>Profile Page for <?=$uInfo['username'] ?> </b><br />
Username: <?=$uInfo['username'] ?><br />
Name: <?=$uInfo['firstname'].' '.$uInfo['lastname'] ?><br />
Birthdate: <?=$uInfo['bmonth'].' '.$uInfo['bdate'].', '.$uInfo['byear'] ?> <br />
Member Role: <?=$uInfo['memberrole'] ?><br />
Music Genre: <?=$uInfo['genre'] ?><p />
<p><b>Personal Details</b><br />
E-mail: <?=$uInfo['email'] ?><br />
Profile Image: <?=$uInfo['Image'] ?><br />
Location: <?=$uInfo['city'].', '.$uInfo['state'].' '.$uInfo['zipcode'] ?><?php ?>
</p>
<p> </p>
</body>
</html>
<?
else:
die('necessary information requested from profile page is missing or omitted');
endif;