Jump to content

Template messes up


duncan_cowan

Recommended Posts

hiwhen i add a register script to my website the template messes up. The code for the page is:

<?php  require 'protected/db_connect.php';	// database connect script.if ($logged_in == 1) {header('Location: http://www.wasper-rocker.co.uk/protected/world_war_six_-.php');}//Deletes Old Database Entries  $maxtime = time() -600; $sql = mysql_query("DELETE FROM ppl_online WHERE UNIX_TIMESTAMP(activity) < '$maxtime'"); $rows = mysql_affected_rows(); if($_SESSION['online'] == "yes"){ 	@mysql_query("INSERT INTO ppl_online (session_id, activity, ip_address, refurl, user_agent) <br>		VALUES ('".session_id()."', now(), '{$_SERVER['REMOTE_ADDR']}', '{$_SERVER['HTTP_REFERER']}', '{$_SERVER['HTTP_USER_AGENT']}')"); 	$_SESSION['online'] = "yes"; } else { 	if ($logged_in == 1){ 		@mysql_query("UPDATE ppl_online SET activity=now(), member='y' WHERE session_id='".session_id()."'"); 	} } if($_SESSION['online'] == "yes"){		 	@mysql_query("UPDATE ppl_online SET activity=now() WHERE session_id='".session_id()."'"); } ?><html><head><meta http-equiv="Content-Language" content="en-gb"><title>World War Six - Home</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"></head><body bgcolor="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><!-- ImageReady Slices (images/WW6.psd) --><center><font color="FFFFFF" face="Haettenschweiler"><table id="Table_01" width="800" height="631" border="0" cellpadding="0" cellspacing="0">	<tr>		<td colspan="12">			<img src="protected/images/WW6_01.gif" width="800" height="69" alt=""></td>	</tr>	<tr>		<td>			<img src="protected/images/WW6_02.gif" width="28" height="21" alt=""></td>		<td>			<img src="protected/images/WW6_03.gif" width="93" height="21" alt=""></td>		<td colspan="3">			<img src="protected/images/WW6_04.gif" width="93" height="21" alt=""></td>		<td>			<a href="index.php"><img border="0" src="protected/images/WW6_05.gif" width="93" height="21" alt=""></a></td>		<td>			<a href="thegame.php"><img border="0" src="protected/images/WW6_06.gif" width="93" height="21" alt=""></a></td>		<td>			<a href="register.php"><img border="0" src="protected/images/WW6_07.gif" width="93" height="21" alt=""></a></td>		<td>			<img src="protected/images/WW6_08.gif" width="93" height="21" alt=""></td>		<td>			<img src="protected/images/WW6_09.gif" width="93" height="21" alt=""></td>		<td>			<img src="protected/images/WW6_10.gif" width="93" height="21" alt=""></td>		<td>			<img src="protected/images/WW6_11.gif" width="28" height="21" alt=""></td>	</tr>	<tr>		<td colspan="12">			<img src="protected/images/WW6_12.gif" width="800" height="23" alt=""></td>	</tr>	<tr>		<td colspan="3">			<img src="protected/images/WW6_13.gif" width="153" height="21" alt=""></td>		<td rowspan="9">			<img src="protected/images/WW6_14.gif" width="6" height="517" alt=""></td>		<td colspan="8">			<img src="protected/images/WW6_15.gif" width="641" height="21" alt=""></td>	</tr>	<tr>		<td colspan="3" height="85" background="protected/images/WW6_16.gif"><div align="center"><?php include("protected/login.php") ?>		<img src="protected/images/WW6_07.gif">		</div></td>		<td colspan="8" rowspan="7" valign="top" background="protected/images/WW6_17.gif"><div align="center"><br><br><font color="#FFFFFF"><?php include("regform.php") ?><br>				</tr>	<tr>		<td colspan="3">			<img src="protected/images/WW6_18.gif" width="153" height="45" alt=""></td>	</tr>	<tr>		<td colspan="3" height="85" background="protected/images/WW6_19.gif"><div align="center"><?php include("protected/memberstats.php") ?></div></td>	</tr>	<tr>		<td colspan="3">			<img src="protected/images/WW6_20.gif" width="153" height="45" alt=""></td>	</tr>	<tr>		<td colspan="3" height="85" background="protected/images/WW6_21.gif"><div align="center">Site			stats here.</div></td>	</tr>	<tr>		<td colspan="3">			<img src="protected/images/WW6_22.gif" width="153" height="45" alt=""></td>	</tr>	<tr>		<td colspan="3" height="85" background="protected/images/WW6_23.gif">		<div align="center">Site stats here.</div></td>	</tr>	<tr>		<td colspan="3">			<img src="protected/images/WW6_24.gif" width="153" height="21" alt=""></td>		<td colspan="8">			<img src="protected/images/WW6_25.gif" width="641" height="21" alt=""></td>	</tr>	<tr>		<td>			<img src="spacer.gif" width="28" height="1" alt=""></td>		<td>			<img src="spacer.gif" width="93" height="1" alt=""></td>		<td>			<img src="spacer.gif" width="32" height="1" alt=""></td>		<td>			<img src="spacer.gif" width="6" height="1" alt=""></td>		<td>			<img src="spacer.gif" width="55" height="1" alt=""></td>		<td>			<img src="spacer.gif" width="93" height="1" alt=""></td>		<td>			<img src="spacer.gif" width="93" height="1" alt=""></td>		<td>			<img src="spacer.gif" width="93" height="1" alt=""></td>		<td>			<img src="spacer.gif" width="93" height="1" alt=""></td>		<td>			<img src="spacer.gif" width="93" height="1" alt=""></td>		<td>			<img src="spacer.gif" width="93" height="1" alt=""></td>		<td>			<img src="spacer.gif" width="28" height="1" alt=""></td>	</tr></table><font size="1" face="Arial">©Duncan Cowan 2006.</font></center><!-- End ImageReady Slices --></body></html>

and the code for the register script is:

<html><head><title>Register an Account</title></head><body><?phpif (isset($_POST['submit'])) { // if form has been submitted	/* check they filled in what they supposed to, 	passwords matched, username	isn't already taken, etc. */	if (!$_POST['uname'] | !$_POST['passwd'] | !$_POST['passwd_again'] | !$_POST['email']) {		die('You did not fill in a required field.');	}	// check if username exists in database.	if (!get_magic_quotes_gpc()) {		$_POST['uname'] = addslashes($_POST['uname']);	}	$name_check = $db_object->query("SELECT username FROM users WHERE username = '".$_POST['uname']."'");	if (DB::isError($name_check)) {		die($name_check->getMessage());	}	$name_checkk = $name_check->numRows();	if ($name_checkk != 0) {		die('Sorry, the username: <strong>'.$_POST['uname'].'</strong> is already taken, please pick another one.');	}	// check passwords match	if ($_POST['passwd'] != $_POST['passwd_again']) {		die('Passwords did not match.');	}	// check e-mail format	if (!preg_match("/.*@.*..*/", $_POST['email']) | preg_match("/(<|>)/", $_POST['email'])) {		die('Invalid e-mail address.');	}	// no HTML tags in username, website, location, password	$_POST['uname'] = strip_tags($_POST['uname']);	$_POST['passwd'] = strip_tags($_POST['passwd']);	$_POST['website'] = strip_tags($_POST['website']);	$_POST['location'] = strip_tags($_POST['location']);	// check show_email data	if ($_POST['show_email'] != 0 & $_POST['show_email'] != 1) {		die('Nope');	}	/* the rest of the information is optional, the only thing we need to 	check is if they submitted a website, 	and if so, check the format is ok. */	// now we can add them to the database.	// encrypt password	$_POST['passwd'] = md5($_POST['passwd']);	if (!get_magic_quotes_gpc()) {		$_POST['passwd'] = addslashes($_POST['passwd']);		$_POST['email'] = addslashes($_POST['email']);		$_POST['website'] = addslashes($_POST['website']);		$_POST['location'] = addslashes($_POST['location']);	}	$regdate = date('m d, Y');	$insert = "INSERT INTO users (			username, 			password, 			regdate, 			email,  			location, 			show_email, 			last_login) 			VALUES (			'".$_POST['uname']."', 			'".$_POST['passwd']."', 			'$regdate', 			'".$_POST['email']."', 			'".$_POST['location']."', 			'".$_POST['show_email']."', 			'Never')";	$add_member = $db_object->query($insert);	if (DB::isError($add_member)) {		die($add_member->getMessage());	}	$db_object->disconnect();?><h1>Registered</h1><p>Thank you, your information has been added to the database, you may now <a href="login.php" title="Login">log in</a>.</p><?php} else {	// if form hasn't been submitted?><h1>Register</h1><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"><table align="center" border="0" cellspacing="0" cellpadding="3"><tr><td><font color="#FFFFFF">Username*:</td><td><br><input type="text" name="uname" maxlength="40" style="width:150px;height:17px;border:solid 1px black; font-size: 11"></td></tr><br><br><tr><td><font color="#FFFFFF">Password*:</td><td><br><input type="password" name="passwd" maxlength="50" style="width:150px;height:17px;border:solid 1px black; font-size: 11"></td></tr><br><br><tr><td><font color="#FFFFFF">Confirm Password*:</td><td><br><input type="password" name="passwd_again" maxlength="50" style="width:150px;height:17px;border:solid 1px black; font-size: 11"></td></tr><br><br><tr><td><font color="#FFFFFF">E-Mail*:</td><td><br><input type="text" name="email" maxlength="100" style="width:150px;height:17px;border:solid 1px black; font-size: 11"></td></tr><br><br><tr><td><font color="#FFFFFF">Location</td><td><br><input type="text" name="location" maxlength="150" style="width:150px;height:17px;border:solid 1px black; font-size: 11"></td></tr><br><br><tr><td><font color="#FFFFFF">Show E-Mail?</td><td><br><select name="show_email" style="width:100px;height:17px;border:solid 1px black; font-size: 11"><option value="1" selected="selected">Yes</option><option value="0">No</option></select></td></tr><br><br><tr><td colspan="2" align="right"><input type="submit" name="submit" value="Sign Up"></td></tr></table></form><?php}?></body></html>

the url of the page is; www.wasper-rocker.co.ukcan anyone help?? :)

Link to comment
Share on other sites

What do you mean the template messes up? What does it do? If you are including that second piece of code on another page, you need to know that the code in the included page gets inserted right where the include statement is in the first page. So, if your second page has <html> and <body> tags, you are including those tags right in the middle of the first page.

Link to comment
Share on other sites

i have gotten rid of the head and body tags from the included bit but it makes no difference, I have also put the php process bit in a seperate file but that also makes no difference. the register page is meant to look like the home page but with a form in the middle.Home pageRegister Page

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...