Search
Left Quote    If at first you don't succeed, redefine success.
- Anon.    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: Member Script Installation Problem
  This user is online  Guest
  Subject: "Member Script Installation Problem" Posted: @ 4:10 pm on Dec 27 2005   
Unregistered
I followed all of the steps in the tutorial, and when I go to the page_header.php the following comes up:
"Parse error: parse error, unexpected '}' in /mounted-storag e/home5/sub003/ sc12642-DIZT/bu ynpay/page_head er.php on line 101"

and when I go to the ob_start.php I get the following:
require_once($_ SERVER['DOCUMEN T_ROOT'].'db_co nnect.php');
Warning: mysql_connect() : Can't connect to local MySQL server through socket '/var/lib/mysql /mysql.sock' (2) in /mounted-storag e/home5/sub003/ sc12642-DIZT/bu ynpay/db_connec t.php on line 11

Warning: mysql_select_db (): Can't connect to local MySQL server through socket '/var/lib/mysql /mysql.sock' (2) in /mounted-storag e/home5/sub003/ sc12642-DIZT/bu ynpay/db_connec t.php on line 13

Warning: mysql_select_db (): A link to the server could not be established in /mounted-storag e/home5/sub003/ sc12642-DIZT/bu ynpay/db_connec t.php on line 13

If anyone could tell me what I did wrong I would appreciate it.

    Viewed: 11,862 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Member Script Installation Prob..." Posted: @ 9:00 pm on Dec 27 2005    

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

I'd read back up on it a bit, you're confused somewhere. There is no ob_start.php - And if you want me to help with the error on your page header, show the code that is line # 101.




-bs0d | AllSyntax.com

    Viewed: 11,854 Times | Reply to This | To top
  This user is online  Guest
  Subject: "re: Member Script Installation Prob..." Posted: @ 9:58 pm on Dec 27 2005    
Unregistered

OK, thank you. Line # 101 is the following:
} //end not logged in



    Viewed: 11,850 Times | Reply to This | To top
  This user is online  Guest
  Subject: "re: Member Script Installation Prob..." Posted: @ 10:01 pm on Dec 27 2005    
Unregistered

Can you tell me what files there should be?



    Viewed: 11,847 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Member Script Installation Prob..." Posted: @ 10:47 pm on Dec 27 2005    

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

files needed: http://www.all syntax.com/tuto rials/PHP/26/Co mplete-Members- System/9.php

Line #101 problem: Go ahead and post your entire code, this will make it easier




-bs0d | AllSyntax.com

    Viewed: 11,842 Times | Reply to This | To top
  This user is online  Guest
  Subject: "re: Member Script Installation Prob..." Posted: @ 11:23 pm on Dec 27 2005    
Unregistered


Code:


if($_SESSION[' logged_in'] == 1)
{
//REDIRECT TO HOMEPAGE
header('Locati on: http://www.buyn pay.com/ . $_SERVER['HTTP _HOST'] . '');
} else {

if(isset($HTTP_ POST_VARS['sub mit']))
{



//BEGIN CHECKING USERNAME...
if(!$_POST['us ername']) die('Alert: username field was blank.');

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

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

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

//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(&q uot;SELECT * FROM `members` WHERE `username` = '".$_POS T['username'] ."');
$q3 = mysql_fetch_obj ect($q2);

if($q3->user name == $_POST['userna me']) {
die('<BR&g t;<BR>Sor ry, but the username "'.$q3-& gt;username.' " is taken, please choose another.');
}



if(!$_POST['pa ssword']) {
die('Error: Password field was blank');
}
if(!$_POST['ve rify_password' ]) {
die('Error: Verify Password field was blank.');
}
if($_POST['pas sword'] != $_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.');
}



$insert ="INSERT INTO `members` (username, user_password, user_email) VALUES ('".$_PO ST['username' ]."',

'".md5($ _POST['passwor d'])."' , '".$_POS T['email'].& quot;')" ;

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

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

} else {
?>


<table>
<form name="sig nup" action="& lt;? $_SERVER['PHP_ SELF']; ?>" method="P OST">
<tr>
<td>Usern ame: <BR> (only A-Z, 0-9 and _ Allowed)<BR& gt;</td>
<td><i nput type="tex t" id ="usernam e" name="use rname" value="& quot; maxlength=&quo t;30"> <BR></ td>
</tr>
<tr>
<td>Passw ord:</td>
<td><i nput type="pas sword" id="passw ord" name="pas sword" value="& quot; maxlength=&quo t;30"> <BR> (minimum 6

characters)< /td>
</tr>
<tr>
<td>Verif y Pass:</td> ;
<td><i nput type="pas sword" id="verif y_password&quo t; name="ver ify_password&q uot; value="& quot; maxlength=&quo t;30"> <BR>

</td>
</tr>
<tr>
<td>Email :</td>
<td><i nput type="tex t" id="email " name="ema il" value="& quot; size="30 "><b r></td> ;
</tr>
<tr>
<td>Click to Complete Signup:</td& gt;
<td><i nput type="sub mit" id="submi t" name="sub mit" value="su bmit"> </td>
</tr>
</form>
</table>
<?
} //end not logged in
} //end submit not pressed
?>




Edited at 11:31:28 pm on 12/27/05

    Viewed: 11,838 Times | Reply to This | To top
  This user is online  Guest
  Subject: "re: Member Script Installation Prob..." Posted: @ 11:25 pm on Dec 27 2005    
Unregistered

Is each of the sections of code a different file? By sections I mean boxes that you select the code out of. Thank you for your help.



    Viewed: 11,835 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Member Script Installation Prob..." Posted: @ 11:31 pm on Dec 27 2005    

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

yea, login file codes goes into your login.php file, logout file code goes into your logout.php file and so on. the page_header code is code that needs to appear on every page of your site that you want to recognize a members status.

also on your code, change your header(); code to this:

header('Locati on: http://www.buyn pay.com');

see if that helps.




-bs0d | AllSyntax.com

    Viewed: 11,828 Times | Reply to This | To top
  This user is online  Guest
  Subject: "re: Member Script Installation Prob..." Posted: @ 4:23 am on Dec 28 2005    
Unregistered

What is this "header( 'Location: http://www.buyn pay.com');&qu ot;
supposed to be the location of? Is that the location of the header? If so if I want to have multiple pages be protected do I need to put multiple locations?

I think I have the files right now I have a login.php, logout.php, register.php, db_connect.php. However when I tried to use this I recieved the following error when I went to the register.php :
"Parse error: parse error, unexpected ')' in /mounted-storag e/home5/sub003/ sc12642-DIZT/bu ynpay/member/re gister.php on line 9"

Line 9 is: header('Locati on: http://www.buyn pay.com/member/ index.htm'); $_SERVER['HTTP _HOST'] . '');

Thank you very much for your help!



    Viewed: 11,824 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Member Script Installation Prob..." Posted: @ 6:15 pm on Dec 28 2005    

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

9 would be:
header('Locati on: http://www.buyn pay.com/member/ index.htm');

not

header('Locati on: http://www.buyn pay.com/member/ index.htm'); $_SERVER['HTTP _HOST'] . '');




-bs0d | AllSyntax.com

    Viewed: 11,814 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