Jump to content
MakeWebGames

my register problem


Coly010

Recommended Posts

my register file is not working and i have no clue why not. i'm not that good at doing registers so if anyone could point out my mistakes or what i've left out etc.

i have to seperate register files.

one that contains the form and the other with mysql insert stuff.

here is the mysql insert stuff one:

<?php
$ip = ($_SERVER['HTTP_X_FORWARDED_FOR'])
   ?  $_SERVER['HTTP_X_FORWARDED_FOR']
   :  $_SERVER['REMOTE_ADDR'];
if(file_exists('ipbans/'.$ip))
{
die("<html><head></head><body>[b]<font color=red size=+1>Your IP has been banned, there is no way around this.</font>[/b]</body></html>");
}
require "connect.php";
global $link;
if($_POST['username'])
{
$sm=100;
if($_POST['promo'] == "7341")
{
$sm+=100;
}
$username=$_POST['username'];
$username=str_replace(array("<", ">"), array("<", ">"), $username);
$q=mysql_query("SELECT * FROM users WHERE username='{$username}'");
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
{
mysql_query("INSERT INTO users (username, password, level, gold, casino_coins, realm, city, user_level, energy, maxenergy, stamina, maxstamina, hp, maxhp, gender, signedup, email,  lastip) VALUES( '{$username}', md5('{$_POST['password']}'), 1, $sm, 10, '{$_POST['realm']', 1, 350, 4000, 350, 1500, 100, 100, 'Male', unix_timestamp(), '{$_POST['email']}',  '$ip')");
$i=mysql_insert_id($link);
mysql_query("INSERT INTO userstats VALUES($i, 1, 1, 1, 1, 1)");
print "You have signed up, enjoy the game.

> [url='login.php']Login[/url]";
}
}
?>

 

i'm creating my own game you see. i'm doing my own code. i dont have referals in my game and i dont no if they need to be in the code or not. like i said i dont know how to make a register.

this is the form one:

<!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 content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Planet 201</title>
<style type="text/css">
body {
background: black;
border: 5px silver groove;
color: #CC0000;
cursor: auto;
font-family: Cambria, Cochin, "Georgia", Times, Times New Roman, serif;
font-size: medium;
font-weight: normal;
font-variant: small-caps;
font-style: oblique;
text-align: center;
text-decoration: blink;
text-indent: 1px;
text-transform: capitalize;
}
#nav {
background: black url('navigation.png');
color: #CC0000;
}
#homebutton {
background: transparent;
color: white;
font-size: large; 
}
input, select {
background: black url('input.png');
color: #FFF;
}
#submit {
background: white;
color: #000;
}
form {
background: transparent;
}
</style>
</head>

<body>
<span>
<div id="nav" style="height: 40px; width: 758px">
<span>
[url="index.html"]<input type="button" id="homebutton" value="Home" style="height: 35px; width: 77px" onclick="home()" />[/url]
<a href="register.html">
<input type="button" id="homebutton" value="Register" style="height: 35px; width: 77px" onclick="register()" /></a>
<a href="story.html">
<input type="button" id="homebutton" value="Story" style="height: 35px; width: 77px" onclick="story()" /></a>
<a href="ages.html">
<input type="button" id="homebutton" value="Ages" style="height: 35px; width: 77px" onclick="ages()" /></a>
</span></div>

<div>
<form method="post" action="register.php" onsubmit="return validate_form(this);">
<label>Username:</label>

<input type="text" name="username" id="username" />

<label>Password:</label>

<input type="password" name="password" id="password" />

<label>Confirm Password:</label>

<input type="password" name="cpassword" id="cpassword" />

<label>Email:</label>

<input type="text" name="email" id="email" />

<label>Time Realm:</label>

<select name="realm">
			<option name="past" id="past" value="past">Past</option>
			<option name="present" id="present" value="present">Present</option>
			<option name="future" id="future" value="future">Future</option>
		</select>[url="ages()"]?help</label>[/url]

<label>Promo Code:</label>

<input type="text" name="promo" />



<input type="submit" value="Register" id="submit" /><input type="reset" value="Reset" id="submit" />
</form>
</div>
</span>
</body>
</html>
<script language="JavaScript">
<!-- hide
function register() {
popupWin = window.open('register.html',
'open_window')
}
 function story() {
popupWin = window.open('story.html',
'open_window')
}
function home() {
popupWin = window.open('index.html',
'open_window')
}
function ages() {
popupWin = window.open('ages.html',
'open_window')
}
// done hiding -->
function validate_email(field,alerttxt)
{
with (field)
 {
 apos=value.indexOf("@");
 dotpos=value.lastIndexOf(".");
 if (apos<1||dotpos-apos<2)
   {alert(alerttxt);return false;}
 else {return true;}
 }
}

function validate_form(thisform)
{
with (thisform)
 {
 if (validate_email(email,"Not a valid e-mail address!")==false)
   {email.focus();return false;}
 }
}
</script>

 

any help?

thanks,

coly010

Link to comment
Share on other sites

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