Page 1 of 1

PHP Help

Posted: Fri Jun 12, 2009 4:30 pm
by Pumfy
Can some one help me

Parse error: syntax error, unexpected $end in /home/crimina/public_html/register.php on line 233

Heres the code

Code: Select all

 
</body>
</html>
}
}
$h->endpage();
?>

the ?> is line 233
Please Help thanks
please PM me thanks

Re: PHP Help

Posted: Fri Jun 12, 2009 4:58 pm
by requinix
1. "PHP Help" is meaningless. People are more likely to help you if you make a useful title.
2. The point of a forum is for everybody to help everybody. It is not for one person to PM you the answer because (a) that answer could help other people too, and (b) their answer might be wrong/horrible/malicious/a bunch of other stuff you don't want.
3. Show some effort on your part.

4. The error message means you are probably missing a closing } somewhere in your code.

Re: PHP Help

Posted: Fri Jun 12, 2009 5:40 pm
by Pumfy
Can I post my code here can you take alook and correct it for me that would be fab thanks

Code: Select all

<?php
session_start();
include_once (DIRNAME(__FILE__) . '/ImPoRtAnT/config.php');
include_once (DIRNAME(__FILE__) . '/global_func.php');
 
global $_CONFIG;
define("MONO_ON", '1');
 
include_once (DIRNAME(__FILE__) . '/ImPoRtAnT/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();
$SelectSettings = $db->query("SELECT `conf_name`, `conf_value` FROM `settings`");
while($r = $db->fetch_row($SelectSettings))
{
 $Set[$r['conf_name']] = $r['conf_value'];
}
 
 
echo '
<!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>
  <title>Criminal-Madness - Register</title>
  <script src="Reg.JS" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="c1s.css" />
 </head>
 <body>
  <div id="container">
   <div id="header"></div>
   <div id="topmenu">
    <ul>
     <li id="topmenucorner1"></li>
     <li id="topmenucorner2"><a href="index.php">Home</a></li><li id="topmenucorner3"></li>
     <li id="topmenucorner2"><a href="tc.php">T&C</a></li><li id="topmenucorner3"></li>
     <li id="topmenucorner2"><a href="login.php">Login</a></li><li id="topmenucorner3"></li>
     <li id="topmenucorner2"><a href="register.php">Register</a></li><li id="topmenucorner3"></li>
    </ul>
   </div>
   <div id="login">
    <form action=authenticate.php method=post name=login onsubmit="return saveme();">
     Username: <input type=text name=username size="10" class="inputback">
     Password: <input type=password name=password size="10" class="inputback">
     Remember me?
     <input type="radio" value="ON" name="save">Yes
     <input type="radio" name="save" value="OFF" checked>No
     <input type=submit value=Enter class="button">
    </form>
   </div>
   <div id="wrapper1">
    <div id="wrapper2">
     <div id="left">
      <div class="leftmenu">
       <div class="leftmenutitle">Menu</div>
       <ul id="leftmenulinks">
        <li><a href="index.php">Home</a></li>
        <li><a href="tc.php">T&C</a></li>
        <li><a href="register.php">Register</a></li>
        <li><a href="login.php">Login</a></li>
       </ul>
      </div>
     </div>
     <div id="right">
      <div class="rightcontent2">
       <div class="rightcontent1"></div>';
       if (isset($_POST['username'])) {
        if ($Set['regcap_on']) {
         if (!$_SESSION['captcha'] OR $_SESSION['captcha'] != $_POST['captcha']) {
          unset($_SESSION['captcha']);
          echo '<div class="CenterText"><span style="color: #FF0000;">Error <br /> Captcha Test Failed!</span><br />
          > <a href="register.php" style="color: #000; text-decoration: underline;">Back</a></div>';
         }
         unset($_SESSION['captcha']);
         include_once (DIRNAME(__FILE__) . '/EPage.php');
        } else if (!ValidEmail(trim($_POST['email']))) {
         echo '<div class="CenterText"><span style="color: #FF0000;">Error <br /> Invalid Email!</span><br />
         > <a href="register.php" style="color: #000; text-decoration: underline;">Back</a></div>';
         include_once (DIRNAME(__FILE__) . '/EPage.php');
        } else if (strlen($_POST['username']) < '4') {
         echo '<div class="CenterText"><span style="color: #FF0000;">Error <br /> Username Is Too Short!</span><br />
         > <a href="register.php" style="color: #000; text-decoration: underline;">Back</a></div>';
         include_once (DIRNAME(__FILE__) . '/EPage.php');
        }
$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.<br />
><a href='register.php'>Back</a>";
include_once (DIRNAME(__FILE__) . '/EPage.php');
}
else if($db->num_rows($q2))
{
print "E-Mail already in use. Choose another.<br />
><a href='register.php'>Back</a>";
include_once (DIRNAME(__FILE__) . '/EPage.php');
}
else if($_POST['password'] != $_POST['cpassword'])
{
print "The passwords did not match, go back and try again.<br />
><a href='register.php'>Back</a>";
include_once (DIRNAME(__FILE__) . '/EPage.php');
}
else
{
$_POST['ref'] = abs((int) $_POST['ref']);
$IP = getip();
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 "<div class='CenterText'>You have signed up, enjoy the game.<br />
<font color=white>Please Note The Following:</font><color=gold>We as staff of Criminal-Mandess do not take Abuse from anyone or to of any od our members if you are caught doing this you will be banned for 5 days for the first offence after that we will Ban and delete your account And IP Ban . If you attemp to bypass our IP banning system and we find you and dont worry we will we will delete evety account that you make . Enjoy the game and dont forget to read the game rules and our Terms And Conditions Thanks eido (1) The Chaotic Banana (2).</font><br />
> <a href='login.php'>Login</a></div>";
include_once (DIRNAME(__FILE__) . '/EPage.php');
}
else
{
if($Set['regcap_on'])
{  $chars="123456789";
  $len=strlen($chars);
  $_SESSION['captcha']="";
  for($i=0;$i<6;$i++)
  $_SESSION['captcha'].=$chars[rand(0, $len - 1)];
}
print "
<h3>Criminal-Madness Registration</h3>
 <div class='rightcontentblock'>
 <form action=register.php method=post>
<table width='75%' class='table' cellspacing='1'>
<tr>
<td width='30%'>Username</td>
<td width='40%'><input type=text name=username onkeyup='CheckUsername(this.value);' class='inputback'></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();' class='inputback'></td>
<td><div id='passwordresult'></div></td>
</tr>
<tr>
<td>Confirm Password</td><td><input type=password name=cpassword id='pw2' onkeyup='PasswordMatch();' class='inputback'></td>
<td><div id='cpasswordresult'></div></td>
</tr>
<tr>
<td>Email</td><td><input type=text name=email onkeyup='CheckEmail(this.value);' class='inputback'></td>
<td><div id='emailresult'></div></td>
</tr>
<tr>
<td>Gender</td>
<td colspan='2'><select name='gender' type='dropdown'>
<option value='Male' class='inputback'>Male
<option value='Female' class='inputback'>Female</select></td>
</tr>
<tr>
<td>Promo Code</td><td colspan=2><input type=text name=promo class='inputback'></td>
</tr>
}
<input type=hidden name=ref value='";
if($_GET['REF']) { print $_GET['REF']; }
print "' />";
if($Set['regcap_on'])
{
print "<tr>
<td colspan=3><img src='captcha_verify.php?bgcolor=C3C3C3' /><br />
<input type='text' name='captcha' /></td>
</tr>";
}
print "
<font color=red>By Clicking Submit Your Agree To Our Terms Of Service.</font>
<tr>
<td colspan=3 align=center><input type=submit value=Submit></td>
</tr>
</table>
</form><br />
<a href='login.php'>Go Back</a>";
print <<<OUT
 
 
</div>
<div class="rightcontent3"></div>
</div>
 
 
 
 
 
 
</div>
<!--wrapper2-end -->
</div>
<!--wrapper2-end -->
</div>
<div id="wrapper3"></div>
<!--wrapper-end -->
</div>
<!--wrapper-end -->
<div id="footer">Copyright 2009-2010 Criminal Madness</span></a></div>
 
<!--container-end -->
</div>
 
 
</body>
</html>
}
>>>OUT
?>
cou;d you edit it and tell me the problem please thanks comes up

Parse error: syntax error, unexpected $end in /home/crimina/public_html/register.php on line 230

Re: PHP Help

Posted: Fri Jun 12, 2009 6:47 pm
by requinix

Code: Select all

}
>>>OUT
Switch those around.

And on line 180 there's a } that probably doesn't belong.

Re: PHP Help

Posted: Sat Jun 13, 2009 1:43 pm
by Pumfy
Apologies ive done what you have said and it has came up with the same message

Re: PHP Help

Posted: Sat Jun 13, 2009 3:44 pm
by Mark Baker
Pumfy wrote:Apologies ive done what you have said and it has came up with the same message
Change

Code: Select all

>>>OUT
to

Code: Select all

OUT;
Quoting from the manual:
It is very important to note that the line with the closing identifier must contain no other characters, except possibly a semicolon (;). That means especially that the identifier may not be indented, and there may not be any spaces or tabs before or after the semicolon. It's also important to realize that the first character before the closing identifier must be a newline as defined by the local operating system. This is \n on UNIX systems, including Mac OS X. The closing delimiter (possibly followed by a semicolon) must also be followed by a newline.

If this rule is broken and the closing identifier is not "clean", it will not be considered a closing identifier, and PHP will continue looking for one. If a proper closing identifier is not found before the end of the current file, a parse error will result at the last line.
Strangely, the second time this evening that I've needed to quote this warning

Re: PHP Help

Posted: Sun Jun 14, 2009 7:43 am
by Pumfy
Many Thanks this did work I thank you :D