Jump to content
MakeWebGames

Recommended Posts

Posted

Does anyone here know how to set promotional codes for your register.php.

On my registration page it has all the fields including promo code.

reg.bmp

Does anyone here know wot to put to add a promo code.

this is my register.php

 

<?php
/**
* Layout modified from a free web template by: Shaved92bravada
* Rest of code is just standard V2 MCcodes
* If you like my layout and design feel free to ask how to get your own.
*/
session_start();
include "config.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db=new database;
$db->configure($_CONFIG['hostname'],
$_CONFIG['username'],
$_CONFIG['password'],
$_CONFIG['database'],
$_CONFIG['persistent']);
$db->connect();
$c=$db->connection_id;
$set=array();
$settq=$db->query("SELECT * FROM settings");
while($r=$db->fetch_row($settq))
{
$set[$r['conf_name']]=$r['conf_value'];
}
$q=$db->query("SELECT userid FROM users");
$membs=$db->num_rows($q);
$q=$db->query("SELECT * FROM users WHERE laston>unix_timestamp()-15*60 ORDER BY laston DESC");
$online=mysql_num_rows($q);
$q=$db->query("SELECT userid FROM users WHERE gender='Male'");
$male=$db->num_rows($q);
$q=$db->query("SELECT userid FROM users WHERE gender='Female'");
$fem=$db->num_rows($q);
$q=mysql_query("SELECT * FROM users WHERE laston<unix_timestamp()-86400*10 ORDER BY laston DESC",$c);
$act=mysql_num_rows($q);
$perctact = $membs - $act;
$pact = round( ($perctact/$membs)*100, 0 );
function money_formatter($muny,$symb='$')
{
return $symb.number_format($muny);
}
$q=$db->query("SELECT userid FROM users WHERE bankmoney>-1");
$banks=$db->num_rows($q);
$total=0;
$q=$db->query("SELECT money FROM users");
while($r=$db->fetch_row($q))
{
$total+=$r['money'];
}
$avg=(int) ($total/$membs);
$totalb=0;
$q=$db->query("SELECT bankmoney FROM users WHERE bankmoney>-1");
while($r=$db->fetch_row($q))
{
$totalb+=$r['bankmoney'];
}
$avgb=(int) ($totalb/$banks);
$totalc=0;
$q=$db->query("SELECT crystals FROM users");
while($r=$db->fetch_row($q))
{
$totalc+=$r['crystals'];
}
$totali=0;
$q=$db->query("SELECT inv_qty FROM inventory");
while($r=$db->fetch_row($q))
{
$totali+=$r['inv_qty'];
}
$avgc=(int) ($totalc/$membs);
//thx to [url]http://www.phpit.net/code/valid-email/[/url] for valid_email
function valid_email($email) {
 // First, we check that there's one @ symbol, and that the lengths are right
 if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
   // Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
   return false;
 }
 // Split it into sections to make life easier
 $email_array = explode("@", $email);
 $local_array = explode(".", $email_array[0]);
 for ($i = 0; $i < sizeof($local_array); $i++) {
    if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
     return false;
   }
 }  
 if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
   $domain_array = explode(".", $email_array[1]);
   if (sizeof($domain_array) < 2) {
       return false; // Not enough parts to domain
   }
   for ($i = 0; $i < sizeof($domain_array); $i++) {
     if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
       return false;
     }
   }
 }
 return true;
}
session_start();
print <<<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>{$set['game_name']}- Registration</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
var xmlHttp // xmlHttp variable

function GetXmlHttpObject(){ // This function we will use to call our xmlhttpobject.
var objXMLHttp=null // Sets objXMLHttp to null as default.
if (window.XMLHttpRequest){ // If we are using Netscape or any other browser than IE lets use xmlhttp.
objXMLHttp=new XMLHttpRequest() // Creates a xmlhttp request.
}else if (window.ActiveXObject){ // ElseIf we are using IE lets use Active X.
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") // Creates a new Active X Object.
} // End ElseIf.
return objXMLHttp // Returns the xhttp object.
} // Close Function

function CheckPasswords(password){ // This is our fucntion that will check to see how strong the users password is.
xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object.
if (xmlHttp==null){ // If it cannot create a new Xmlhttp object.
alert ("Browser does not support HTTP Request") // Alert Them!
return // Returns.
} // End If.

var url="check.php?password="+escape(password) // Url that we will use to check the password.
xmlHttp.open("GET",url,true) // Opens the URL using GET
xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done.
if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text.
document.getElementById("passwordresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php
} // End If.
}; // Close Function
xmlHttp.send(null); // Sends NULL insted of sending data.
} // Close Function.

function CheckUsername(password){ // This is our fucntion that will check to see how strong the users password is.
xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object.
if (xmlHttp==null){ // If it cannot create a new Xmlhttp object.
alert ("Browser does not support HTTP Request") // Alert Them!
return // Returns.
} // End If.

var url="checkun.php?password="+escape(password) // Url that we will use to check the password.
xmlHttp.open("GET",url,true) // Opens the URL using GET
xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done.
if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text.
document.getElementById("usernameresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php
} // End If.
}; // Close Function
xmlHttp.send(null); // Sends NULL insted of sending data.
} // Close Function.

function CheckEmail(password){ // This is our fucntion that will check to see how strong the users password is.
xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object.
if (xmlHttp==null){ // If it cannot create a new Xmlhttp object.
alert ("Browser does not support HTTP Request") // Alert Them!
return // Returns.
} // End If.

var url="checkem.php?password="+escape(password) // Url that we will use to check the password.
xmlHttp.open("GET",url,true) // Opens the URL using GET
xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done.
if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text.
document.getElementById("emailresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php
} // End If.
}; // Close Function
xmlHttp.send(null); // Sends NULL insted of sending data.
} // Close Function.

function PasswordMatch()
{
pwt1=document.getElementById('pw1').value;
pwt2=document.getElementById('pw2').value;
if(pwt1 == pwt2)
{
document.getElementById('cpasswordresult').innerHTML="OK";
}
else
{
document.getElementById('cpasswordresult').innerHTML="Not Matching";
}
}
</script>
</head>

<body>
EOF;
$IP = ($_SERVER['HTTP_X_FORWARDED_FOR'])
   ?  $_SERVER['HTTP_X_FORWARDED_FOR']
   :  $_SERVER['REMOTE_ADDR'];
if(file_exists('ipbans/'.$IP))
{
die("[b]<font color=red size=+1>Your IP has been banned, there is no way around this.</font>[/b]</body></html>");
}
if($_POST['username'])
{
if($set['regcap_on'])
{
 if(!$_SESSION['captcha'] or $_SESSION['captcha'] != $_POST['captcha'])
 {
   unset($_SESSION['captcha']);
   die("Captcha Test Failed

>[url='register.php']Back[/url]");
 }
 unset($_SESSION['captcha']);
}
if(!valid_email($_POST['email']))
{
die("Sorry, the email is invalid.

>[url='register.php']Back[/url]");
}
if(strlen($_POST['username']) < 4)
{
die("Sorry, the username is too short.

>[url='register.php']Back[/url]");
}
$sm=100;
if($_POST['promo'] == "Your Promo Code Here")
{
$sm+=100;
}
$username=$_POST['username'];
$username=str_replace(array("<", ">"), array("<", ">"), $username);
$q=$db->query("SELECT * FROM users WHERE username='{$username}' OR login_name='{$username}'");
$q2=$db->query("SELECT * FROM users WHERE email='{$_POST['email']}'");
if($db->num_rows($q))
{
print "Username already in use. Choose another.

>[url='register.php']Back[/url]";
}
else if($db->num_rows($q2))
{
print "E-Mail already in use. Choose another.

>[url='register.php']Back[/url]";
}
else if($_POST['password'] != $_POST['cpassword'])
{
print "The passwords did not match, go back and try again.

>[url='register.php']Back[/url]";
}
else
{
$_POST['ref'] = abs((int) $_POST['ref']);
$IP = ($_SERVER['HTTP_X_FORWARDED_FOR'])
   ?  $_SERVER['HTTP_X_FORWARDED_FOR']
   :  $_SERVER['REMOTE_ADDR'];
$q=$db->query("SELECT * FROM users WHERE lastip='$IP' AND userid={$_POST['ref']}");
if($db->num_rows($q))
{
die("No creating referral multies. Bad dog.

>[url='register.php']Back[/url]");
}
if($_POST['ref']) {
$q=$db->query("SELECT * FROM users WHERE userid={$_POST['ref']}");
$r=$db->fetch_row($q);
}
$db->query("INSERT INTO users (username, login_name, userpass, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip, lastip_signup) VALUES( '{$username}', '{$username}', md5('{$_POST['password']}'), 1, $sm, 0, 0, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, '{$_POST['gender']}', unix_timestamp(), '{$_POST['email']}', -1, '$IP', '$IP')");
$i=$db->insert_id();
$db->query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10)");

if($_POST['ref']) {
require "global_func.php";
$db->query("UPDATE users SET crystals=crystals+2 WHERE userid={$_POST['ref']}");
event_add($_POST['ref'],"For refering $username to the game, you have earnt 2 valuable crystals!",$c);
$db->query("INSERT INTO referals VALUES('', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$IP')");
}
print "You have signed up, enjoy the game.

> [url='login.php']Login[/url]";
}
}
else
{
if($set['regcap_on'])
{  $chars="123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!?\\/%^";
 $len=strlen($chars);
 $_SESSION['captcha']="";
 for($i=0;$i<6;$i++)
 $_SESSION['captcha'].=$chars[rand(0, $len - 1)];
}
$year=date('Y');
echo '
<div id="topPan">
[url="index.html"][img=banner.png][/url]

   <div id="topimagePan"> </div>
<ul>
	<li class="home">[url="login.php"]Login[/url]
	[*][url="register.php"]Register[/url]
	[/list]
</div>


<div id="bodyPan">
 <div id="leftPan">
 	<h2>'.$set['game_name'].'<span>Registration</span></h2>


<form action="register.php" method="post">
<table width="75%" border="2" class="table" cellspacing="1">
<tr>
<td width="30%">Username</td>
<td width="40%"><input type="text" name="username" onkeyup="CheckUsername(this.value);" /></td>
<td width="30%"><div id="usernameresult"></div></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" id="pw1" name="password" onkeyup="CheckPasswords(this.value);PasswordMatch();" /></td>
<td><div id="passwordresult"></div></td>
</tr>
<tr>
<td>Confirm Password</td><td><input type="password" name="cpassword" id="pw2" onkeyup="PasswordMatch();" /></td>
<td><div id="cpasswordresult"></div></td>
</tr>
<tr>
<td>Email</td><td><input type="text" name="email" onkeyup="CheckEmail(this.value);" /></td>
<td><div id="emailresult"></div></td>
</tr>
<tr>
<td>Gender</td>
<td colspan="2">
<select name="gender">
<option value="Male">Male</option>
<option value="Female">Female</option>
</select></td>
</tr>
<tr>
<td>Promo Code</td><td colspan="2"><input type="text" name="promo" /></td>
</tr>';
print"
<tr><td colspan='3'><input type='hidden' name='ref' value='";
if($_GET['REF']) { print $_GET['REF']; }
print "' />";
if($set['regcap_on'])
{
print "<center>
[img=captcha_verify.php?bgcolor=C3C3C3]

<input type='text' name='captcha' /></center></td>
</tr>";
}
print "
<tr>
<td colspan='3' align='center'><input type='submit' value='Submit' /></td>
</tr>
</table></form>


> [url='login.php']Go Back[/url]";
}


/**
 * The following part below will only work if you are using the ingame v2 forums..... if you are using another type of forums
 * then I suggest changing the part below to something else. You cannot just delete this block as it will throw off the whole
 * template. So it must be used for something.
 */

   echo '
<div id="leftblockonePan">
	<h3>economic <span>stats</span></h3>
<ul>

				[*]Total Cash: $'.money_formatter($total,"").'
				[*]Average Cash: $'.money_formatter($avg,"").'
				[*]Cash in banks: $'.money_formatter($totalb,"").'
				[*]Bank accounts: '.$banks.'
				[*]Average bank balance: $'.money_formatter($avgb,"").'
				[*]Total Crystals: '.money_formatter($totalc,"").'
				[*]Average Crystals: '.money_formatter($avgc,"").'
				[*]Total Items: '.money_formatter($totali,"").'

[/list]


    <div id="leftblockoneLinkPan">

	</div>
	<p class="border">[img=images/blank.gif]</p>
	<h3>random <span>item</span></h3>';
			$q=$db->query("SELECT i.*,it.* FROM items i LEFT JOIN itemtypes it ON i.itmtype=itmtypeid ORDER BY rand() DESC limit 1");
			$r=$db->fetch_row($q);
			{
			$cn++;
			echo '<h4><span>2.</span> '.$r['itmname'].'</h4>


Item Type: <span>'.$r['itmtypename'].'</span>
Item Description: '.$r['itmdesc'].'</p>';
			}
			echo'

	<div id="leftblockoneLinktwoPan">

	</div>
   </div>

   <div id="leftblocktwoPan">

	[/list]


</div>
 </div>
 <div id="rightPan">
 	<form action="authenticate.php" method="post" name="login" class="form1">
	<h2>member login</h2>
	<label>Name:</label>
	<input name="username" type="text" />
	<label>Passward:</label>
	<input name="password" type="password" />
	<label class="label1">[url="register.php"]not registered ?[/url]</label>
	<input name="GO" type="submit" class="botton" id="GO" value="GO" />
</form>
<h3>players <span>online</span></h3>
<ul>';
			$cn=0;
			$q=$db->query("SELECT * FROM users WHERE laston>unix_timestamp()-15*60 ORDER BY laston DESC limit 5");
			if (!$db->num_rows($q))
			{
				echo '[*][url="#"]No One[/url]';
			 }
			while($r=$db->fetch_row($q))
			{
			$la=time()-$r['laston'];
			$unit="secs";
			if($la >= 60)
			{
			$la=(int) ($la/60);
			$unit="mins";
			}
			if($la >= 60)
			{
			$la=(int) ($la/60);
			$unit="hours";
			if($la >= 24)
			{
			$la=(int) ($la/24);
			$unit="days";
			}
			}
			$cn++;
			echo '[*][url="#"]'.$cn.'. '.$r['username'].'[/url]';
			}
			echo'

[/list]

<h3>game <span>stats</span></h3>
<ul>

				[*][url="#"]Registered Users: '.$membs.'[/url]
				[*][url="#"]Total Online: '.$online.'[/url]
				[*][url="#"]Total Males: '.$male.'[/url]
				[*][url="#"]Total Females: '.$fem.'[/url]
				[*][url="#"]Percent Active: '.$pact.'%[/url]

[/list]


 </div>
</div>';
/** This section below will show advertisments on the page if you have the advertising modification installed.
If you do not have the mod installed then leave this commented out as to not cause any problems with the
page or just delete from the beginning of this comment down to the end of the last comment.*/

/**
* <div id="bodyBottomPan">
*   <div id="BottomLeftPan">
*   	

paid 
<span>advertising</span></p>
*   	

contact <span>Shaved92bravada</span></p>
*   </div>
*   
*   <div id="BottomMiddlePan">';
*   			
* 			$q=$db->query("SELECT * FROM ads ORDER BY rand() LIMIT 1",$c);
* 			if($db->num_rows($q))
*			{
* 			$ar=mysql_fetch_array($q);
* 			}
* 			echo '
* 			
*   	

[url="adlog.php?ad='.$ar['adID'].'"][img='.$ar['adIMG'].'][/url]</p>
* 	
*   		</div>
* 	</div>
* 	End your delete here.........*/
echo '
<div id="footerPan">

	<ul class="templateworld">
 			[*]design by:
		[*][url="http://www.templateworld.com"]Template World[/url][*]• modified by •[*][email="[email protected]"]Shaved Designs[/email]
	   [/list]

	<p class="copyright">

	[url="http://validator.w3.org/check?uri=referer"][img=http://www.w3.org/Icons/valid-xhtml10-blue][/url]
	   •   

	?YOUR GAMENAME '.$year.' all right reserved.

	   •   	
 	<a href="http://jigsaw.w3.org/css-validator/">
   	[img=http://jigsaw.w3.org/css-validator/images/vcss-blue]
	</a>
	</p>


</div>
</body>
</html>';
?>

Posted

Re: Promo Codes

 

Does anyone here know how to set promotional codes for your register.php.

On my registration page it has all the fields including promo code.

reg.bmp

Does anyone here know wot to put to add a promo code.

this is my register.php

 

<?php
/**
* Layout modified from a free web template by: Shaved92bravada
* Rest of code is just standard V2 MCcodes
* If you like my layout and design feel free to ask how to get your own.
*/
session_start();
include "config.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db=new database;
$db->configure($_CONFIG['hostname'],
$_CONFIG['username'],
$_CONFIG['password'],
$_CONFIG['database'],
$_CONFIG['persistent']);
$db->connect();
$c=$db->connection_id;
$set=array();
$settq=$db->query("SELECT * FROM settings");
while($r=$db->fetch_row($settq))
{
$set[$r['conf_name']]=$r['conf_value'];
}
$q=$db->query("SELECT userid FROM users");
$membs=$db->num_rows($q);
$q=$db->query("SELECT * FROM users WHERE laston>unix_timestamp()-15*60 ORDER BY laston DESC");
$online=mysql_num_rows($q);
$q=$db->query("SELECT userid FROM users WHERE gender='Male'");
$male=$db->num_rows($q);
$q=$db->query("SELECT userid FROM users WHERE gender='Female'");
$fem=$db->num_rows($q);
$q=mysql_query("SELECT * FROM users WHERE laston<unix_timestamp()-86400*10 ORDER BY laston DESC",$c);
$act=mysql_num_rows($q);
$perctact = $membs - $act;
$pact = round( ($perctact/$membs)*100, 0 );
function money_formatter($muny,$symb='$')
{
return $symb.number_format($muny);
}
$q=$db->query("SELECT userid FROM users WHERE bankmoney>-1");
$banks=$db->num_rows($q);
$total=0;
$q=$db->query("SELECT money FROM users");
while($r=$db->fetch_row($q))
{
$total+=$r['money'];
}
$avg=(int) ($total/$membs);
$totalb=0;
$q=$db->query("SELECT bankmoney FROM users WHERE bankmoney>-1");
while($r=$db->fetch_row($q))
{
$totalb+=$r['bankmoney'];
}
$avgb=(int) ($totalb/$banks);
$totalc=0;
$q=$db->query("SELECT crystals FROM users");
while($r=$db->fetch_row($q))
{
$totalc+=$r['crystals'];
}
$totali=0;
$q=$db->query("SELECT inv_qty FROM inventory");
while($r=$db->fetch_row($q))
{
$totali+=$r['inv_qty'];
}
$avgc=(int) ($totalc/$membs);
//thx to [url]http://www.phpit.net/code/valid-email/[/url] for valid_email
function valid_email($email) {
  // First, we check that there's one @ symbol, and that the lengths are right
  if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
    // Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
    return false;
  }
  // Split it into sections to make life easier
  $email_array = explode("@", $email);
  $local_array = explode(".", $email_array[0]);
  for ($i = 0; $i < sizeof($local_array); $i++) {
     if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|("[^(\\|")]{0,62}"))$", $local_array[$i])) {
      return false;
    }
  }  
  if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
    $domain_array = explode(".", $email_array[1]);
    if (sizeof($domain_array) < 2) {
        return false; // Not enough parts to domain
    }
    for ($i = 0; $i < sizeof($domain_array); $i++) {
      if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
        return false;
      }
    }
  }
  return true;
}
session_start();
print <<<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>{$set['game_name']}- Registration</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
var xmlHttp // xmlHttp variable

function GetXmlHttpObject(){ // This function we will use to call our xmlhttpobject.
var objXMLHttp=null // Sets objXMLHttp to null as default.
if (window.XMLHttpRequest){ // If we are using Netscape or any other browser than IE lets use xmlhttp.
objXMLHttp=new XMLHttpRequest() // Creates a xmlhttp request.
}else if (window.ActiveXObject){ // ElseIf we are using IE lets use Active X.
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") // Creates a new Active X Object.
} // End ElseIf.
return objXMLHttp // Returns the xhttp object.
} // Close Function

function CheckPasswords(password){ // This is our fucntion that will check to see how strong the users password is.
xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object.
if (xmlHttp==null){ // If it cannot create a new Xmlhttp object.
alert ("Browser does not support HTTP Request") // Alert Them!
return // Returns.
} // End If.

var url="check.php?password="+escape(password) // Url that we will use to check the password.
xmlHttp.open("GET",url,true) // Opens the URL using GET
xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done.
if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text.
document.getElementById("passwordresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php
} // End If.
}; // Close Function
xmlHttp.send(null); // Sends NULL insted of sending data.
} // Close Function.

function CheckUsername(password){ // This is our fucntion that will check to see how strong the users password is.
xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object.
if (xmlHttp==null){ // If it cannot create a new Xmlhttp object.
alert ("Browser does not support HTTP Request") // Alert Them!
return // Returns.
} // End If.

var url="checkun.php?password="+escape(password) // Url that we will use to check the password.
xmlHttp.open("GET",url,true) // Opens the URL using GET
xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done.
if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text.
document.getElementById("usernameresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php
} // End If.
}; // Close Function
xmlHttp.send(null); // Sends NULL insted of sending data.
} // Close Function.

function CheckEmail(password){ // This is our fucntion that will check to see how strong the users password is.
xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object.
if (xmlHttp==null){ // If it cannot create a new Xmlhttp object.
alert ("Browser does not support HTTP Request") // Alert Them!
return // Returns.
} // End If.

var url="checkem.php?password="+escape(password) // Url that we will use to check the password.
xmlHttp.open("GET",url,true) // Opens the URL using GET
xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done.
if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text.
document.getElementById("emailresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php
} // End If.
}; // Close Function
xmlHttp.send(null); // Sends NULL insted of sending data.
} // Close Function.

function PasswordMatch()
{
pwt1=document.getElementById('pw1').value;
pwt2=document.getElementById('pw2').value;
if(pwt1 == pwt2)
{
document.getElementById('cpasswordresult').innerHTML="OK";
}
else
{
document.getElementById('cpasswordresult').innerHTML="Not Matching";
}
}
</script>
</head>

<body>
EOF;
$IP = ($_SERVER['HTTP_X_FORWARDED_FOR'])
    ?  $_SERVER['HTTP_X_FORWARDED_FOR']
    :  $_SERVER['REMOTE_ADDR'];
if(file_exists('ipbans/'.$IP))
{
die("[b]<font color=red size=+1>Your IP has been banned, there is no way around this.</font>[/b]</body></html>");
}
if($_POST['username'])
{
if($set['regcap_on'])
{
  if(!$_SESSION['captcha'] or $_SESSION['captcha'] != $_POST['captcha'])
  {
    unset($_SESSION['captcha']);
    die("Captcha Test Failed

>[url='register.php']Back[/url]");
  }
  unset($_SESSION['captcha']);
}
if(!valid_email($_POST['email']))
{
die("Sorry, the email is invalid.

>[url='register.php']Back[/url]");
}
if(strlen($_POST['username']) < 4)
{
die("Sorry, the username is too short.

>[url='register.php']Back[/url]");
}
$sm=100;
if($_POST['promo'] == "Your Promo Code Here")
{
$sm+=100;
}
$username=$_POST['username'];
$username=str_replace(array("<", ">"), array("<", ">"), $username);
$q=$db->query("SELECT * FROM users WHERE username='{$username}' OR login_name='{$username}'");
$q2=$db->query("SELECT * FROM users WHERE email='{$_POST['email']}'");
if($db->num_rows($q))
{
print "Username already in use. Choose another.

>[url='register.php']Back[/url]";
}
else if($db->num_rows($q2))
{
print "E-Mail already in use. Choose another.

>[url='register.php']Back[/url]";
}
else if($_POST['password'] != $_POST['cpassword'])
{
print "The passwords did not match, go back and try again.

>[url='register.php']Back[/url]";
}
else
{
$_POST['ref'] = abs((int) $_POST['ref']);
$IP = ($_SERVER['HTTP_X_FORWARDED_FOR'])
    ?  $_SERVER['HTTP_X_FORWARDED_FOR']
    :  $_SERVER['REMOTE_ADDR'];
$q=$db->query("SELECT * FROM users WHERE lastip='$IP' AND userid={$_POST['ref']}");
if($db->num_rows($q))
{
die("No creating referral multies. Bad dog.

>[url='register.php']Back[/url]");
}
if($_POST['ref']) {
$q=$db->query("SELECT * FROM users WHERE userid={$_POST['ref']}");
$r=$db->fetch_row($q);
}
$db->query("INSERT INTO users (username, login_name, userpass, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip, lastip_signup) VALUES( '{$username}', '{$username}', md5('{$_POST['password']}'), 1, $sm, 0, 0, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, '{$_POST['gender']}', unix_timestamp(), '{$_POST['email']}', -1, '$IP', '$IP')");
$i=$db->insert_id();
$db->query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10)");

if($_POST['ref']) {
require "global_func.php";
$db->query("UPDATE users SET crystals=crystals+2 WHERE userid={$_POST['ref']}");
event_add($_POST['ref'],"For refering $username to the game, you have earnt 2 valuable crystals!",$c);
$db->query("INSERT INTO referals VALUES('', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$IP')");
}
print "You have signed up, enjoy the game.

> [url='login.php']Login[/url]";
}
}
else
{
if($set['regcap_on'])
{  $chars="123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!?\\/%^";
  $len=strlen($chars);
  $_SESSION['captcha']="";
  for($i=0;$i<6;$i++)
  $_SESSION['captcha'].=$chars[rand(0, $len - 1)];
}
$year=date('Y');
echo '
<div id="topPan">
[url="index.html"][img=banner.png][/url]

    <div id="topimagePan"> </div>
<ul>
	<li class="home">[url="login.php"]Login[/url]
	[*][url="register.php"]Register[/url]
	[/list]
</div>


<div id="bodyPan">
  <div id="leftPan">
  	<h2>'.$set['game_name'].'<span>Registration</span></h2>
  	

<form action="register.php" method="post">
<table width="75%" border="2" class="table" cellspacing="1">
<tr>
<td width="30%">Username</td>
<td width="40%"><input type="text" name="username" onkeyup="CheckUsername(this.value);" /></td>
<td width="30%"><div id="usernameresult"></div></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" id="pw1" name="password" onkeyup="CheckPasswords(this.value);PasswordMatch();" /></td>
<td><div id="passwordresult"></div></td>
</tr>
<tr>
<td>Confirm Password</td><td><input type="password" name="cpassword" id="pw2" onkeyup="PasswordMatch();" /></td>
<td><div id="cpasswordresult"></div></td>
</tr>
<tr>
<td>Email</td><td><input type="text" name="email" onkeyup="CheckEmail(this.value);" /></td>
<td><div id="emailresult"></div></td>
</tr>
<tr>
<td>Gender</td>
<td colspan="2">
<select name="gender">
<option value="Male">Male</option>
<option value="Female">Female</option>
</select></td>
</tr>
<tr>
<td>Promo Code</td><td colspan="2"><input type="text" name="promo" /></td>
</tr>';
print"
<tr><td colspan='3'><input type='hidden' name='ref' value='";
if($_GET['REF']) { print $_GET['REF']; }
print "' />";
if($set['regcap_on'])
{
print "<center>
[img=captcha_verify.php?bgcolor=C3C3C3]

<input type='text' name='captcha' /></center></td>
</tr>";
}
print "
<tr>
<td colspan='3' align='center'><input type='submit' value='Submit' /></td>
</tr>
</table></form>


> [url='login.php']Go Back[/url]";
}


/**
 * The following part below will only work if you are using the ingame v2 forums..... if you are using another type of forums
 * then I suggest changing the part below to something else. You cannot just delete this block as it will throw off the whole
 * template. So it must be used for something.
 */

    echo '
<div id="leftblockonePan">
	<h3>economic <span>stats</span></h3>
<ul>

				[*]Total Cash: $'.money_formatter($total,"").'
				[*]Average Cash: $'.money_formatter($avg,"").'
				[*]Cash in banks: $'.money_formatter($totalb,"").'
				[*]Bank accounts: '.$banks.'
				[*]Average bank balance: $'.money_formatter($avgb,"").'
				[*]Total Crystals: '.money_formatter($totalc,"").'
				[*]Average Crystals: '.money_formatter($avgc,"").'
				[*]Total Items: '.money_formatter($totali,"").'

[/list]


    <div id="leftblockoneLinkPan">

	</div>
	<p class="border">[img=images/blank.gif]</p>
	<h3>random <span>item</span></h3>';
			$q=$db->query("SELECT i.*,it.* FROM items i LEFT JOIN itemtypes it ON i.itmtype=itmtypeid ORDER BY rand() DESC limit 1");
			$r=$db->fetch_row($q);
			{
			$cn++;
			echo '<h4><span>2.</span> '.$r['itmname'].'</h4>
			      

Item Type: <span>'.$r['itmtypename'].'</span>
Item Description: '.$r['itmdesc'].'</p>';
			}
			echo'

	<div id="leftblockoneLinktwoPan">

	</div>
    </div>
   
    <div id="leftblocktwoPan">

	[/list]


</div>
  </div>
  <div id="rightPan">
  	<form action="authenticate.php" method="post" name="login" class="form1">
	<h2>member login</h2>
	<label>Name:</label>
	<input name="username" type="text" />
	<label>Passward:</label>
	<input name="password" type="password" />
	<label class="label1">[url="register.php"]not registered ?[/url]</label>
	<input name="GO" type="submit" class="botton" id="GO" value="GO" />
</form>
<h3>players <span>online</span></h3>
<ul>';
			$cn=0;
			$q=$db->query("SELECT * FROM users WHERE laston>unix_timestamp()-15*60 ORDER BY laston DESC limit 5");
			if (!$db->num_rows($q))
			{
				echo '[*][url="#"]No One[/url]';
			 }
			while($r=$db->fetch_row($q))
			{
			$la=time()-$r['laston'];
			$unit="secs";
			if($la >= 60)
			{
			$la=(int) ($la/60);
			$unit="mins";
			}
			if($la >= 60)
			{
			$la=(int) ($la/60);
			$unit="hours";
			if($la >= 24)
			{
			$la=(int) ($la/24);
			$unit="days";
			}
			}
			$cn++;
			echo '[*][url="#"]'.$cn.'. '.$r['username'].'[/url]';
			}
			echo'

[/list]

<h3>game <span>stats</span></h3>
<ul>

				[*][url="#"]Registered Users: '.$membs.'[/url]
				[*][url="#"]Total Online: '.$online.'[/url]
				[*][url="#"]Total Males: '.$male.'[/url]
				[*][url="#"]Total Females: '.$fem.'[/url]
				[*][url="#"]Percent Active: '.$pact.'%[/url]

[/list]


  </div>
</div>';
/** This section below will show advertisments on the page if you have the advertising modification installed.
If you do not have the mod installed then leave this commented out as to not cause any problems with the
page or just delete from the beginning of this comment down to the end of the last comment.*/

/**
* <div id="bodyBottomPan">
*   <div id="BottomLeftPan">
*   	

paid 
<span>advertising</span></p>
*   	

contact <span>Shaved92bravada</span></p>
*   </div>
*   
*   <div id="BottomMiddlePan">';
*   			
* 			$q=$db->query("SELECT * FROM ads ORDER BY rand() LIMIT 1",$c);
* 			if($db->num_rows($q))
*			{
* 			$ar=mysql_fetch_array($q);
* 			}
* 			echo '
* 			
*   	

[url="adlog.php?ad='.$ar['adID'].'"][img='.$ar['adIMG'].'][/url]</p>
* 	
*   		</div>
* 	</div>
* 	End your delete here.........*/
echo '
<div id="footerPan">

	<ul class="templateworld">
  			[*]design by:
		[*][url="http://www.templateworld.com"]Template World[/url][*]• modified by •[*][email="[email protected]"]Shaved Designs[/email]
	   [/list]

	<p class="copyright">

	[url="http://validator.w3.org/check?uri=referer"][img=http://www.w3.org/Icons/valid-xhtml10-blue][/url]
	   •   

	?YOUR GAMENAME '.$year.' all right reserved.

	   •   	
 	<a href="http://jigsaw.w3.org/css-validator/">
    	[img=http://jigsaw.w3.org/css-validator/images/vcss-blue]
	</a>
	</p>


</div>
</body>
</html>';
?>

 

 

I suggest you get the original registration, I can change that one.

This is has many spelling mistakes lol

Posted

Re: Promo Codes

You can change your Promo code on line 221,

paste it onto pastebin to see

$sm=100;

if($_POST['promo'] == "Your Promo Code Here")

And on line 329,

Maybe change this :

<td>Promo Code</td><td colspan="2"><input type="text" name="promo" /></td>

</tr>';

To Promo code (actual promo code)

Posted

Re: Promo Codes

Why did you just post what I posted?

Why can't you let me have my time to shine?

I finally answered someone's question, right.

and your trying to steal my thunder??

Huh?

 

lol

Posted

Re: Promo Codes

 

You can change your Promo code on line 221,

paste it onto pastebin to see

$sm=100;

if($_POST['promo'] == "Your Promo Code Here")

And on line 329,

Maybe change this :

<td>Promo Code</td><td colspan="2"><input type="text" name="promo" /></td>

</tr>';

To Promo code (actual promo code)

if (isset($_POST['promo']) == 'Teh Promo Code')

 

Thanks Strats and Karlos

Posted

Re: Promo Codes

 

if (isset($_POST['promo']) == 'Teh Promo Code')

 

isset will return 1 or 0 (true or false) which in this case isn't very useful. try this:

 

if(isset($_POST['promo']) AND ctype_alnum($_POST['promo']) AND $_POST['promo'] == 'Teh Promo Code')
  • 1 month later...
Posted

Re: Promo Codes

 

here promo code lols

$promo_code = 'IRN00BLOLS';

lol

I Wouldn't Say Promo Code. More A Shot At Looking Funny And Smart ... Basicly My Assupmtion Of This Is Massive Epic Failure.

Posted

Re: Promo Codes

Promo Codes is another way of advertising some users actually try looking for a promo code before they play/buy so its cheaper/easier.

Its a great addition to the game

Posted

Re: Promo Codes

Yes I agree, it's a great addition to any game.

1)Help's people refer other's by saying they can get a little boost ingame.

2)People who just visit the site will like the idea of getting a headstart.

3)A better start to the game makes them feel good so may lead to more donations lol (just an assumption on this)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...