I have been working on this issue for quite sometime and have done research but nothing I
can find was specific to my issue. I am building a profile page for each of my users they
register with our site. During this registration the user adds profile data as well as a
profile image. The user logs in ok and displays everything correctly but when displaying
the uploadedimage it returns the name of the file uploaded and not the actual image as such;
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: [email protected]</br>
Profile Image: pic.jpg</br>
Location: test, California 90100</br>
login code below. Please help!
<?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;
tbldatabase(ID,firstname,lastname,Image) VALUES (NULL, '$firstname' , '$lastname' , '$Image')";