newbie

newbie

am 18.09.2007 13:28:21 von cory

Hi at all, I'm newbie in php and I'm searching to make function one
project that I found in a school book, the project is ok because it
functions a part some script. I'd like to know which is the error.
I'm working on win xp pro and on it I have installed a server apache
ver.2.2.4
php ver. 5.2.4, mysql server and client ver.
3.23

I report you the problem:
When I compile the form, my data that I fill in, it has not
processed.The thing strange is that when I change version of Apache,
version of php, And version of mysql the problem becomes another in
other words is another script that don't go.
here is the script:

include ("admin/config.php");
include ("admin/users.php");

########################################################
## NEW MEMBER REGISTER
########################################################
if($register=="Register New Member"){


//****************************
// CHECK FOR USER AND EMAIL **
//****************************

$SELECT_USERS = mysql_query("SELECT * FROM users WHERE
Username='$username'",$db);
$USER_EXISTS = mysql_num_rows($SELECT_USERS);

$SELECT_EMAILS = mysql_query("SELECT * FROM users WHERE
Email='$email'",$db);
$EMAIL_EXISTS = mysql_num_rows($SELECT_EMAILS);



//******************
// BEGIN CHECK **
//******************

if(strlen($firstname)<3){$msg[1] = "Firstname too short";}
if(strlen($surname)<3) {$msg[2] = "Surname too short";}
if(strlen($telephone)<6){$msg[3] = "Not a valid phone number";}
if(strlen($email)<3) {$msg[4] = "Not a valid e-mail address";}
if(strlen($address)<10) {$msg[5] = "Address is too short";}
if(strlen($city)<3) {$msg[6] = "City name too short";}
if(strlen($postcode)<4) {$msg[7] = "Postcode too short";}
if(strlen($country)<3) {$msg[8] = "Country too short";}

if($EMAIL_EXISTS) {$msg[4] = "E-mail already exists";}

if(strlen($username)<3) {$msg_user = "Very short username";}

if($USER_EXISTS) {$msg_user = "Username already exists";}
else{$user_ok = 1;}

if(strlen($password)<6) {$msg_pass = "Please use more than 6
characters";}
else{$pass_ok = 1;}

if((count($msg)!= 0)||(!$user_ok)||(!$pass_ok)) {$msg[0] = "Error on
creating new account";}
else{$details_ok = 1;}


//*****************************
// SUCCESSIVE REGISTRATION **
//*****************************

if(($details_ok)&&($user_ok)&&($pass_ok)){

$md5_password = md5($password);

$INSERT = mysql_query("INSERT INTO users (
Username,
Password,
Firstname,
Surname,
Company,
Address,
City,
County,
Postcode,
Country,
Telephone,
Mobile,
Fax,
Email
)

VALUES (
'$username',
'$md5_password',
'$firstname',
'$surname',
'$company',
'$address',
'$city',
'$county',
'$postcode',
'$country',
'$telephone',
'$mobile',
'$fax',
'$email'
)",$db);

if($INSERT){$meta_next = "";
$msg[0]= "Thank You!";


//*****************************
// INSERT CARDHOLDER DETAILS **
//*****************************
$INSERT_CARDHOLDER = mysql_query("INSERT INTO cardholders (

Username,
Firstname,
Surname,
Address,
City,
Postcode,
Country,
Telephone,
Email,
Mobile,
Fax,
Cardtype,
Cardname,
Cardnumber,
Cardexpire
)

VALUES (
'$username',
'$firstname',
'$surname',
'$address',
'$city',
'$postcode',
'$country',
'$telephone',
'$email',
'$mobile',
'$fax',
'$cardtype',
'$username',
'$cardnumber',
'$cardexpire'
)",$db);

if($INSERT_CARDHOLDER){$msg_cardholder = "Done!";}
else{$msg_cardholder = "Error";}


//*****************************
// INSERT SHIPPING DETAILS **
//*****************************
$INSERT_SHIPPING = mysql_query("INSERT INTO shipping (

Username,
Firstname,
Surname,
Address,
City,
Postcode,
Country,
Telephone
)

VALUES (
'$username',
'$firstname',
'$surname',
'$address',
'$city',
'$postcode',
'$country',
'$telephone'
)",$db);

if($INSERT_SHIPPING){$msg_shipping = "Done!";}
else{$msg_shipping = "Error";}


//***************************************************
//REPLACE ANONYMOUS ITEM SELECTIONS/NORMAL USERNAME *
//***************************************************

$SELECT_ITEMS = mysql_query("SELECT * FROM cart WHERE
Username='$user'",$db);
$DELETE_USER = mysql_query("DELETE FROM users_anonymous WHERE
IDName='$user'",$db);

while($item = mysql_fetch_array($SELECT_ITEMS)){

$UPDATE_ITEMS = mysql_query("UPDATE cart SET
Username ='$username',
Date ='$tdate'
WHERE Username='$user'",$db);
}

//***************************************************
//MAKES THE USER A MEMBER *
//***************************************************

$loggedin=1;
$set_cookie = setcookie ("customer","$username",time()+2600000);


}
else{$meta_next = NULL;}
}

}

?>



<?=$conf[title];?>







height="575">




















width="190" height="101">
  

width="26" align="right">
align="center" class="text_small_1">

width="10" height="10">



class="menu_1">   b>REGISTER
height="168" align="center">








cellpadding="3" class="text_small_1">









Personal Member Details: class="register">




cellpadding="3" height="78" bgcolor="#ECEEF0">








































































width="21%">Firstname:
value="">
*

width="21%">Surname:
value="">
*

width="21%">Company:
value="">
background="images/seprow.gif">
width="21%">Address:

*

width="21%">City:
value="">
*

width="21%">Postcode:
value="">
*

width="21%">Country:
value="">
*

width="21%">Telephone:
value="">
*

width="21%">Mobile:
value="">
width="21%">Fax:
value="">
E-
mail:

value="">
*

background="images/seprow.gif">
width="21%">Username:
value="">
*

width="21%">Password:
class="boxes">
*

background="images/seprow.gif">
width="21%">Mailing list?
checked>
Receive any latest
news on your
e-mail!
bgcolor="#E6E6E6">
bgcolor="#E6E6E6">
value="Register New Member" class="buttons">

colspan="2" bgcolor="#E6E6E6">



href="index.php">











width="174">





Re: newbie

am 18.09.2007 13:41:20 von Jerry Stuckle

cory wrote:
> Hi at all, I'm newbie in php and I'm searching to make function one
> project that I found in a school book, the project is ok because it
> functions a part some script. I'd like to know which is the error.
> I'm working on win xp pro and on it I have installed a server apache
> ver.2.2.4
> php ver. 5.2.4, mysql server and client ver.
> 3.23
>
> I report you the problem:
> When I compile the form, my data that I fill in, it has not
> processed.The thing strange is that when I change version of Apache,
> version of php, And version of mysql the problem becomes another in
> other words is another script that don't go.
> here is the script:
>



Please do not multi-post. Cross-post instead, if you must.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: newbie

am 18.09.2007 15:07:48 von Lammi

that code will never work on php5 or 4 , if you're not editing
php.ini. your script uses globals, that are de-activated by default
sind php4.
you're using short tags, that must be activated in php.ini too (they
are activated by default i think).

php-code isn't compiled ever. it's parsed.

it would be extremly useful if you post the errormessage instead of
loads of html.

Re: newbie

am 18.09.2007 16:17:52 von Michael Fesser

..oO(Lammi)

>php-code isn't compiled ever.

PHP code is compiled into a bytecode, which is then interpreted by the
Zend engine. Code caches are able to keep the compiled code in memory to
speed up the script execution.

>it's parsed.

Parsing is one of the steps that have to be done before code can be
compiled.

Micha

Re: newbie

am 18.09.2007 18:44:32 von Jerry Stuckle

Michael Fesser wrote:
> .oO(Lammi)
>
>> php-code isn't compiled ever.
>
> PHP code is compiled into a bytecode, which is then interpreted by the
> Zend engine. Code caches are able to keep the compiled code in memory to
> speed up the script execution.
>
>> it's parsed.
>
> Parsing is one of the steps that have to be done before code can be
> compiled.
>
> Micha

Nope, Lammi is correct. PHP code is not compiled, it is parsed. It may
or may not be stored as byte code.

Not even Zend claims PHP is compiled.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: newbie

am 18.09.2007 19:10:03 von Michael Fesser

..oO(Jerry Stuckle)

>Nope, Lammi is correct. PHP code is not compiled, it is parsed. It may
> or may not be stored as byte code.

The parser is just a part of the entire process.

>Not even Zend claims PHP is compiled.

| [...] The Web Server Disk retrieves the code for the PHP-based web
| page and sends the PHP code to the Run-time Compiler. (3). The Zend
| Engine Run-time Compiler creates an compiled representation of the
| script, which is passed on to the Zend Engine Executor. [...]

(from )

There's even the special function __halt_compiler().

Micha