Jump to content
MakeWebGames

Recommended Posts

Posted

I decided to give a free game template, it has no "fancy" graphics but i think it looks nice! I have created login pages and the in game template. I uploaded the folder to filefactory (if someone knows a better website please tell me) the download link will be down the page. Here is the link.

http://www.filefactory.com/file/a000g5b/n/POG1_tar_gz

Here are some screen shots;

Register http://img78.imageshack.us/img78/7807/s ... onmze8.png

In Game http://img522.imageshack.us/img522/6121/ingamefh6.png

Demo http://pog1.co.cc/TEMPLATE/

 

Can people post improvements for the next! Hope you enjoy 8-)

  • 3 months later...
Posted

Re: [mccodes V2] Free Game Template

Can some help me as i am using this template on the register page the repeat password box is like half under the other box at the bottom as you can see in the screen shot.Please can you help me.

 

imagehzx.jpg

  • 2 weeks later...
Posted

Re: [mccodes V2] Free Game Template

anyone have way of getting this to work with v1

i have most of the files corrected except the login file im pretty sure, since i was already logged in and was able to see everything perfectly

login.php file

<?php
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'];
}
$page = (isset($_GET['p'])) ? preg_replace("/[^a-zA-Z0-9]/","",strip_tags(trim($_GET['p']))) : 'news' ;
$pageArray = array('register','fpass','screenshots','news');

$pageTitle = array('news'=>'Game News','register'=>'Registration','fpass'=>'Forgot Password','screenshots'=>'Game Screenshots');
$pageTitle = $pageTitle[$page];


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']} - {$pageTitle}</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script language="JavaScript" type="text/javascript" src="login.js" /></script>
</head>
<body onload="getme();" id="login">

<div id="wrapper">
<div id="header">
	<ul>
		[*][url="#"]Settings[/url]
		[*][url="#"]High Scores[/url]
		[*][url="#"]Manual[/url]
		[*][url="#"]Forum[/url]
		[*][url="#"]Chat[/url]
	[/list]
</div>
<div id="banner">[img=images/pog1.png]</div>
<div id="leftNav">
	<ul>
		<li class="header">Login
		<li class="login">
			<form action="authenticate.php" method="post" name="login" onsubmit="return saveme();">Username 
			<input type="text" name="username"> 

			Password <input type="password" name="password"> 

			Remember me?

			<input type="radio" value="ON" name="save"> Yes 
			<input type="radio" name="save" value="OFF" checked> No
			<input type=submit value=Submit>
			</form>

		[*][url="login.php?p=news"]News[/url]
		[*][url="login.php?p=register"]Register[/url]
		[*][url="login.php?p=fpass"]Forgot Password[/url]
		[*][url="login.php?p=screenshots"]Screenshots[/url]
	[/list]
</div>
<div id="mainContent">

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(in_array($page,$pageArray)) {
	switch($page) {

		case 'register':register();break;
		case 'fpass':fpass();break;
		case 'screenshots':screenshots();break;
		default:news();break;

	}	
}
	function register() {

		function valid_email($email) {
		  if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
		    return false;
		  }
		  $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;
		}		


if(isset($_POST['register'])) {

$username = preg_replace("/[^a-zA-Z0-9]/","",strip_tags(trim($_POST['username'])));

if(!valid_email($_POST['email'])) { $errorMSG .= '[*]Sorry, the email is invalid.'; }
if(strlen($username) < 4) {$errorMSG .= '[*]Sorry, the username is too short.'; }
$string = sprintf("SELECT username,login_name FROM `users` WHERE `username` = '%u' OR `login_name` = '%u'",$username,$username);
$result = mysql_query($string);
echo (!$result) ? 'SELECTION ERROR' : '';

if(mysql_num_rows($result)) { $errorMSG .= '[*]Username already in use. Choose another.'; }

$string = sprintf("SELECT email FROM `users` WHERE `email` = '%s'",$_POST['email']);
$result = mysql_query($string);
echo (!$result) ? 'SELECTION ERROR' : '';

if(mysql_num_rows($result)) { $errorMSG .= '[*]E-Mail already in use. Choose another.'; }

if($_POST['pw1'] != $_POST['pw2']) { $errorMSG .= '[*]The passwords did not match, go back and try again.'; }

$_POST['ref'] = abs((int) $_POST['ref']);

$IP = ($_SERVER['HTTP_X_FORWARDED_FOR']) ?  $_SERVER['HTTP_X_FORWARDED_FOR'] :  $_SERVER['REMOTE_ADDR'];
$q=mysql_query(sprintf("SELECT lastip,userid FROM `users` WHERE `lastip` = '$u' AND `userid` = '%u'",$IP,$_POST['ref']));

if(mysql_num_rows($q)) { $errorMSG .= '[*]No creating referral multies. Bad dog.'; }



if(!isset($errorMSG)) {

	if($_POST['ref']) {
		$q=(sprintf("SELECT userid FROM users WHERE `userid` = '%u'",$_POST['ref']));
		$r=$db->fetch_row($q);
	}



// ******************************** //


//	Insert your querys for when the playe registers here


// ******************************** //




	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.</p>';

}
else { echo '<div id="errorBox"><h3>You had some errors</h3>[list=1]'.$errorMSG.'[/list]

[url="login.php?p=register"]Back[/url]</p></div>'; }
}

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)];
}
?>

<form id="registerForm" method="post">
<fieldset id="pt1">
	<legend><span>Step </span>1. <span>: Login details</span></legend>
	<h3>Pick a login name.</h3>
	<div class="help">
		This will be the name used to login, even if you change your username later 
		this will not change.
	</div>
	<label for="username">Login / Username</label>
	<input id="username" name="username" type="text" onkeyup="CheckUsername(this.value);" />
	<div id="usernameresult"></div>
</fieldset>
<fieldset id="pt2">
	<legend><span>Step </span>2. <span>: Password</span></legend>
	<h3>Choose a password for your new account.</h3>
	<div class="help">Passwords must be 6-30 characters in length.</div>
	<label for="pw1">Password</label>
	<input id="pw2" name="pw1" onkeyup="CheckPasswords(this.value);PasswordMatch();" type="password" />
	<label for="pw2">Repeat Password</label>
	<input id="pw2" name="pw2" onkeyup="PasswordMatch();" type="password" />
</fieldset>
<fieldset id="pt3" class="error">
	<legend><span>Step </span>3. <span>: Email details</span></legend>
	<h3>Enter your email address.</h3>
	<div class="help">You must enter a valid email address to activate your account.</div>
	<label for="email1">Email</label>
	<input id="email1" type="text" name="email" onkeyup="CheckEmail(this.value);" />
	<div id="emailresult"></div>	
</fieldset>
<fieldset id="pt4">
	<legend>Step 4  : Submit form</legend>
	<h3>Terms of Service</h3>
	<div id="disclaimer">By clicking the 'Complete Signup' button, I am attaching my electronic signature to and agreeing to the Squarespace Terms of Service Agreement; I understand that if I do not agree to these terms of use and privacy statements, I should refrain from using Squarespace.</div>
	<input id="submitform" name="register" value="Complete Registration" type="submit" />
</fieldset>
<br style="clear:both" />
</form>
<?
}

	}
	function fpass() {
		echo '

put your content here</p>';
	}
	function screenshots() {
		echo '

put your content here</p>';		
	}
	function news() {
		echo '

Put your content here.
This will be the home page</p>'.
		'

For a demo of the imgame template login with the demo login;</p>'.
		'

[b]User: [/b] demo
[b]Password[/b] demo</p>';	
	}	
?>
</div>
<div id="footer">
	<div id="copyright">Copyright GameName. All rights reserved.  Design by [url="http://pog1.co.cc"]Pogone Design[/url]</div>
	<div id="privacy">[url="#"]Terms of Service[/url] | [url="#"]Privacy Policy[/url] | [url="#"]Game Rules[/url] | [url="#"]Contact[/url]</div>
</div>
</div>
</body>
</html>

 

register.php

<?php
session_start();
print "<html>
<head>
<title>Thug Mayhem</title>
<style>
body
{ font-family:Verdana;font-size:9pt;color: red;
  background-color: black; 
  scrollbar-base-color: #005B70;
  scrollbar-arrow-color: #F3960B;
  scrollbar-DarkShadow-Color: #000000; }
a:visited,a:active,a:hover,a:link { color: white;text-decoration: none; }
table,tr,td { font-size:9pt; }
img { border:none; }
</style>
</head>
<body><center>[img=logo.png]</center>
";
$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>");
}
require "mysql.php";
global $c;
if($_POST['username'])
{
$sm=100;
if($_POST['promo'] == "Your Promo Code Here")
{
$sm+=100;
}
$username=$_POST['username'];
$username=str_replace(array("<", ">"), array("<", ">"), $username);
$q=mysql_query("SELECT * FROM users WHERE username='{$username}'",$c);
if(mysql_num_rows($q))
{
print "Username already in use. Choose another.";
}
else if($_POST['password'] != $_POST['cpassword'])
{
print "The passwords did not match, go back and try again.";
}
else
{
$_POST['ref'] = abs((int) $_POST['ref']);
$ip = ($_SERVER['HTTP_X_FORWARDED_FOR'])
   ?  $_SERVER['HTTP_X_FORWARDED_FOR']
   :  $_SERVER['REMOTE_ADDR'];
$q=mysql_query("SELECT * FROM users WHERE lastip='$ip' AND userid={$_POST['ref']}",$c);
if(mysql_num_rows($q))
{
die("No creating referral multies. Bad dog.");
}
if($_POST['ref']) {
$q=mysql_query("SELECT * FROM users WHERE userid={$_POST['ref']}",$c);
$r=mysql_fetch_array($q);
}
mysql_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) VALUES( '{$username}', '{$username}', md5('{$_POST['password']}'), 1, $sm, 0, 0, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, 'Male', unix_timestamp(), '{$_POST['email']}', -1, '$ip')", $c);
$i=mysql_insert_id($c);
mysql_query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10)", $c);

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

> [url='login.php']Login[/url]";
}
}
else
{
print "<center><h3><Thug Mayhem Registration</h3>";
print "<center><h3>Fill out the form below to Join Free!</h3>"; 
print "<form action=register.php method=post>[b]Username:[/b] <input type=text name=username>

[b]Password: <input type=password name=password>

Confirm Password: <input type=password name=cpassword>

Email: <input type=text name=email>

Promo Code[/b] (Leave blank if unknown): <input type=text name=promo>

<input type=hidden name=ref value='";
if($_GET['REF']) { print $_GET['REF']; }
print "'>
<input type=submit value=Submit></center></form>
<center>[url='login.php'][Go Back][/url]</center>";
}
print "</body></html>";
?>

</center>

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...