php-general Digest 26 Aug 2007 18:18:38 -0000 Issue 4983

2007-08-26 Thread php-general-digest-help
php-general Digest 26 Aug 2007 18:18:38 - Issue 4983 Topics (messages 261282 through 261298): Re: Calling functions which names are inside a variable 261282 by: Robert Cummings 261284 by: Robert Keizer 261286 by: Sanjeev N determine which string is longer and then

[PHP] determine which string is longer and then what is different in that string

2007-08-26 Thread Richard Kurth
I am trying to find out which string is the longest and then find out what is different between the two string. Sometimes String 2 is longer than String 1 The script below works sometimes but not all the time. Is there a better way to do this or tell me what is wrong with the script I am using

[PHP] Re: Calling functions which names are inside a variable

2007-08-26 Thread Robert Keizer
Thats great thanks, but it doesn't solve my problem completly, im trying to use $output = $var(); .. which gives me an error. The $var(); works though, so thanks for that. Robert Keizer Robert Keizer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am currently working on a module

[PHP] Re: determine which string is longer and then what is different in that string

2007-08-26 Thread Robert Keizer
Okay, why not try somthing like this: $string1 = 1,2,3,4,5,6,7,8; $string2 = 2,4,6,8,10; $ary1 = implode(,,$string1); $ary2 = implode(,,$string2); $num1 = ''; $num2 = ''; foreach($ary1 as $num){ $num1 .= $num; } foreach($ary2 as $num){ $num2 .= $num; } that would get the strings into

RE: [PHP] Calling functions which names are inside a variable

2007-08-26 Thread Sanjeev N
I tested this functionality. This is working fine. foo.php ? function foo( $var ){ include $var.'.php'; return $var(); }; foo(somefunction); ? somefunction.php ? function somefunction(){ echo hello; } ? Out put is hello. You make sure that your both

RE: [PHP] determine which string is longer and then what is different in that string

2007-08-26 Thread Sanjeev N
Hi Richard, I am trying to get your actual problem. First, you want to compare 2 strings and want to check what the difference between these 2 strings is. I assuming string may contain either numbers or any characters. Second, you are trying to compare the numbers. But I am thinking that your

Re: [PHP] Does JavaScript not work in php web file?

2007-08-26 Thread Patrik Hasibuan
Dear Sanjeev, you're right. I am sorry for my carelessness. I corrected my code and than try it again. But again, it does not work as I expect. I even put prompt(this function is being called); in the jsopsi() but again the prompt does not come out. Pffuih... I am desperate only because of

[PHP] help with session

2007-08-26 Thread Jason Cartledge
Hi, this is my first post to this newsgroup. Does this code look ok or is there a more clean way of doing this? I am learning. Thank you for reading. Jason if ( !empty($_REQUEST['gender']) ) { $registrationGender=$_REQUEST['gender']; } else {

Re: [PHP] help with session

2007-08-26 Thread mike
On 8/26/07, Jason Cartledge [EMAIL PROTECTED] wrote: I would replace $_REQUEST with $_GET or $_POST (as appropriate) if ( !empty($_REQUEST['gender']) ) { $registrationGender=$_REQUEST['gender']; } else { Personally I would use

Re: [PHP] help with session

2007-08-26 Thread Wouter van Vliet / Interpotential
I would go for: if (isset($_REQUEST['gender'])) $_SESSION['registrationGender'] = $_REQUEST['gender']; print isset($_SESSION['registrationGender']) ? You are registered as gender: .$_SESSION['registrationGender'] : Your gender is unknown; And make no assumptions about a gender when you

[PHP] text to HTML

2007-08-26 Thread Ron Piggott
Is there a PHP command that turns text into HTML? EXAMPLE: before Hi. How are you doing? after Hi.p How are you doing?p

[PHP] upload temp dir in vhost env.

2007-08-26 Thread jekillen
Hello again; I have a question about upload temp dir as defined in php.ini; I have been working on a project that has registered users, each having a user space portion of the web site file system. I want them to be able to upload images and such and have the stuff transfered to their own user

RE: [PHP] text to HTML

2007-08-26 Thread Bastien Koert
the closest is nl2br() which converts line breaks to tags. Other than that, you would need to look at regex manipulation to make those changes. Bastien From: [EMAIL PROTECTED] To: php-general@lists.php.net Date: Sun, 26 Aug 2007 10:36:06 -0400

Re: [PHP] upload temp dir in vhost env.

2007-08-26 Thread brian
jekillen wrote: Hello again; I have a question about upload temp dir as defined in php.ini; I have been working on a project that has registered users, each having a user space portion of the web site file system. I want them to be able to upload images and such and have the stuff transfered

Re: [PHP] upload temp dir in vhost env.

2007-08-26 Thread Ludovic André
Hi, that's not a problem to specify where the uploaded file has to be moved after upload. As you specify for each user a personal directory in the system, you just need to use a function like move_uploaded_file() to move the uploaded file to this directory. Each uploaded file goes to,

[PHP] How do I delete a composite key?

2007-08-26 Thread nitrox .
Im trying to delete a composite key but cannot figure out the proper format. Would somebody tell me where im messing up? I have an url that is supposed to send the member id and game id to a delete query. And the delete query is supposed to grab the id's based on type. This is the link: a

RE: [PHP] Does JavaScript not work in php web file?

2007-08-26 Thread Sanjeev N
Hi, I tried this code by removing PHP codes and made as HTML. As you said prompt dint come to me also. When I checked JavaScript errors then I saw that prompt function had some errors (like ; in wrong place). I have corrected the errors in script. Script Language=JavaScript function

Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-26 Thread Stut
Nathan Nobbe wrote: look at C++, Java, and PHP. these languages are all written in C; Just wanted to pick you up on this. PHP is the only language you've listed that only has a single implementation. There are implementations of C++ compilers that are writting in other languages. I can't

Re: [PHP] How do I delete a composite key?

2007-08-26 Thread Stut
nitrox . wrote: Im trying to delete a composite key but cannot figure out the proper format. Would somebody tell me where im messing up? I have an url that is supposed to send the member id and game id to a delete query. And the delete query is supposed to grab the id's based on type. This

[PHP] How do I get Apache 1.3.36 to use PHP 5

2007-08-26 Thread Beauford
Not to sound like a total nob, but how do I get Apache 1.3.36 to use PHP5. I have both 4 and 5 installed, but it still uses 4. I never had a problem with 4. I read the followed the INSTALL file for PHP5, below. I reinstall Apache as well and nothing - step 11. I tried putting LoadModule

[PHP] Adding text before last paragraph

2007-08-26 Thread Dotan Cohen
I have a string with some HTML paragraphs, like so: $text=pFirst paragraph/p\npMore text/p\npSome more text/p\npEnd of story/p; I'd like to add an image before the last paragraph. I know that preg_replace can replace only the first n occurrences of a string, but how can I replace the _last_

Re: [PHP] Adding text before last paragraph

2007-08-26 Thread Richard Lynch
On Sun, August 26, 2007 3:41 pm, Dotan Cohen wrote: I have a string with some HTML paragraphs, like so: $text=pFirst paragraph/p\npMore text/p\npSome more text/p\npEnd of story/p; I'd like to add an image before the last paragraph. I know that preg_replace can replace only the first n

Re: [PHP] How do I delete a composite key?

2007-08-26 Thread Richard Lynch
On Sun, August 26, 2007 2:05 pm, Stut wrote: nitrox . wrote: Im trying to delete a composite key but cannot figure out the proper format. Would somebody tell me where im messing up? I have an url that is supposed to send the member id and game id to a delete query. And the delete query is

Re: [PHP] upload temp dir in vhost env.

2007-08-26 Thread Richard Lynch
On Sun, August 26, 2007 10:34 am, jekillen wrote: I have been working on a project that has registered users, each having a user space portion of the web site file system. I want them to be able to upload images and such and have the stuff transfered to their own user spaces. With one up load

Re: [PHP] text to HTML

2007-08-26 Thread Richard Lynch
On Sun, August 26, 2007 9:36 am, Ron Piggott wrote: Is there a PHP command that turns text into HTML? EXAMPLE: before Hi. How are you doing? after Hi.p How are you doing?p http://php.net/nl2br You could also do: echo p, str_replace(\n, /p\n/p, $text), /p\n; Another option, if

Re: [PHP] determine which string is longer and then what is different in that string

2007-08-26 Thread Richard Lynch
On Sun, August 26, 2007 1:11 am, Richard Kurth wrote: I am trying to find out which string is the longest and then find out what is different between the two string. Sometimes String 2 is longer than String 1 The script below works sometimes but not all the time. Is there a better way to do

Re: [PHP] Calling functions which names are inside a variable

2007-08-26 Thread Richard Lynch
On Sun, August 26, 2007 12:46 am, Robert Keizer wrote: I am currently working on a module testing class, I can't seem to find the correct syntax. Here is an example of the problem: function foo( $var ){ include $var.'.php'; return $var(); // !--- problem Try this: return

Re: [PHP] Trying to understand sessions and using them to authenticate...

2007-08-26 Thread Richard Lynch
On Fri, August 24, 2007 11:03 am, Jason Pruim wrote: Hi Everyone, I'm attempting to figure out the proper way to use sessions to log someone into my system. The idea being, if they arn't logged in all they can see is the login form, and if they are logged in, they and have access to a

Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-26 Thread Richard Lynch
On Fri, August 24, 2007 10:11 am, Steve Brown wrote: html head titlePHP Web Server Test/title /head body ?php phpinfo(); ? /body /html phpinfo(), which should never be called in a production setting, is quite possibly the worst benchmark function you could choose. :-) :-) :-) I ran

Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-26 Thread Richard Lynch
On Sat, August 25, 2007 9:45 am, Robert Cummings wrote: PHP4 AND PHP5 developers don't even use OOP. Tell me what is compelling in PHP5 that doesn't rely on you being an OOP developer? The XML stuff, if you need to parse XML a lot, which is not exactly a niche market, but not everybody needs

Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-26 Thread Richard Lynch
On Sat, August 25, 2007 11:56 am, Nathan Nobbe wrote: so we would really have to dig deeper for a definition of 'basic oop' / 'true oop' etc. I'll consider PHP true OOP when PECL has a Lisp extension for me to write REAL oop code :-) Actually, that could be a kind of fun extension to write...

Re: [PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink

2007-08-26 Thread Richard Lynch
On Fri, August 24, 2007 3:20 am, Goltsios Theodore wrote: Please do not encourage the use of $_REQUEST. You might as well just tell people to enable register_globals again. This is *SO* not correct at all! $_REQUEST[] is merely array_merge($_GET, $_POST, $_COOKIE); It is *NOT* in any way,

Re: [PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink

2007-08-26 Thread Richard Lynch
On Fri, August 24, 2007 6:34 am, Suamya Srivastava wrote: by doing this can i disable the register_globals? You can disable register_globals by using these: $_GET['foo'] $_POST['foo'] $_REQUEST['foo']; $_COOKIES['foo']; $_SESSION['foo']; $_ENV['foo']; $_SERVER['foo']; and never, ever, ever,

Re: [PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink

2007-08-26 Thread mike
On 8/26/07, Richard Lynch [EMAIL PROTECTED] wrote: This is *SO* not correct at all! $_REQUEST[] is merely array_merge($_GET, $_POST, $_COOKIE); Yes and it mimics being lazy - allowing overriding values from $_POST vs. $_GET vs. $_COOKIE depending on what the programmer wants to trust It

Re: [PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink

2007-08-26 Thread Richard Lynch
On Sun, August 26, 2007 6:37 pm, mike wrote: On 8/26/07, Richard Lynch [EMAIL PROTECTED] wrote: It is *NOT* in any way, shape, or form, polluting the global namespace of all your variables, which is what register_globals is. That is why I said it was *one* reason register_globals was

Re: [PHP] PHP and SOAP calls

2007-08-26 Thread Richard Lynch
On Fri, August 24, 2007 12:55 am, Angelo Zanetti wrote: Dear All I have been using nusoap to development a client that makes SOAP calls to a server. I have however been stuck on a small issue but can't seem to solve it and therefore I need to relook at using another package to get a

Re: [PHP] [mssql_connect error] Changed database context to..

2007-08-26 Thread Richard Lynch
On Thu, August 23, 2007 6:26 pm, Liz Kim wrote: Did anyone else run into this problem? PHP fails to connect to MSSQL7 with mssql_connect with the message: Changed database context to 'DB_NAME'. I've been searching around but did not find a good solution for PHP. I did find this link:

Re: [PHP] Spam Post Defense / ID spam form posts

2007-08-26 Thread Richard Lynch
On Thu, August 23, 2007 2:49 pm, Instruct ICC wrote: Can server1 receive a web page form post from remoteAttacker, identify it as spam (or a DoS or DDoS attack), hand off the socket to multiple threads on multiple servers owned by server1's owner, return multiple responses to remoteAttacker

Re: [PHP] Spam Post Defense / ID spam form posts

2007-08-26 Thread Richard Lynch
On Thu, August 23, 2007 4:46 pm, Stut wrote: Instruct ICC wrote: Wow, that's for that egg-sucking lesson. I would think it was clear from my answer that I know what a socket is. Sorry. You understood the concept but it wasn't clear to me that you understood about the socket. Save me a

Re: [PHP] ignore-user-abort and connection-handling

2007-08-26 Thread Richard Lynch
On Thu, August 23, 2007 12:04 pm, Jason Pruim wrote: One of these days someone is going to get sick of hearing from me, but until that day comes I have another question :) I asked on a MySQL list about wether it's better to have 1 database with many tables, or many databases with 1 table for

[PHP] Re: determine which string is longer and then what is different in that string

2007-08-26 Thread Bill Guion
At 11:11 PM -0700 8/25/07, Richard Kurth wrote: I am trying to find out which string is the longest and then find out what is different between the two string. Sometimes String 2 is longer than String 1 The script below works sometimes but not all the time. Is there a better way to do this or

Re: [PHP] upload temp dir in vhost env.

2007-08-26 Thread jekillen
On Aug 26, 2007, at 9:15 AM, brian wrote: jekillen wrote: Hello again; I have a question about upload temp dir as defined in php.ini; I have been working on a project that has registered users, each having a user space portion of the web site file system. I want them to be able to upload

[PHP] RE: determine which string is longer and then what is different in that string

2007-08-26 Thread Richard Kurth
I am trying to find out which string is the longest and then find out what is different between the two string. Sometimes String 2 is longer than String 1 The script below works sometimes but not all the time. Is there a better way to do this or tell me what is wrong with the

Re: [PHP] upload temp dir in vhost env.

2007-08-26 Thread jekillen
On Aug 26, 2007, at 2:56 PM, Richard Lynch wrote: On Sun, August 26, 2007 10:34 am, jekillen wrote: I have been working on a project that has registered users, each having a user space portion of the web site file system. I want them to be able to upload images and such and have the stuff

Re: [PHP] Re: Recompiling PHP with mssql

2007-08-26 Thread Richard Lynch
On Thu, August 23, 2007 9:45 am, Colin Guthrie wrote: Dan Shirah wrote: You shouldn't need to recompile PHP. Just go into your PHP.ini file and uncomment the line: ;extension=php_mssql.dll After that you can go to the [MSSQL] section of the .ini file and change the rest of the settings

Re: [PHP] Table shows even when if () is false

2007-08-26 Thread Richard Lynch
The definition of 'empty' changed several times in the life of PHP. I think an empty array was always empty though... Still, if it's giving you grief, just use http://php.net/count On Wed, August 22, 2007 4:06 pm, Dan Shirah wrote: From my understanding, if $result_deferred_comments is empty,

Re: [PHP] Override parent class constants

2007-08-26 Thread Richard Lynch
On Wed, August 22, 2007 3:04 pm, James Ausmus wrote: Hello - I'm trying to find a (sane) way to, in an extended class, override the parent class's constants, something like the following (which doesn't actually work): Call me crazy, but if you're over-riding it, then it's not a constant, so

Re: [PHP] using disable_functions silently

2007-08-26 Thread Richard Lynch
You could change the PHP source to not emit an error when a function doesn't exist and matches the list in disable_functions... But since a whole heck of a lot of scripts would NOT just work without exec, that would probably not be such a Good Idea... On Thu, August 23, 2007 12:25 am, Samuel

[PHP] RE: determine which string is longer and then what is different in that string

2007-08-26 Thread Bill Guion
At 6:00 PM -0700 8/26/07, Richard Kurth wrote: I am trying to find out which string is the longest and then find out what is different between the two string. Sometimes String 2 is longer than String 1 The script below works sometimes but not all the time. Is there a better way to do

Re: [PHP] How do I get Apache 1.3.36 to use PHP 5

2007-08-26 Thread Richard Lynch
On Sun, August 26, 2007 3:03 pm, Beauford wrote: I tried putting LoadModule php5_module /usr/local/apache/libphp5.so in my http.conf, but it doesn't exist. Example 2-2. Installation Instructions (Static Module Installation for Apache) for PHP I think static module installation means

[PHP] Database includes

2007-08-26 Thread Bruce Cowin
I'm curious as to how everyone organises and includes their classes in PHP5. Let's take a simple example that has 3 classes: customer, order, and database. The database class has a base sql db class (I know there is PDO and other things but this class is already written and working) and classes

Re: [PHP] Re: Announcement: Releasing CORE GRASP for PHP. An open source, dynamic web application protection system.

2007-08-26 Thread Richard Lynch
On Wed, August 22, 2007 3:31 pm, mike wrote: I thing a good FAQ entry would be how this patch fits in with Suhosin and what are the comparable/conflicting concepts, are they compatible with each other etc. http://www.hardened-php.net/suhosin/a_feature_list.html Both systems are liable to

[PHP] Re: Database includes

2007-08-26 Thread Gregory Beaver
Bruce Cowin wrote: I'm curious as to how everyone organises and includes their classes in PHP5. Let's take a simple example that has 3 classes: customer, order, and database. The database class has a base sql db class (I know there is PDO and other things but this class is already written

Re: [PHP] Database includes

2007-08-26 Thread Larry Garfield
On Sunday 26 August 2007, Bruce Cowin wrote: I'm curious as to how everyone organises and includes their classes in PHP5. Let's take a simple example that has 3 classes: customer, order, and database. The database class has a base sql db class (I know there is PDO and other things but this

Re: [PHP] RE: determine which string is longer and then what is different in that string

2007-08-26 Thread Richard Lynch
On Sun, August 26, 2007 8:00 pm, Richard Kurth wrote: I am trying to find out which string is the longest and then find out what is different between the two string. Sometimes String 2 is longer than String 1 The script below works sometimes but not all the time. Is there a better way to do

Re: [PHP] using disable_functions silently

2007-08-26 Thread Richard Lynch
On Thu, August 23, 2007 12:58 pm, Samuel Vogel wrote: That'd be at least some kind of a solution. I'm thinking of overwriting the functions I want to block with one, that just returns true and does nothing. How would I do that? E. You don't. Well, okay, you *COULD* install the Run-Kit

Re: [PHP] Database includes

2007-08-26 Thread Chris
Bruce Cowin wrote: I'm curious as to how everyone organises and includes their classes in PHP5. Let's take a simple example that has 3 classes: customer, order, and database. The database class has a base sql db class (I know there is PDO and other things but this class is already written and

Re: [PHP] export data of html table

2007-08-26 Thread Richard Lynch
On Wed, August 22, 2007 1:09 am, Vanessa Vega wrote: i have a table generated using PHP javascript...the data on that table came from a form where several data was inputted... I want to let them see a preview of the data they entered, so i put a link or button that when clicked, will

Re: [PHP] php to generate java-script

2007-08-26 Thread Richard Lynch
If you want to capture the output of your current script, toss ob_start() at the top and $data = ob_get_content() at the bottom and then munge it as you will. Though I also think you'd be better off putting the JS validation in-line with the input tags. On Tue, August 21, 2007 1:32 pm, Jas

Re: [PHP] Server error

2007-08-26 Thread Richard Lynch
On Tue, August 21, 2007 6:14 am, Humani Power wrote: Hi everybody. I have a Fedora Core 7 with php 5, and I want to upload an image. The funniest thing is that my script works fine in other computer but not in this one. I look for the error in /var/log/httpd/error.log and I found this

Re: [PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink

2007-08-26 Thread mike
I'll say it again: regsiter_globals has *NOTHING* to do with $_REQUEST. Zero. Zilch. Nada. Zip. To me it allows for the same [lazy] behavior. Period. I've had other people agree. Say what you want about it. No, it only relies on one Designer who wants their request to look like a FORM

Re: [PHP] Best Practices for calling 'setup' classes that extend 'parent' classes?

2007-08-26 Thread Richard Lynch
Put all your classes into a single directory structure. Use http://php.net/set_include_path (or php.ini or .htaccess) to provide the FULL PATH to that directory. PHP now knows where to start its search, and essentially prepends that directory when it does an include. Assume this directory

Re: [PHP] for/foreach speed

2007-08-26 Thread Richard Lynch
On Mon, August 20, 2007 11:50 am, Sascha Braun, CEO @ fit-o-matic wrote: could somebody please explain me, what loop construct is faster? The for, while or foreach. If you are doing anything where the speed of for/while/foreach matters, you shouldn't have done that in PHP in the first place,

Re: [PHP] PHP eval() fatal error

2007-08-26 Thread Richard Lynch
On Mon, August 20, 2007 8:54 am, Maarten Balliauw wrote: Here's the thing: I'm trying to do some dynamic code compilation within PHP using eval(). The code I'm trying to compile raises an E_ERROR (Fatal). Here's a simple example: ?php $code = ' $returnValue = 12*A+; '; // Clearly

Re: [PHP] variables

2007-08-26 Thread Richard Lynch
On Mon, August 20, 2007 12:41 am, Augusto Morais wrote: Hi, I want create a variable based in another variable. Example: $foo (a simple variable); $myvar_foo Does it possible? variable variables will do it. But 99.% of the time, you're better off just using an array. -- Some

Re: [PHP] Delete row in a lookup table

2007-08-26 Thread Richard Lynch
On Sat, August 18, 2007 6:31 pm, nitrox . wrote: Is it not considered good practice to have a primary key on a lookup table for a database? I have 3 tables setup, games, memberleagues and members. The memberleagues table holds the id of the games table and members table. The problem I have is

Re: [PHP] Database includes

2007-08-26 Thread Richard Lynch
On Sun, August 26, 2007 9:16 pm, Bruce Cowin wrote: I'm curious as to how everyone organises and includes their classes in PHP5. Let's take a simple example that has 3 classes: customer, order, and database. The database class has a base sql db class (I know there is PDO and other things

Re: [PHP] Pass $_GET to php cli.

2007-08-26 Thread Richard Lynch
On Tue, August 21, 2007 3:08 am, Per Jessen wrote: N0K wrote: But if it run in the browser, i think it have to run in cli, dont you think ? No, certainly not by default. They are very different environments, as you have already found out. If you want to force it to work, you could hack up

Re: [PHP] apache/php with sybase12.5

2007-08-26 Thread Richard Lynch
Are you sure it's not --with-apxs2 instead of --with-apx2 ??? On Fri, August 17, 2007 8:00 am, ROUKOS Michel wrote: Hi, I am integrating httpd-2.0.59 with php-5.2.1 and Sybase 12.5 on a solaris 8 machine. I followed these steps: Install apache: ./configure --prefix=/usr/local/apache2