Location: PHPKode > projects > NetLink > netlink_os/profile.php
<style type="text/css">
<!--
.prof
{font-weight:bold;}
-->
</style>

<?php
extract($_POST);
	include("db.php");
	$dbh=mysql_connect ($host,$account,$acc_pw) or die (mysql_error());
	mysql_select_db ($table); 
	$user=$_SESSION['login'];
	if ($flag=="1")
	{
		$update_f_name="UPDATE Accounts SET FirstName='$f_name_up' WHERE Username='$user'";
		$update=mysql_query($update_f_name,$dbh);
		$update_l_name="UPDATE Accounts SET LastName='$l_name_up' WHERE Username='$user'";
		$update=mysql_query($update_l_name,$dbh);
		$update_theme="UPDATE Accounts SET theme='$theme_pick' WHERE Username='$user'";
    $update=mysql_query($update_theme, $dbh);
    #for updating Site Manager Preference
    $update_edit="UPDATE Accounts SET pref='$pref' WHERE Username='$user'";
    $update=mysql_query($update_edit,$dbh);
    $flag=0;
                
		echo "<b>Account Information for $user Account Updated!\n";
		echo "<hr width='200px' align='left'/>\n\n";
                
	}
	if ($upgd_yes)
	{
		$update_edit="UPDATE Accounts SET edit='Advanced' WHERE Username='$user'";
		$update=mysql_query($update_edit,$dbh);
		$update_theme_none="UPDATE Accounts SET theme='none' WHERE Username='$user'";
		$update=mysql_query($update_theme_none,$dbh);
		echo "Editing Scheme Changed to <span style='color:navy; font-weight:bold;'>Advanced</span>\n";
		echo "<hr width='200px' align='left'/>\n\n";
	}
	
	
	
	$sql="SELECT * FROM Accounts WHERE Username='$user'";
	$rs=mysql_query($sql,$dbh);
	$row=mysql_fetch_array($rs);
	
	$f_name=$row['FirstName'];
	$l_name=$row['LastName'];
	$f_name=ucfirst($f_name);
	$l_name=ucfirst($l_name);
	$user=$row['Username'];
	$pass=$row['Password'];
	$edit=$row['edit'];
	$theme=$row['theme'];
	$pref=$row['pref'];
	mysql_close($dbh);
	
	if (($theme=="Cherry")||($theme=="Forest")||($theme=="Dolphin")||($theme=="Grape")||($theme=="None"))
  {
    $theme_lower=strtolower($theme);
    $file="themes/$theme_lower.css";
    $user_file="Users/$user/www.css";
    unlink($user_file);
    copy($file, $user_file);
  }	
	
	echo "<h3>$user's Profile</h3>";
	echo "<table summary='profile' border='0' style='font-size:10pt;'>";
	echo "<tr>";
	echo "<td>Username:</td>";
	echo "<td class='prof'>$user</td>";
	echo "</tr><tr>";
	echo "<td>Password:</td>";
	echo "<td><i>Hidden for Security</i></td>";
	echo "</tr><tr>";
	echo "<td>First Name:</td>";
	echo "<td class='prof'>$f_name</td>";
	echo "</tr><tr>";
	echo "<td>Last Name:</td>";
	echo "<td class='prof'>$l_name</td>";
	echo "</tr><tr>";
	echo "<td>Editing Preference:<br/><br/></td>";
	echo "<td width='150px'>";
	if ($edit=="Beginner")
	{
	  echo "<b>Beginner</b><br/>";
	  echo "<a href='?id=upgrade' style='color:#006600; border-bottom:#006600 1px solid;'>Upgrade to <b>Advanced</b></a>";
	}
	elseif ($edit=="Advanced")
	{
	  #good color: 003399
	  echo "<span style='font-weight:bold; color:#000099'>Advanced<br/>(Raw HTML Coding)</span>";
	}
	
	echo "</td><tr>";
	echo "<td>Site Theme:</td>";
	echo "<td width='150px'>";
	$Theme= ucfirst($theme);
	echo "<span class='#$theme'>$Theme</span>";
	echo "</td></tr>";
	echo "<tr><td>Current Theme:</td><td>";
	echo "<img src='Images/themes/".strtolower($theme).".jpg' alt='$Theme Theme'/>";
	echo "<br/><div align='center' style='width:50px'><small>".$theme."</small></div>";
	#Theme Picture and Listing
	echo "</td>";
	echo "</tr><tr><td colspan='2'/></tr><tr>";
	echo "<td colspan='2' align='center' style='border:2px black solid; background-color:#c0c0c0'>";
	echo "<a href='?id=edit_profile' class='under'>Update Profile</a>";
	echo "</td></tr></table>";
	
	?> 
Return current item: NetLink