Search
Left Quote    Nearly all men can stand adversity, but if you want to test a man's character, give him power.
- Abraham Lincoln    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: Complete Member Ship "register .php"
  This user is offline  Genius
  Subject: "Complete Member Ship "registe..." Posted: @ 9:20 pm on Feb 23 2008   

Member #: 582
Rank: User - (77)
Since: 02/18/08
Posts: 76
From: kmmk

Hi again,
I have a problem with my register.php file. It just shows blank page.
Heres the error I got from Apache error log:

Code:
[Sat Feb 23 15:59:38 2008] [error] [client 127.0.0.1] PHP Parse error: parse error, unexpected '`', expecting ')' in D:\\Server\\HTT P\\new\\registe r.php on line 20, referer: http://localhos t/new/login.php



This is my register.php

Code:
<?php
require_once('d b_connect.php') ;

//SEE IF ALREADY LOGGED IN

if($_SESSION[' logged_in'] == 1)
{
//REDIRECT TO HOMEPAGE
header('Locatio n: http://' . $_SERVER['HTTP_ HOST'] . '');
} else {

if(isset($HTTP _POST_VARS['sub mit']))
{

//BEGIN CHECKING USERNAME...

if(!$_POST['use rname']) die('Alert: username field was blank.');

//array of invalid characters
$junk = array('.' , ',' , '/' , '\' , '`' , ';' , '[' , ']' , '-', '_', '*', '&', '^', '%', '$', '#', '@', '!', '~', '+', '(', ')', '|', '{', '}', '<', '>', '?', ':', '"', '=');

//starting lenght of username
$len = strlen($_POST[' username']);

//replace invalid characters
$_POST['usernam e'] = str_replace($ju nk, '', $_POST['usernam e']);
$test = $_POST['usernam e'];

//if lenghts are different ($len smaller), invalid characters found, so prompt error.
if(strlen($test ) != $len) {
die('Username Error: Username contained invalid characters. You can only use A-Z, 0-9 and the

underscore (_).');
}

//Check if username already exists...

$q2 = mysql_query(&qu ot;SELECT * FROM `members` WHERE `username` = '".$_POST[ 'username'].&qu ot;'";
$q3 = mysql_fetch_obj ect($q2);

if($q3->user name == $_POST['usernam e']) {
die('<BR> ;<BR>Sorr y, but the username "'.$q3-> ;username.'&quo t; is taken, please choose another.');
}

//PASSWORD

if(!$_POST['pas sword']) {
die('Error: Password field was blank');
}
if(!$_POST['ver ify_password']) {
die('Error: Verify Password field was blank.');
}
if($_POST['pass word'] != $_POST['verify_ password']) {
die('Error: The passwords do not match.');
}
if(strlen($_POS T['password']) < 6 ) {
die('Error: Your password is too short. Must be 6 or more characters in length.');
}

//ADD NEW MEMBER

$insert ="INSERT INTO `members` (username, user_password, user_email) VALUES ('".$_POST ['username'].&q uot;',

'".md5($_P OST['password'] )."', '".$_POST[ 'email']." ')";

$insert2 = mysql_query($in sert);
if(!$insert2) die(mysql_error ());

echo('Registrat ion Successful, Welcome new member! You can now login to your new account.');

} else {
?>
<table>
<form name="sign up" action="&l t;? $_SERVER['PHP_S ELF']; ?>" method="PO ST">
<tr>
<td>Usern ame: <BR> (only A-Z, 0-9 and _ Allowed)<BR& gt;</td>
<td><i nput type="text " id ="username " name="user name" value="&qu ot; maxlength=" ;30"> <BR></ td>
</tr>
<tr>
<td>Passw ord:</td>
<td><i nput type="pass word" id="passwo rd" name="pass word" value="&qu ot; maxlength=" ;30">&l t;BR> (minimum 6

characters)< /td>
</tr>
<tr>
<td>Verif y Pass:</td> ;
<td><i nput type="pass word" id="verify _password" name="veri fy_password&quo t; value="&qu ot; maxlength=" ;30">&l t;BR>

</td>
</tr>
<tr>
<td>Email :</td>
<td><i nput type="text " id="email& quot; name="emai l" value="&qu ot; size="30&q uot;><br& gt;</td>
</tr>
<tr>
<td>Click to Complete Signup:</td& gt;
<td><i nput type="subm it" id="submit " name="subm it" value="sub mit">&l t;/td>
</tr>
</form>
</table>
<?
} //end not logged in
} //end submit not pressed
?>



This is line 20

Code:
//array of invalid characters
$junk = array('.' , ',' , '/' , '\' , '`' , ';' , '[' , ']' , '-', '_', '*', '&', '^', '%', '$', '#', '@', '!', '~', '+', '(', ')', '|', '{', '}', '<', '>', '?', ':', '"', '=');



Thanks in advance

Edited at 09:25:41 pm on 02/23/08


    Viewed: 4,332 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Complete Member Ship "reg..." Posted: @ 12:23 am on Feb 24 2008    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

This person had the exact same problem, read the solution to this thread: http://www.all syntax.com/foru ms/view.php?f=4 &t=120& p=944&pg=1< /font>

thanks




-bs0d | AllSyntax.com

    Viewed: 4,321 Times | Reply to This | To top
  This user is offline  Genius
  Subject: "re: Complete Member Ship "reg..." Posted: @ 3:35 am on Feb 24 2008    

Member #: 582
Rank: User - (77)
Since: 02/18/08
Posts: 76
From: kmmk

OK. My bad, I fixed the problem. My Apache didn't log errors until I restarted the servers. My problem was "<?&q uot; at the end of code. Didn't have chance to turn PHP thing on.

Apalogies!



Edited at 03:50:49 am on 02/24/08


    Viewed: 4,314 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank