Advertisement
Guest User

SAMP VVP

a guest
Jun 19th, 2015
536
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.21 KB | None | 0 0
  1. /*------------------MYSQL INFO------------*/
  2.  
  3. <?php
  4.  
  5.  
  6. $db_host = 'localhost';
  7. $db_user = 'root';
  8. $db_password = '';
  9. $db_name = 'vvp';
  10.  
  11.  
  12. $db_connection = @mysqli_connect($db_host, $db_user, $db_password, $db_name)
  13. OR die('Ivyko klaida jungiantis i duomenu baze: ' .mysqli_connect_error());
  14.  
  15.  
  16.  
  17. ?>
  18.  
  19. /*------------------MYSQL INFO------------*/
  20. /*-----------------INDEX.PHP------------*/
  21. <html>
  22.    
  23.     <head>
  24.     <meta charset="utf-8">
  25.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  26.     <meta name="viewport" content="width=device-width, initial-scale=1">
  27.     <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
  28.     <title>VVP SISTEMA</title>
  29.  
  30.     <!-- Bootstrap -->
  31.     <link href="css/bootstrap.min.css" rel="stylesheet">
  32.  
  33.     <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  34.     <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  35.     <!--[if lt IE 9]>
  36.       <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  37.       <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  38.     <![endif]-->
  39.   </head>
  40.  
  41.  
  42.  
  43. <body>
  44. <br><br>
  45.     <div class="container">
  46.       <div class="header clearfix">
  47.         <h3 class="text-muted">VVP SISTEMA</h3>
  48.         <center><h4 class="text-muted">PRISIJUNGIMAS</h4></center>
  49.       </div>
  50.  
  51.       <div class="jumbotron">
  52.  
  53.  
  54.     <form action = 'login.php' method = 'POST'>
  55.        
  56.         <!--<center><input type='text' name='username'></center><br> -->
  57.         <center><input type="text" name='username' class="form-control" placeholder="Vartotojo Vardas" required="" autofocus=""><br></center>
  58.  
  59.         <center><input type="password" name='password' class="form-control" placeholder="Slaptažodis" required="" autofocus=""><br></center>
  60.         <br>
  61.  
  62.         <button class="btn btn-lg btn-info btn-block" type="submit">Prisijungti</button>
  63.  
  64.     </form>
  65.  
  66.       </div>
  67.  
  68.       <footer class="footer">
  69.         <p>© Arnas V. 2015</p>
  70.       </footer>
  71.  
  72.     </div>
  73.  
  74.  
  75.     <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
  76.  
  77.  
  78. </body>
  79. </html>
  80. /*------------------------------INDEX.PHP-----------------*/
  81. /*---------------------------LOGIN.PHP-------------------*/
  82.  
  83. <html>
  84.    
  85.     <head>
  86.     <meta charset="utf-8">
  87.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  88.     <meta name="viewport" content="width=device-width, initial-scale=1">
  89.     <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
  90.     <title>VVP SISTEMA</title>
  91.  
  92.     <!-- Bootstrap -->
  93.     <link href="css/bootstrap.min.css" rel="stylesheet">
  94.  
  95.     <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  96.     <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  97.     <!--[if lt IE 9]>
  98.       <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  99.       <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  100.     <![endif]-->
  101.   </head>
  102. </html>
  103.  
  104.  
  105. <?php
  106.  
  107.  
  108. require_once('mysqli_connection.php');
  109.  
  110. $username = $_POST['username'];
  111. $password = $_POST['password'];
  112.  
  113.  
  114. if($username && $password){
  115.     $query = "SELECT * FROM playerdata WHERE name='$username'";
  116.  
  117. // Execute the query with mysql_query()
  118.     $result = mysqli_query($db_connection,$query);
  119. // $result is a result resource that can be passed
  120. // to mysql_num_rows() unless the query failed and $result is FALSE
  121.     if ($result && mysqli_num_rows($result) != 0) {
  122.         while($row = mysqli_fetch_assoc($result)){
  123.             $dbusername = $row['name'];
  124.             $dbpassword = $row['password'];
  125.             if($password == $dbpassword){
  126.                 $dbemail = $row['email'];
  127.                 $dbskin = $row['skin'];
  128.                 $dbmoney = $row['money'];
  129.                 $dbxp = $row['xp'];
  130.                 $dbhp = $row['health'];
  131.                 $dbarmour = $row['armour'];
  132.                 $dbcar = $row['car1'];
  133.                 $dbcar2 = $row['car2'];
  134.                 $_passCount = 0;
  135.                 $_passSize = strlen($dbpassword);
  136.                
  137.  
  138.  
  139.                 ?>
  140.                 <h2><br><br></h2>
  141.                 <div class="jumbotron">
  142.                 <center><h2>Žaidejo informacija</h2></center><br>
  143.                 </html>
  144.  
  145.                 <?php
  146.  
  147.                 echo
  148.                 "
  149.                 <center><h4>Vartotojo vardas: $dbusername<br>
  150.                 Slaptažodžis: ";
  151.                
  152.                 while($_passCount != $_passSize){
  153.                     echo '•';
  154.                     $_passCount = $_passCount + 1;
  155.                 }
  156.  
  157.  
  158.                 echo
  159.                 "<br>El.paštas: $dbemail<br>
  160.                 Patirtis: $dbxp XP<br>
  161.                 Gyvybės: $dbhp <br>
  162.                 Šarvai: $dbarmour <br>
  163.                 Žaidėjo išvaizdos ID: $dbskin<br>
  164.                 Pinigai: $dbmoney $<br>";
  165.  
  166.  
  167.                 if($dbcar > 0){
  168.                     echo "Pirmos mašinos ID: $dbcar<br>";
  169.                 }
  170.                 else{
  171.                     echo "Pirma mašina: nėra<br>";
  172.                 }
  173.  
  174.  
  175.                 if($dbcar2 > 0){
  176.                     echo "Antros mašinos ID: $dbcar2<br>";
  177.                 }
  178.                 else{
  179.                     echo "Antra mašina: nėra<br>";
  180.                 }
  181.  
  182.  
  183.  
  184.  
  185.  
  186.             }
  187.             else{
  188.                 echo 'Neteisingas slaptažodžis!';
  189.             }
  190.         }
  191.     }
  192.  
  193.     else{
  194.         echo '<center><b>Tokio žaidėjo nėra!</b></center>';
  195.     }
  196. }
  197. else{
  198.     echo 'Neįvedete vardo arba slaptažodžio';
  199. }
  200.  
  201. ?>
  202.  
  203. /*--------------------------LOGIN.PHP-------------------------*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement