Rabid Jelly
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Application

2 posters

Go down

Application Empty Application

Post  Aries Wed Jan 26, 2011 2:04 pm

Name: Stephen

Age: 18

Gender: Male

Previous Jobs: I haven't really worked for an established pet site before. All programming experience I have is me creating sites to build my knowledge or helping friends in the virtual pet community with a script or two.

Examples:
Rock Paper Scissors - Built for Solar VPS
Code:

<?php

//Solar VPS original programmed by Ole
//@author Aries
//@script Rock, Paper, Sissors!


$default_action = "Display";
if(isset($_GET['action'])) {
   
   $action = $_GET['action'];

} else {
   
   $action = $default_action;

}

include("includes/header.php");
include("layout.php");

if ($action == "Display") {

   echo "Welcome to Rock Paper Sissors. This is a game of complete luck. If you manage to beat me I'll give you 500 virapoints. However if you lose I'll take 250. Good Luck!";
   echo "<br><br>";
   echo "<form method="post" action="?action=play"><table>";
   echo "<tr><td>Select: </td> <td><select name="item"><option value="Rock">Rock</option><option value="Paper">Paper</option><option value="Sissors">Sissors</option></select></td></tr>";
   echo "<tr><td><input type="submit" value="Shoot!"></td></tr>";
   echo "</table></form>";
}

if ($action == "play") {

   $yourchoice = $_POST['item'];
   
   $computerpickr = rand(1,3);
   $computerpicka = array(
   
   '1' => 'Rock',
   '2' => 'Paper',
   '3' => 'Sissors'
   );
   
   $computerchoice = $computerpicka[$computerpickr];
   
   
   //Lets do the outcome if you picked rock
   if ($yourchoice == "Rock" && $computerchoice == "Rock") {
   
      echo "It's a tie. No one won.<br><a href='rps.php'>Play again?</a>";
   }
   
   elseif ($yourchoice == "Rock" && $computerchoice == "Paper") {
   
      echo "You lost to the computer.<br><a href='rps.php'>Play again?</a>";
      $user->takePoints(250);
   }
   
   elseif ($yourchoice == "Rock" && $computerchoice == "Sissors") {
   
      echo "You beat the computer.<br><a href='rps.php'>Play again?</a>";
      $user->givePoints(500);
   }
   
   //Lets do the outcome if you picked paper
   
   elseif ($yourchoice == "Paper" && $computerchoice == "Rock") {
   
      echo "You beat the computer.<br><a href='rps.php'>Play again?</a>";
      $user->givePoints(500);
   }
   
   elseif ($yourchoice == "Paper" && $computerchoice == "Paper") {
   
      echo "It's a tie. No one won. <br><a href='rps.php'>Play again?</a>";
   }
   
   elseif ($yourchoice == "Paper" && $computerchoice == "Sissors") {
   
      echo "You lost to the computer. <br><a href='rps.php'>Play again?</a>";
      $user->takePoints(250);
   }
   
   //Lets do the outcome if you picked sissors
   
   elseif ($yourchoice == "Sissors" && $computerchoice == "Rock") {
   
      echo "You lost to the computer.<br><a href='rps.php'>Play again?</a>";
      $user->takePoints(250);
   }
   
   elseif ($yourchoice == "Sissors" && $computerchoice == "Paper") {
   
      echo "You beat the computer.<br><a href='rps.php'>Play again?</a>";
      $user->givePoints(500);
   }
   
   elseif ($yourchoice == "Sissors" && $computerchoice == "Sissors") {
   
      echo "It's a tie. No one won.<br><a href='rps.php'>Play again?</a>";
   }
}

include("includes/footer.php");
?>

Basic Quest System also for Solar VPS
Code:

<?php


/**
 * @author Aries
 * @copyright 2009
 */
 
 
$default_action = "Display";
if(isset($_GET['action'])) {
$action = $_GET['action'];
} else {
$action = $default_action;
}
include("includes/header.php");
$user->checkLogin();
include("layout.php");
$quest_query = mysql_query("SELECT * FROM `svps_quest_game` WHERE `username` = '{$user->info['username']}'");
   $numgames = mysql_num_rows($quest_query);

   
if ($action == 'Display') {
   
   if ($numgames == '1') {
      echo "You are already doing a <a href='?action=quest'>quest</a>. Go complete it before you want to start a new one.";
   } else {
   
   echo "Come one, come all! I am the great Psicosis, programmer for Virapetz. I'd like for you to retrieve an item for me. Are you capable of that?<br><a href='?action=quest'>Of Course!</a><br><a href='games.php'>No. Back to games</a>";
}
}

if ($action == 'quest') {
   if ($numgames == '1') {
      $quest_array = mysql_fetch_array($quest_query);
      $item = $quest_array['item_requested'];
      
      $item_query = mysql_query("SELECT * FROM `svps_items` WHERE `name` = '$item'");
      $item_array = mysql_fetch_array($item_query);
      $iimage = $item_array['image'];
      
      echo "Bring me my $item NOW!<br><img src='$iimage'><br><br><a href='?action=complete'>Yes, I have your item!</a><br><a href='?action=quit'>No, I want to quit!</a>";
   } else {
$query = mysql_query ("SELECT * FROM svps_items ORDER BY RAND() LIMIT 1");
$r = mysql_fetch_array($query);
$name = $r['name'];
$image = $r['image'];



   echo "Fetch me:<br>
   $name<br><img src='$image'>";
   
   mysql_query( "INSERT INTO `svps_quest_game` ( `username` , `item_requested` ) VALUES ('{$user->info['username']}', '$name')" ) or die( mysql_error() ) ;
   
}
}

if ($action == 'complete') {
   
   $complete_quest_array = mysql_fetch_array($quest_query);
   $username = $complete_quest_array['username'];
   $quested_item = $complete_quest_array['item_requested'];
   
   $item_query2 = mysql_query("SELECT * FROM `svps_items` WHERE `name` = '$quested_item'");
   $item_array2 = mysql_fetch_array($item_query2);
   $itemID = $item_array2['ID'];
   $price = $item_array2['price'];
   
   $check_inv = mysql_num_rows(mysql_query("SELECT * FROM `svps_inventory` WHERE `itemid` = '$itemID'"));
   
   if ($check_inv == '0') {
      echo "You liar! You don't have my item. Come back when you do.";
   } else {
      $multiplier = rand(2,5); // You can easily change these values. Determins payout.
      $payout = $price * $multiplier;
      
      echo "I have been extremely generous and have awarded you $payout points. Be gone!<br><br><a href='pquest.php'>Back to Questing</a>";
      $user->givePoints($payout);
      mysql_query("DELETE FROM `svps_quest_game` WHERE `username` = '{$user->info['username']}'");
      mysql_query("DELETE FROM `svps_inventory` WHERE `itemid` = '$itemID' AND `userid` = '{$user->info['id']}' LIMIT 1");
      
   }
   
}

if ($action == 'quit'){
   
   echo "You are an embarassment. Go away. <a href='pquest.php'>Try again?</a>";
   mysql_query("DELETE FROM `svps_quest_game` WHERE `username` = '{$user->info['username']}'");
   
}
include("includes/footer.php");
?>

Newest - Registration
Code:

<?php

function cleanup($string){
    $string = mysql_real_escape_string($string);
    $string = strip_tags($string);
    $string = addslashes($string);
   
    return $string;
}

function database(){
    $con = mysql_connect("localhost", "root", "") or die(mysql_error());
    $db = mysql_select_db("users", $con);
}


?>
<?php

database();

if(!$_POST['submit']){
    echo "<table border="0" cellspacing="3" cellpadding="3">\n";
    echo "<form method="post" action="register.php">\n";
    echo "<tr><td colspan="2" align="center">Registration Form</td></tr>\n";
    echo "<tr><td>Username</td><td><input type="text" name="username"></td></tr>\n";
    echo "<tr><td>Password</td><td><input type="password" name="password"></td></tr>\n";
    echo "<tr><td>Confirm</td><td><input type="password" name="passconf"></td></tr>\n";
    echo "<tr><td>E-Mail</td><td><input type="text" name="email"></td></tr>\n";
    echo "<tr><td>Name</td><td><input type="text" name="name"></td></tr>\n";
    echo "<tr><td>AIM Address</td><td><input type="text" name="aim"></td></tr>\n";
    echo "<tr><td colspan="2" align="center"><input type="submit" name="submit" value="Register"></td></tr>\n";
    echo "</form></table>\n";
}else {
    $username = protect($_POST['username']);
    $password = protect($_POST['password']);
    $confirm = protect($_POST['passconf']);
    $email = protect($_POST['email']);
    $name = protect($_POST['name']);
    $aim = protect($_POST['aim']);
   
    $errors = array();
   
        if(!$username){
            $errors[] = "Username is not defined!";
        }
       
        if(!$password){
            $errors[] = "Password is not defined!";
        }
       
        if($password){
            if(!$confirm){
                $errors[] = "Confirmation password is not defined!";
            }
        }
       
        if(!$email){
            $errors[] = "E-mail is not defined!";
        }
       
        if(!$name){
            $errors[] = "Name is not defined!";
        }
       
        if(!$aim){
            $errors[] = "AIM Screename is not defined!";
        }
       
        if($username){
            if(!ctype_alnum($username)){
                $errors[] = "Username can only contain numbers and letters!";
            }
           
            $range = range(1,32);
            if(!in_array(strlen($username),$range)){
                $errors[] = "Username must be between 1 and 32 characters!";
            }
        }
       
        if($password && $confirm){
            if($password != $confirm){
                $errors[] = "Passwords do not match!";
            }
        }
       
        if($email){
            $checkemail = "/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i";
            if(!preg_match($checkemail, $email)){
                $errors[] = "E-mail is not valid, must be name@server.tld!";
            }
        }
       
        if($name){
            $range2 = range(3,64);
            if(!in_array(strlen($name),$range2)){
                $errors[] = "Your name must be between 3 and 64 characters!";
            }
        }
       
        if($aim){
            $range3 = range(3,16);
            if(!in_array(strlen($aim),$range3)){
                $errors[] = "Your AIM screenname must be between 3 and 16 characters!";
            }
        }
       
        if($username){
            $sql = "SELECT * FROM `users` WHERE `username`='".$username."'";
            $res = mysql_query($sql) or die(mysql_error());
           
                if(mysql_num_rows($res) > 0){
                    $errors[] = "The username you supplied is already in use!";
                }
        }
       
        if($email){
            $sql2 = "SELECT * FROM `users` WHERE `email`='".$email."'";
            $res2 = mysql_query($sql2) or die(mysql_error());
           
                if(mysql_num_rows($res2) > 0){
                    $errors[] = "The e-mail address you supplied is already in use of another user!";
                }
        }
       
        if($aim){
            $sql3 = "SELECT * FROM `users` WHERE `aim`='{$aim}'";
            $res3 = mysql_query($sql3) or die(mysql_error());
           
                if(mysql_num_rows($res3) > 0){
                    $errors[] = "The AIM screenname you supplied is already in use of another user!";
                }
        }
       
        if(count($errors) > 0){
            foreach($errors AS $error){
                echo $error . "<br>\n";
            }
        }else {
            $sql4 = "INSERT INTO `users`
                    (`username`,`password`,`email`,`name`,`aim`,`admin`,`time`)
                    VALUES ('".$username."','".md5($password)."','".$email."','".$name."','".$aim."','0','".time()."')";
            $res4 = mysql_query($sql4) or die(mysql_error());
            echo "You have successfully registered with the username <b>".$username."</b> and the password of <b>".$password."</b>!";
        }
}

?>

Why should we pick you?: I have been around in the virtual pet community for quite some time so I know how pet sites work. I am always hardworking and dependable.

Aries

Posts : 1
Join date : 2011-01-26

Back to top Go down

Application Empty Re: Application

Post  Shadow Thu Jan 27, 2011 7:03 am

I'm not a programmer, but everything looks good to me! X3
You're definately accepted Smile
You can PM me about the art in exchange here, VPC, or my e-mail Smile
Shadow
Shadow
Owner

Posts : 430
Join date : 2010-12-15
Age : 30

https://rabidjelly.forumotion.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum