PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > newbie
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
newbie

Réponse
 
LinkBack Outils de la discussion
Vieux 18/09/2007, 12h28   #1
cory
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut newbie

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 = "<META HTTP-EQUIV='REFRESH' CONTENT='1;
URL=products.php'>";
$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_ = set ("customer","$username",time()+2600000);


}
else{$meta_next = NULL;}
}

}

?>

<html>
<head>
<title><?=$conf[title];?></title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<?=$meta_next;?>

<link rel="stylesheet" href="style.css" type="text/css">
</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
<table width="800" border="0" cellspacing="0" cellpadding="0"
height="575">
<tr bgcolor="#8F97AF">
<td colspan="4" height="58"><img src="images/logo_1.gif"
width="190" height="101"></td>
</tr>
<tr>
<td colspan="4" height="1" bgcolor="#FFFFFF"></td>
</tr>
<tr>
<td height="16" bgcolor="#336699" width="122"></td>
<td height="24" bgcolor="#336699" width="478"> &nbsp;&nbsp;
<?include("menu_links.php");?>
</td>
<td height="26" rowspan="2" valign="bottom" bgcolor="#336699"
width="26" align="right">
<img src="images/corner.gif"></td>
<td height="26" rowspan="2" bgcolor="#336699" width="174"
align="center" class="text_small_1"><font color="#FFFFFF">
<?if($loggedin){echo "Hello $user";}?>
</font></td>
</tr>
<tr>
<td width="122" valign="top" rowspan="2"><img src="images/
hi_contrast_side2.gif" width="122" height="501"></td>
<td width="478" height="11"><img src="images/corner2.gif"
width="10" height="10"></td>
</tr>
<tr>
<td height="506" colspan="2" valign="top"> <br>
<form name="form1" method="post" action="<?=$PHP_SELF;?>">
<span class="menu_1"><b><font color="#F5F5F5" size="5"><span
class="menu_1"><b><font color="#F5F5F5" size="5">&nbsp;&nbsp;</font></
b></span>REGISTER</font></b></span>
<table width="479" border="0" cellspacing="0" cellpadding="3"
height="168" align="center">
<tr bgcolor="#F8F8F8">
<td valign="top" height="271" align="center"> <br>
<table width="100%" border="0" cellspacing="0"
cellpadding="3" class="text_small_1">
<tr>
<td bgcolor="#CCCCCC">Personal Member Details:<span
class="register">
<?=$msg[0];?>
</span></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"></td>
</tr>
</table>
<br>
<table width="96%" border="0" cellspacing="0"
cellpadding="3" height="78" bgcolor="#ECEEF0">
<tr>
<td class="text_small_4" height="21"
width="21%">Firstname:</td>
<td class="register" height="21" width="79%">
<input type="text" name="firstname" class="boxes"
value="<?=$firstname;?>">
*
<?=$msg[1];?>
</td>
</tr>
<tr>
<td class="text_small_4" height="21"
width="21%">Surname:</td>
<td class="register" height="21" width="79%">
<input type="text" name="surname" class="boxes"
value="<?=$surname;?>">
*
<?=$msg[2];?>
</td>
</tr>
<tr>
<td class="text_small_4" height="21"
width="21%">Company:</td>
<td class="register" height="21" width="79%">
<input type="text" name="company" class="boxes"
value="<?=$company;?>">
</td>
</tr>
<tr>
<td colspan="2" class="text_small_1" height="4"
background="images/seprow.gif"></td>
</tr>
<tr>
<td class="text_small_4" height="21"
width="21%">Address:</td>
<td class="register" height="21" width="79%">
<textarea name="address" class="boxes" rows="5"
cols="30"><?=$address;?></textarea>
*
<?=$msg[5];?>
</td>
</tr>
<tr>
<td class="text_small_4" height="21"
width="21%">City:</td>
<td class="register" height="21" width="79%">
<input type="text" name="city" class="boxes"
value="<?=$city;?>">
*
<?=$msg[6];?>
</td>
</tr>
<tr>
<td class="text_small_4" height="21"
width="21%">Postcode:</td>
<td class="register" height="21" width="79%">
<input type="text" name="postcode" class="boxes"
value="<?=$postcode;?>">
*
<?=$msg[7];?>
</td>
</tr>
<tr>
<td class="text_small_4" height="21"
width="21%">Country:</td>
<td class="register" height="21" width="79%">
<input type="text" name="country" class="boxes"
value="<?=$country;?>">
*
<?=$msg[8];?>
</td>
</tr>
<tr>
<td class="text_small_4" height="21"
width="21%">Telephone:</td>
<td class="register" height="21" width="79%">
<input type="text" name="telephone" class="boxes"
value="<?=$telephone;?>">
*
<?=$msg[3];?>
</td>
</tr>
<tr>
<td class="text_small_4" height="21"
width="21%">Mobile:</td>
<td class="register" height="21" width="79%">
<input type="text" name="mobile" class="boxes"
value="<?=$mobile;?>">
</td>
</tr>
<tr>
<td class="text_small_4" height="8"
width="21%">Fax:</td>
<td class="register" height="8" width="79%">
<input type="text" name="fax" class="boxes"
value="<?=$fax;?>">
</td>
</tr>
<tr>
<td class="text_small_4" height="21" width="21%">E-
mail:</td>
<td class="register" height="21" width="79%">
<input type="text" name="email" class="boxes"
value="<?=$email;?>">
*
<?=$msg[4];?>
</td>
</tr>
<tr>
<td colspan="2" class="text_small_1" height="4"
background="images/seprow.gif"></td>
</tr>
<tr>
<td class="text_small_4" height="21"
width="21%"><b>Username:</b></td>
<td class="register" height="21" width="79%">
<input type="text" name="username" class="boxes"
value="<?=$username;?>">
*
<?=$msg_user;?>
</td>
</tr>
<tr>
<td class="text_small_4" height="21"
width="21%"><b>Password:</b></td>
<td class="register" height="21" width="79%">
<input type="password" name="password"
class="boxes">
*
<?=$msg_pass;?>
</td>
</tr>
<tr>
<td colspan="2" class="text_small_1" height="4"
background="images/seprow.gif"></td>
</tr>
<tr>
<td class="text_small_4" height="21"
width="21%">Mailing list?</td>
<td class="text_small_3" height="21" width="79%">
<input type="checkbox" name="mlist" value="1"
checked>
<span class="text_small_1"> Receive any latest
news on your
e-mail!</span></td>
</tr>
<tr>
<td valign="top" class="text_small_1" height="4"
bgcolor="#E6E6E6">
</td>
<td valign="top" class="text_small_1" height="4"
bgcolor="#E6E6E6">
<input type="submit" name="register"
value="Register New Member" class="buttons">
<input type="reset" name="Submit4" value="Reset
Details" class="buttons">
</td>
</tr>
<tr>
<td valign="top" class="text_small_1" height="4"
colspan="2" bgcolor="#E6E6E6"></td>
</tr>
</table>
<br>
</td>
</tr>
<tr>
<td bgcolor="#F8F8F8" class="text_small_1" height="29"> <a
href="index.php">
</a> </td>
</tr>
</table>
<br>
</form>
<div align="center">
<?=$conf[footer];?>
<br>
</div>
<br>
</td>
<td align="center" height="506" valign="top" bgcolor="#F5F5F5"
width="174">
<br>
<?include ("menu_groups.php");?>
</td>
</tr>
</table>
</body>
</html>

  Réponse avec citation
Vieux 18/09/2007, 12h41   #2
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: newbie

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:
>


<lots of code snipped>

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
==================
  Réponse avec citation
Vieux 18/09/2007, 14h07   #3
Lammi
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: newbie

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.

  Réponse avec citation
Vieux 18/09/2007, 15h17   #4
Michael Fesser
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: newbie

..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
  Réponse avec citation
Vieux 18/09/2007, 17h44   #5
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: newbie

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
==================
  Réponse avec citation
Vieux 18/09/2007, 18h10   #6
Michael Fesser
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: newbie

..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 <http://www.zend.com/zend/technology.php>)

There's even the special function __halt_compiler().

Micha
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 16h18.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,21299 seconds with 14 queries