[PHP] Warning messages on web page.

2010-06-22 Thread Mike Davies
Hello, This is my first post to this list and I am a novice at php coding. I can generally follow the code but not good at writing from scratch. I have recently been trying to add to a website which was originally developed by someone else and is written in php and mysql. I am trying to add a 'n

Re: [PHP] Warning messages on web page.

2010-06-22 Thread Jim Lucas
Mike Davies wrote: > Hello, > > This is my first post to this list and I am a novice at php coding. I > can generally follow the code but not good at writing from scratch. > > > I have recently been trying to add to a website which was originally > developed by someone else and is written in php

Re: [PHP] Warning messages on web page.

2010-06-22 Thread Shreyas Agasthya
Mike, A couple of things that I could understand reading carefully at the error. 1. reset takes an array as the input and perhaps your $thumbsarray is *not *an array? Reset will set the internal pointer to the start of the array. 2. Warning # 2 is very closely related to #1 since you can iterate

Re: [PHP] Warning messages on web page.

2010-06-22 Thread Daniel P. Brown
On Tue, Jun 22, 2010 at 10:17, Mike Davies wrote: [snip!] > > Warning: reset() [function.reset]: Passed variable is not an array or > object in /home/b23aadf/public_html/news/details.php on line 72 [snip!] > > Is anyone able to help resolve this? If you let me know what further > information you r

Re: [PHP] Warning messages on web page.

2010-06-22 Thread Paul M Foster
On Tue, Jun 22, 2010 at 03:17:53PM +0100, Mike Davies wrote: > Hello, > > This is my first post to this list and I am a novice at php coding. I > can generally follow the code but not good at writing from scratch. > > > I have recently been trying to add to a website which was originally > deve

[PHP] Stripping Characters

2010-06-22 Thread Rick Dwyer
Hello List. I need to remove characters from a string and replace them with and underscore. So instead of having something like: $moditem = str_replace("--","_","$mystring"); $moditem = str_replace("?","_","$mystring"); $moditem = str_replace("!","_","$mystring"); etc. For every possibl

RE: [PHP] Stripping Characters

2010-06-22 Thread David Česal
Hello, can this resolve your problem? $trans = array( "from" => "to", "another" => "to"); $moditem = StrTr($moditem, $trans); -- http://cz.php.net/manual/en/function.strtr.php David -Original Message- From: Rick Dwyer [mailto:rpdw...@earthlink.net] Sent: Tuesday, June 22, 2010 5:41 PM

Re: [PHP] Stripping Characters

2010-06-22 Thread Ashley Sheridan
On Tue, 2010-06-22 at 11:40 -0400, Rick Dwyer wrote: > Hello List. > > I need to remove characters from a string and replace them with and > underscore. > > So instead of having something like: > > $moditem = str_replace("--","_","$mystring"); > $moditem = str_replace("?","_","$mystring"); >

Re: [PHP] Stripping Characters

2010-06-22 Thread Shreyas Agasthya
Perhaps, ereg_replace("your regex", "replacement_string", String $variable). Regards, Shreyas On Tue, Jun 22, 2010 at 9:10 PM, Rick Dwyer wrote: > Hello List. > > I need to remove characters from a string and replace them with and > underscore. > > So instead of having something like: > > $modi

Re: [PHP] Stripping Characters

2010-06-22 Thread Richard Quadling
On 22 June 2010 16:44, Ashley Sheridan wrote: > On Tue, 2010-06-22 at 11:40 -0400, Rick Dwyer wrote: > >> Hello List. >> >> I need to remove characters from a string and replace them with and >> underscore. >> >> So instead of having something like: >> >> $moditem = str_replace("--","_","$mystring

Re: [PHP] Stripping Characters

2010-06-22 Thread Nathan Nobbe
On Tue, Jun 22, 2010 at 9:40 AM, Rick Dwyer wrote: > Hello List. > > I need to remove characters from a string and replace them with and > underscore. > > So instead of having something like: > > $moditem = str_replace("--","_","$mystring"); > $moditem = str_replace("?","_","$mystring"); > $modit

Re: [PHP] Stripping Characters

2010-06-22 Thread Richard Quadling
"A "word" character is any letter or digit or the underscore character, that is, any character which can be part of a Perl "word". The definition of letters and digits is controlled by PCRE's character tables, and may vary if locale-specific matching is taking place. For example, in the "fr" (Frenc

Re: [PHP] Stripping Characters

2010-06-22 Thread Shreyas Agasthya
Then, when does one use ereg_replace as against preg_replace? I read from one the forums that preg_* is faster and ereg_* is if not faster but simpler. Is that it? Regards, Shreyas On Tue, Jun 22, 2010 at 9:58 PM, Richard Quadling wrote: > "A "word" character is any letter or digit or the und

Re: [PHP] Stripping Characters

2010-06-22 Thread Rick Dwyer
Thanks to everyone who responded. Regarding the myriad of choices, isn't Ashley's, listed below, the one most like to guarantee the cleanest output of just letters and numbers? --Rick On Jun 22, 2010, at 11:44 AM, Ashley Sheridan wrote: On Tue, 2010-06-22 at 11:40 -0400, Rick Dwyer wrot

Re: [PHP] Stripping Characters

2010-06-22 Thread Ashley Sheridan
On Tue, 2010-06-22 at 13:35 -0400, Rick Dwyer wrote: > Thanks to everyone who responded. > > Regarding the myriad of choices, isn't Ashley's, listed below, the one > most like to guarantee the cleanest output of just letters and numbers? > > > --Rick > > > On Jun 22, 2010, at 11:44 AM, As

Re: [PHP] Stripping Characters

2010-06-22 Thread Jim Lucas
Shreyas Agasthya wrote: > Then, when does one use ereg_replace as against preg_replace? I read from > one the forums that preg_* is faster and ereg_* is if not faster but > simpler. BUT, all the ereg_* has been depricated. DO NOT USE THEM if you want your code to work in the future. :) > > Is

Re: [PHP] Stripping Characters

2010-06-22 Thread Rick Dwyer
On Jun 22, 2010, at 1:41 PM, Ashley Sheridan wrote: It is clean, but as Richard mentioned, it won't handle strings outside of the traditional 128 ASCII range, so accented characters and the like will be converted to an underscore. Also, spaces might become an issue. However, if you are

[PHP] Question about logins and locking

2010-06-22 Thread James Colannino
Hey everyone, I have a question about logins. Let's say that I want to allow each user account to login only once at a time. I would then need some kind of locking mechanism to make sure that the same user can't login again somewhere else until first logging off. What's a good way to achieve th

RE: [PHP] Question about logins and locking

2010-06-22 Thread Tommy Pham
> -Original Message- > From: James Colannino [mailto:ja...@colannino.org] > Sent: Tuesday, June 22, 2010 2:29 PM > To: php-general@lists.php.net > Subject: [PHP] Question about logins and locking > > Hey everyone, > > I have a question about logins. Let's say that I want to allow each us

Re: [PHP] Stripping Characters

2010-06-22 Thread Rick Dwyer
Hello again list. My code for stripping characters is below. I'm hoping to get feedback as to how rock solid it will provide the desired output under any circumstance: My output must look like this (no quotes): "This-is-my-string-with-lots-of-junk-characters-in-it" The code with string l

Re: [PHP] Stripping Characters

2010-06-22 Thread Ashley Sheridan
On Tue, 2010-06-22 at 20:03 -0400, Rick Dwyer wrote: > Hello again list. > > My code for stripping characters is below. I'm hoping to get feedback > as to how rock solid it will provide the desired output under any > circumstance: > > My output must look like this (no quotes): > > "This-is

Re: [PHP] Stripping Characters

2010-06-22 Thread Rick Dwyer
Very good. Thank you. --Rick On Jun 22, 2010, at 8:14 PM, Ashley Sheridan wrote: On Tue, 2010-06-22 at 20:03 -0400, Rick Dwyer wrote: Hello again list. My code for stripping characters is below. I'm hoping to get feedback as to how rock solid it will provide the desired output under a

[PHP] In what scenario an extension of a class is useful?

2010-06-22 Thread Camilo Sperberg
Hello everybody :) I'm really intrigued on something... In what real-world applications could an extension of a class be really useful? Let's say I have this code: class foo { function hello_world($a) { echo 'foo hello world'; } function bye_world() { echo 'foo bye world'; } }

Re: [PHP] Question about logins and locking

2010-06-22 Thread James Colannino
Tommy Pham wrote: > 1) Set an encrypted (to prevent hijacking and eavesdropping) cookie to > expire when browser closes > 2) Have a table in the DB backend to keep track if the user is logged in or > not and when was the last time the validated user access your site (this > gets updated when the u

RE: [PHP] Question about logins and locking

2010-06-22 Thread Tommy Pham
> -Original Message- > From: James Colannino [mailto:ja...@colannino.org] > Sent: Tuesday, June 22, 2010 10:06 PM > To: PHP-General List > Subject: Re: [PHP] Question about logins and locking > > Tommy Pham wrote: > > > 1) Set an encrypted (to prevent hijacking and eavesdropping) cookie t

[PHP] $_SERVER['REMOTE_ADDR'] and sql injection

2010-06-22 Thread Tanel Tammik
Hi, is there a vulnerability with using $_SERVER['REMOTE_ADDR'] in sql queries? Br Tanel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] In what scenario an extension of a class is useful?

2010-06-22 Thread Rene Veerman
inheritance of this kind is useful if you have common descendants for specific types of object object mammal ( function eat (mixed $food) function shit () function sleep() ) object carnivore extends mammal ( function eat (meat $food) ) object herbivore extends mammal ( function eat (vegg