<?php
error_reporting(0);

/*** Crimestyle | Perfect Edition | Check RPGBUNNY.COM for more Full RPG Sources | www.rpgbunny.com ***/

/***********************************************
* © Rpgbunny.com (www.rpgbunny.com)
* This notice MUST stay intact for legal use
* You need a valid product order number to use this source
* Without this your running an illegal version
* We check our products from time to time. If asked you have to show this number
* Visit Rpgbunny.com at http://www.rpgbunny.com/ for more RPG games and layouts
***********************************************/

include("data/names.php");
  include("_include-config2.php");

  $dbres				= mysql_query("SELECT `id` FROM `users` WHERE `activated`=1");
  $leden				= mysql_num_rows($dbres);
  $dbres2                                = mysql_query("SELECT `id` FROM `users` WHERE UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(`online`) < 300");
  $online                                = mysql_num_rows($dbres2);
  $laatstelid = mysql_query("select `login` from `users` order by id desc limit 0,3");
  $laatste = @mysql_result($laatstelid,0,0);
	$hoogsterank = mysql_query("SELECT * FROM `users` WHERE `activated`>=0 ORDER BY rank DESC LIMIT 0,1");
	$meestepower = mysql_query("SELECT * FROM `users` WHERE `activated`>=0 ORDER BY attack DESC LIMIT 0,1");
	$meesterespect = mysql_query("SELECT * FROM `users` WHERE `activated`>=0 ORDER BY respect DESC LIMIT 0,1");

  if(isset($_POST['login'],$_POST['pass'])) {
    $dbres				= mysql_query("SELECT `login`,`activated` FROM `users` WHERE `login`='{$_POST['login']}' AND `pass`=MD5('{$_POST['pass']}')");
    if(($data = mysql_fetch_object($dbres)) && $data->activated == 1) {
      $validate				= md5(rand(0,1000));
      setcookie("login",$data->login,time()+60*60*24,"/","");
      setcookie("validate",$validate,time()+60*60*24,"/","");
      mysql_query("REPLACE INTO `[online]`(`time`,`login`,`IP`,`validate`) values(NOW(),'{$_SERVER['REMOTE_ADDR']}','{$data->login}','$validate')");
      $_SESSION['login']		= $data->login;
      $_SESSION['IP']			= $_SERVER['REMOTE_ADDR'];
      $dbres				= mysql_query("SELECT *,UNIX_TIMESTAMP(`signup`) AS `signup` FROM `users` WHERE `login`='{$_SESSION['login']}'");
      $_SESSION['data']			= mysql_fetch_object($dbres);
    }
  }
?>


<html>
<head>
<link rel="stylesheet" type="text/css" href="<? echo $sitelink;?>/layout/crimestyle12/css/css.css"></head>
<body style="margin: 0px;">

							<div class="title_bg">
			<div class="title">Register your account</div>
		</div>

		<div style="background-color:#dbd2b7; padding:10px; padding-top:4px;">
		<table cellpadding="0" cellspacing="0" width="100%"><tr><td>

    <div id="registerBox">
     <!-- <h3>Story</h3>-->






<?php /* ------------------------- */
  $login					= $_POST['login'];
  $pass                     = $_POST['pass'];
  $passconfirm              = $_POST['passconfirm'];
  $city						= $_POST['stad'];
  $email					= $_POST['email'];
  $recruiter					= $rec;


  if(isset($_POST['submit'])) {
    $message					= Array(
	"<center><br><b>Your login may only contain: A-Z, a-z, 0-9, _  - </b><BR><BR>",
   	"<center><br><b>Your passwords were not the same</b><BR><BR>",
	"<center><br><b>Fill in a valid Email-Address</b><BR><BR>",
	"<center><br><b>Select a Criminal Type</b><BR><BR>",
	"<center><br><b>That login already exists in the database</b><BR><BR>",
	"<center><br><b>That email already exists in the database</b><BR><BR>",
	"<center><br><b>The Recruiter name can only contain A-Z, a-z, 0-9, _  - </b><BR><BR>",
        "<center><br><b>There is already an account in use on this computer!</b><BR><BR>"); 

    $msgnum					= -1;
    if(preg_match('/^[a-zA-Z0-9_\-]+$/',$login) == 0)
      $msgnum					= 0;
      if($pass == "" || $pass != $passconfirm)
      $msgnum					= 1;
    if(preg_match('/^.+@.+\..+$/',$email) == 0)
      $msgnum					= 2;
    else {
      $dbres					= mysql_query("SELECT `id` FROM `users` WHERE `login`='{$login}'");
      if(mysql_num_rows($dbres) > 0)
        $msgnum					= 4;
      $dbres					= mysql_query("SELECT `id` FROM `users` WHERE `email`='{$email}'");
      if(mysql_num_rows($dbres) > 0)
    $msgnum					= 5;
	 $dbres					= mysql_query("SELECT `id` FROM `users` WHERE `ipz`='{$_SERVER['REMOTE_ADDR']}'");
      if(mysql_num_rows($dbres) > 0)
    $msgnum					= 8;
    if(preg_match('/^[a-zA-Z0-9_\-]+$/',$login) == 0)
        $msgnum					= 6;
     if(mysql_num_rows($dbres) > 0)
        $msgnum                                 = 7;

      if($msgnum == -1) {


        mysql_query("UPDATE `users` SET `recruits`=`recruits`+'1' WHERE `login`='{$recruiter}'");
        mysql_query("UPDATE `users` SET `contant`=`contant`+'100000' WHERE `login`='{$recruiter}'");
if($rec != "") {
        mysql_query("INSERT INTO `messages`(`time`,`from`,`to`,`subject`,`message`,`outbox`) values(NOW(),'$page->sitetitle','$recruiter','Referal','You have got a refferal at $page->sitetitle! you get ;100.000 for free from $page->sitetitle!','0')");
}
        mysql_query("INSERT INTO `users`(signup,login,pass,IP,email,land) values(NOW(),'$login',MD5('$pass'),'$IP','$email','$city')") or die (mysql_error());


        $id					= mysql_insert_id();
        mail($email,"$page->sitetitle - Account","$page->sitetitle - Account.

Dear $login

Your account details are as follows:

Login          = $login
E-mail address = $email
Password       = $pass

Keep your account information safe and DO NOT give it to amyone under any circumstances.

If you need any support, feel free to contact us via the support ticket on the site, or using the Game Forums.

DO NOT:

-Spam. Spamming is against the rules. Spamming not only annoys the admins, but annoys everybody else too.
 
-Threaten or insult anyone during your time on The Gangster Game. We know its a gangster game and people can get carried away, but do refrain from using abusive behaviour.

-Use proxies. This will result in a permenant ban from your IP.

-Create and Use multiple accounts. All the accounts will be banned. If you have a brother, sister etc take this up with the Admins.

-Do not advertise your own stuff on our site. We appreciate you wouldnt like it if we did it on your site, so dont do it on our site.

If you find a bug in the game. Report it to an Admin IMMEDIATELY. Although finding of a bug is not a bannable offence.
But abusing the bug is, and you will be caught and banned!

Abusing or not Obeying any of these rules will result in a permenant and emmediate ban. No second chances. You have been Warned!

Kind Regards,

Get Respect... Get Loyalty... Get Wealthy... 

The $page->sitetitle Team.","From: $page->sitetitle <$sitelink");
      }

    }
  }

/* ------------------------- */ ?>



<?php /* ------------------------- */

  if(isset($_GET['id'],$_GET['code'])) {
    print "  <tr><td class=\"subTitle\"><b>Activation</b></td></tr>\n";

    $id						= $_GET['id'];
    $code					= $_GET['code'];
    $dbres					= mysql_query("SELECT `login` FROM `[temp]` WHERE `area`='signup' AND `id`='$id' AND `code`='$code'");
    if($data = mysql_fetch_object($dbres)) {
	$acti = 1;
	mysql_query("UPDATE `users` SET `activated`=1,`signup`=NOW() WHERE `login`='{$login}'");
      mysql_query("DELETE FROM `[temp]` WHERE `id`='{$id}'");
      print "  <tr><td class=\"mainTxt\">Activated Account, You can now loggin</td></tr>\n";
    }
    else
      print "  <tr><td class=\"mainTxt\">Incorrect activation-code...</td></tr>\n";
  }
  else {
    if($msgnum != -1) {
      if(isset($msgnum) && $msgnum != -1)
        print "{$message[$msgnum]}\n";
        $rec = $_GET['rec'];
    print "  <TR><Td><br>&nbsp;</td></tr><tr><td class=\"subTitle\">
		

</td></tr>\n";
      print <<<ENDHTML


	<table width="100%" class="mod_list" cellspacing="2" cellpadding= "2">
		<tr class="top">
			<td align="center">
 	<div id="loginBox"> 

<div id="regBox">
  <tr><td class="mainTxt">
	<form method="post" id="regForm" name="regForm" ><table align="center" class="2">
 	  <tr><td width=100><font size="2"><b>Login:</b><font color=red>*</td>		<td><input type="text" name="login" maxlength=16 style="width: 150;" value="$login"></td></tr>
          <tr><td width=100><font size="2"><b>Password:</b><font color=red>*</font></td>        <td><input type="password" name="pass" maxlength=16 style="width: 150;" ;"></td></tr>
          <tr><td width=100><font size="2"><b>Repeat Password:</b><font color=red>*</font></td>        <td><input type="password" name="passconfirm" maxlength=16 style="width: 150;" ;"></td></tr>
	  <tr><td width=100><font size="2"><b>E-Mail:</b><font color=red>*</td>	<td><input type="text" name="email" maxlength=64 style="width: 150;" value="$email"></td></tr>

	  <tr><td></td><td align="center"> <input class="2" type="submit" name="submit" style="width: 100;" value="Sign Up"></td></tr>
	</table></form><br>
ENDHTML;
    }
    else
      print "<tr><td class=\"subTitle\">You'r Signed Up</td></tr>
<tr><td class=\"mainTxt\">Well Done.<br><br>
Congratulations and Welcome to <b>$page->sitetitle</b>. You can now login and start a world of drugdealing, murder, corruption, gambling and many other crimes that comes along with being a Mob Boss... or on the other hand, a simple drug runner! You decide!</td></tr>\n";
  }

/* ------------------------- */ ?>





		<ul class="inlineLinks">

					</ul>
	</div>
    </div>

	</table>

	<br />
		</td></tr></table>
		</div>

		<table width='100%' cellspacing='2' cellpadding='2'>
			<tr>

				<td class='content_bottom'></td>
			</tr>
		</table>
				</div>
	</td>
	</tr>

	</table>
	</td>
