Not quite lol.
Here is the page that I have created:
PHP Code:
<?php
// Easy Adoptables Script by Brandon Rusnak
// Get our includes out of the way
include("inc/functions.php");
include("inc/levels.php");
include("inc/config.php");
include("inc/settings.php");
include("inc/nbbc.php"); // BBCODE Parser
$bbcode = new BBCode;
// Connect to our database
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql database!');
mysql_select_db($dbname);
//Set up our login info...
$username = "";
$password = "";
//Check for cookie
if (isset($_COOKIE['adoptu']) and isset($_COOKIE['adoptp'])){
$username = $_COOKIE['adoptu'];
$password = $_COOKIE['adoptp'];
$username = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $username);
$password = preg_replace("/[^a-zA-Z0-9s]/", "", $password);
//Run login operation
$query = "SELECT * FROM users WHERE username = '$username'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$luser=@mysql_result($result,$i,"username");
$lpass=@mysql_result($result,$i,"password");
$i++;
}
if($username == $luser and $password == $lpass){
$isloggedin = "yes";
}
else{
if (isset($_COOKIE['adoptu'])){
$past = time() - 10;
setcookie("adoptu",$username,$past);
}
if (isset($_COOKIE['adoptp'])){
$past = time() - 10;
setcookie("adoptp",$password,$past);
}
$isloggedin = "no";
}
}
else
{
//User is not logged in
$isloggedin = "no";
}
//Begin our content for the page
$id = $_GET["id"];
$id = preg_replace("/[^a-zA-Z0-9s]/", "", $id);
//Begin the level up procedure
if($id != ""){
//Adoptable ID is not empty, continue...
//Check that the adoptable does in fact exist...
$query = "SELECT * FROM users WHERE uid = '$id'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$uname=@mysql_result($result,$i,"username");
$imageurl=@mysql_result($result,$i,"imageurl");
$realname=@mysql_result($result,$i,"realname");
$email=@mysql_result($result,$i,"email");
$location=@mysql_result($result,$i,"location");
$aim=@mysql_result($result,$i,"aim");
$msn=@mysql_result($result,$i,"msn");
$birthday=@mysql_result($result,$i,"birthday");
$i++;
}
if($uname != ""){
$article_title = "Profile of ".$uname.".";
$article_date = date('Y-m-d');
$article_content = "<img src='".$imageurl."' border='0'><br><br>
<b>Real Name: </b>".$realname."<br>
<b>Email: </b>".$email."<br>
<b>Location: </b>".$location."<br>
<b>AIM: </b> ".$aim."<br>
<b>MSN: </b> ".$msn."<br>
<b>Birthday: </b> ".$birthday."<br>
Like the sound of ".$username."? <b><a href='addfriend.php?id=".$id."'>Click here to add them to your friend's list!</a></b>";
}
else {
$article_title = "Invalid Adoptable ID";
$article_date = date('Y-m-d');
$article_content = "The adoptable ID specified does not exist in our system. If you would like your own adoptable you can
<a href='adopt.php'>get one free here</a>.";
}
}
else{
$article_title = "No Adoptable Specified";
$article_date = date('Y-m-d');
$article_content = "You did not specify an adoptable ID to show. If you would like your own adoptable you can
<a href='adopt.php'>get one free here</a>.";
}
// Define our Template File
$file = $current_theme;
$article_title = stripslashes($article_title);
$article_content = stripslashes($article_content);
// Should we show the extra pages in the nav bar?
$link1 = "";
if($show_extra_page1 == "yes"){
$link1 = "<li><a href='$extra_page1_link'>$extra_page1_name<span class='tab-l'></span><span class='tab-r'></span></a></li>";
}
$link2 = "";
if($show_extra_page2 == "yes"){
$link2 = "<li><a href='$extra_page2_link'>$extra_page2_name<span class='tab-l'></span><span class='tab-r'></span></a></li>";
}
// Do the template changes and echo the ready template
$template = file_get_contents($file);
$template = replace(':SITETITLE:',$site_title,$template);
$template = replace(':SITENAME:',$site_name,$template);
$template = replace(':ARTICLETITLE:',$article_title,$template);
$template = replace(':ARTICLEDATE:',$article_date,$template);
$template = replace(':ARTICLECONTENT:',$article_content,$template);
$template = replace(':LINK1:',$link1,$template);
$template = replace(':LINK2:',$link2,$template);
$template = replace(':LINK3:',$link3,$template);
//Get the featured adoptable...
$featured = getfeatured();
$template = replace(':FEATURED:',$featured,$template);
//Ad Management
$header = @file_get_contents("ads/header.txt");
$footer = @file_get_contents("ads/footer.txt");
$tower = @file_get_contents("ads/tower.txt");
$header = stripslashes($header);
$footer = stripslashes($footer);
$tower = stripslashes($tower);
$template = replace(':HEADERAD:',$header,$template);
$template = replace(':FOOTERAD:',$footer,$template);
$template = replace(':TOWERAD:',$tower,$template);
//Is the user logged in?
//$isloggedin = "no";
if ($isloggedin == "yes"){
$template = replace(':WELCOMEORREGISTER:','<u>Welcome Back:</u>',$template);
$template = replace(':LOGINORACCT:', 'Welcome back '.$username.'. <br><br><a href="logout.php">Log Out</a>' ,$template);
}
else{
//User is not logged in
$template = replace(':WELCOMEORREGISTER:','<u>Member Login:</u>',$template);
$loginform = "<form name='form1' method='post' action='login.php'>
<p>Username:
<input name='username' type='text' id='username'>
</p>
<p>Password:
<input name='password' type='password' id='password'>
</p>
<p>
<input type='submit' name='Submit' value='Submit'>
</p>
<p>Don't have an account?<br>
<a href='register.php'>Register Free</a> </p>
</form>
";
$template = replace(':LOGINORACCT:', $loginform ,$template);
}
echo $template;
?>
As you can tell, I've just modified one of your pages (well, started to mod), to create a more detailed profile page. The only thing that I'm having trouble with is linking to this page. I want to replace the current account page with this one. So the "My Account" link, will link to this page. I'm just not sure how to go about putting php in a link to add the users ID onto the end of the link.
I'm definitely donating to help support this project when I get paid a week tomorrow. Thanks Brandon!