[PHP] Re: form validation

2012-12-20 Thread Jim Giner

On 12/20/2012 10:27 AM, David Mehler wrote:

Hello,

I just read the Php5 changelog. Legacy features specifically magic
quotes were removed, does that mean that any system running php 5.4 or
newer does not need to use either addslashes() or stripslashes() when
dealing with form input?

Thanks.
Dave.

As I understood it, addslashes was never preferred, nor was 
magic_quotes=on.  Now that magic_quotes is gone, you will have to make 
sure that you are using some validation/sanitation method on your 
incoming data.  If you are using mysql for a db, then you should already 
be using mysql_real_escape_string in place of addslashes.


The PHP manual has quite a bit on these subjects.

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



Re: [PHP] Re: form validation

2012-12-20 Thread Daniel Brown
On Thu, Dec 20, 2012 at 10:34 AM, Jim Giner
jim.gi...@albanyhandball.com wrote:

 If you are using
 mysql for a db, then you should already be using mysql_real_escape_string in
 place of addslashes.

Actually, you should start moving toward MySQLi, as mysql_*() is deprecated.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] Re: form validation

2012-12-20 Thread Jonathan Sundquist
On Thu, Dec 20, 2012 at 9:34 AM, Jim Giner jim.gi...@albanyhandball.comwrote:

 If you are using mysql for a db, then you should already be using
 mysql_real_escape_string in place of addslashes.


You should not be using mysql_real_escape_string going forward as it will
be deprecated in php 5.5.0.
http://php.net/manual/en/function.mysql-real-escape-string.php.  You should
be looking to use either mysqli functions or the PDO class.


Re: [PHP] Re: form validation

2012-12-20 Thread Jim Giner

On 12/20/2012 10:36 AM, Daniel Brown wrote:

On Thu, Dec 20, 2012 at 10:34 AM, Jim Giner
jim.gi...@albanyhandball.com wrote:


If you are using
mysql for a db, then you should already be using mysql_real_escape_string in
place of addslashes.


 Actually, you should start moving toward MySQLi, as mysql_*() is 
deprecated.


true dat.

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



[PHP] Re: Form Validation filter - Regex Q

2009-11-12 Thread Nisse Engström
On Tue, 10 Nov 2009 09:34:52 -0800, Haig Davis wrote:

 foreach($_POST as $keyTemp = $valueTemp){
 $key = mysqlclean($keyTemp);
 $value = mysqlclean($valueTemp);

Mysql and form validation are totally unrelated.
In my mind, this seems spectacularly misguided.

 if($key = ($customerServiceEmail) || ($billingEmail)){
 
 if(preg_match(/^([a-za-z0-9._%...@[a-za-z0-9.-]+\.[a-za-z]{2,4})*$/,
 $value)){

Just as almost every other email validation regexp
I have seen, this has a few imperfections:

* It does not allow some valid email addresses (mail!...@example.com)
* It does not allow some valid domains (*.museum)
* It allows invalid email addresses (@example.com)
* It allows invalid domains (example..com)

 $style = yellow;
 $formMsg = Invalid Characters;
 $bad = $key;

Personally, I'd put the invalid keys in an array and
mark all the problematic fields at once.


/Nisse

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



[PHP] Re: Form Validation filter - Regex Q

2009-11-12 Thread Al



Haig Davis wrote:

 Morning All,

I've been figthing with this little problem for two days now, so far no luck
with google and am beginning to question my own sanity.

I have a application that has over one hundred forms some quite lengthy so
what I'm trying to achieve rather than writing a bunch of individual
sanitize statements then form validation statemenst that I could run $_POST
through a foreach loop and filter the values by form class i.e.is it an
emaill addreess or simply a text block with letters and numbers. The regex's
alone work fine as does the foreach loop the only issue I have is the IF
statement comparing $key to expected varieable names.

Heres the bit of code envolved.

if(isset($_POST['submit'])){
foreach($_POST as $keyTemp = $valueTemp){
$key = mysqlclean($keyTemp);
$value = mysqlclean($valueTemp);
$$key = $key;
$$key = $value;

if($key != ($customerServiceEmail) || ($billingEmail) ||
($website)){
if(preg_match(/[^a-zA-Z0-9\s]/, $value)){
$style = yellow;
$formMsg = Invalid Characters;
$bad = $key;

}
}
if($key = ($customerServiceEmail) || ($billingEmail)){

if(preg_match(/^([a-za-z0-9._%...@[a-za-z0-9.-]+\.[a-za-z]{2,4})*$/,
$value)){
$style = yellow;
$formMsg = Invalid Characters;
$bad = $key;
}
}

}
}

Thanks for taking a peek.

Haig



Sorry about the misreading your request, earlier.

Here is a function that I use.

function checkEmailAddr($emailAddr)
{
if(empty($emailAddr))
{
throw new Exception(No email address provided);
}

if(!preg_match(%...@%, $emailAddr))
{
throw new Exception(Email address missing mailbox name, or syntax is 
wrong. );

}

if(!filter_var($emailAddr, FILTER_VALIDATE_EMAIL))
{
throw new Exception(Email address error. Syntax is wrong. );
}
$domain = substr(strchr($emailAddr, '@'), 1);
if(!checkdnsrr($domain))
{
throw new Exception(Email address warning. Specified domain 
\$domain\ appears to be invalid. Check carefully.);

}
return true;
}

Use the function like this

try{
checkEmailAddr($userSubmitedDataArray[EMAIL_ADDR_FIELD]);
}

catch (Exception $e)
{
$userErrorMsg = $e-getMessage(); //Message text in check function
}


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



[PHP] Re: Form Validation filter - Regex Q

2009-11-11 Thread Manuel Lemos
Hello,

on 11/10/2009 03:34 PM Haig Davis said the following:
 I've been figthing with this little problem for two days now, so far no luck
 with google and am beginning to question my own sanity.
 
 I have a application that has over one hundred forms some quite lengthy so
 what I'm trying to achieve rather than writing a bunch of individual
 sanitize statements then form validation statemenst that I could run $_POST
 through a foreach loop and filter the values by form class i.e.is it an
 emaill addreess or simply a text block with letters and numbers. The regex's
 alone work fine as does the foreach loop the only issue I have is the IF
 statement comparing $key to expected varieable names.

I am not a big fan of filtering. If the form has invalid data, do not
accept it, just show the form again to the user and make it fix it. He
may have made a mistake and if you fix his mistakes, you may be doing it
incorrectly.

What I suggest is to present the form again to the user denoting invalid
fields.

You may want to watch this tutorial video on this subject:

http://www.phpclasses.org/browse/video/1/package/1/section/usage.html

Other than that, doing all validation by hand is painful. You may want
to try this forms generation and validation package that performs all
the necessary types of validation on the server side in PHP and on
browser side using Javascript generated by the class within your form
template.

http://www.phpclasses.org/formsgeneration

Take a look here for a live example:

http://www.meta-language.net/forms-examples.html?example=test_form

If you have many forms for CRUD (Create, Retrieve, Update and Delete)
operations, you may want to also use this plug-in that automates the
generation of tha types of forms so you can do it in a fraction of your
time.

http://www.meta-language.net/forms-examples.html?example=test_scaffolding_input


-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



[PHP] Re: Form Validation filter - Regex Q

2009-11-10 Thread Al



Haig Davis wrote:

 Morning All,

I've been figthing with this little problem for two days now, so far no luck
with google and am beginning to question my own sanity.

I have a application that has over one hundred forms some quite lengthy so
what I'm trying to achieve rather than writing a bunch of individual
sanitize statements then form validation statemenst that I could run $_POST
through a foreach loop and filter the values by form class i.e.is it an
emaill addreess or simply a text block with letters and numbers. The regex's
alone work fine as does the foreach loop the only issue I have is the IF
statement comparing $key to expected varieable names.

Heres the bit of code envolved.

if(isset($_POST['submit'])){
foreach($_POST as $keyTemp = $valueTemp){
$key = mysqlclean($keyTemp);
$value = mysqlclean($valueTemp);
$$key = $key;
$$key = $value;

if($key != ($customerServiceEmail) || ($billingEmail) ||
($website)){
if(preg_match(/[^a-zA-Z0-9\s]/, $value)){
$style = yellow;
$formMsg = Invalid Characters;
$bad = $key;

}
}
if($key = ($customerServiceEmail) || ($billingEmail)){

if(preg_match(/^([a-za-z0-9._%...@[a-za-z0-9.-]+\.[a-za-z]{2,4})*$/,
$value)){
$style = yellow;
$formMsg = Invalid Characters;
$bad = $key;
}
}

}
}

Thanks for taking a peek.

Haig



1] Pear has several classes that will help you from reinventing the wheel.

2] I always, when possible, restrict what users are allowed to enter.  Then, I 
simply delete or warn them about anything that is not permissible. e.g., they 
can enter any of the plain html tags. Any tags not in this list are removed.


//region Usable XHTML elements for user admin prepared user instructions 
[Only these XHTML tags can be used] /


$inlineHtmlTagsArray = array('a', 'b', 'img', 'em', 'object', 'option', 
'select', 'span', 'strong',);//Note img is both empty and inline

$blockHtmlTagsArray = array('div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 
'pre',);
$emptyHtmlTagsArray = array('br', 'hr', 'img',);
$listHtmlTagsArray = array('li', 'ol', 'ul');
$tableHtmlTagsArray = array('col', 'table', 'tbody', 'td', 'th', 'thead', 
'tr',);

I also do syntax and reverse DNS tests for all links and email addresses.


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



[PHP] Re: Form Validation filter - Regex Q

2009-11-10 Thread Nathan Rixham
Haig Davis wrote:
 alone work fine as does the foreach loop the only issue I have is the IF
 statement comparing $key to expected varieable names.
 
 if($key != ($customerServiceEmail) || ($billingEmail) ||

multiple points here..

1: is the key name held in a php variable called $customerServiceEmail?

if you have input name=customerServiceEmail / then use:
?php
if( $key != 'customerServiceEmail' )
?

if you have input name=$customerServiceEmail / then use:
?php
if( $key != '$customerServiceEmail' )
?


2: if you need to compare multiples then you need to use either..

?php
if( !in_array( $key , array('customerServiceEmail' , 'billingEmail' ,
'website') ) ) {
?

?php
if( $key != 'customerServiceEmail'  $key != 'billingEmail'  $key !=
'website' )
?

note in the above I've *ass*umed some mistyped logic, in that only
proceed if not ('customerServiceEmail' || 'billingEmail' || 'website') -
which is in correct because string || string || string *always* equals 1
- hence you need the 3 comparisons achieved by using and() or in_array.


3: these two lines override each other, and variable variables aren't
needed here
$$key = $key;
$$key = $value;


here's a full version for you that should work as you expect:

?php
if( isset($_POST['submit']) ) {
  foreach($_POST as $keyTemp = $valueTemp){
$key = mysqlclean($keyTemp);
$value = mysqlclean($valueTemp);
if( in_array( $key , array( 'customerServiceEmail' , 'billingEmail'
) ) ) {
  // only email validate if its an email field
  if(
preg_match(/^([a-za-z0-9._%...@[a-za-z0-9.-]+\.[a-za-z]{2,4})*$/,
$value) ) {
$style = yellow;
$formMsg = Invalid Characters;
$bad = $key;
  }
} else if( $key == 'website' ) {
  // placeholder incase you want URL validation
} else {
  // only gets here if not and email field, and not a website address
  if(preg_match(/[^a-zA-Z0-9\s]/, $value)){
$style = yellow;
$formMsg = Invalid Characters;
$bad = $key;
  }
}
  }
}
?

regards;

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



[PHP] Re: Form Validation

2009-08-12 Thread Ralph Deffke
this is a PHP mailing list, may be u ask this on a js mailinglist

ralph_def...@yahoo.de


Micheleh Davis m...@micheleh.com wrote in message
news:002901ca1b68$fc6b0020$f54100...@com...
 Please help.  My form validation worked fine until I added the terms check
 at the bottom.  Any ideas?



 //form validation step one

 function validateStep1(myForm){

 // list of required fields

 with (myForm) {

 var requiredFields = new Array (

 firstName,

 lastName,

 phone,

 email,

 terms)

 }

 // check for missing required fields

 for (var i = 0; i  requiredFields.length; i++){

 if (requiredFields[i].value == ){

 alert (You left a
required
 field blank. Please enter the required information.);

 requiredFields[i].focus();

 return false;

 }

 }

 // check for valid email address format

 var eaddress= myForm.email.value;

 var validaddress=
 /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})$/;

 //var validaddress= /^((\w+).?(\w+))+...@\w+/i;

 var result= eaddress.match(validaddress);

 if (result == null) {

 alert (Please enter your complete email
 address.);

 myForm.email.focus();

 return false;

 }

 // check for valid phone format

 var check= myForm.phone.value;

 check= check.replace(/[^0-9]/g,);

 if (check.length  10) {

alert (please enter your complete phone number.);

return false;

 }//end if



 return true;



 //begin terms and conditions check

 var termsCheck= myForm.terms.value;

 if (bcForm1.checked == false)

 {

 alert ('Please read and select I Agree to
 the Terms and Conditions of Service.');

 return false;

 }

 else

 {

 return true;

 }

//end terms check







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



RE: [PHP] Re: Form Validation

2009-08-12 Thread Micheleh Davis
Yep, I'm sorry, sent to the wrong one.  Thanks all! 


-Original Message-
From: Ralph Deffke [mailto:ralph_def...@yahoo.de] 
Sent: Wednesday, August 12, 2009 12:29 PM
To: php-general@lists.php.net
Subject: [PHP] Re: Form Validation

this is a PHP mailing list, may be u ask this on a js mailinglist

ralph_def...@yahoo.de


Micheleh Davis m...@micheleh.com wrote in message
news:002901ca1b68$fc6b0020$f54100...@com...
 Please help.  My form validation worked fine until I added the terms check
 at the bottom.  Any ideas?



 //form validation step one

 function validateStep1(myForm){

 // list of required fields

 with (myForm) {

 var requiredFields = new Array (

 firstName,

 lastName,

 phone,

 email,

 terms)

 }

 // check for missing required fields

 for (var i = 0; i  requiredFields.length; i++){

 if (requiredFields[i].value == ){

 alert (You left a
required
 field blank. Please enter the required information.);

 requiredFields[i].focus();

 return false;

 }

 }

 // check for valid email address format

 var eaddress= myForm.email.value;

 var validaddress=
 /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})$/;

 //var validaddress= /^((\w+).?(\w+))+...@\w+/i;

 var result= eaddress.match(validaddress);

 if (result == null) {

 alert (Please enter your complete email
 address.);

 myForm.email.focus();

 return false;

 }

 // check for valid phone format

 var check= myForm.phone.value;

 check= check.replace(/[^0-9]/g,);

 if (check.length  10) {

alert (please enter your complete phone number.);

return false;

 }//end if



 return true;



 //begin terms and conditions check

 var termsCheck= myForm.terms.value;

 if (bcForm1.checked == false)

 {

 alert ('Please read and select I Agree to
 the Terms and Conditions of Service.');

 return false;

 }

 else

 {

 return true;

 }

//end terms check







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



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



Re: [PHP] Re: Form Validation

2009-08-12 Thread Ralph Deffke
may I ask what JS list u are using?

Micheleh Davis m...@micheleh.com wrote in message
news:003901ca1b6b$dd103d00$9730b7...@com...
 Yep, I'm sorry, sent to the wrong one.  Thanks all!


 -Original Message-
 From: Ralph Deffke [mailto:ralph_def...@yahoo.de]
 Sent: Wednesday, August 12, 2009 12:29 PM
 To: php-general@lists.php.net
 Subject: [PHP] Re: Form Validation

 this is a PHP mailing list, may be u ask this on a js mailinglist

 ralph_def...@yahoo.de


 Micheleh Davis m...@micheleh.com wrote in message
 news:002901ca1b68$fc6b0020$f54100...@com...
  Please help.  My form validation worked fine until I added the terms
check
  at the bottom.  Any ideas?
 
 
 
  //form validation step one
 
  function validateStep1(myForm){
 
  // list of required fields
 
  with (myForm) {
 
  var requiredFields = new Array (
 
  firstName,
 
  lastName,
 
  phone,
 
  email,
 
  terms)
 
  }
 
  // check for missing required fields
 
  for (var i = 0; i  requiredFields.length; i++){
 
  if (requiredFields[i].value == ){
 
  alert (You left a
 required
  field blank. Please enter the required information.);
 
 
requiredFields[i].focus();
 
  return false;
 
  }
 
  }
 
  // check for valid email address format
 
  var eaddress= myForm.email.value;
 
  var validaddress=
  /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})$/;
 
  //var validaddress= /^((\w+).?(\w+))+...@\w+/i;
 
  var result= eaddress.match(validaddress);
 
  if (result == null) {
 
  alert (Please enter your complete email
  address.);
 
  myForm.email.focus();
 
  return false;
 
  }
 
  // check for valid phone format
 
  var check= myForm.phone.value;
 
  check= check.replace(/[^0-9]/g,);
 
  if (check.length  10) {
 
 alert (please enter your complete phone number.);
 
 return false;
 
  }//end if
 
 
 
  return true;
 
 
 
  //begin terms and conditions check
 
  var termsCheck= myForm.terms.value;
 
  if (bcForm1.checked == false)
 
  {
 
  alert ('Please read and select I Agree
to
  the Terms and Conditions of Service.');
 
  return false;
 
  }
 
  else
 
  {
 
  return true;
 
  }
 
 //end terms check
 
 
 
 



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





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



Re: [PHP] Re: Form Validation Issues

2007-05-24 Thread Tijnema

On 5/23/07, Crayon Shin Chan [EMAIL PROTECTED] wrote:

On Thursday 24 May 2007 00:51, Greg Donald wrote:

 As I watch PHP de-evolve into Java, I find myself wanting something
 lighter weight and with a smaller syntax.

PHP has long since spawned into something uncontrollable. Compare the
number of functions (and its aliases) to eg Ruby. The string functions in
particular are absolutely bloated, eg ltrim, trim  rtrim - WTF. Why not
just have trim() and have the option of specifying whether
left/right/both? The same goes for the case-sensitive and
case-insensitive versions of functions.

--
Crayon


Yeah, for case-insensitive functions would a bool be a lot better,
like the strstr function, the current syntax is (also for the
case-insensitive function stristr):
string strstr ( string $haystack, string $needle )
It would be a lot better to have it like this:
string strstr ( string $haystack, string $needle, bool $case_sensitive )

The trim functions are fine for me..

Tijnema

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



[PHP] Re: Form Validation Issues

2007-05-23 Thread Jared Farrish

Having a giant conditional statement such as the one you have posted is a
real problem for many different reasons. Below is a simple states class that
allows you to test for a state using a couple of different checks (such as
making both comparables lower or upper case). One major issue with the code
block you posted (which may or may not be a problem on your end, it could be
the email software), but these two are not comparable:

code
$v = New Hampshire;
$x = New
Hampshire;
if ($v === $x) {
   echo(pre$v is exactly equal to $x/pre);
} elseif ($v == $x) {
   echo(pre$v is loosely equal to $x/pre);
} else {
   echo(pre$v is not exactly equal to $x/pre);
}
/code
This will produce: New Hampshire is not exactly equal to New
Hampshire

A better way to test a conditional (whether complex and/or lengthy) is to
wrap it in either a function, or a class method, like so:

code
?php
class States {
   var $suggest = null;
   var $states = Array(
   'alabama'=true,'al'=true,
   'alaska'=true,'ak'=true,
   'arizona'=true,'az'=true,
   'arkansas'=true,'ar'=true,
   'california'=true,'ca'=true,
   'colorado'=true,'co'=true,
   'connecticut'=true,'ct'=true,
   'delaware'=true,'de'=true,
   'florida'=true,'fl'=true,
   'georgia'=true,'ga'=true,
   'hawaii'=true,'hi'=true,
   'idaho'=true,'id'=true,
   'illinois'=true,'il'=true,
   'indiana'=true,'in'=true,
   'iowa'=true,'ia'=true,
   'kansas'=true,'ks'=true,
   'kentucky'=true,'ky'=true,
   'louisiana'=true,'la'=true,
   'maine'=true,'me'=true,
   'maryland'=true,'md'=true,
   'massachusetts'=true,'ma'=true,
   'michigan'=true,'mi'=true,
   'minnesota'=true,'mn'=true,
   'mississippi'=true,'ms'=true,
   'missouri'=true,'mo'=true,
   'montana'=true,'mt'=true,
   'nebraska'=true,'ne'=true,
   'nevada'=true,'nv'=true,
   'new hampshire'=true,'nh'=true,
   'new jersey'=true,'nj'=true,
   'new mexico'=true,'nm'=true,
   'new york'=true,'ny'=true,
   'north carolina'=true,'nc'=true,
   'north dakota'=true,'nd'=true,
   'ohio'=true,'oh'=true,
   'oklahoma'=true,'ok'=true,
   'oregon'=true,'or'=true,
   'pennsylvania'=true,'pa'=true,
   'rhode island'=true,'ri'=true,
   'south carolina'=true,'sc'=true,
   'south dakota'=true,'sd'=true,
   'tennesee'=true,'tn'=true,
   'texas'=true,'tx'=true,
   'utah'=true,'ut'=true,
   'vermont'=true,'vt'=true,
   'virginia'=true,'va'=true,
   'washington'=true,'wa'=true,
   'west virginia'=true,'wv'=true,
   'wisconsin'=true,'wi'=true,
   'wyoming'=true,'wy'=true
   );
   function States() {
   }
   function isValid($str,$suggest) {
   if ($this-states[strtolower($str)] === true) {
   $this-suggest = null;
   return true;
   } elseif ($suggest === true  strlen($str)  3) {
   $this-doSuggest($str);
   return false;
   } else {
   $this-suggest = null;
   return false;
   }
   }
   function doSuggest($str) {
   foreach ($this-states as $state = $val) {
   similar_text(strtolower($state),strtolower($str),$result);
   if ($result  85) {
   $this-suggest = $state;
   }
   }
   if (empty($this-suggest)) {
   $this-suggest = null;
   }
   }
   function isSuggested() {
   return $this-suggest;
   }
}
$states = new States();
$state = 'Hawii';
if ($states-isValid($state,true) === true) {
   echo(p$state is a state./p);
} elseif ($suggest = $states-isSuggested()) {
   echo(pMay we suggest $suggest?/p);
} else {
   echo(pState not found./p);
}
?
/code
--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


Re: [PHP] Re: Form Validation Issues

2007-05-23 Thread Robert Cummings
On Wed, 2007-05-23 at 11:16 -0500, Jared Farrish wrote:

 Abraham Maslow: If the only tool you have is a hammer, you tend to see
 every problem as a nail. $$

Robert Cummings:

if every problem can be described as a nail, then all you
 need is a hammer.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] Re: Form Validation Issues

2007-05-23 Thread Jared Farrish

Also, Indiana and Connecticut were misspelled.

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


Re: [PHP] Re: Form Validation Issues

2007-05-23 Thread Greg Donald

On 5/23/07, Robert Cummings [EMAIL PROTECTED] wrote:

Robert Cummings:

if every problem can be described as a nail, then all you
 need is a hammer.


Don't you ever get the urge to swing a different hammer?  I sure do.

As I watch PHP de-evolve into Java, I find myself wanting something
lighter weight and with a smaller syntax.  PHP seems fine for most web
development projects, but if PHP's SPL and the Zend Framework are a
sign of things to come from the core PHP developers, my interest in
using other hammers is only going to increase.  Possibly to the point
of putting my PHP hammer down.


--
Greg Donald
http://destiney.com/

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



Re: [PHP] Re: Form Validation Issues

2007-05-23 Thread Crayon Shin Chan
On Thursday 24 May 2007 00:51, Greg Donald wrote:

 As I watch PHP de-evolve into Java, I find myself wanting something
 lighter weight and with a smaller syntax. 

PHP has long since spawned into something uncontrollable. Compare the 
number of functions (and its aliases) to eg Ruby. The string functions in 
particular are absolutely bloated, eg ltrim, trim  rtrim - WTF. Why not 
just have trim() and have the option of specifying whether 
left/right/both? The same goes for the case-sensitive and 
case-insensitive versions of functions.

-- 
Crayon

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



[PHP] Re: form validation

2007-04-07 Thread Haydar TUNA
Hello,
 You can use javascript and Ajax together. If you use the ajax, you 
can validate your data with PHP code. Please visit the web site below. You 
will find information about PHP and Ajax::)

http://www.w3schools.com/php/default.asp




-- 
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

al phillips [EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]
 I''ve tried !preg_match and !eregi to validate my form. I get back 
 whatever the user inputs into the textboxes. I would like to validate each 
 textbox before submitting and redirect the user after submission?  Here's 
 part of the code

  ?php // Script 1 handle .html
 // Should accept First  Last Name email address phone city state
 // Validate input from textfields

 if (!preg_match(/[^a-zA-Z\.\-\Ä\ä\Ö\ö\Ü\ü\
   ]+$/s,$firstname)); {
 print 'pPlease enter Letters from A to Z/p';
 }


 -
 8:00? 8:25? 8:40?  Find a flick in no time
 with theYahoo! Search movie showtime shortcut. 

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



[PHP] Re: Form Validation

2004-10-13 Thread Manuel Lemos
Hello,
On 10/13/2004 03:03 PM, Ou Huang wrote:
I am currently working on a newsletter mailing list project and
developed a form in php. I would like to validate before it is
submitted. What would be the best way to validate a form? Write your own
routines or using a form validator. I just started learning PHP, so
don't have much experience on this. I am thinking using a form validator
but not sure where I can get it. 

Any suggestions would be appreciated! 
You may want to try this popular forms generation and validation class:
http://www.phpclasses.org/formsgeneration
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Form validation: client- or server-side?

2004-01-09 Thread Manuel Lemos
Hello,

On 01/09/2004 04:07 PM, Matt Grimm wrote:
Is there a distinct advantage to doing form validation / error checking on
the server side using PHP?  That's how I've always done it because I know
PHP better than JavaScript, but wouldn't it make sense to validate as much
of your form as possible using JavaScript before the form was ever posted?
I'm just talking about the basics, like empty required fields, illegal
characters, string lengths, etc.
What are your preferred methods?  I do an awful lot of content management
with HTML forms, so it's not an entirely spurious question.
Server side validation is mandatory. However, whenever possible you 
should perform client side validation to make your forms more usable as 
the users do not have to wait for the server to process the submitted 
form to tell the user about invalid fields, if with some client side 
validation that feedback can be antecipated.

You may want to take a look and this popular forms generation and 
validation class that not only can perform many built-in supported types 
both client side and server side validation, as it can preform some 
pre-processing of values like capitalization of text values, 
auto-completion or reformatting based on rules define with regular 
expressions also with support to perform that on client and server side. 
Take a look at the examples:

http://www.phpclasses.org/formsgeneration

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Form validation: client- or server-side?

2004-01-09 Thread Matt Grimm
Thanks for the great input guys.  Sounds like I'm using a sound method now
with full server-side validation.  Perhaps to make the most user- and
server-friendly forms, one could use JavaScript as a guide to the user,
alerting them to erroneous input and suggesting alternatives rather than
being relied upon for more serious validation.

--
Matt Grimm


Matt Grimm [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Is there a distinct advantage to doing form validation / error checking on
 the server side using PHP?  That's how I've always done it because I know
 PHP better than JavaScript, but wouldn't it make sense to validate as much
 of your form as possible using JavaScript before the form was ever posted?
 I'm just talking about the basics, like empty required fields, illegal
 characters, string lengths, etc.

 What are your preferred methods?  I do an awful lot of content management
 with HTML forms, so it's not an entirely spurious question.

 --
 Matt Grimm
 Web Developer
 The Health TV Channel, Inc.
 (a non - profit organization)
 3820 Lake Otis Parkway
 Anchorage, AK 99508
 907.770.6200 ext. 686
 907.336.6205 (fax)
 E-mail: [EMAIL PROTECTED]
 Web: www.healthtvchannel.org

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



[PHP] Re: Form validation

2002-04-25 Thread Manuel Lemos

Hello,

Tarjei Huse wrote:
 Hi,
 
 I need a function or class to validate a form with a cuple of text areas
 that are alloed to contain a few html tags (brp etc) but not all,
 and I need a script to validate the input from the fields and stop the
 html elements that are not allowed.
 
 Does anyone have a function or class handy that I might use? (for free)

You may want to try to use this class using regular expressions to 
forbid the tags that you do not want to be accepted:

http://www.phpclasses.org/browse.html/package/1.html

Regards,
Manuel Lemos



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




[PHP] Re: Form Validation class

2002-01-03 Thread Chris Lee

Ive seen em on zend.com, I wrote my own. I would recommend you take a look
at the ones on zend.com and modify it to taste.

--

  Chris Lee
  [EMAIL PROTECTED]


Daniel Harik [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello guys,

 at moment i'm reading Hack Proofing your web apps book, but it makes
 me scared, i have seen a class from newbienetwork.net(can't find it
 now), that validates
 user input, things like telephone number, state, country , email, and
 also can check if only letters or numbers are in text field, my
 question is this are there classes of this kind around? I would really
 need it.

 Thank You very much



 --
 Best regards,
  Daniel  mailto:[EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: Form Validation class

2002-01-03 Thread Daniel Harik

Hello Chris,

Thursday, January 03, 2002, 10:41:34 AM, you wrote:

CL Ive seen em on zend.com, I wrote my own. I would recommend you take a look
CL at the ones on zend.com and modify it to taste.

CL --

CL   Chris Lee
CL   [EMAIL PROTECTED]


CL Daniel Harik [EMAIL PROTECTED] wrote in message
CL [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello guys,

 at moment i'm reading Hack Proofing your web apps book, but it makes
 me scared, i have seen a class from newbienetwork.net(can't find it
 now), that validates
 user input, things like telephone number, state, country , email, and
 also can check if only letters or numbers are in text field, my
 question is this are there classes of this kind around? I would really
 need it.

 Thank You very much



 --
 Best regards,
  Daniel  mailto:[EMAIL PROTECTED]



Thank You for your reply

That's the reason i've posted, can't find what i'm looking for
anywhere

-- 
Best regards,
 Danielmailto:[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Form Validation class

2002-01-03 Thread Manuel Lemos

Hello,

Daniel Harik wrote:
 
 Hello guys,
 
 at moment i'm reading Hack Proofing your web apps book, but it makes
 me scared, i have seen a class from newbienetwork.net(can't find it
 now), that validates
 user input, things like telephone number, state, country , email, and
 also can check if only letters or numbers are in text field, my
 question is this are there classes of this kind around? I would really
 need it.

This is what you are looking for:

http://phpclasses.upperdesign.com/browse.html/package/1

You may also want to check all these:

http://phpclasses.upperdesign.com/browse.html

Regards,
Manuel Lemos

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]