[Tool/Web/Other] UCP 0.1
#1

Hey guys
Last night I started making an UCP System for my server, so I wanted to discuss with you the possible security issues with the code. It is consisted from 3 files, index.php, connect.php and login.php.
Please don't mind the current layout because it is only a work in progress, I am just interested in the possible security issues.

index.php
Код:
<html>
<head><title>Balkan Underground UCP</title></head>
<body>
<form action="login.php" method="post">
<table align="center">
<tr>
<td align="center">
<b><font size="4" color="#000080">Balkan Underground UCP</font></b>
</td>
</tr>
<tr align="center">
<td>
<p><input type="text" name="User" size="20" /></p>
<p><input type="password" name="Password" size="20" /></p>
</td>
</tr>
<tr>
<td align="center">
<p><input type="submit" />
<input type="reset" /> </p>
</td>
</tr>
</table>
</form>
</body>
</html>
connect.php
Код:
<?php
$con = mysql_connect("localhost","testuser","*********");
mysql_select_db("testuser");
?>
login.php
Код:
<?php
include("connect.php");
session_start();
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
  if(isset($_SESSION["Username"]))
  {
    $user = $_SESSION["Username"];
    $pass = $_SESSION["Password"];
  }
  else
  {
    $user = $_POST["User"]; 
    $pass = $_POST["Password"];
    $_SESSION['Username'] = $user;
    $_SESSION['Password'] = $pass;
    $escuser = mysql_real_escape_string($user);
    $escpass = mysql_real_escape_string($pass);
  }
  $query = "SELECT * FROM users WHERE pUsername = '$escuser'";
  $result = mysql_query($query);
  $username_exist = mysql_num_rows($result);
  if($username_exist == 0)
  {
    echo 'That profile does not exist! <br />';
    echo '<a href="index.php">Idi nazad</a>';
    unset($_SESSION['Username']);
    unset($_SESSION['Password']);
    die;
  }  
  $row = mysql_fetch_row($result);
  if($row[2] !== $escpass)
  {
    echo 'Password is not valid!  <br />';
    echo '<a href="index.php">Idi nazad</a>';
    unset($_SESSION['Username']);
    unset($_SESSION['Password']);
    die;
  }

$message = "Welcome $escuser!<br />";
echo $message;
echo "<br />";
echo "
<table border = 1>
  <tr>
    <td>Level</td>
    <td>$row[7]</td>
  </tr>
  <tr>
    <td>Expirience</td>
    <td>$row[8]</td>
  </tr>
  <tr>
    <td>Hours Played</td>
    <td>$row[9]</td>
  </tr>

  <tr>
    <td>Money</td>
    <td>$$row[10]</td>
  </tr>
  <tr>
    <td>Bank</td>
    <td>$$row[11]</td>
  </tr>
</table>";
?>
Live test: URL
User: demo
Pass: demo
Reply


Messages In This Thread
UCP 0.1 - by Gigi-The-Beast - 23.04.2011, 09:52
Re: UCP 0.1 - by [ADC]Aldi96 - 23.04.2011, 09:52
Re: UCP 0.1 - by Sensitive - 23.04.2011, 09:53
Re: UCP 0.1 - by Oliverraisk - 23.04.2011, 09:58
Re: UCP 0.1 - by Gigi-The-Beast - 23.04.2011, 10:10
Re: UCP 0.1 - by XFlawless - 23.04.2011, 10:15
Re: UCP 0.1 - by Gigi-The-Beast - 23.04.2011, 10:22
Re: UCP 0.1 - by TheArcher - 23.04.2011, 10:24
Re: UCP 0.1 - by Gigi-The-Beast - 23.04.2011, 10:28
Re: UCP 0.1 - by XFlawless - 23.04.2011, 10:29
Re: UCP 0.1 - by Gigi-The-Beast - 23.04.2011, 10:43
Re: UCP 0.1 - by TheArcher - 23.04.2011, 12:03
Re: UCP 0.1 - by Gigi-The-Beast - 23.04.2011, 12:05
Re: UCP 0.1 - by royal_king - 23.04.2011, 16:19
Re: UCP 0.1 - by XFlawless - 23.04.2011, 16:20
Re: UCP 0.1 - by LoLaMan - 24.04.2011, 20:18
Re: UCP 0.1 - by TheArcher - 24.04.2011, 20:20
Re: UCP 0.1 - by CODMW5 Owner - 24.04.2011, 21:04
Re: UCP 0.1 - by NicoBellic - 24.04.2011, 22:03
Re: UCP 0.1 - by Gigi-The-Beast - 25.04.2011, 16:32
Re: UCP 0.1 - by XFlawless - 25.04.2011, 16:38
Re: UCP 0.1 - by Gigi-The-Beast - 25.04.2011, 16:58

Forum Jump:


Users browsing this thread: 10 Guest(s)