Re: [PHP] download php
You should also store passwords in a non-readable to the world directory. -Dan - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] To: Mantas Kriauciunas [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, July 10, 2003 5:01 AM Subject: Re: [PHP] download php Do you use secure connection? Well, you should. Mantas Kriauciunas wrote: Hello php-general, some hacker just tries his luck everyday to get me pissed, is it possible to make php files not downloadable? or coded? or something? because some dude knows my passwords every time, and with them passes the shity security to main user, thank god not root. So is there any way? if anyone knows any links or resources, please reply, i'll check them, i need to put this to end P.S system is freebsd. Thank you!!! there are even more and more kids that want to be named haker, lookin at their age, could be even my son:) -- 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] Another newbie
Take a close look at OO programming. Class objects are great for reusing code and making cleaner code. The art of designing code is a mastered art which is why my white board is always messy ;) . Never the less, oject oriented programming is definately the way to go. Chapter 6 in the PHP and MySQL Web Development book has great real world examples on how class objects relate to one another. Lots of Luck! -Dan - Original Message - From: Jay Fitzgerald [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, June 28, 2003 3:10 PM Subject: [PHP] Another newbie I have been writing PHP for almost a year now and someone on phpfreaks told me the other day that my code was very sloppy. Since I want to more more into programming than design, can anyone recommend where to learn how to make sure your code is clean, optimized and as error-free as it can get? Even if it is the style of how to write the code, please let me knowI know noone can be the perfect programmer, but I would at least like to be a decent programmer :) Jay -- 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
[PHP] PHP and Macromedia Flash
Does anyone know if you can dynamically update a flash swf file with a PHP script ? For instance in menu navigation I was thinking of using a flash object to display an interactive menu and have in my main class a way to update the links or buttons from page to page. Thanks in advance, Dan
Re: [PHP] PHP and Macromedia Flash
Well, at least I know its possible. Im guessing that an action script of some kind pulls the the xml data and displays the new information or button. I wish that you could just pass it directly to the flash object, that would be nice -Dan - Original Message - From: Andrew McCombe [EMAIL PROTECTED] To: Daniel J. Rychlik [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, June 28, 2003 6:09 PM Subject: Re: [PHP] PHP and Macromedia Flash On Sun, 2003-06-29 at 00:00, Daniel J. Rychlik wrote: Does anyone know if you can dynamically update a flash swf file with a PHP script ? For instance in menu navigation I was thinking of using a flash object to display an interactive menu and have in my main class a way to update the links or buttons from page to page. Thanks in advance, Dan Yes you can. I'm currently writing a script that uses php to pull info in from a mysql db and passes the results back to flash as xml. Don't ask me how the flash part works though, i don't do that part. Regards Andrew McCombe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and Macromedia Flash
Anyone have any experience with PHPObject from http://ghostwire.com/resources/phpobject/ - Original Message - From: Daniel J. Rychlik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, June 28, 2003 6:13 PM Subject: Re: [PHP] PHP and Macromedia Flash Well, at least I know its possible. Im guessing that an action script of some kind pulls the the xml data and displays the new information or button. I wish that you could just pass it directly to the flash object, that would be nice -Dan - Original Message - From: Andrew McCombe [EMAIL PROTECTED] To: Daniel J. Rychlik [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, June 28, 2003 6:09 PM Subject: Re: [PHP] PHP and Macromedia Flash On Sun, 2003-06-29 at 00:00, Daniel J. Rychlik wrote: Does anyone know if you can dynamically update a flash swf file with a PHP script ? For instance in menu navigation I was thinking of using a flash object to display an interactive menu and have in my main class a way to update the links or buttons from page to page. Thanks in advance, Dan Yes you can. I'm currently writing a script that uses php to pull info in from a mysql db and passes the results back to flash as xml. Don't ask me how the flash part works though, i don't do that part. Regards Andrew McCombe -- 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] PHP and Macromedia Flash
If anyone is intrested in this, please take a look. This is really cool stuff. This use flash to present data that was passed from a PHP script that was pulled from a MySQL db. Really cool stuff. http://actionscript-toolbox.com/samplemx_php.php -Dan - Original Message - From: Daniel J. Rychlik [EMAIL PROTECTED] To: Daniel J. Rychlik [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, June 28, 2003 7:26 PM Subject: Re: [PHP] PHP and Macromedia Flash Anyone have any experience with PHPObject from http://ghostwire.com/resources/phpobject/ - Original Message - From: Daniel J. Rychlik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, June 28, 2003 6:13 PM Subject: Re: [PHP] PHP and Macromedia Flash Well, at least I know its possible. Im guessing that an action script of some kind pulls the the xml data and displays the new information or button. I wish that you could just pass it directly to the flash object, that would be nice -Dan - Original Message - From: Andrew McCombe [EMAIL PROTECTED] To: Daniel J. Rychlik [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, June 28, 2003 6:09 PM Subject: Re: [PHP] PHP and Macromedia Flash On Sun, 2003-06-29 at 00:00, Daniel J. Rychlik wrote: Does anyone know if you can dynamically update a flash swf file with a PHP script ? For instance in menu navigation I was thinking of using a flash object to display an interactive menu and have in my main class a way to update the links or buttons from page to page. Thanks in advance, Dan Yes you can. I'm currently writing a script that uses php to pull info in from a mysql db and passes the results back to flash as xml. Don't ask me how the flash part works though, i don't do that part. Regards Andrew McCombe -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Zend Studio and DreamWeaver MX
Hey guys, Which is a better environment to write PHP code in? Zend or Dreamweaver ? Does zend provide a WYSIWYG for putting together a web page ? -Dan
[PHP] Array Dump
Hmm, I just noticed that array dump counts the number of charaters and white space and lables that number string... What function name is that ? The string counter I mean ? -Dan
Re: [PHP] Newbie and learning
PHP is, arguably, the better way to go when developing an ecomm solution. This list is full of very intelligent programmers that will help or direct you to the proper documentation. If you use $_GET you will be able to pass value pairs in the url. Make sure that in your data check script that you specifically assign variables to your $_GET in order to prevent malicious use. $HTTP_POST_VARS is probably a better way to go here. Its cross platform and will almost guarantee that you will be able to use on any server. $HTTP_POST_VARS['name']; $HTTP_POST_VARS['email']; Good Luck! -Dan - Original Message - From: Larry R. Sieting [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 27, 2003 5:22 PM Subject: [PHP] Newbie and learning Hello All, I have been reading and digesting information from this list for about two weeks now. I am doing some work and testing (both) and learning php on the way. Now I have seen several replies about using $_GET[] and $_POST[] and that if you ARE sending variables using the URL you _should_ use $_GET[] whereas if you are _not_ passing variables in the URL you should use $_POST[]. Is this correct? I just want to make sure I have it in my mind so that when I start passing info via url I use the right method. I ask this because I have a friend that wants to have me setup an e-commerce site for him. I am trying to decide if I should use ASP (gasp) or PHP (yeah). It will be a db driven site which will have images in the db and probably multiple tables with inner and outer joins and search systems. Yes, I have the 4000+ (pdf) page manual on my system and refer to it and read sections of it at a time (chunk). And I hope that I will be able to answer most of my own questions there or in other resources before I have to submit to the list. Thanks. Larry R. Sieting -- 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
[PHP] Passing Array to object
Hello, I am developing a site that uses classes to reuse code and objects. I have in my main class a function SetLinks($newlinks) { $this-links = $newlinks; } And another function that displays them in the same class main { I have another file called index.php that basically just passes attributes to the main class and the main class displays them. Im having a bit of trouble passing an array to the object in the index.php I create new. $index = new main(); $index-SetLink = array ( 'Link1'= 'link1.php', . ); When I run I recieve Variable passed to each() is not an array or object so I tried this $index-SetLink($newlink = array('link1'= ...); same error message. I was wondering if someone could shed some light on what Im doing wrong. Thanks Daniel
Re: [PHP] Passing Array to object
yea, I gave that a shot, Same message. Logically it makes sense, but php doesnt like it. by the way, thanks for your help Chris. You've helped me in the past. -Daniel - Original Message - From: Chris Sherwood [EMAIL PROTECTED] To: Daniel J. Rychlik [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 1:02 PM Subject: Re: [PHP] Passing Array to object Have you tried to assign the array to a variable then pass the variable to the function ie $index = new main(); $yourvar = array('array values'); $index-SetLink ($yourvar); - Original Message - From: Daniel J. Rychlik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 10:46 AM Subject: [PHP] Passing Array to object Hello, I am developing a site that uses classes to reuse code and objects. I have in my main class a function SetLinks($newlinks) { $this-links = $newlinks; } And another function that displays them in the same class main { I have another file called index.php that basically just passes attributes to the main class and the main class displays them. Im having a bit of trouble passing an array to the object in the index.php I create new. $index = new main(); $index-SetLink = array ( 'Link1'= 'link1.php', . ); When I run I recieve Variable passed to each() is not an array or object so I tried this $index-SetLink($newlink = array('link1'= ...); same error message. I was wondering if someone could shed some light on what Im doing wrong. Thanks Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Array to object
Its erroring at my display links function. This function is inside my main class. function DisplayLinks($links) { while(list($name, $url) = each($links) { echo :::a href= '$url''$name/a:::\n; } //End while } // End DisplayLinks function I dont see why it wont work... I even try assigning $links to the array. - Original Message - From: Daniel J. Rychlik [EMAIL PROTECTED] To: Chris Sherwood [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 1:08 PM Subject: Re: [PHP] Passing Array to object yea, I gave that a shot, Same message. Logically it makes sense, but php doesnt like it. by the way, thanks for your help Chris. You've helped me in the past. -Daniel - Original Message - From: Chris Sherwood [EMAIL PROTECTED] To: Daniel J. Rychlik [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 1:02 PM Subject: Re: [PHP] Passing Array to object Have you tried to assign the array to a variable then pass the variable to the function ie $index = new main(); $yourvar = array('array values'); $index-SetLink ($yourvar); - Original Message - From: Daniel J. Rychlik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 10:46 AM Subject: [PHP] Passing Array to object Hello, I am developing a site that uses classes to reuse code and objects. I have in my main class a function SetLinks($newlinks) { $this-links = $newlinks; } And another function that displays them in the same class main { I have another file called index.php that basically just passes attributes to the main class and the main class displays them. Im having a bit of trouble passing an array to the object in the index.php I create new. $index = new main(); $index-SetLink = array ( 'Link1'= 'link1.php', . ); When I run I recieve Variable passed to each() is not an array or object so I tried this $index-SetLink($newlink = array('link1'= ...); same error message. I was wondering if someone could shed some light on what Im doing wrong. Thanks Daniel -- 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] Passing Array to object
I remember seeing somewhere that you could only pass a single deminsional Array to a class. But I cant even get this one deminsional to work. If I place the links inside the main class and call it an attribute it works fine. var $newlinks = array (...)' When I var_dump($myarray) I recieve the output as expected. For some reason its still giving me the warning. hmmm.. Ive tried everything that was suggested. I think I need to go back and take another look at OO programming in php. - Original Message - From: Chris Sherwood [EMAIL PROTECTED] To: Daniel J. Rychlik [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 1:46 PM Subject: Re: [PHP] Passing Array to object hmmm okay cause list works by assigning elements in order from an array each iterates thru each element in a list so you want to pass both elements at the same time so you need to pass an array to get the effect your looking for ie $name being from the first array element, and $url being from the second array element... so I am thinking you wish to assign urls and names to a single array you will want to make it a multidimensional array ie array (array(name, link),array(name,link)) hope this helps you daniel - Original Message - From: Daniel J. Rychlik [EMAIL PROTECTED] To: Daniel J. Rychlik [EMAIL PROTECTED]; Chris Sherwood [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 11:17 AM Subject: Re: [PHP] Passing Array to object Its erroring at my display links function. This function is inside my main class. function DisplayLinks($links) { while(list($name, $url) = each($links) { echo :::a href= '$url''$name/a:::\n; } //End while } // End DisplayLinks function I dont see why it wont work... I even try assigning $links to the array. - Original Message - From: Daniel J. Rychlik [EMAIL PROTECTED] To: Chris Sherwood [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 1:08 PM Subject: Re: [PHP] Passing Array to object yea, I gave that a shot, Same message. Logically it makes sense, but php doesnt like it. by the way, thanks for your help Chris. You've helped me in the past. -Daniel - Original Message - From: Chris Sherwood [EMAIL PROTECTED] To: Daniel J. Rychlik [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 1:02 PM Subject: Re: [PHP] Passing Array to object Have you tried to assign the array to a variable then pass the variable to the function ie $index = new main(); $yourvar = array('array values'); $index-SetLink ($yourvar); - Original Message - From: Daniel J. Rychlik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 10:46 AM Subject: [PHP] Passing Array to object Hello, I am developing a site that uses classes to reuse code and objects. I have in my main class a function SetLinks($newlinks) { $this-links = $newlinks; } And another function that displays them in the same class main { I have another file called index.php that basically just passes attributes to the main class and the main class displays them. Im having a bit of trouble passing an array to the object in the index.php I create new. $index = new main(); $index-SetLink = array ( 'Link1'= 'link1.php', . ); When I run I recieve Variable passed to each() is not an array or object so I tried this $index-SetLink($newlink = array('link1'= ...); same error message. I was wondering if someone could shed some light on what Im doing wrong. Thanks Daniel -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Array to object
And thats why Chris is the man. Your're right it doesnt look pretty but it works. If I come up with another solution I will email it out. Thanks again, Daniel - Original Message - From: Chris Sherwood [EMAIL PROTECTED] To: Daniel J. Rychlik [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 3:11 PM Subject: Re: [PHP] Passing Array to object function DisplayLinks($links,$names) { $namecount = sizeof($names); for($a=0;$a$namecount;$a++) { $name = $names[$a]; $url = $links[$a]; echo :::a href= '$url''$name/a:::\n; } //End for } // End DisplayLinks function try this and assigning the names you want to be displayed to the names array and links to the links array... I know this isnt pretty but it should work - Original Message - From: Daniel J. Rychlik [EMAIL PROTECTED] To: Chris Sherwood [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 12:59 PM Subject: Re: [PHP] Passing Array to object I remember seeing somewhere that you could only pass a single deminsional Array to a class. But I cant even get this one deminsional to work. If I place the links inside the main class and call it an attribute it works fine. var $newlinks = array (...)' When I var_dump($myarray) I recieve the output as expected. For some reason its still giving me the warning. hmmm.. Ive tried everything that was suggested. I think I need to go back and take another look at OO programming in php. - Original Message - From: Chris Sherwood [EMAIL PROTECTED] To: Daniel J. Rychlik [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 1:46 PM Subject: Re: [PHP] Passing Array to object hmmm okay cause list works by assigning elements in order from an array each iterates thru each element in a list so you want to pass both elements at the same time so you need to pass an array to get the effect your looking for ie $name being from the first array element, and $url being from the second array element... so I am thinking you wish to assign urls and names to a single array you will want to make it a multidimensional array ie array (array(name, link),array(name,link)) hope this helps you daniel - Original Message - From: Daniel J. Rychlik [EMAIL PROTECTED] To: Daniel J. Rychlik [EMAIL PROTECTED]; Chris Sherwood [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 11:17 AM Subject: Re: [PHP] Passing Array to object Its erroring at my display links function. This function is inside my main class. function DisplayLinks($links) { while(list($name, $url) = each($links) { echo :::a href= '$url''$name/a:::\n; } //End while } // End DisplayLinks function I dont see why it wont work... I even try assigning $links to the array. - Original Message - From: Daniel J. Rychlik [EMAIL PROTECTED] To: Chris Sherwood [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 1:08 PM Subject: Re: [PHP] Passing Array to object yea, I gave that a shot, Same message. Logically it makes sense, but php doesnt like it. by the way, thanks for your help Chris. You've helped me in the past. -Daniel - Original Message - From: Chris Sherwood [EMAIL PROTECTED] To: Daniel J. Rychlik [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 1:02 PM Subject: Re: [PHP] Passing Array to object Have you tried to assign the array to a variable then pass the variable to the function ie $index = new main(); $yourvar = array('array values'); $index-SetLink ($yourvar); - Original Message - From: Daniel J. Rychlik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 10:46 AM Subject: [PHP] Passing Array to object Hello, I am developing a site that uses classes to reuse code and objects. I have in my main class a function SetLinks($newlinks) { $this-links = $newlinks; } And another function that displays them in the same class main { I have another file called index.php that basically just passes attributes to the main class and the main class displays them. Im having a bit of trouble passing an array to the object in the index.php I create new. $index = new main(); $index-SetLink = array ( 'Link1'= 'link1.php', . ); When I run I recieve Variable passed to each() is not an array or object so I tried
[PHP] $command actions
I have a line of code in my form that I am trying to get to work. $action = ($HTTP_POST_VARS['action'] == data_input) ? check : display; I recieved undefined action when running. So I did this. $command = isset($HTTP_VARS['action'] == data_input) ? check : display; I recieve unexpected T_IS_EQUAL, expecting ',' or ')' Ive tried a couple different ways to isolate my syntax. I am using the example from http://www.zend.com/zend/spotlight/form-pro-php4.php Ive also read this document and I understand it. http://ca2.php.net/manual/en/language.expressions.php I know that is my syntax, I followed the example that Lars Torben Wilson [EMAIL PROTECTED] gave me, and it worked great checking the isset before declaring in my form. Im hoping that this is just as simple. -Dan
Re: [PHP] $command actions
I recieved a unexpected T_LOGICAL_AND, expecting ',' or ')'; - Original Message - From: Leif K-Brooks [EMAIL PROTECTED] To: Daniel J. Rychlik [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, June 14, 2003 10:22 AM Subject: Re: [PHP] $command actions $command = isset($HTTP_POST_VARS['action'] and $HTTP_POST_VARS['action'] == data_input) ? check : display; Daniel J. Rychlik wrote: I have a line of code in my form that I am trying to get to work. $action = ($HTTP_POST_VARS['action'] == data_input) ? check : display; I recieved undefined action when running. So I did this. $command = isset($HTTP_VARS['action'] == data_input) ? check : display; I recieve unexpected T_IS_EQUAL, expecting ',' or ')' Ive tried a couple different ways to isolate my syntax. I am using the example from http://www.zend.com/zend/spotlight/form-pro-php4.php Ive also read this document and I understand it. http://ca2.php.net/manual/en/language.expressions.php I know that is my syntax, I followed the example that Lars Torben Wilson [EMAIL PROTECTED] gave me, and it worked great checking the isset before declaring in my form. Im hoping that this is just as simple. -Dan -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- 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] $command actions
It worked! thanks so much. I did however place another ( on the second $HTTP_POST_ to make it function with out error. Appreciate your time! dan - Original Message - From: Leif K-Brooks [EMAIL PROTECTED] To: Daniel J. Rychlik [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, June 14, 2003 10:54 AM Subject: Re: [PHP] $command actions Whoops! $command = isset($HTTP_POST_VARS['action']) and $HTTP_POST_VARS['action'] == data_input) ? check : display; Daniel J. Rychlik wrote: I recieved a unexpected T_LOGICAL_AND, expecting ',' or ')'; - Original Message - From: Leif K-Brooks [EMAIL PROTECTED] To: Daniel J. Rychlik [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, June 14, 2003 10:22 AM Subject: Re: [PHP] $command actions $command = isset($HTTP_POST_VARS['action'] and $HTTP_POST_VARS['action'] == data_input) ? check : display; Daniel J. Rychlik wrote: I have a line of code in my form that I am trying to get to work. $action = ($HTTP_POST_VARS['action'] == data_input) ? check : display; I recieved undefined action when running. So I did this. $command = isset($HTTP_VARS['action'] == data_input) ? check : display; I recieve unexpected T_IS_EQUAL, expecting ',' or ')' Ive tried a couple different ways to isolate my syntax. I am using the example from http://www.zend.com/zend/spotlight/form-pro-php4.php Ive also read this document and I understand it. http://ca2.php.net/manual/en/language.expressions.php I know that is my syntax, I followed the example that Lars Torben Wilson [EMAIL PROTECTED] gave me, and it worked great checking the isset before declaring in my form. Im hoping that this is just as simple. -Dan -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] isset()
Having a bit of trouble with my forms returnin 1 in the form fields accept the data that was entered. I think its because of this line, $output_fname = isset($HTTP_POST_VARS['fname']); I have a command action handler also that works in the same script and it seems to work well, the only problem that Im having is passing back the error to the related filed that requires proper data. I started just passing back a generic message so that I could get the routine down, once I get that I will be able to do more. Here is a snipit of my code. head ?php if ($has_errors) { ? Please fix your errors ?php foreach($errors as $val) { echo $val; } ? ?php } else { ? Please fill out form. ?php } ? form . HTML STUFF. /form ?php if (count($errors)) $has_errors = true; // If we find errors, then flag if ($has_errors) $command =data_check // Take us back to the data_check hidden field and set $has_errors true to display our errors at the top of our form. ? head This is really a 2 question issue, and I greatly appreicate you're time. This is my 2nd week learning PHP... Thanks in advance, Dan
Re: [PHP] isset()
Why is my script autopopulating a 1 in the field names and not the orginal values ? Is it something to do with this statement ? $output_fname = isset($HTTP_POST_VARS['fname']); Im declaring the var and using it in value field in my form. I know that I missing something. Its returning true when value is entered or when its not and placing a nice 1 in every field of my form. Im thinking $output_fname = isset($HTTP_POST_VARS['fname']) ? $HTTP_POST_VARS['fname'] is the answer and ive tried for several hours to fix it. -dan - Original Message - From: Daniel J. Rychlik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, June 14, 2003 4:54 PM Subject: [PHP] isset() Having a bit of trouble with my forms returnin 1 in the form fields accept the data that was entered. I think its because of this line, $output_fname = isset($HTTP_POST_VARS['fname']); I have a command action handler also that works in the same script and it seems to work well, the only problem that Im having is passing back the error to the related filed that requires proper data. I started just passing back a generic message so that I could get the routine down, once I get that I will be able to do more. Here is a snipit of my code. head ?php if ($has_errors) { ? Please fix your errors ?php foreach($errors as $val) { echo $val; } ? ?php } else { ? Please fill out form. ?php } ? form . HTML STUFF. /form ?php if (count($errors)) $has_errors = true; // If we find errors, then flag if ($has_errors) $command =data_check // Take us back to the data_check hidden field and set $has_errors true to display our errors at the top of our form. ? head This is really a 2 question issue, and I greatly appreicate you're time. This is my 2nd week learning PHP... Thanks in advance, Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION as $key=$value
I read the document 4 times. I understand how it works and now Im excited about applying this to my application, however Im running into a problem. Im recieving an error on my page. I have this in my form. input name =fname type=text value= ?php $HTTP_POST_VARS['fname']; ? / and when running, I recieve Notice: Undefined index: fname I also used the example from here http://www.zend.com/zend/spotlight/form-pro-php4.php and I recieved the same message. Any Ideas, to help me break through these barriers? Thanks so much Dan - Original Message - From: Ralph [EMAIL PROTECTED] To: 'Daniel J. Rychlik' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, June 13, 2003 1:50 AM Subject: RE: [PHP] $_SESSION as $key=$value Daniel, Rather than sending them to a new page to validate the form and then sending them back if a field is invalid, do the error checking from the same script. Here's an example, a bit simple but just to give you an idea. For a better explanation, you should read this article which elaborates on this method: http://www.zend.com/zend/spotlight/form-pro-php4.php ?php if($HTTP_POST_VARS){ // check for required fields if(!HTTP_POST_VARS['name'] || !HTTP_POST_VARS['email']) $error_message = 'You did not provide all required fields' } // any other error checking you want to do ? ?php // if error, print out error message if($error_message){ echo $error_message; } ? FORM METHOD=post ACTION=?php echo $PHP_SELF ? INPUT TYPE=text NAME=name SIZE=20 VALUE=?php echo $HTTP_POST_VARS['name'] ? INPUT TYPE=text NAME=email SIZE=20 VALUE=?php echo $HTTP_POST_VARS['email'] ? and so on INPUT TYPE=submit NAME=process_form VALUE=Submit -Original Message- From: Daniel J. Rychlik [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 2:40 PM To: [EMAIL PROTECTED] Subject: [PHP] $_SESSION as $key=$value Is this valid to iterate over a form variables.? foreach ($_SESSION as $key=$value) and another question, do I need this form action=scripts/process.php method=post in my form? Im really struggling with $_SESSION. Im trying to program smarter and make friendlier applications. Ive submitted several emails dealing with this function and I apologize for beating a dead horse, so to speak. I have a form with a few form fields. Im working on an error function that will take the data that was entered and pass it back to the form so that the user will not have to input the data again. If an error is found I use the header function to go back to the form. Im having trouble with passing back the data. Do I in my form setup a $_GET or should I use the $_SESSION to call it. I am also going to setup a few css styles that highlight which field was found in error. Again, I apologize for my lack of vision and maybe a spark of light will go off, and I will be able to make some connections to get this done. Dan -- 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] $_SESSION as $key=$value
I tried to echo it as well, I recieved the same message. - Original Message - From: Ralph [EMAIL PROTECTED] To: 'Daniel J. Rychlik' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, June 13, 2003 6:50 PM Subject: RE: [PHP] $_SESSION as $key=$value I think this may be because you did not include echo in: value= ?php echo $HTTP_POST_VARS['fname']; ? so try this: input name =fname type=text value= ?php echo $HTTP_POST_VARS['fname']; ? -Original Message- From: Daniel J. Rychlik [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2003 4:28 PM To: Ralph; [EMAIL PROTECTED] Subject: Re: [PHP] $_SESSION as $key=$value I read the document 4 times. I understand how it works and now Im excited about applying this to my application, however Im running into a problem. Im recieving an error on my page. I have this in my form. input name =fname type=text value= ?php $HTTP_POST_VARS['fname']; ? / and when running, I recieve Notice: Undefined index: fname I also used the example from here http://www.zend.com/zend/spotlight/form-pro-php4.php and I recieved the same message. Any Ideas, to help me break through these barriers? Thanks so much Dan - Original Message - From: Ralph [EMAIL PROTECTED] To: 'Daniel J. Rychlik' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, June 13, 2003 1:50 AM Subject: RE: [PHP] $_SESSION as $key=$value Daniel, Rather than sending them to a new page to validate the form and then sending them back if a field is invalid, do the error checking from the same script. Here's an example, a bit simple but just to give you an idea. For a better explanation, you should read this article which elaborates on this method: http://www.zend.com/zend/spotlight/form-pro-php4.php ?php if($HTTP_POST_VARS){ // check for required fields if(!HTTP_POST_VARS['name'] || !HTTP_POST_VARS['email']) $error_message = 'You did not provide all required fields' } // any other error checking you want to do ? ?php // if error, print out error message if($error_message){ echo $error_message; } ? FORM METHOD=post ACTION=?php echo $PHP_SELF ? INPUT TYPE=text NAME=name SIZE=20 VALUE=?php echo $HTTP_POST_VARS['name'] ? INPUT TYPE=text NAME=email SIZE=20 VALUE=?php echo $HTTP_POST_VARS['email'] ? and so on INPUT TYPE=submit NAME=process_form VALUE=Submit -Original Message- From: Daniel J. Rychlik [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 2:40 PM To: [EMAIL PROTECTED] Subject: [PHP] $_SESSION as $key=$value Is this valid to iterate over a form variables.? foreach ($_SESSION as $key=$value) and another question, do I need this form action=scripts/process.php method=post in my form? Im really struggling with $_SESSION. Im trying to program smarter and make friendlier applications. Ive submitted several emails dealing with this function and I apologize for beating a dead horse, so to speak. I have a form with a few form fields. Im working on an error function that will take the data that was entered and pass it back to the form so that the user will not have to input the data again. If an error is found I use the header function to go back to the form. Im having trouble with passing back the data. Do I in my form setup a $_GET or should I use the $_SESSION to call it. I am also going to setup a few css styles that highlight which field was found in error. Again, I apologize for my lack of vision and maybe a spark of light will go off, and I will be able to make some connections to get this done. Dan -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_SESSION as $key=$value
Is this valid to iterate over a form variables.? foreach ($_SESSION as $key=$value) and another question, do I need this form action=scripts/process.php method=post in my form? Im really struggling with $_SESSION. Im trying to program smarter and make friendlier applications. Ive submitted several emails dealing with this function and I apologize for beating a dead horse, so to speak. I have a form with a few form fields. Im working on an error function that will take the data that was entered and pass it back to the form so that the user will not have to input the data again. If an error is found I use the header function to go back to the form. Im having trouble with passing back the data. Do I in my form setup a $_GET or should I use the $_SESSION to call it. I am also going to setup a few css styles that highlight which field was found in error. Again, I apologize for my lack of vision and maybe a spark of light will go off, and I will be able to make some connections to get this done. Dan
Re: [PHP] header function problem
It works now. Are their any examples out there that will show how to pass back the information that was entered and pass the error message back to the form.htm ? Or a function that i need to read up on. -Dan - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 05, 2003 1:01 AM Subject: Re: [PHP] header function problem On Thursday 05 June 2003 07:01, Daniel J. Rychlik wrote: Well, it works if I use the full path instead of relative So obviously its an apache permissions issue. It has nothing to do with apache. The specs require that the location is absolute. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* It is undignified for a woman to play servant to a man who is not hers. -- Spock, Amok Time, stardate 3372.7 */ -- 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
[PHP] Passing values back to form
Im new to PHP coming from a background in perl devlopement. I have a form that a user can fill out. On submit the values are iterated over a foreach to check for empty(). If the an emtyp $key is found then it passes an error string to my error function. I have 2 php files, one that is the Form called profile.php and one that processes the values from the form, called profileprocess.php. There are multiple functions in profileprocess.php. When the header function is called in the profileprocess.php it takes you back to the profile.php with empty values in the fields. I was wandering if their is a way, (which Im sure their is) to pass back all the data that was correctly entered back to the form, and then a nice little message that displays the error of the data that needs to be checked by the user. I could do this a number of ways, but the key is not writing code that you dont have to. Its just smarter programming. Any ideas, or functions I could read on in the rtFM manual is greatly appreciated. I appreciate you looking at this problem... Thanks in advance, Daniel
Re: [PHP] Passing values back to form
Thanks so much for your time. These are great tips, thanks again. - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: Daniel J. Rychlik [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, June 05, 2003 12:37 PM Subject: Re: [PHP] Passing values back to form Hi Daniel, My advice is to use php sessions. You can register both the filled and empty values in the session after processing them. Then you can header() redirect normally with no fuss and extract the values from the session file on the form page. And here's a tip. Set up some CSS in a switch() statement to highlight the form fields that are left blank. This makes for a nice user interface, esspecially on larger forms. Read up on sessions.. http://www.php.net/manual/en/ref.session.php HTH, Kevin Stone - Original Message - From: Daniel J. Rychlik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 05, 2003 10:31 AM Subject: [PHP] Passing values back to form Im new to PHP coming from a background in perl devlopement. I have a form that a user can fill out. On submit the values are iterated over a foreach to check for empty(). If the an emtyp $key is found then it passes an error string to my error function. I have 2 php files, one that is the Form called profile.php and one that processes the values from the form, called profileprocess.php. There are multiple functions in profileprocess.php. When the header function is called in the profileprocess.php it takes you back to the profile.php with empty values in the fields. I was wandering if their is a way, (which Im sure their is) to pass back all the data that was correctly entered back to the form, and then a nice little message that displays the error of the data that needs to be checked by the user. I could do this a number of ways, but the key is not writing code that you dont have to. Its just smarter programming. Any ideas, or functions I could read on in the rtFM manual is greatly appreciated. I appreciate you looking at this problem... Thanks in advance, Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session_start questions.
Questions, Questions, Questions. Where do I start in understanding how this function works. Ive read the document multiple times, and I am having a bit of trouble figuring out how this function works. I know that you can take session data and hold it somewhere for a user and use that data throughout php web pages. I am wandering, where is this data held and how to do you reference it ? Is their a more detailed explanantion of session's ? If their is not, once I get this, I will write one for people like me. You know, Sessions for Dummies ;o) Never the less, how do you set a session name for a specific user and hold that data for processing? Is this magic from somewhere or do you specifically name a session for every user ? What about security implications ? I will be running all my forms through secured protocol so hopefully their wont be any hijacking going on... Sorry for being a pain.
[PHP] Calling HTML pages
I was looking for a function that will take you to a html page. For instance. I have a function that checks for !empty values in $_POST; What I would like to do is if the field is empty then go back to the form. I have a function function display_error ($err) { echo $err; # I need to redirect or automatically go to the previous page. } Is their a PHP function already written that does this ? TIA Daniel
Re: [PHP] Calling HTML pages
When I tested it, I recieved a Forbidden 403 page from apache. Intresting... Any Ideas. I know its a permissions issue, but I thought that I was simply calling the page because an error was found.. - Original Message - From: Edward Peloke [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 3:26 PM Subject: RE: [PHP] Calling HTML pages just remember you can't have any other output before the header() function is used... -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 4:19 PM To: Daniel J. Rychlik; [EMAIL PROTECTED] Subject: RE: [PHP] Calling HTML pages [snip] I was looking for a function that will take you to a html page. For instance. I have a function that checks for !empty values in $_POST; What I would like to do is if the field is empty then go back to the form. I have a function function display_error ($err) { echo $err; # I need to redirect or automatically go to the previous page. } Is their a PHP function already written that does this ? [/snip] header() is the function you're looking for. HTH! Jay -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] insert loop logic
perhaps, a foreach loop and use the empty () function. Thats how I did it. - Original Message - From: Ryan A [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 5:24 PM Subject: [PHP] insert loop logic Hi, Can you tell me whats the best way of doing this please? I am getting values from a form's checkboxes (eg input type=checkbox name='id[]' value=1 input type=checkbox name='id[]' value=2 etc) When i get these values I want to enter them into the database but 1)I should enter only the first 5 (and ignore the rest) into the database 2)it has to enter 1 record for every every id picked eg: if id[1], id[2],id[3] and id[4] were picked it should enter this as 4 differient records How do i do this? I have tried using a for loop but somewhere the logic is very very bad :-) and so i deleted the whole damn thing. What do you think? When replying if possible reply with a little code as am feeling braindead. Cheers, -Ryan -- 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
[PHP] header function problem
I am using a header function to take a user back to a form if they have mistyped or entered in data that is not desirable. I have multiple functions that Ive written but the one that pertains to this situation is listed function check_data () { if (!empty($value)) { go_back( blah ); } } function go_back($err) { header(Location: http://webserver/form.htm;); } When calling this, I recieved a 403 Forbidden error message. Obviously Im doing something wrong... Or I have a permissions issue. I would not think its a permissions issue execpt the way the header function calls. I honestly dont know, just guessing. I was wandering if anyone has seen this when using the header() function Thanks so much, Daniel
Re: [PHP] header function problem
Well, it works if I use the full path instead of relative So obviously its an apache permissions issue. - Original Message - From: Daniel J. Rychlik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 5:36 PM Subject: [PHP] header function problem I am using a header function to take a user back to a form if they have mistyped or entered in data that is not desirable. I have multiple functions that Ive written but the one that pertains to this situation is listed function check_data () { if (!empty($value)) { go_back( blah ); } } function go_back($err) { header(Location: http://webserver/form.htm;); } When calling this, I recieved a 403 Forbidden error message. Obviously Im doing something wrong... Or I have a permissions issue. I would not think its a permissions issue execpt the way the header function calls. I honestly dont know, just guessing. I was wandering if anyone has seen this when using the header() function Thanks so much, Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] regex problem
Hello,, I have a preg_match issue matching numbers. I am currently using !preg_match ('/([0-9\-\.\#:])/', $_POST['nums1'] throw error[] This fails if you use something like ' asdf ' but if you use ' asdf789 ' it passes false and does not throw an error. This is not the obvious solution I know its a problem in my regular expression. Should I ONLY be using ' /([0-9])/ ' , ? Thanks in advance. Daniel
Re: [PHP] regex problem
If I wanted to remove script/script tags from my form as well as html tags, would I use a preg_match function or is their another simple funtion that does this ? -Dan - Original Message - From: Jim Lucas [EMAIL PROTECTED] To: Daniel J. Rychlik [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, May 31, 2003 6:04 PM Subject: Re: [PHP] regex problem Are you wanting the $_POST['nums1'] to have only numbers, -, ., #, : Is this what you are trying to match. if so, try this. if ( preg_match(/[^0-9\#\:\.\-]/, $_POST['nums1']) ) { throw error() } This will match anything that is not a number or one of the other special chars that are in the pattern to be matched. Therefor, if it does find anything that is not in the pattern to be matched it will return true and then it will enter the if statement instead of skipping over it. Jim Lucas - Original Message - From: Daniel J. Rychlik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, May 31, 2003 11:46 AM Subject: [PHP] regex problem Hello,, I have a preg_match issue matching numbers. I am currently using !preg_match ('/([0-9\-\.\#:])/', $_POST['nums1'] throw error[] This fails if you use something like ' asdf ' but if you use ' asdf789 ' it passes false and does not throw an error. This is not the obvious solution I know its a problem in my regular expression. Should I ONLY be using ' /([0-9])/ ' , ? Thanks in advance. Daniel -- 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
[PHP] preg_match array question
Hey, Im trying to use preg_match to validate numbers in multiple fields. I can check one field but Im having trouble checking multiple fields. preg_match ( '(foo)' , $_POST[num1] ); - That works fine. but I need to check multiple fields. I thought I would build an array with the POST data like this... $num = array ($_POST[num1], ($_POST[num2]); There are more than that... and then use preg_match ('(foo)', $num) ; $num should point to my array, but that doesnt work. I get a warning message.. and it doesnt check the first num1 in the array. Im certain that Its my code, and I wanted to get some input on what Im doing wrong. -Dan
Re: [PHP] preg_match array question
The problem is, that I have multiple fields and what I am trying to do is check each field to make sure I get the data that I need and not some crap, like letters in a number field or a script tag in a field. Things of this sort. The foreach loop wont work for me in this instance because Im checking for proper input. I can write multiple elseif statements to check each field but alas, this is not optimal. I may go ahead and write this to get it done and then go back and put it to the write board -dan - Original Message - From: Ralph [EMAIL PROTECTED] To: 'Daniel J. Rychlik' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, May 30, 2003 12:59 PM Subject: RE: [PHP] preg_match array question Try this: Let say you have these three fields in your form: INPUT TYPE=text VALUE=num[1] INPUT TYPE=text VALUE=num[2] INPUT TYPE=text VALUE=num[3] then use the following to iterate through each field: foreach($_POST['num'] as $key = $value){ preg_match ( '(foo)' , $_POST[num][$key] ); } or you can also try this: $c = count($num); for($i; $i $c; $i++){ preg_match ( '(foo)' , $_POST[num][$i] ); } this should get you started. -Original Message- From: Daniel J. Rychlik [mailto:[EMAIL PROTECTED] Sent: Friday, May 30, 2003 9:48 AM To: [EMAIL PROTECTED] Subject: [PHP] preg_match array question Hey, Im trying to use preg_match to validate numbers in multiple fields. I can check one field but Im having trouble checking multiple fields. preg_match ( '(foo)' , $_POST[num1] ); - That works fine. but I need to check multiple fields. I thought I would build an array with the POST data like this... $num = array ($_POST[num1], ($_POST[num2]); There are more than that... and then use preg_match ('(foo)', $num) ; $num should point to my array, but that doesnt work. I get a warning message.. and it doesnt check the first num1 in the array. Im certain that Its my code, and I wanted to get some input on what Im doing wrong. -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_match array question
perhaps I am misunderstanding... I have snipit of my foreach. I have a preg_match that checks for a valid email address. basically it just checks for an @ and a . When I place this in my loop all of the keys are evaluated, so hence the name key is evaluated and thrown error because of the check. To remedy this problem I took it out of the loop and it worked fine. Ultimately I would love to keep it in the loop and throw checks for certain fields, but syntaxtually it doesnt work for me. Any Suggestions ? foreach ($_POST as $key=$value) { # Begin Foreach loop if (empty($value)) { # Begin If echo $key :: Missing Databr/; if (!preg_match('/([a-z0-9\-\.\#\:[EMAIL PROTECTED])/i', $_POST[eaddy])) {echo $_POST[eaddy], is not a valid address.br/; } } # End if else { echo $key, -Okbr/;} } # End Foreach - Original Message - From: Ralph [EMAIL PROTECTED] To: 'Daniel J. Rychlik' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, May 30, 2003 2:42 PM Subject: RE: [PHP] preg_match array question Not sure if I'm misunderstanding, but I know that foreach() will do this. -Original Message- From: Daniel J. Rychlik [mailto:[EMAIL PROTECTED] Sent: Friday, May 30, 2003 11:58 AM To: Ralph; [EMAIL PROTECTED] Subject: Re: [PHP] preg_match array question The problem is, that I have multiple fields and what I am trying to do is check each field to make sure I get the data that I need and not some crap, like letters in a number field or a script tag in a field. Things of this sort. The foreach loop wont work for me in this instance because Im checking for proper input. I can write multiple elseif statements to check each field but alas, this is not optimal. I may go ahead and write this to get it done and then go back and put it to the write board -- 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] preg_match array question
OH man, thats the ticket. I didnt even think about checking the $_POST[email] == email and then running the preg_match. I assumed that it evaluate the end of the preg_match statement and see $_POST[email] I appreciate your time... Sincerely, Dan - Original Message - From: Ralph [EMAIL PROTECTED] To: 'Daniel J. Rychlik' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, May 30, 2003 4:41 PM Subject: RE: [PHP] preg_match array question foreach ($_POST as $key=$value) { if (empty($value)) { error_message[] = $key :: Missing Databr/; } // if email field, perform email validation if($_POST[$key] == 'email') if (!preg_match('/([a-z0-9\-\.\#\:[EMAIL PROTECTED])/i', $_POST[$key])) { error_message[] = $value . is not a valid address.br/; } } // etc.. } // check for error message if(!empty($error_message)){ $c = count($error_message); for($i = 0; $i $c; $i++){ echo $error_message[$i]; } } else { // no error found } -Original Message- From: Daniel J. Rychlik [mailto:[EMAIL PROTECTED] Sent: Friday, May 30, 2003 1:04 PM To: Ralph; [EMAIL PROTECTED] Subject: Re: [PHP] preg_match array question perhaps I am misunderstanding... I have snipit of my foreach. I have a preg_match that checks for a valid email address. basically it just checks for an @ and a . When I place this in my loop all of the keys are evaluated, so hence the name key is evaluated and thrown error because of the check. To remedy this problem I took it out of the loop and it worked fine. Ultimately I would love to keep it in the loop and throw checks for certain fields, but syntaxtually it doesnt work for me. Any Suggestions ? foreach ($_POST as $key=$value) { # Begin Foreach loop if (empty($value)) { # Begin If echo $key :: Missing Databr/; if (!preg_match('/([a-z0-9\-\.\#\:[EMAIL PROTECTED])/i', $_POST[eaddy])) {echo $_POST[eaddy], is not a valid address.br/; } } # End if else { echo $key, -Okbr/;} } # End Foreach - Original Message - From: Ralph [EMAIL PROTECTED] To: 'Daniel J. Rychlik' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, May 30, 2003 2:42 PM Subject: RE: [PHP] preg_match array question Not sure if I'm misunderstanding, but I know that foreach() will do this. -Original Message- From: Daniel J. Rychlik [mailto:[EMAIL PROTECTED] Sent: Friday, May 30, 2003 11:58 AM To: Ralph; [EMAIL PROTECTED] Subject: Re: [PHP] preg_match array question The problem is, that I have multiple fields and what I am trying to do is check each field to make sure I get the data that I need and not some crap, like letters in a number field or a script tag in a field. Things of this sort. The foreach loop wont work for me in this instance because Im checking for proper input. I can write multiple elseif statements to check each field but alas, this is not optimal. I may go ahead and write this to get it done and then go back and put it to the write board -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A good function
What is a good function for striping white space and removing \\..\.. and possible , Anything that would be considered unwanted user input??? I looked at trim() but its doesnt do all the things I need it to do. -Dan