Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ////////////////////////////////////////////////
- // TO DEACTIVATE YOU WILL HAVE TO DELETE FILE //
- ////////////////////////////////////////////////
- if($user['admin'] == 1){
- mysql_query("CREATE TABLE `apps` ( `id` VARCHAR ( 80 ), `type` VARCHAR( 25 ), `content` VARCHAR ( 9000 ), `sender` VARCHAR ( 25 ), `accepted` VARCHAR ( 20 ) );");
- }
- //////////////////
- // ALL MESSAGES //
- //////////////////
- $noRegister = "You are not registered, please either login or register to view this page.";
- $appSent = "Your application has been sent, thank you.";
- $appFailed = "Your application hasn't been sent, please check the forms.";
- $date = date("d/m/Y");
- if($_GET['delete']){
- if($user['admin'] == 1){
- $getit = $_GET[delete];
- mysql_query("DELETE FROM `apps` WHERE `id` = '$getit'") or die(mysql_error());
- header('location: index.php?page=tinyapp&do=admin');
- }
- }
- if($_GET['decline']){
- if($user['admin'] == 1){
- $decline = $_GET[decline];
- mysql_query("UPDATE `apps` SET `accepted` = 'Declined' WHERE `id` = '$decline'");
- header('location: index.php?page=tinyapp&do=admin');
- }
- }
- if($_GET['accept']){
- if($user['admin'] == 1){
- $accept = $_GET[accept];
- mysql_query("UPDATE `apps` SET `accepted` = 'Accepted!' WHERE `id` = '$accept'");
- echo "Private message this user or whatever you hope to do! :)";
- }
- }
- if($_GET['do'] == "admin"){
- if($user['admin'] > 1){
- header('location: index.php');
- } else {
- $check = mysql_query("SELECT * FROM `apps`");
- if(mysql_num_rows($check) == 0){
- echo "<center>No applications</center><br /><center><a href=index.php?page=tinyapp>Go back.</a></center><br />";
- } else {
- while($a = mysql_fetch_array($check)){
- $av = mysql_query("SELECT * FROM `members` WHERE `username` = '$a[sender]'");
- $av = mysql_fetch_array($av);
- if($av[avatar] == null){
- $avatar = "images/noav.png";
- } else {
- $avatar = "$av[avatar]";
- }
- 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 />";
- }
- }
- }
- }
- if($user['username'] == null){
- echo$noRegister;
- } else {
- if($_GET['do'] == "myapps"){
- $apps = mysql_query("SELECT * FROM `apps` WHERE `sender` = '$user[username]'");
- if(mysql_num_rows($apps) == 0){
- 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>";
- } else {
- while($myApps = mysql_fetch_array($apps)){
- if($user['avatar'] == null){
- $avatar = "images/noav.png";
- } else {
- $avatar = $user[avatar];
- }
- 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 />";
- }
- }
- }
- }
- if($_GET['do'] == "apply"){
- if($user['username'] == null){
- echo$noRegister;
- } else {
- 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>";
- }
- }
- if(isset($_POST['doapp'])){
- $username = $user[username];
- $type = addslashes($_POST[type]);
- $content = addslashes($_POST[content]);
- $accepted = "Waiting..";
- $id = rand(0, 999999999);
- if(empty($username) or empty($type) or empty($content)){
- echo$appFailed;
- } else {
- mysql_query("INSERT INTO `apps` (id, type, content, sender, accepted) VALUES('$id', '$type', '$content', '$username', '$accepted')") or die(mysql_error());
- header('location: index.php?page=tinyapp&do=myapps');
- }
- }
- if($user['admin'] == 1){
- echo "<center><br /><a href=index.php?page=tinyapp&do=admin>Administration</a></center>";
- } if(!$user['username'] == null){
- echo "<center><a href=index.php?page=tinyapp&do=apply>Application Form</a></center>";
- }
- if(!$user['username'] == null){
- $count = mysql_query("SELECT * FROM `apps` WHERE `sender` = '$user[username]'");
- $hmm = mysql_num_rows($count);
- if(mysql_num_rows($count) == 0){
- echo "<center>You have 0 apps</center>";
- } else {
- echo "<center>You have <a href=index.php?page=tinyapp&do=myapps>$hmm</a> apps</center>";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement