Page 1 of 1

Unexpected $

Posted: Thu Oct 05, 2006 6:56 pm
by LiveFree
Ok Im either really stupid or really tired :(

I cant seem to find the cause of this error:


Parse error: parse error, unexpected $

Code: Select all

<?php
/*  File: register.php
	 Author: Rick Tucker (freedomisntfree.usa@gmail.com)
*/
session_start();
session_regenerate_id();
require('../init.php'); //Include DB connection file

if ($_POST['regSubmit']) {
	$fName = stripslashes(mysql_real_escape_string($_POST['first']));
	$mName = stripslashes(mysql_real_escape_string($_POST['middle']));
	$lName = stripslashes(mysql_real_escape_string($_POST['last']));
	$age = (int) stripslashes(mysql_real_escape_string($_POST['age']));
	$aim = stripslashes(mysql_real_escape_string($_POST['aim']));
	$yim = stripslashes(mysql_real_escape_string($_POST['yim']));
	$icq = stripslashes(mysql_real_escape_string($_POST['icq']));
	$msn = stripslashes(mysql_real_escape_string($_POST['msn']));
	$gtalk = stripslashes(mysql_real_escape_string($_POST['gtalk']));
	$jabber = stripslashes(mysql_real_escape_string($_POST['jabber']));
	$site = stripslashes(mysql_real_escape_string($_POST['site']));
	$interests = stripslashes(mysql_real_escape_string($_POST['interests']));
	
	$errormsgs = array();
	
		if (!empty($_POST['user'])) {
			$user = stripslashes(mysql_real_escape_string($_POST['user']));
				if (mysql_num_rows(mysql_query("SELECT id FROM `profile` WHERE `username` = '".$user."' LIMIT 1"))) {
					$errormsgs[] = "The Username Chosen Already Exists!";
					$user = ''; # Reset Variable					
		}else {
			$errormsgs[] = "You Did not Enter a Username";
		}
		
		if (!empty($_POST['pass'])) {
				$pass = stripslashes(mysql_real_escape_string($_POST['pass']));
				$pass = md5(md5($pass));
		} else {
			$errormsgs[] = "You Did Not Enter in a Password";
		}
		
		if (!empty($_POST['email'])) {
				$email = stripslashes(mysql_real_escape_string($_POST['email']));
					if (!preg_match("^[a-zA-Z]([.]?([[]_-]+)*)?@([[]\-_]+\.)+[a-zA-Z]{2,4}$", $email)) {
							$errormsgs[] = "You Did Not Enter a Valid Email";
							$email = '';
		} else {
			$errormsgs[] = "You Did Not Enter in an Email";
		}
		
		if (!empty($user) && !empty($pass) && !empty($email)) {
				$query = mysql_query("INSERT INTO `profile` VALUES ('', '$user', '$email', '$pass', '$fName', '$mName', '$lName', '$age', '$aim', '$yim', '$icq', '$msn', '$gtalk', '$jabber', '$site', '$interests')");
					if (mysql_affected_rows($query) == 1) {
							echo "<b>You Have Been Registered Successfully, Welcome!</b>";
					}
		} else {
			fire_form();
		}
	} else {
			fire_form();
	}
	
	function fire_form() { 
			global $errormsgs;
	?>
<html>

<body bgcolor='#000000' text='#ffffff' link='#880000' alink='#ff0000' vlink='#550000'>

<center>

<table width='800' height='100%' border='1' bordercolor='666666'>

<tr height='1'>
<th colspan='2'>
<center><img src='http://flamelicker.com/logo.jpg'></center>
</th>
</tr>


<tr>
<td valign='top' width='1'>

<pre>

LOGIN

<a href='http://flamelicker.com/registration/'>REGISTER</a>


---Services---

<a href='http://flamelicker.com/'>HOME</a>

<a href='http://forum.flamelicker.com/' target='_blank'>FORUMS</a>
<a href='http://flamelicker.com/chat/' target='_blank'>CHAT ROOM</a>
<a href='http://flamelicker.com/submission/'>SUBMISSION</a>

<a href='http://flamelicker.com/filehosting/'>FILE HOSTING</a>
<a href='http://flamelicker.com/minisite/'>MINI SITE HOSTING</a>
<a href='http://flamelicker.com/members/'>MEMBERS</a>
<a href='http://flamelicker.com/affiliates/'>AFFILIATES</a>

---Media---

<a href='http://flamelicker.com/media/games/'>GAMES</a>
<a href='http://flamelicker.com/media/apps/'>APPS</a>
<a href='http://flamelicker.com/media/videos/'>VIDEOS</a>
<a href='http://flamelicker.com/media/audio/'>AUDIO</a>

<a href='http://flamelicker.com/media/pictures/'>PICTURES</a>
<a href='http://flamelicker.com/media/userbars/'>USERBARS</a>
<a href='http://flamelicker.com/media/interviews/'>INTERVIEWS</a>
<a href='http://flamelicker.com/media/wips/'>WIPs</a>

---Submissions---

<a href='http://flamelicker.com/submission/submissions/games/'>GAMES</a>
<a href='http://flamelicker.com/submission/submissions/apps/'>APPS</a>
<a href='http://flamelicker.com/submission/submissions/videos/'>VIDEOS</a>
<a href='http://flamelicker.com/submission/submissions/music/'>MUSIC</a>

<a href='http://flamelicker.com/submission/submissions/pictures/'>PICTURES</a>

---Tutorials---

<a href='http://flamelicker.com/tutorials/html/'>HTML</a>
<a href='http://flamelicker.com/tutorials/css/'>CSS</a>
<a href='http://flamelicker.com/tutorials/php/'>PHP</a>
<a href='http://flamelicker.com/tutorials/gm/'>GM</a>
<a href='http://flamelicker.com/tutorials/flash/'>FLASH</a>
<a href='http://flamelicker.com/tutorials/photoshop/'>PHOTOSHOP CS2</a>
<a href='http://flamelicker.com/tutorials/uvs/'>ULEAD VIDEO STUDIO</a>

</pre>


</td>
<td valign='top' width='700'>
<!------------------------------------>

<center>
<table width='1'>
<td>
<form>
<div id="errorDiv">
<?php

foreach ($errormsgs as $msg) {
		echo "<font color='red'><b>".$msg."</b></font>";
}
?>
</div>
*Required*<br>
<hr><p>

Username: (4-32 characters)<br> <input type='text' name='user'> <input type='button' value='Check' name='check'><p>
Password:<br> <input type='password' name='pass'><br>
Varify Password:<br> <input type='password' name='repass'><p>
Email:<br> <input type='text' name='email'><p>

*Profile*<br>
<hr><p>

First Name:<br> <input type='text' name='first'><br>
Middle Name:<br> <input type='text' name='middle'><br>
Last Name:<br> <input type='text' name='last'><p>

Age:<br> <input type='text' name='age'><p>

AIM:<br> <input type='text' name='aim'><br>

ICQ:<br> <input type='text' name='icq'><br>
Y!:<br> <input type='text' name='yim'><br>
MSN:<br> <input type='text' name='msn'><br>
Google Talk:<br> <input type='text' name='gtalk'><br>
Jabber:<br> <input type='text' name='jabber'><p>

Website:<br> <input type='text' name='site'><p>

Interests:<br> <textarea cols='50' rows='10' name='interests'></textarea><p>

<table width='100%'><td>

<input type='reset' value='Reset'>

</td><td align='right'>

<input type='submit' value='Submit'>

</td></table>


</form>
</td>
</table>
</center>

<!------------------------------------>
</td>
</tr>
</table>

</center>

</body>

</html>
<?php
	}
?>
Thanks All

Posted: Thu Oct 05, 2006 7:01 pm
by Luke
mark the line # it gave you and maybe somebody will be able to help... :roll:

Posted: Thu Oct 05, 2006 7:08 pm
by LiveFree
EDIT:

Well yes I am stupid, I was missing a set of brackets! D'Oh!