Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.54 KB | None | 0 0
  1. <?php
  2.     if(!($connection = mysql_connect("localhost", "bbbbb","addaasasad")))
  3.     die("false_CANT_CONNECT_TO_DATABASE");
  4.     if(!(mysql_select_db("flash")))
  5.     die("false_DATABASE_DOESNT_EXIST");
  6.    
  7.     if(!(isset($_POST['do'])))
  8.     exit("false_MISSING_VAR_'do'");
  9.     if(!(isset($_POST['password'])))
  10.     exit("false_MISSING_VAR_'password'");
  11.     if(!(isset($_POST['user'])))
  12.     exit("false_MISSING_VAR_'user'");
  13.     if(!(isset($_POST['gameID'])))
  14.     exit("false_MISSING_VAR_'gameID'");
  15.  
  16.     $action = $_POST['action'];
  17.     $password = $_POST['password'];
  18.     $user = $_POST['user'];
  19.     $parameter1 = (int)$_POST['parameter01'];
  20.     $parameter2 = (int)$_POST['parameter02'];  
  21.     $parameter3 = (int)$_POST['parameter03'];  
  22.     $game = (string)$_POST['gameID'];
  23.    
  24.     if(!($password == "42220404404847"))
  25.     exit("false_WRONG_AUTHENTIFICATON");
  26.     if(is_string($user) == false)
  27.     exit("false_UNEXPECTED_VAR_TYPE_user");
  28.     if(!(strlen($user)<24))
  29.     exit("false_VAR_(user)_TOO_LONG");
  30.     if(!(strlen($user)>4))
  31.     exit("false_VAR_(user)_TOO_SHORT");
  32.    
  33.     if ($action == 'addscore')
  34.     {
  35.             if(!(isset($_POST['parameter01'])))
  36.             exit("false_MISSING_VAR_'parameter01'");
  37.             if(is_int($parameter1) == false)
  38.             exit("false_UNEXPECTED_VAR_TYPE_highscore");
  39.  
  40.             $insert = "INSERT INTO $game (name, score) VALUES ('$user', '$highscore')";
  41.             if ($test == mysql_query($insert))
  42.             {
  43.             mysql_close($connection);
  44.             exit ("false_ADDSCORE");
  45.             }
  46.             else
  47.             {
  48.             mysql_close($connection);
  49.             exit ("true_ADDSCORE");
  50.             }
  51.     }
  52.     else
  53.     {
  54.     exit ("false_WRONG_ACTION");
  55.     }
  56.    
  57.     mysql_close($connection);
  58. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement