Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <style>
- body {
- background-color:000;
- color:white;
- }
- a {
- color:white;
- text-decoration:none;
- }
- td {
- background-color:202020;
- }
- th {
- backgrounf-color:000;
- color:00ff00;
- }
- .submitLink {
- color:white;
- background-color: transparent;
- text-decoration: none;
- border: none;
- cursor: pointer;
- cursor: hand;
- font-size:8pt;
- }
- </style>
- <?php
- $username = $_POST['username'];
- $username = strtolower($username);
- $password = $_POST['password'];
- $new_status = $_POST['status'];
- $action = $_POST['action'];
- if($username == null) {
- print "<title>PURPL3™</title>";
- print "<h3>PuRpL3™ BETA v03.01.01</h3>";
- print "</br>";
- print "<form action='index.php' method='post'>";
- print "<table>";
- print "<tr>";
- print "<td>Username: </td>";
- print "<td><input type='text' name='username'></td>";
- print "</tr>";
- print "<tr>";
- print "<td>Password:</td>";
- print "<td><input type='password' name='password'></td>";
- print "</tr>";
- print "<tr>";
- print "<td><input type='submit' value='Login'></td><td></td>";
- print "</tr>";
- print "</table>";
- print "</form>";
- print "</br>";
- print "<a href='signup.php'>Don't Have an account? Signup</a>";
- }
- else {
- $con = mysql_connect("localhost","root","******");
- if (!$con)
- {
- die('[ERROR] 002: MYSQL ERROR ' . mysql_error() . " [*]");
- }
- mysql_select_db("users", $con);
- $users = mysql_query("SELECT * FROM users");
- while($row = mysql_fetch_array($users))
- {
- if($row['username'] == $username) {
- $exists = true;
- $corr_password = $row['password'];
- if($password == $corr_password) {
- $profilepic = $row['profilepic'];
- if($new_status != null) {
- mysql_query("UPDATE users SET status = '" . $new_status . "' WHERE username = '" . $row['username'] . "'");
- $status = $new_status;
- }
- if($action == null || $action == "home") {
- print "<title>Hello, " . $username . "!</title>";
- print "<table width='100%' bgcolor=202020 height=30>";
- print "<tr>";
- print "<td>";
- print "<table width='100%'>";
- print "<tr>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='profile'><input type='submit' value='Profile' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='inbox'><input type='submit' value='Inbox' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='users'><input type='submit' value='Users' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='account'><input type='submit' value='Account' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='submit' value='Logout' class='submitLink'></form></td>";
- print "</tr>";
- print "</table>";
- print "</tr>";
- print "</table>";
- print "</br>Hello, " . $username . "!</br>";
- $level = $row['level'];
- $title = $row['title'];
- $profilepic = $row['profilepic'];
- $email = $row['email'];
- if($status == null) {
- $status = $row['status'];
- }
- print "</br>";
- print "<table width='100%'>";
- print "<tr>";
- print "<td width='30%'>";
- print "<form action='index.php' method='post'>";
- print "<input type='hidden' name='username' value='" . $username . "'>";
- print "<input type='hidden' name='password' value='" . $password . "'>";
- print "<textarea name='status' rows='3' cols='50'>" . $status . "</textarea>";
- print "</br><input type='submit' value='Update'></br>";
- print "</br>";
- print "</br>";
- print "</td>";
- print "<table width='100%'>";
- print "<tr>";
- print "<th><p align='left'>News Feed:</p></th>";
- print "</tr>";
- print "<tr>";
- $friends = mysql_query("SELECT * FROM friends");
- while($news = mysql_fetch_array($friends)) {
- if($news['username1'] == $username) {
- $has_friends = true;
- print "<td width='15%'>" . $news['username2'] . "</td>";
- $status_friends = mysql_query("SELECT * FROM users");
- while($news_status = mysql_fetch_array($status_friends)) {
- if($news_status['username'] == $news['username2']) {
- print "<td>";
- print $news_status['status'];
- print "</td>";
- }
- }
- print "</tr>";
- }
- }
- if($has_friends != true) {
- print "<td>No News</td></tr>";
- print "</table>";
- }
- print "</td>";
- print "</tr>";
- print "</table>";
- }
- else {
- if($action == "profile") {
- $level = $row['level'];
- $title = $row['title'];
- $profilepic = $row['profilepic'];
- if($profilepic == null) {
- $profilepic = "default.PNG";
- }
- $firstname = $row['firstname'];
- $lastname = $row['lastname'];
- $email = $row['email'];
- print "<title>Profile - " . $username . "</title>";
- print "<table width='100%' bgcolor=202020 height=30>";
- print "<tr>";
- print "<td>";
- print "<table width='100%'>";
- print "<tr>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='home'><input type='submit' value='Home' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='inbox'><input type='submit' value='Inbox' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='users'><input type='submit' value='Users' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='account'><input type='submit' value='Account' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='submit' value='Logout' class='submitLink'></form></td>";
- print "</tr>";
- print "</table>";
- print "</tr>";
- print "</table>";
- print "</br>";
- print "<table width='100%'>";
- print "<tr>";
- print "<td width='100%'>";
- print "<table>";
- print "<tr>";
- print "<td width='20%' height='30%'><img src='" . $profilepic . "'></td>";
- print "<td><textarea rows='3' cols='50' disabled='true'>" . $row['status'] . "</textarea></td>";
- print "</tr>";
- print "<td>";
- print "<table><tr><td>Title: </td><td>" . $title . "</td></tr><tr><td>Name: </td><td>" . $firstname . " " . $lastname . "</td></tr><tr><td>Level: </td><td>" . $level . "</td></tr></table>";
- print "</td>";
- print "</table>";
- print "</td>";
- print "</tr>";
- print "</table>";
- }
- else if($action == "account") {
- $newpass = $_POST['newpass'];
- $newprofilepic = $_POST['newprofilepic'];
- $newtitle = $_POST['newtitle'];
- print "<title>Account - " . $username . "</title>";
- print "<table width='100%' bgcolor=202020 height=30>";
- print "<tr>";
- print "<td>";
- print "<table width='100%'>";
- print "<tr>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='home'><input type='submit' value='Home' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='inbox'><input type='submit' value='Inbox' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='users'><input type='submit' value='Users' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='account'><input type='submit' value='Account' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='submit' value='Logout' class='submitLink'></form></td>";
- print "</tr>";
- print "</table>";
- print "</tr>";
- print "</table>";
- $title = $row['title'];
- $profilepic = $row['profilepic'];
- if($newpass == null) {
- print "<table width='100%'>";
- print "<tr>";
- print "<td>";
- print "<form action='index.php' method='post'>";
- print "<input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='account'>";
- print "<table>";
- print "<tr>";
- print "<td>Password: </td>";
- print "<td><input type='text' name='newpass' value='" . $corr_password . "'></td>";
- print "</tr>";
- print "<tr>";
- print "<td>Profile pic URL: </td>";
- print "<td><input type='text' name='newprofilepic' value='" . $profilepic . "'></td>";
- print "</tr>";
- print "<tr>";
- print "<td>Title: </td>";
- print "<td><input type='text' name='newtitle' value='" . $title . "'></td>";
- print "</tr>";
- print "<tr>";
- print "<td><input type='submit' value='Update'></td>";
- print "</tr>";
- print "</table>";
- print "</td>";
- print "</tr>";
- print "</table>";
- }
- else {
- $newpass = $_POST['newpass'];
- $newprofilepic = $_POST['newprofilepic'];
- $newtitle = $_POST['newtitle'];
- mysql_query("UPDATE users SET profilepic = '" . $newprofilepic . "' WHERE username = '" . $username . "'");
- if($newpass != null) {
- mysql_query("UPDATE users SET password = '" . $newpass . "' WHERE username = '" . $username . "'");
- }
- if($newtitle != null) {
- mysql_query("UPDATE users SET title = '" . $newtitle . "' WHERE username = '" . $username . "'");
- }
- print "<table width='100%'>";
- print "<tr>";
- print "<td><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='submit' value='Back To Home' class='submitLink'></form></td></tr></table>";
- }
- }
- if($action == "delete_message") {
- $msgid = $_POST['msgid'];
- $inbox = mysql_query("SELECT * FROM inbox");
- while($messages = mysql_fetch_array($inbox)) {
- if($messages['id'] == $msgid) {
- $message_exists = true;
- }
- }
- if($message_exists == true) {
- mysql_query("DELETE FROM inbox WHERE id='" . $msgid . "'");
- print "<title>Deleted</title>";
- print "Message deleted.</br>";
- print "<form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='inbox'><input type='submit' value='Return to inbox'></form>";
- }
- else {
- print "<title>Error</title>";
- print "Error Message Not found.</br>";
- print "<form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='inbox'><input type='submit' value='Return to inbox'></form>";
- }
- }
- if($action == "read_message") {
- $message_id = $_POST['message_id'];
- print "<title>Inbox - " . $username . "</title>";
- print "<table width='100%' bgcolor=202020 height=30>";
- print "<tr>";
- print "<td>";
- print "<table width='100%'>";
- print "<tr>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='home'><input type='submit' value='Home' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='inbox'><input type='submit' value='Inbox' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='users'><input type='submit' value='Users' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='account'><input type='submit' value='Account' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='submit' value='Logout' class='submitLink'></form></td>";
- print "</tr>";
- print "</table>";
- print "</tr>";
- print "</table>";
- $message = mysql_query("SELECT * FROM inbox");
- while($messages_list = mysql_fetch_array($message)) {
- if($messages_list['id'] == $message_id) {
- print "<table width='100%'>";
- print "<tr>";
- print "<td>From: </td>";
- print "<td>" . $messages_list['from'] . "</td>";
- print "</tr>";
- print "<tr>";
- print "<td>Subject: </td>";
- print "<td>" . $messages_list['subject'] . "</td>";
- print "</tr>";
- print "<tr>";
- print "<td></td>";
- print "<td><textarea rows='8' cols='100'>" . $messages_list['body'] . "</textarea></td>";
- print "</tr>";
- print "</table>";
- print "<table width='100%'><tr><td><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='delete_message'><input type='hidden' name='msgid' value='" . $messages_list['id'] . "'><input type='submit' value='Delete'></form></td></tr></table>";
- }
- }
- }
- if($action == "inbox") {
- print "<title>Inbox - " . $username . "</title>";
- print "<table width='100%' bgcolor=202020 height=30>";
- print "<tr>";
- print "<td>";
- print "<table width='100%'>";
- print "<tr>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='home'><input type='submit' value='Home' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='inbox'><input type='submit' value='Inbox' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='users'><input type='submit' value='Users' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='account'><input type='submit' value='Account' class='submitLink'></form></td>";
- print "<td width='20%'><center><form action='index.php' method='post'><input type='submit' value='Logout' class='submitLink'></form></td>";
- print "</tr>";
- print "</table>";
- print "</tr>";
- print "</table>";
- print "<h3>Inbox - " . $username . "</h3>";
- print "<table width='100%'><tr><td>ID </td><td>From </td><td>Subject </td><td></td></tr>";
- $inbox = mysql_query("SELECT * FROM inbox");
- while($messages = mysql_fetch_array($inbox)) {
- if($messages['to'] == $username) {
- $has_mail = true;
- print "<tr>";
- print "<td>";
- print $messages['id'];
- print "</td<td> ";
- print $messages['from'];
- print "</td><td> ";
- print $messages['subject'];
- print "</td><td>";
- print "<form action='index.php' method='post'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='read_message'><input type='hidden' name='message_id' value=" . $messages['id'] . "><input type='submit' value='Read' class='submitLink'></form>";
- print "</td></tr>";
- print "</table>";
- print "<form action='index.php' method='POST'><input type='hidden' name='action' value='delete_message'><input type='hidden' name='msgid' value='" . $messages_list['id'] . "'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='submit' value='Delete'></form>";
- }
- }
- if($has_mail != true) {
- print "<tr><td>";
- print "No Messages";
- print "</td><td></td><td></td><td></td></tr>";
- }
- print "</table>";
- print "</br>";
- print "</br>";
- print "<table width='100%'><tr><td>";
- print "<table width='100%'><tr><td>Delete Messages</td></tr><tr><td><form action='index.php' method='POST'><input type='hidden' name='action' value='delete_message'><input type='text' name='msgid'><input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'></td></tr><tr><td><input type='submit' value='Delete'></form></td></tr></table>";
- print "</td></tr></table>";
- }
- }
- }
- else {
- print "<title>PURPL3™</title>";
- print "<h3>PuRpL3™</h3>";
- print "</br>";
- print "<form action='index.php' method='post'>";
- print "<table>";
- print "<tr>";
- print "<td>Username: </td>";
- print "<td><input type='text' name='username'></td>";
- print "</tr>";
- print "<tr>";
- print "<td>Password:</td>";
- print "<td><input type='password' name='password'></td>";
- print "</tr>";
- print "<tr>";
- print "<td><input type='submit' value='Login'></td><td></td>";
- print "</tr>";
- print "</table>";
- print "</form>";
- print "</br>";
- print "[ERROR] 001: Authentication failure. [*]</br>";
- }
- }
- }
- mysql_close($con);
- }
- if($exists != true && $username != null) {
- print "<title>PURPL3™</title>";
- print "<h3>PuRpL3™</h3>";
- print "</br>";
- print "<form action='index.php' method='post'>";
- print "<table>";
- print "<tr>";
- print "<td>Username: </td>";
- print "<td><input type='text' name='username'></td>";
- print "</tr>";
- print "<tr>";
- print "<td>Password:</td>";
- print "<td><input type='password' name='password'></td>";
- print "</tr>";
- print "<tr>";
- print "<td><input type='submit' value='Login'></td><td></td>";
- print "</tr>";
- print "</table>";
- print "</form>";
- print "</br>";
- print "[ERROR] 002: Non-existant user [*]</br>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement