Can has cookie?
style/poseidonBB/usercp.php (apparently he didn't finish it, cuz it's crap. T_T)
PHP Code:
<?php
/**
* User Control Panel
*/
if(isset($_SESSION['uid']))
{
$sql = "SELECT * FROM `users` WHERE `id`='".$_SESSION['uid']."'";
$res = mysql_query($sql) or die (mysql_error());
$row = mysql_fetch_array($res);
$profile_ops = array('Edit Your Details' => 'edit_detail', 'Change Your Account Details' => 'acc_detail');
$comm_ops = array('Friends and Contacts' => 'friends_contacts', 'Ignored Users' => 'ignore_users');
$pm_ops = array('Send New' => 'pm_send', 'Inbox' => 'pm_inbox', 'Sent' => 'pm_sent');
$proc = 1;
$count = count($profile_ops);
$comm_count = count($comm_ops);
$pm_count = count($pm_ops);
if(isset($_GET['do'])) {
$do = $_GET['do'];
} else {
$do = "";
}
echo "<center>";
echo "<div id=\"container\">";
echo "<div id=\"userinfo\">";
echo "<table border=\"0\" width=\"100%\">";
echo "<tr align=\"right\"><td>Welcome, <a href=\"".$rootdir."profile.php?id=".$row['id']."\">".$row['username']."</a>! <a href=\"".$rootdir."logout.php\">Logout</a></td></tr>";
echo "</table>";
echo "</div>";
echo "<table border=\"0\" width=\"100%\" cellspacing=\"3\" cellpadding=\"3\">";
echo "<tr><td align=\"left\" width=\"22%\">";
echo "<div id=\"notice\" style=\"width:95%; border:1px solid #000;\">UCP Options</div>";
echo "<div id=\"content\" style=\"width:95%; border:1px solid #000; margin-top:0px;\">";
echo "<a href=\"".$rootdir."ucp.php\">«UCP Home»</a><br><br>";
echo "<b>Profile Options</b><br>";
foreach($profile_ops AS $name => $link)
{
$break = ($proc == $count) ? "" : " <br> ";
echo "<a href=\"".$rootdir."ucp.php?do=".$link."\">".$name."</a>" . $break . "\n";
$proc++;
}
echo "<br><b>Community</b><br>";
foreach($comm_ops AS $name => $link)
{
$break = ($proc == $comm_count) ? "" : " <br> ";
echo "<a href=\"".$rootdir."ucp.php?do=".$link."\">".$name."</a>" . $break . "\n";
$proc++;
}
echo "<b>Private Messaging</b><br>";
foreach($pm_ops AS $name => $link)
{
$break = ($proc == $pm_count) ? "" : " <br> ";
echo "<a href=\"".$rootdir."ucp.php?do=".$link."\">".$name."</a>" . $break . "\n";
$proc++;
}
echo "</div>";
echo "</div>";
echo "</td><td colspan=\"2\" valign=\"top\" align=\"left\">";
echo "<div id=\"content\">";
switch($do)
{
case NULL:
echo "<title>User Control Panel</title>";
echo "Welcome to the User Control Panel, ".$_SESSION['name']."!<br>
Here, you will find many useful tools to tweak and edit your profile to create the ultimate look!<br><br>
<i>Profile Options - Change your email, include your website, your location, anything! Keep in mind that all of this is displayed publicly.</i><br><br>
<i>Community - Access friends, contacts, or anything related to the community here!</i><br><br>
<i>Private Messaging - You can use private messaging to send someone a message without it being publicly displayed on the user's profile.</i>";
break;
case "edit_detail":
$image = (file_exists("avatars/".$get['posterid'].".gif")) ? "<img src=\"avatars/".$_SESSION['uid'].".gif\" title=\"Your Avatar\" border=\"1\">" : "No Avatar";
echo "<title>User Control Panel - Edit Details</title>";
echo "<fieldset>
<legend>Avatar</legend>
<center>
".$image."<br />
</center>
<form method=\"post\" action=\"\">
<table border=\"0\" cellspacing=\"1\" width=\"100%\">
<tr>
<td>
<input type=\"file\" name=\"avatar\">
</td>
</tr>
</table>
</form>
</fieldset>";
break;
case "acc_detail":
echo "<title>User Control Panel - Edit Account Details</title>";
if(!isset($_POST['updatepass']))
{
echo "<fieldset>
<legend>Change Password</legend>
<form method=\"post\" action=\"\">
<table border=\"0\" cellspacing=\"1\" width=\"100%\">
<tr>
<td>
<fieldset>
<legend>Please enter your current password to continue</legend>
<input type=\"password\" name=\"password\">
</fieldset>
</td>
</tr>
<tr>
<td>
New Password
<input type=\"password\" name=\"newp\">
</td>
</tr>
<tr>
<td>
Confirm New Password
<input type=\"password\" name=\"cnewp\">
</td>
</tr>
<tr>
<td>
New Email Address
<input type=\"text\" name=\"newemail\">
</td>
</tr>
<tr>
<td>
<input type=\"submit\" name=\"updatepass\" value=\"Update Details\">
</td>
</tr>
</table>
</form>
</fieldset>";
}
else
{
$old = mysql_real_escape_string(stripslashes($_POST['password']));
$new = mysql_real_escape_string(stripslashes($_POST['newp']));
$confirm = mysql_real_escape_string(stripslashes($_POST['$cnewp']));
$email = mysql_real_escape_string(stripslashes($_POST['newemail']));
$sql = "SELECT * FROM `users` WHERE id='".$_SESSION['uid']."'";
$query = mysql_query($sql) or die(mysql_error());
$fetch = mysql_fetch_array($query);
$md5pass = md5($old);
$md5newpass = md5($new);
if($md5pass == $fetch['password'])
{
if($new == $confirm)
{
mysql_query("UPDATE `users` SET password='".$md5newpass."' WHERE id='".$_SESSION['uid']."'") or die(mysql_error());
}
else
{
echo "Passwords do not match!";
}
if($email != "")
{
mysql_query("UPDATE `users` SET email='".$email."' WHERE id='".$_SESSION['uid']."'") or die(mysql_error());
}
else
{
echo "Please provide an email!";
}
}
else
{
echo "Incorrect password provided!";
}
}
break;
case "pm_send":
$userid = mysql_real_escape_string(stripslashes($_GET['uid']));
#$script = "INSERT INTO";
break;
}
echo "</div>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
echo "</center><br>";
}
else
{
include('notice.php');
}
?>