Advertisement
Guest User

Untitled

a guest
Jun 20th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.16 KB | None | 0 0
  1. <style>
  2. body {
  3. background-color:000;
  4. color:white;
  5. }
  6. a {
  7. color:white;
  8. text-decoration:none;
  9. }
  10. td {
  11. background-color:202020;
  12. }
  13. th {
  14. backgrounf-color:000;
  15. color:00ff00;
  16. }
  17. .submitLink {
  18. color:white;
  19. background-color: transparent;
  20. text-decoration: none;
  21. border: none;
  22. cursor: pointer;
  23. cursor: hand;
  24. font-size:8pt;
  25. }
  26.  
  27. </style>
  28.  
  29. <?php
  30. $username = $_POST['username'];
  31. $username = strtolower($username);
  32. $password = $_POST['password'];
  33. $new_status = $_POST['status'];
  34. $action = $_POST['action'];
  35. if($username == null) {
  36. print "<title>PURPL3&trade;</title>";
  37. print "<h3>PuRpL3&trade; BETA v03.01.01</h3>";
  38. print "</br>";
  39. print "<form action='index.php' method='post'>";
  40. print "<table>";
  41. print "<tr>";
  42. print "<td>Username: </td>";
  43. print "<td><input type='text' name='username'></td>";
  44. print "</tr>";
  45. print "<tr>";
  46. print "<td>Password:</td>";
  47. print "<td><input type='password' name='password'></td>";
  48. print "</tr>";
  49. print "<tr>";
  50. print "<td><input type='submit' value='Login'></td><td></td>";
  51. print "</tr>";
  52. print "</table>";
  53. print "</form>";
  54. print "</br>";
  55. print "<a href='signup.php'>Don't Have an account? Signup</a>";
  56. }
  57. else {
  58. $con = mysql_connect("localhost","root","******");
  59. if (!$con)
  60. {
  61. die('[ERROR] 002: MYSQL ERROR ' . mysql_error() . " [*]");
  62. }
  63. mysql_select_db("users", $con);
  64. $users = mysql_query("SELECT * FROM users");
  65. while($row = mysql_fetch_array($users))
  66. {
  67. if($row['username'] == $username) {
  68. $exists = true;
  69. $corr_password = $row['password'];
  70. if($password == $corr_password) {
  71. $profilepic = $row['profilepic'];
  72. if($new_status != null) {
  73. mysql_query("UPDATE users SET status = '" . $new_status . "' WHERE username = '" . $row['username'] . "'");
  74. $status = $new_status;
  75. }
  76.  
  77. if($action == null || $action == "home") {
  78. print "<title>Hello, " . $username . "!</title>";
  79. print "<table width='100%' bgcolor=202020 height=30>";
  80. print "<tr>";
  81. print "<td>";
  82. print "<table width='100%'>";
  83. print "<tr>";
  84. 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>";
  85. 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>";
  86. 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>";
  87. 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>";
  88. print "<td width='20%'><center><form action='index.php' method='post'><input type='submit' value='Logout' class='submitLink'></form></td>";
  89. print "</tr>";
  90. print "</table>";
  91. print "</tr>";
  92. print "</table>";
  93. print "</br>Hello, " . $username . "!</br>";
  94. $level = $row['level'];
  95. $title = $row['title'];
  96. $profilepic = $row['profilepic'];
  97. $email = $row['email'];
  98. if($status == null) {
  99. $status = $row['status'];
  100. }
  101. print "</br>";
  102. print "<table width='100%'>";
  103. print "<tr>";
  104. print "<td width='30%'>";
  105. print "<form action='index.php' method='post'>";
  106. print "<input type='hidden' name='username' value='" . $username . "'>";
  107. print "<input type='hidden' name='password' value='" . $password . "'>";
  108. print "<textarea name='status' rows='3' cols='50'>" . $status . "</textarea>";
  109. print "</br><input type='submit' value='Update'></br>";
  110. print "</br>";
  111. print "</br>";
  112. print "</td>";
  113. print "<table width='100%'>";
  114. print "<tr>";
  115. print "<th><p align='left'>News Feed:</p></th>";
  116. print "</tr>";
  117. print "<tr>";
  118. $friends = mysql_query("SELECT * FROM friends");
  119. while($news = mysql_fetch_array($friends)) {
  120. if($news['username1'] == $username) {
  121. $has_friends = true;
  122. print "<td width='15%'>" . $news['username2'] . "</td>";
  123. $status_friends = mysql_query("SELECT * FROM users");
  124. while($news_status = mysql_fetch_array($status_friends)) {
  125. if($news_status['username'] == $news['username2']) {
  126. print "<td>";
  127. print $news_status['status'];
  128. print "</td>";
  129. }
  130. }
  131. print "</tr>";
  132.  
  133. }
  134. }
  135. if($has_friends != true) {
  136. print "<td>No News</td></tr>";
  137. print "</table>";
  138.  
  139.  
  140. }
  141. print "</td>";
  142. print "</tr>";
  143. print "</table>";
  144. }
  145. else {
  146. if($action == "profile") {
  147. $level = $row['level'];
  148. $title = $row['title'];
  149. $profilepic = $row['profilepic'];
  150. if($profilepic == null) {
  151. $profilepic = "default.PNG";
  152. }
  153. $firstname = $row['firstname'];
  154. $lastname = $row['lastname'];
  155. $email = $row['email'];
  156. print "<title>Profile - " . $username . "</title>";
  157. print "<table width='100%' bgcolor=202020 height=30>";
  158. print "<tr>";
  159. print "<td>";
  160. print "<table width='100%'>";
  161. print "<tr>";
  162. 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>";
  163. 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>";
  164. 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>";
  165. 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>";
  166. print "<td width='20%'><center><form action='index.php' method='post'><input type='submit' value='Logout' class='submitLink'></form></td>";
  167. print "</tr>";
  168. print "</table>";
  169. print "</tr>";
  170. print "</table>";
  171. print "</br>";
  172. print "<table width='100%'>";
  173. print "<tr>";
  174. print "<td width='100%'>";
  175. print "<table>";
  176. print "<tr>";
  177. print "<td width='20%' height='30%'><img src='" . $profilepic . "'></td>";
  178. print "<td><textarea rows='3' cols='50' disabled='true'>" . $row['status'] . "</textarea></td>";
  179. print "</tr>";
  180. print "<td>";
  181. 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>";
  182. print "</td>";
  183. print "</table>";
  184. print "</td>";
  185. print "</tr>";
  186. print "</table>";
  187.  
  188.  
  189. }
  190. else if($action == "account") {
  191. $newpass = $_POST['newpass'];
  192. $newprofilepic = $_POST['newprofilepic'];
  193. $newtitle = $_POST['newtitle'];
  194. print "<title>Account - " . $username . "</title>";
  195. print "<table width='100%' bgcolor=202020 height=30>";
  196. print "<tr>";
  197. print "<td>";
  198. print "<table width='100%'>";
  199. print "<tr>";
  200. 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>";
  201. 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>";
  202. 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>";
  203. 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>";
  204. print "<td width='20%'><center><form action='index.php' method='post'><input type='submit' value='Logout' class='submitLink'></form></td>";
  205. print "</tr>";
  206. print "</table>";
  207. print "</tr>";
  208. print "</table>";
  209. $title = $row['title'];
  210. $profilepic = $row['profilepic'];
  211. if($newpass == null) {
  212. print "<table width='100%'>";
  213. print "<tr>";
  214. print "<td>";
  215. print "<form action='index.php' method='post'>";
  216. print "<input type='hidden' name='username' value='" . $username . "'><input type='hidden' name='password' value='" . $password . "'><input type='hidden' name='action' value='account'>";
  217. print "<table>";
  218. print "<tr>";
  219. print "<td>Password: </td>";
  220. print "<td><input type='text' name='newpass' value='" . $corr_password . "'></td>";
  221. print "</tr>";
  222. print "<tr>";
  223. print "<td>Profile pic URL: </td>";
  224. print "<td><input type='text' name='newprofilepic' value='" . $profilepic . "'></td>";
  225. print "</tr>";
  226. print "<tr>";
  227. print "<td>Title: </td>";
  228. print "<td><input type='text' name='newtitle' value='" . $title . "'></td>";
  229. print "</tr>";
  230. print "<tr>";
  231. print "<td><input type='submit' value='Update'></td>";
  232. print "</tr>";
  233. print "</table>";
  234. print "</td>";
  235. print "</tr>";
  236. print "</table>";
  237.  
  238. }
  239. else {
  240. $newpass = $_POST['newpass'];
  241. $newprofilepic = $_POST['newprofilepic'];
  242. $newtitle = $_POST['newtitle'];
  243. mysql_query("UPDATE users SET profilepic = '" . $newprofilepic . "' WHERE username = '" . $username . "'");
  244. if($newpass != null) {
  245. mysql_query("UPDATE users SET password = '" . $newpass . "' WHERE username = '" . $username . "'");
  246. }
  247. if($newtitle != null) {
  248. mysql_query("UPDATE users SET title = '" . $newtitle . "' WHERE username = '" . $username . "'");
  249. }
  250. print "<table width='100%'>";
  251. print "<tr>";
  252. 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>";
  253.  
  254.  
  255.  
  256.  
  257. }
  258.  
  259. }
  260. if($action == "delete_message") {
  261. $msgid = $_POST['msgid'];
  262. $inbox = mysql_query("SELECT * FROM inbox");
  263. while($messages = mysql_fetch_array($inbox)) {
  264. if($messages['id'] == $msgid) {
  265. $message_exists = true;
  266. }
  267.  
  268. }
  269. if($message_exists == true) {
  270. mysql_query("DELETE FROM inbox WHERE id='" . $msgid . "'");
  271. print "<title>Deleted</title>";
  272. print "Message deleted.</br>";
  273. 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>";
  274.  
  275.  
  276. }
  277. else {
  278. print "<title>Error</title>";
  279. print "Error Message Not found.</br>";
  280. 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>";
  281. }
  282. }
  283. if($action == "read_message") {
  284. $message_id = $_POST['message_id'];
  285. print "<title>Inbox - " . $username . "</title>";
  286. print "<table width='100%' bgcolor=202020 height=30>";
  287. print "<tr>";
  288. print "<td>";
  289. print "<table width='100%'>";
  290. print "<tr>";
  291. 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>";
  292. 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>";
  293. 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>";
  294. 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>";
  295. print "<td width='20%'><center><form action='index.php' method='post'><input type='submit' value='Logout' class='submitLink'></form></td>";
  296. print "</tr>";
  297. print "</table>";
  298. print "</tr>";
  299. print "</table>";
  300.  
  301. $message = mysql_query("SELECT * FROM inbox");
  302. while($messages_list = mysql_fetch_array($message)) {
  303. if($messages_list['id'] == $message_id) {
  304. print "<table width='100%'>";
  305. print "<tr>";
  306. print "<td>From: </td>";
  307. print "<td>" . $messages_list['from'] . "</td>";
  308. print "</tr>";
  309. print "<tr>";
  310. print "<td>Subject: </td>";
  311. print "<td>" . $messages_list['subject'] . "</td>";
  312. print "</tr>";
  313. print "<tr>";
  314. print "<td></td>";
  315. print "<td><textarea rows='8' cols='100'>" . $messages_list['body'] . "</textarea></td>";
  316. print "</tr>";
  317. print "</table>";
  318. 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>";
  319. }
  320.  
  321. }
  322.  
  323.  
  324.  
  325. }
  326. if($action == "inbox") {
  327. print "<title>Inbox - " . $username . "</title>";
  328. print "<table width='100%' bgcolor=202020 height=30>";
  329. print "<tr>";
  330. print "<td>";
  331. print "<table width='100%'>";
  332. print "<tr>";
  333. 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>";
  334. 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>";
  335. 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>";
  336. 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>";
  337. print "<td width='20%'><center><form action='index.php' method='post'><input type='submit' value='Logout' class='submitLink'></form></td>";
  338. print "</tr>";
  339. print "</table>";
  340. print "</tr>";
  341. print "</table>";
  342. print "<h3>Inbox - " . $username . "</h3>";
  343. print "<table width='100%'><tr><td>ID </td><td>From </td><td>Subject </td><td></td></tr>";
  344. $inbox = mysql_query("SELECT * FROM inbox");
  345. while($messages = mysql_fetch_array($inbox)) {
  346. if($messages['to'] == $username) {
  347. $has_mail = true;
  348. print "<tr>";
  349. print "<td>";
  350. print $messages['id'];
  351. print "</td<td> ";
  352. print $messages['from'];
  353. print "</td><td> ";
  354. print $messages['subject'];
  355. print "</td><td>";
  356. 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>";
  357. print "</td></tr>";
  358. print "</table>";
  359. 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>";
  360.  
  361. }
  362.  
  363.  
  364.  
  365.  
  366. }
  367.  
  368. if($has_mail != true) {
  369. print "<tr><td>";
  370. print "No Messages";
  371. print "</td><td></td><td></td><td></td></tr>";
  372. }
  373. print "</table>";
  374. print "</br>";
  375. print "</br>";
  376. print "<table width='100%'><tr><td>";
  377. 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>";
  378. print "</td></tr></table>";
  379. }
  380.  
  381. }
  382.  
  383. }
  384. else {
  385. print "<title>PURPL3&trade;</title>";
  386. print "<h3>PuRpL3&trade;</h3>";
  387. print "</br>";
  388. print "<form action='index.php' method='post'>";
  389. print "<table>";
  390. print "<tr>";
  391. print "<td>Username: </td>";
  392. print "<td><input type='text' name='username'></td>";
  393. print "</tr>";
  394. print "<tr>";
  395. print "<td>Password:</td>";
  396. print "<td><input type='password' name='password'></td>";
  397. print "</tr>";
  398. print "<tr>";
  399. print "<td><input type='submit' value='Login'></td><td></td>";
  400. print "</tr>";
  401. print "</table>";
  402. print "</form>";
  403. print "</br>";
  404. print "[ERROR] 001: Authentication failure. [*]</br>";
  405. }
  406.  
  407. }
  408.  
  409.  
  410. }
  411. mysql_close($con);
  412. }
  413. if($exists != true && $username != null) {
  414. print "<title>PURPL3&trade;</title>";
  415. print "<h3>PuRpL3&trade;</h3>";
  416. print "</br>";
  417. print "<form action='index.php' method='post'>";
  418. print "<table>";
  419. print "<tr>";
  420. print "<td>Username: </td>";
  421. print "<td><input type='text' name='username'></td>";
  422. print "</tr>";
  423. print "<tr>";
  424. print "<td>Password:</td>";
  425. print "<td><input type='password' name='password'></td>";
  426. print "</tr>";
  427. print "<tr>";
  428. print "<td><input type='submit' value='Login'></td><td></td>";
  429. print "</tr>";
  430. print "</table>";
  431. print "</form>";
  432. print "</br>";
  433. print "[ERROR] 002: Non-existant user [*]</br>";
  434.  
  435.  
  436. }
  437.  
  438. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement