RE: [PHP-DB] php/sendmail help!

2006-02-09 Thread bastien_k

You are in serious need of some regex here...google email regex and you will 
have enough results to get you what you want.

Postal Code (assume 2 letters 4 dgits in that order

  if (ereg(^[A-Z]{2}{0-9]{4}$,$_POST['postal'])){
...

As for pasting it back to the form, I would suggest you have the form as a 
function and the processing code as a function, then you can pass the post 
arrays back and forth and pass the error handling along with it

Bastien

From: JeRRy [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] php/sendmail help!
Date: Tue, 7 Feb 2006 13:22:53 +1100 (EST)

Hi, I have a form, form results are PUSHED to another page and processed.  
Files below. (in plain-tet)

   Now this is what I want to do:

   1) Make all fields required input, but if easy to configure I want to 
have rules for each textarea.  For instance an email address must contain a 
'@' symbol.  Must be at leat 5 character longs and must be in a form of an 
email address.  So if I type [EMAIL PROTECTED] it would produce an error, 
highlighting 
the error area or display a message at the top of the page.  Postcode 
should contain 4 numbers and numbers only, etc.  The only field that can be 
left blank will be the message area.  How do I achieve this? (message 
regarding this below)

   2) I want to add to the form a UNIQUE ID generater.  I will add a new 
hidden form field for this.  I need a script called by PHP to generate it.  
Would include both letters and numbers and be atleast 8 CHARS long.

   As for 1) I have tried some javascript but it failed, since I PUSH all 
field responses to another page.  When i add it the submit button fails and 
does not push the results through.  But it produces the error fine, but 
form is not PUSHED on.  So it seems it's lost because of the javascript.  
So i took it out completely.  I think there is a way in PHP to call errors 
for forms?  But anways, here are the files below.  Please help, I am on a 
tight schedule here if anyone can assist me.

   file one looks like this: (form.php)

   ? include(header.php);?
   table width=800 border=0
   tr
 td width=270 valign=top? include(menu.php);?/td
 td width=500 valign=center
   DIV ALIGN=JUSTIFY
   ? include(ads.php);?
   h1bPre Order Form!/h1/b
   TABLE  WIDTH=90% ALIGN=left CELLSPACING=1 CELLPADDING=4 
BORDER=0
 FORM ACTION=contact1.php METHOD=POST
font face=arial
trtdFirst Name:/td tdINPUT TYPE=text NAME=firstname SIZE=25 
MAXLENGTH=20/td/trBRBtrtd
Last Name:/td/BtdINPUT TYPE=text NAME=lastname SIZE=25 
MAXLENGTH=25/td/trBtrtd
BtrtdCompany:/td/BtdINPUT TYPE=text NAME=company SIZE=25 
MAXLENGTH=25/td/trBRBtrtd
Unit/House #:/td/BtdINPUT TYPE=text NAME=address1 SIZE=25 
MAXLENGTH=6/td/trBRBtrtd
Street Name:/td/BtdINPUT TYPE=text NAME=address2 SIZE=25 
MAXLENGTH=25/td/trBRBtrtd
Suburb/Town:/td/BtdINPUT TYPE=text NAME=suburb SIZE=25 
MAXLENGTH=25/td/trBRBtrtd
Post Code/Zip:/td/BtdINPUT TYPE=text NAME=postcode SIZE=25 
MAXLENGTH=25/td/trBRBtrtd
Phone #:/td/BtdINPUT TYPE=text NAME=phone SIZE=25 
MAXLENGTH=25/td/trBRBtrtd
Email Address:/td/BtdINPUT TYPE=text NAME=emailaddress SIZE=25 
MAXLENGTH=25/td/trBRBtrtd/td/Btd 
/td/trBRBtrtdCountry:/td/BtdSELECT NAME=country 
SIZE=1OPTION SELECTEDAUSTRALIAOPTIONNEW 
ZEALANDOPTIONFIJIOPTIONUNITED 
KINGDOMOPTIONGERMANYOPTIONSWEDENOPTIONCANADAOPTION-OPTIONAFGHANISTANOPTIONALBANIAOPTIONALGERIAOPTIONAMERICAN
 
SAMOAOPTIONANDORRAOPTIONANGOLAOPTIONANGUILLAOPTIONANTARCTICAOPTIONANTIGUA
 
AND 
BARBUDAOPTIONARGENTINAOPTIONARMENIAOPTIONARUBAOPTIONAUSTRIAOPTIONAZERBAIJANOPTIONBAHAMASOPTIONBAHRAINOPTIONBANGLADESHOPTIONBARBADOSOPTIONBELARUSOPTIONBELGIUMOPTIONBELIZEOPTIONBENINOPTIONBERMUDAOPTIONBHUTANOPTIONBOLIVIAOPTIONBOSNIA
 
AND HERZEGOWINAOPTIONBOTSWANAOPTIONBOUVET 
ISLANDOPTIONBRAZILOPTIONBRITISH INDIAN OCEAN TERRITORYOPTIONBRUNEI 
DARUSSALAMOPTIONBULGARIAOPTIONBURKINA
  
FASOOPTIONBURUNDIOPTIONCAMBODIAOPTIONCAMEROONOPTIONCANADAOPTIONCAPE 
VERDEOPTIONCAYMAN ISLANDSOPTIONCENTRAL AFRICAN 
REPUBLICOPTIONCHADOPTIONCHILEOPTIONCHINAOPTIONCHRISTMAS 
ISLANDOPTIONCOCOS (KEELING) 
ISLANDSOPTIONCOLOMBIAOPTIONCOMOROSOPTIONCONGOOPTIONCOOK 
ISLANDSOPTIONCOSTA RICAOPTIONCOTE D'IVOIREOPTIONCROATIA (local name: 
Hrvatska)OPTIONCUBAOPTIONCYPRUSOPTIONCZECH 
REPUBLICOPTIONDENMARKOPTIONDJIBOUTIOPTIONDOMINICAOPTIONDOMINICAN 
REPUBLICOPTIONEAST TIMOROPTIONECUADOROPTIONEGYPTOPTIONEL 
SALVADOROPTIONEQUATORIAL 
GUINEAOPTIONERITREAOPTIONESTONIAOPTIONETHIOPIAOPTIONFALKLAND 
ISLANDS (MALVINAS)OPTIONFAROE 
ISLANDSOPTIONFIJIOPTIONFINLANDOPTIONFRANCEOPTIONFRANCE, 
METROPOLITANOPTIONFRENCH GUIANAOPTIONFRENCH POLYNESIAOPTIONFRENCH
  
OTHEROPTIONGABONOPTIONGAMBIAOPTIONGEORGIAOPTIONGERMANYOPTIONGHANAOPTIONGIBRALTAROPTIONGREECEOPTIONGREENLANDOPTIONGRENADAOPTIONGUADELOUPEOPTIONGUAMOPTIONGUATEMALAOPTIONGUINEAOPTIONGUINEA-BISSAUOPTIONGUYANAOPTIONHAITIOPTIONHEARD
 
AND MC DONALD ISLANDSOPTIONHONDURASOPTIONHONG 
KONGOPTIONHUNGARYOPTIONICELANDOPTIONINDIAOPTIONINDONESIAOPTIONIRAN 
(ISLAMIC REPUBLIC 

RE: [PHP-DB] Re: UPDATE command

2005-06-20 Thread bastien_k
used is a column name, if you need to surround it use the back ticks (beow 
the esc key, same button as the tilde (~). That is why it fails...it 
shouldn't be req'd for the update, though the value may need to be quoted 
depending on the col data type

Bastien

From: Ron Piggott [EMAIL PROTECTED]
Reply-To: Ron Piggott [EMAIL PROTECTED]
To: Webmaster [EMAIL PROTECTED]
CC: PHP DB php-db@lists.php.net
Subject: [PHP-DB] Re: UPDATE command
Date: Fri, 17 Jun 2005 23:47:31 -0400

This is kind of interesting ...

$query=SELECT * FROM quiettimequotation WHERE used = 0 ORDER BY RAND()
LIMIT 1;

works;

$query=SELECT * FROM bibleverses WHERE 'used' = 0 ORDER BY RAND() LIMIT 
1;

doesn't!  Having the ' around used makes that select command fail --- but
the UPDATE command requires it!

Thanks for those of you who responded to my question below.  I am creating 
a
mailing list for my web site that I am wanting each entry which is randomly
selected from the database to only be used once and not be available again
until the entire list has been used.  I needed the UPDATE command to change
the used column all back to 0 again once the last entry had been selected
from the database.  I think I like programming mySQL stuff :)  Ron

---

 Does the UPDATE command only change one row or each occurance if the the
 criteria repeat itself through the table?

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


GWAVAsigAdmID:2D9388A3F9FA0C7BE52690ABC7B22408



**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


GWAVAsig
-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP-DB] addslashes + stripslashes + mysql question

2005-05-17 Thread bastien_k
turn of magic quotes or test for it before using addslashes

Bastien

From: Petzo [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] addslashes + stripslashes + mysql question
Date: Mon, 16 May 2005 11:20:41 +0300

Hi,

 My question is about the norlmal behaviour of PHP and MYSQL but I cant
explain it without a simple example. Thank you for reading:

 I have the following code:

?php
print $t = $_POST['txt'];
print $t = addslashes($t);

@ $db = mysql_pconnect(xxx,xxx,xxx);
mysql_select_db('test');

$q = update ttable set ffield='$t';
mysql_query($q);

$q = select * from ttable;
$result = mysql_query($q);
$bo = mysql_fetch_array($result);

print $t = $bo['ffield'];
print $t = stripslashes($t);
?



from a HTML form I send variable:

' \ \' \\ \\\


after addshashes it becomes:

\' \\ \\\'  \\


after that it gets in the database

but after I get it out it becomes:

' \ \' \\ \\\

(without the backslashes!)

and ofcourse after stripslashes it gets messed-up:

' ' \ \


So my question is if this is a normal behaviour for PHP+MYSQL or it may 
vary
indifferent conficurations or versions of both php or mysql.
It's not a bad thing to be like that but I wonder if my code will behave 
the
same at most systems.

Thank you very much

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


GWAVAsigAdmID:D8E9019DA2421EF16B6F98046B509684



**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


GWAVAsig
-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php