Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.14 KB | None | 0 0
  1. <?php
  2.  
  3.        ////////////////////////////////////////////////
  4.        // TO DEACTIVATE YOU WILL HAVE TO DELETE FILE //
  5.        ////////////////////////////////////////////////
  6.  
  7.        if($user['admin'] == 1){
  8.        mysql_query("CREATE TABLE `apps` ( `id` VARCHAR ( 80 ), `type` VARCHAR( 25 ), `content` VARCHAR ( 9000 ), `sender` VARCHAR ( 25 ), `accepted` VARCHAR ( 20 ) );");
  9.        }
  10.  
  11.        //////////////////
  12.        // ALL MESSAGES //
  13.        //////////////////
  14.          $noRegister = "You are not registered, please either login or register to view this page.";
  15.          $appSent = "Your application has been sent, thank you.";
  16.          $appFailed = "Your application hasn't been sent, please check the forms.";
  17.          $date = date("d/m/Y");
  18.  
  19.        if($_GET['delete']){
  20.          if($user['admin'] == 1){
  21.           $getit = $_GET[delete];
  22.           mysql_query("DELETE FROM `apps` WHERE `id` = '$getit'") or die(mysql_error());
  23.           header('location: index.php?page=tinyapp&do=admin');
  24.          }
  25.        }
  26.  
  27.        if($_GET['decline']){
  28.          if($user['admin'] == 1){
  29.            $decline = $_GET[decline];
  30.            mysql_query("UPDATE `apps` SET `accepted` = 'Declined' WHERE `id` = '$decline'");
  31.            header('location: index.php?page=tinyapp&do=admin');
  32.            }
  33.        }
  34.  
  35.        if($_GET['accept']){
  36.          if($user['admin'] == 1){
  37.            $accept = $_GET[accept];
  38.            mysql_query("UPDATE `apps` SET `accepted` = 'Accepted!' WHERE `id` = '$accept'");
  39.            echo "Private message this user or whatever you hope to do! :)";
  40.          }
  41.        }
  42.  
  43.        if($_GET['do'] == "admin"){
  44.          if($user['admin'] > 1){
  45.            header('location: index.php');
  46.          } else {
  47.  
  48.          $check = mysql_query("SELECT * FROM `apps`");
  49.          if(mysql_num_rows($check) == 0){
  50.            echo "<center>No applications</center><br /><center><a href=index.php?page=tinyapp>Go back.</a></center><br />";
  51.          } else {
  52.            while($a = mysql_fetch_array($check)){
  53.              $av = mysql_query("SELECT * FROM `members` WHERE `username` = '$a[sender]'");
  54.              $av = mysql_fetch_array($av);
  55.              if($av[avatar] == null){
  56.               $avatar = "images/noav.png";
  57.              } else {
  58.               $avatar = "$av[avatar]";
  59.              }
  60.              echo "<table id=forum><th style=background-image:url('style/thread_header.png'); width=200px;>Details</th><th style=background-image:url('style/thread_header.png');>Application</th><tr><td><img src=$avatar align=right class=avatar>Sender: <a href=index.php?page=profile&id=$a[sender]>$a[sender]</a><br />Status: $a[accepted]<br />Applying for: $a[type]<br /><a href=index.php?page=tinyapp&delete=$a[id]>Delete</a> | <a href=index.php?page=tinyapp&decline=$a[id]>Decline</a> | <a href=index.php?page=tinyapp&accept=$a[id]>Accept</a></td><td>$a[content]</td></tr></table><br /><br />";
  61.            }
  62.          }
  63.        }  
  64.        }
  65.  
  66.        if($user['username'] == null){
  67.            echo$noRegister;
  68.        } else {
  69.           if($_GET['do'] == "myapps"){
  70.           $apps = mysql_query("SELECT * FROM `apps` WHERE `sender` = '$user[username]'");
  71.           if(mysql_num_rows($apps) == 0){
  72.              echo "<table id=forum><th style=background-image:url('style/thread_header.png');>Error</th><tr><td><center><strong>You have no applications on our system.</strong><br /><a href=index.php?page=tinyapp&do=apply>Apply for something</a></center></td></tr></table>";
  73.           } else {
  74.             while($myApps = mysql_fetch_array($apps)){
  75.                if($user['avatar'] == null){
  76.                  $avatar = "images/noav.png";
  77.                } else {
  78.                  $avatar = $user[avatar];
  79.                }
  80.                echo "<table id=forum><th style=background-image:url('style/thread_header.png'); width=200px;>Details</th><th style=background-image:url('style/thread_header.png');>Your Application</th><tr><td><img src=$avatar align=right>Status: $myApps[accepted]<br />Applying for: $myApps[type]</td><td>$myApps[content]</td></tr></table><br />";
  81.             }
  82.           }
  83.           }
  84.        }
  85.  
  86.        if($_GET['do'] == "apply"){
  87.         if($user['username'] == null){
  88.           echo$noRegister;
  89.         } else {
  90.          echo "<br /><br /><table id=forum><th style=background-image:url('style/thread_header.png');>Apply</th><tr><td><form method=POST><strong>Your username</strong><br /><input type=text name=username disabled=disabled value=$user[username]><br /><strong>Applying for</strong>(Must be a correct answer)<br /><input type=text name=type maxlength=25><br /><strong>Tell us why you should get the job, if you've have experience or not and a little something about you.<br /><textarea cols=6 rows=6 name=content maxlength=9000></textarea><br /><input type=submit name=doapp value=Submit Application></form></td></tr></table>";
  91.         }
  92.        }
  93.  
  94.        if(isset($_POST['doapp'])){
  95.          $username = $user[username];
  96.          $type = addslashes($_POST[type]);
  97.          $content = addslashes($_POST[content]);
  98.          $accepted = "Waiting..";
  99.          $id = rand(0, 999999999);
  100.          if(empty($username) or empty($type) or empty($content)){
  101.             echo$appFailed;
  102.          } else {
  103.             mysql_query("INSERT INTO `apps` (id, type, content, sender, accepted) VALUES('$id', '$type', '$content', '$username', '$accepted')") or die(mysql_error());
  104.             header('location: index.php?page=tinyapp&do=myapps');
  105.          }
  106.        }    
  107.  
  108.        if($user['admin'] == 1){
  109.           echo "<center><br /><a href=index.php?page=tinyapp&do=admin>Administration</a></center>";
  110.        } if(!$user['username'] == null){
  111.          echo "<center><a href=index.php?page=tinyapp&do=apply>Application Form</a></center>";
  112.        }
  113.  
  114.        if(!$user['username'] == null){
  115.          $count = mysql_query("SELECT * FROM `apps` WHERE `sender` = '$user[username]'");
  116.          $hmm = mysql_num_rows($count);
  117.          if(mysql_num_rows($count) == 0){
  118.            echo "<center>You have 0 apps</center>";
  119.          } else {
  120.            echo "<center>You have <a href=index.php?page=tinyapp&do=myapps>$hmm</a> apps</center>";
  121.          }
  122.        }
  123. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement