1)open your members.php file
2)under the <body> add the following code:
CODE
<?php
require 'db_connect.php';
if ($article = $_GET['art'] == $_SESSION['username']) {
?>
Welcome to your member profile! This is where you can edit your information, check your mail, compose a new message, and delete your account.
<table align="center" border="1" cellspacing="0" cellpadding="3">
<tr><td>
<?php
$article = $_GET['art'];
echo "Username: ",$article;
?></td></tr>
<br><br><tr><td>
<?php
$article = $_GET['art'];
$qry = "SELECT show_email FROM users WHERE username = '".$article."'";
$show_email = $db_object->query($qry);
$db_show_email = $show_email->fetchRow();
if($db_show_email['show_email'] != 1) {
?>[You have chosen not to show your email]
<?php } else {
$article = $_GET['art'];
$qry = "SELECT email FROM users WHERE username = '".$article."'";
$email = $db_object->query($qry);
$db_email = $email->fetchRow();
echo "Email: ",$db_email['email'];
}
?>
<br><br></tr></td><tr><td>
<?php
$article = $_GET['art'];
$qry = "SELECT website FROM users WHERE username = '".$article."'";
$website = $db_object->query($qry);
$db_website = $website->fetchRow();
echo "Website: ",$db_website['website'];
?><br><br></tr></td><tr><td>
<?php
$article = $_GET['art'];
$qry = "SELECT regdate FROM users WHERE username = '".$article."'";
$regdate = $db_object->query($qry);
$db_regdate = $regdate->fetchRow();
echo "Registration Date: ",$db_regdate['regdate'];
?><br><br></tr></td><tr><td>
<?php
$article = $_GET['art'];
$qry = "SELECT location FROM users WHERE username = '".$article."'";
$location = $db_object->query($qry);
$db_location = $location->fetchRow();
echo "Location: ",$db_location['location'];
?><br><br></tr></td></table>
//edit your website
<a href="YOURWEBSITE/logout.php">Log Out</a>
<?php
}
else {
?>
<table align="center" border="1" cellspacing="0" cellpadding="3">
<tr><td>
<?php
//Get the value
$article = $_GET['art'];
echo "Username: ",$article;
?>
<br><br></tr></td><tr><td>
<?php
$article = $_GET['art'];
$qry = "SELECT show_email FROM users WHERE username = '".$article."'";
$show_email = $db_object->query($qry);
$db_show_email = $show_email->fetchRow();
if($db_show_email['show_email'] != 1) {
?>[You have chosen not to show your email]
<?php } else {
$article = $_GET['art'];
$qry = "SELECT email FROM users WHERE username = '".$article."'";
$email = $db_object->query($qry);
$db_email = $email->fetchRow();
echo "Email: ",$db_email['email'];
}
?>
<br><br></tr></td><tr><td>
<?php
$article = $_GET['art'];
$qry = "SELECT website FROM users WHERE username = '".$article."'";
$website = $db_object->query($qry);
$db_website = $website->fetchRow();
echo "Website: ",$db_website['website'];
?><br><br></tr></td><tr><td>
<?php
$article = $_GET['art'];
$qry = "SELECT regdate FROM users WHERE username = '".$article."'";
$regdate = $db_object->query($qry);
$db_regdate = $regdate->fetchRow();
echo "Registration Date: ",$db_regdate['regdate'];
?><br><br></tr></td><tr><td>
<?php
$article = $_GET['art'];
$qry = "SELECT location FROM users WHERE username = '".$article."'";
$location = $db_object->query($qry);
$db_location = $location->fetchRow();
echo "Location: ",$db_location['location'];
?><br><br></tr></td></table>
//edit your website
<a href="YOURWEBSITE/logout.php">Log Out</a>
<?php
}
?>
require 'db_connect.php';
if ($article = $_GET['art'] == $_SESSION['username']) {
?>
Welcome to your member profile! This is where you can edit your information, check your mail, compose a new message, and delete your account.
<table align="center" border="1" cellspacing="0" cellpadding="3">
<tr><td>
<?php
$article = $_GET['art'];
echo "Username: ",$article;
?></td></tr>
<br><br><tr><td>
<?php
$article = $_GET['art'];
$qry = "SELECT show_email FROM users WHERE username = '".$article."'";
$show_email = $db_object->query($qry);
$db_show_email = $show_email->fetchRow();
if($db_show_email['show_email'] != 1) {
?>[You have chosen not to show your email]
<?php } else {
$article = $_GET['art'];
$qry = "SELECT email FROM users WHERE username = '".$article."'";
$email = $db_object->query($qry);
$db_email = $email->fetchRow();
echo "Email: ",$db_email['email'];
}
?>
<br><br></tr></td><tr><td>
<?php
$article = $_GET['art'];
$qry = "SELECT website FROM users WHERE username = '".$article."'";
$website = $db_object->query($qry);
$db_website = $website->fetchRow();
echo "Website: ",$db_website['website'];
?><br><br></tr></td><tr><td>
<?php
$article = $_GET['art'];
$qry = "SELECT regdate FROM users WHERE username = '".$article."'";
$regdate = $db_object->query($qry);
$db_regdate = $regdate->fetchRow();
echo "Registration Date: ",$db_regdate['regdate'];
?><br><br></tr></td><tr><td>
<?php
$article = $_GET['art'];
$qry = "SELECT location FROM users WHERE username = '".$article."'";
$location = $db_object->query($qry);
$db_location = $location->fetchRow();
echo "Location: ",$db_location['location'];
?><br><br></tr></td></table>
//edit your website
<a href="YOURWEBSITE/logout.php">Log Out</a>
<?php
}
else {
?>
<table align="center" border="1" cellspacing="0" cellpadding="3">
<tr><td>
<?php
//Get the value
$article = $_GET['art'];
echo "Username: ",$article;
?>
<br><br></tr></td><tr><td>
<?php
$article = $_GET['art'];
$qry = "SELECT show_email FROM users WHERE username = '".$article."'";
$show_email = $db_object->query($qry);
$db_show_email = $show_email->fetchRow();
if($db_show_email['show_email'] != 1) {
?>[You have chosen not to show your email]
<?php } else {
$article = $_GET['art'];
$qry = "SELECT email FROM users WHERE username = '".$article."'";
$email = $db_object->query($qry);
$db_email = $email->fetchRow();
echo "Email: ",$db_email['email'];
}
?>
<br><br></tr></td><tr><td>
<?php
$article = $_GET['art'];
$qry = "SELECT website FROM users WHERE username = '".$article."'";
$website = $db_object->query($qry);
$db_website = $website->fetchRow();
echo "Website: ",$db_website['website'];
?><br><br></tr></td><tr><td>
<?php
$article = $_GET['art'];
$qry = "SELECT regdate FROM users WHERE username = '".$article."'";
$regdate = $db_object->query($qry);
$db_regdate = $regdate->fetchRow();
echo "Registration Date: ",$db_regdate['regdate'];
?><br><br></tr></td><tr><td>
<?php
$article = $_GET['art'];
$qry = "SELECT location FROM users WHERE username = '".$article."'";
$location = $db_object->query($qry);
$db_location = $location->fetchRow();
echo "Location: ",$db_location['location'];
?><br><br></tr></td></table>
//edit your website
<a href="YOURWEBSITE/logout.php">Log Out</a>
<?php
}
?>
That is it!! now you have a form that will tell your user all the information that he has in the database, and will allow other users to view that persons profile!!
REMEMBER!!!!
on any link to your members site, you must have the code look like this:
CODE
<a href ="<?php require 'db_connect.php';
echo "/members.php?art=",$_SESSION['username'];
?>">Members only</a>
echo "/members.php?art=",$_SESSION['username'];
?>">Members only</a>
and always in any page that uses the user database, make sure the following code is above the <head> tag:
CODE
<?php
require 'db_connect.php';
?>
require 'db_connect.php';
?>
Thank you all and good night!