[PHP] Declare variables in advance question
I want to declare these variables Game_id and Member_id in advance. Following the suggestionfrom one of my books can I do something like this: $expected = array('Game_id', 'Member_id');foreach($expected AS $key) {if ( !empty($_POST[$key])) { ${$key} = $_POST[$key];}else { ${$key} = NULL;}} case "addmember": switch ($_GET['type']) {case "membergame": $sql = "INSERT INTO xsm_membergames (Game_id,Member_id) VALUES ('" . mysql_real_escape_string((int)$_POST["Game_id"])) . "', '" . mysql_real_escape_string((int)$_POST["Member_id"])) . "')"; break; } break; My concern is did I achieve anything with the code I just added to declare the variables? Is it actually being passed to this: case "addmember": switch ($_GET['type']) {case "membergame": $sql = "INSERT INTO xsm_membergames(Game_id,Member_id) VALUES('" . mysql_real_escape_string((int)$_POST["Game_id"]) . "','" . mysql_real_escape_string((int)$_POST["Member_id"]) . "')"; break; } break; I did add this and tested it on my server and I didnt recieve any errors. So how can I be sure its doing what I intended? _ See what you’re getting into…before you go there http://newlivehotmail.com/?ocid=TXT_TAGHM_migration_HM_viral_preview_0507
Re: [PHP] php 4.4.7 make install with pear causes zend freeing errors
M. Sokolewicz wrote: Chris wrote: John Mendenhall wrote: Is the only valid response to problems with php4 to upgrade to php5? Or, are there still some people out there still using php4 and possibly have had problems with install such as the following? If php5 is the only answer, I guess we'll just have to go with what we have and limp along until we can get everything converted to work on php5. I sent this to the php-install list. Try the -internals list. I don't think the php-internals folks would appreciate such emails. For problems with the install, first make sure it's not your fault (sounds stupid, but usually is), and if it's a bug, report it via the bugtracker. There is no need to bother the PHP developers with such things. The compiler complaining about free'ing memory is something they should pay attention to as far as I'm concerned. *shrug* -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php 4.4.7 make install with pear causes zend freeing errors
Chris wrote: John Mendenhall wrote: Is the only valid response to problems with php4 to upgrade to php5? Or, are there still some people out there still using php4 and possibly have had problems with install such as the following? If php5 is the only answer, I guess we'll just have to go with what we have and limp along until we can get everything converted to work on php5. I sent this to the php-install list. Try the -internals list. I don't think the php-internals folks would appreciate such emails. For problems with the install, first make sure it's not your fault (sounds stupid, but usually is), and if it's a bug, report it via the bugtracker. There is no need to bother the PHP developers with such things. Just as a note, the internals list is (afaik) not meant to provide _any_ type of support, it's for discussion about the internals of PHP (mainly). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php 4.4.7 make install with pear causes zend freeing errors
Chris, > >I sent this to the php-install list. > > Try the -internals list. Thanks! JohnM -- john mendenhall [EMAIL PROTECTED] surf utopia internet services -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php 4.4.7 make install with pear causes zend freeing errors
John Mendenhall wrote: Is the only valid response to problems with php4 to upgrade to php5? Or, are there still some people out there still using php4 and possibly have had problems with install such as the following? If php5 is the only answer, I guess we'll just have to go with what we have and limp along until we can get everything converted to work on php5. I sent this to the php-install list. Try the -internals list. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] good os, php drive classifieds package?
I need to put together a car classifieds site and before I re-invent the wheel was curious if anyone new of any good php driven OS packages available. Does anyone have any recommendations? Thanks!
RE: [PHP] Best Practices for calling 'setup' classes that extend 'parent' classes?
[snip] What is the best practice for correctly targeting 'include' paths when using Initialization/Setup classes that extend Parent classes? In my extend_parent_class.php file, I have to provide an incorrect relative path. Apparently, the path (that does work) is relative to php file that calls the initialization/setup class (call_the_extend_parent_class.php). Is there a less confusing way to correctly target include paths when creating initialization classes? Should I be using absolute paths instead? [/snip] Have you considered autoloading? http://us2.php.net/autoload -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Best Practices for calling 'setup' classes that extend 'parent' classes?
What is the best practice for correctly targeting 'include' paths when using Initialization/Setup classes that extend Parent classes? In my extend_parent_class.php file, I have to provide an incorrect relative path. Apparently, the path (that does work) is relative to php file that calls the initialization/setup class (call_the_extend_parent_class.php). Is there a less confusing way to correctly target include paths when creating initialization classes? Should I be using absolute paths instead? many thanks in advance extend_parent_class.php: include_once('./path/to/parent_class.php'); # Works with 'incorrect' relative path //include_once('../path/to/parent_class.php'); # Fatal Error with 'correct' relative path class Initialize_Parent_Class extends Parent_Class { function Initialize_Parent_Class() { $this->Parent_Class(); echo "This was successful and does not result in a fatal 'class not found' error"; } } Call the initialization class. call_the_extend_parent_class.php: // prints 'This was successful and does not result in a fatal 'class not found' error' ?> File structure: php ++call_the_extend_parent_class.php ++ includes directory extend_parent_class.php ++ classes directory parent_class.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Monitoring system resources used by PHP
I'm looking for a way to monitor the system resources (CPU, memory, Disk I/O, etc) used by the PHP engine on a linux machine. I can't monitor it by the usual means (top, etc), since it runs as part of the apache process(es). Does anyone know if a tool exists from Zend, or a module for Apache, to monitor resource usage for internal subprocesses such as PHP? The machines I need to monitor are a cluster of load-balanced servers running Perl and mod_jk in addition to PHP, so that complicates things a bit. It was suggested to me on a message board to set up a similar test environment with just PHP and some kind of profiling built into all the scripts, but this would kind of defeat the point, since we're wanting to monitor production machines so that in the case they do down for whatever reason, we can see which applications spiked when and why. Sorry for the lengthy question, hope someone can help. Thanks for your time.
Re: [PHP] php 5 and ms sql server express won't play nice !
> ... but the > second comment seems helpful. > > [1] http://www.php.net/manual/en/function.mssql-connect.php For SQL Server 2005, getting the right version of that ntwdblib.dll is crucial. However, Microsoft has apparently abandoned the NTWDBLIB library, so I have begun working with PDO ODBC instead. (It isn't 100%, though.) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php 4.4.7 make install with pear causes zend freeing errors
Is the only valid response to problems with php4 to upgrade to php5? Or, are there still some people out there still using php4 and possibly have had problems with install such as the following? If php5 is the only answer, I guess we'll just have to go with what we have and limp along until we can get everything converted to work on php5. I sent this to the php-install list. However, with no response, I knew there would be more eyes looking at it here. Hopefully, someone can send me a pointer on how to resolve this issue. It might be the root of other problems I am having. Per my previous message, I have recently upgraded from php 4.4.0, to php 4.4.7. My configure options are as follows: - ./configure \ --prefix=/usr/local/php4 \ --with-apxs=/usr/sbin/apxs \ --enable-debug \ --disable-cgi \ --enable-force-cgi-redirect \ --enable-discard-path \ --enable-safe-mode \ --disable-short-tags \ --disable-ipv6 \ --enable-magic-quotes \ --with-openssl \ --with-pcre-regex \ --with-curl \ --with-curlwrappers \ --with-mcrypt \ --enable-session \ --with-mysql=/usr/local \ --with-mysql-sock=/var/www/var/run/mysql/mysql.sock - After running configure and make, I run make install. This is the output of the make install: - calvin:php-4.4.7 {156} sudo make install Installing PHP SAPI module: apache [activating module `php4' in /var/www/conf/httpd.conf] cp libs/libphp4.so /usr/lib/apache/modules/libphp4.so chmod 755 /usr/lib/apache/modules/libphp4.so cp /var/www/conf/httpd.conf /var/www/conf/httpd.conf.bak cp /var/www/conf/httpd.conf.new /var/www/conf/httpd.conf rm /var/www/conf/httpd.conf.new Installing PHP CLI binary:/usr/local/php4/bin/ Installing PHP CLI man page: /usr/local/php4/man/man1/ Installing PEAR environment: /usr/local/php4/lib/php/ [PEAR] Archive_Tar- already installed: 1.3.2 [PEAR] Console_Getopt - already installed: 1.2.3 [PEAR] HTML_Template_IT- already installed: 1.2.1 [PEAR] Net_UserAgent_Detect- already installed: 2.3.0 [PEAR] PEAR - already installed: 1.6.1 Wrote PEAR system config file at: /usr/local/php4/etc/pear.conf You may want to add: /usr/local/php4/lib/php to your php.ini include_path [PEAR] Structures_Graph- already installed: 1.0.2 /usr/local/src/php.net/php-4.4.7/Zend/zend_hash.c(458) : Freeing 0x3CB27624 (128 bytes), script=/usr/local/src/php.net/php-4.4.7/pear/install-pear.php Last leak repeated 89 times /usr/local/src/php.net/php-4.4.7/Zend/zend_execute.c(795) : Freeing 0x3CBB9EA4 (44 bytes), script=/usr/local/src/php.net/php-4.4.7/pear/install-pear.php /usr/local/src/php.net/php-4.4.7/Zend/zend_variables.c(123) : Actual location (location was relayed) Last leak repeated 30 times /usr/local/src/php.net/php-4.4.7/Zend/zend_hash.c(280) : Freeing 0x3CBB9724 (43 bytes), script=/usr/local/src/php.net/php-4.4.7/pear/install-pear.php Last leak repeated 4173 times /usr/local/src/php.net/php-4.4.7/Zend/zend_hash.c(204) : Freeing 0x3CBB96A4 (32 bytes), script=/usr/local/src/php.net/php-4.4.7/pear/install-pear.php Last leak repeated 1504 times /usr/local/src/php.net/php-4.4.7/Zend/zend_execute.c(2392) : Freeing 0x3CBB94A4 (44 bytes), script=/usr/local/src/php.net/php-4.4.7/pear/install-pear.php /usr/local/src/php.net/php-4.4.7/Zend/zend_variables.c(123) : Actual location (location was relayed) Last leak repeated 27 times /usr/local/src/php.net/php-4.4.7/Zend/zend_execute.c(1818) : Freeing 0x3CB26D24 (12 bytes), script=/usr/local/src/php.net/php-4.4.7/pear/install-pear.php Last leak repeated 18 times /usr/local/src/php.net/php-4.4.7/Zend/zend_execute.c(2126) : Freeing 0x3CB26CE4 (12 bytes), script=/usr/local/src/php.net/php-4.4.7/pear/install-pear.php Last leak repeated 568 times /usr/local/src/php.net/php-4.4.7/Zend/zend_execute.c(2129) : Freeing 0x3CBB9124 (45 bytes), script=/usr/local/src/php.net/php-4.4.7/pear/install-pear.php /usr/local/src/php.net/php-4.4.7/Zend/zend_variables.c(111) : Actual location (location was relayed) Last leak repeated 568 times /usr/local/src/php.net/php-4.4.7/Zend/zend_execute.c(512) : Freeing 0x3CB266A4 (12 bytes), script=/usr/local/src/php.net/php-4.4.7/pear/install-pear.php Last leak repeated 525 times /usr/local/src/php.net/php-4.4.7/Zend/zend_execute.c(2106) : Freeing 0x3CBB8A24 (44 bytes), script=/usr/local/src/php.net/php-4.4.7/pear/install-pear.php /usr/local/src/php.net/php-4.4.7/Zend/zend_API.c(563) : Actual location (location was relayed) Last leak repeated 512 times /usr/local/src/php.net/php-4.4.7/Zend/zend_API.c(595) : Freeing 0x3CBB8424 (44 bytes), script=/usr/local/src/php.net/php-4.4.7/pear/install-pear.php /usr/local/src/php.net/php-4.4.7/Zend/zend_API.c(583) : Actual location (location was relayed) Last leak repeated 35 times /usr/local/src/php.net/php-4.4.7/Zend/zend_hash.c(424) : Freeing 0x3CBB51A4 (35 bytes), script=/usr/local/src/php.net/php-4.4.7/pear/install-pear.php Last leak repeated 1202 times /usr/local/src/php.net/php-4.4.7/Zend/z
Re: [PHP] for/foreach speed
Thank you very much. When we might have time for testing we can wager :)) Am Montag, den 20.08.2007, 13:21 -0400 schrieb Robert Cummings: > On Mon, 2007-08-20 at 18:50 +0200, Sascha Braun, CEO @ fit-o-matic > wrote: > > Hi people, > > > > could somebody please explain me, what loop construct is > > faster? The for, while or foreach. > > I haven't bothered testing but I'd wager $5 that the following is the > fastest loop: > > > while( 1 ) > { > } > > ?> > > Depending on bytecode creation though, the following might be just as > fast: > > > for( ;; ) > { > } > > ?> > > Cheers, > Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] for/foreach speed
On Mon, 2007-08-20 at 18:50 +0200, Sascha Braun, CEO @ fit-o-matic wrote: > Hi people, > > could somebody please explain me, what loop construct is > faster? The for, while or foreach. I haven't bothered testing but I'd wager $5 that the following is the fastest loop: Depending on bytecode creation though, the following might be just as fast: Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pass $_GET to php cli.
> On 8/20/07, N0K <[EMAIL PROTECTED]> wrote: > [snip!] >> But if i do in a browser: >> http://www.example.com/administration.php?varpass=112233&checkpass=Submit >> >> Then i go directly to the administration web, without request pass. >> >> So, im trying to the the same in php command line > [snippity-snip!] > > One method: > > [filename=foo.php] > for($i=1;$i<$argc;$i++) { > $things = split("=",$argv[$i]); > $_GET[$things[0]] = $things[1]; > } > include('administration.php'); > ?> > > Then just call it like so (from a Unix-like command line --- > change this as appropriate for Windows, etc.): > > `which php` foo.php varpass=112233 checkpass=Submit > Hello, Thanks for your faster answer. I have to say im runing php cli from linux. And i havent got many idea about php, i only want to run from command line that script. I have test with Daniel Brown's script, but dont work. If you dont specific the password, then you get the html body when run the script and with your script, still getting the html body which request the password. I cant see the code because is encode with Zend, so, i cant give many details about it or modify it. But if it run in the browser, i think it have to run in cli, dont you think ? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] for/foreach speed
Hi people, could somebody please explain me, what loop construct is faster? The for, while or foreach. I at the moment don't know if there are more. And thanks to the person who is missusing the list here for sending trojan horses everywhere. Since I write to the PHP General list I am receiving round about 5 E-Mails from random domains, from this list, containing a Jpeg image with an embeded trojan horse. Thats really wonderfull. But maybe I should say, that we are using a nice mailscanner, and as well we are only working on linux machines. So better find another way of performing your frauds. If there are people here in the list, who would like to discuss how its possible to fight this kind of fraud. I am very open to that. Get the hacking tools prepared and lets fight back. I am sure the police would love to get an inquiry from a hole bunch of senior developers wanting to see little assholes in jail! Best Regards, Sascha Braun -- BRAUN Networks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pass $_GET to php cli.
On 8/20/07, N0K <[EMAIL PROTECTED]> wrote: [snip!] > But if i do in a browser: > http://www.example.com/administration.php?varpass=112233&checkpass=Submit > > Then i go directly to the administration web, without request pass. > > So, im trying to the the same in php command line [snippity-snip!] One method: [filename=foo.php] Then just call it like so (from a Unix-like command line --- change this as appropriate for Windows, etc.): `which php` foo.php varpass=112233 checkpass=Submit -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Hey, PHP-General list 50% off for life on web hosting plans $10/mo. or more at http://www.pilotpig.net/. Use the coupon code phpgeneralaug07 Register domains for about $0.01 more than what it costs me at http://domains.pilotpig.net/. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] This is a bug?
On 8/20/07, Augusto Morais <[EMAIL PROTECTED]> wrote: [snip!] > // - foo.php > include "lib/clients.class.php"; > $clients = new clients(); //instatiating the clients class > [snip again!] > > var_dump($clients); //i dont get the object here. I got NULL!!! why?!?!!? > > problem: > When the method(include_file) return "include FILE" the $client object > stay NULL but when the same method only return "FILE" : > include $globalactions->include_file("foo"); > > the $client object isnt empty. Augusto, I read your code over several times where is the clients(); code, and how is that returned to the script? I couldn't find it anywhere in there, and I didn't see an explanation. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Hey, PHP-General list 50% off for life on web hosting plans $10/mo. or more at http://www.pilotpig.net/. Use the coupon code phpgeneralaug07 Register domains for about $0.01 more than what it costs me at http://domains.pilotpig.net/. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP eval() fatal error
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: Now, I'd like to catch the error made by eval: // ... try { eval($code); } catch (Exception $ex) { var_dump($ex); } // ... Problem persists: a fatal error occurs. Using set_error_handler() and set_exception_handler() is not working either... Is there any way to gracefully catch this error? Regards, Maarten If you read the manual (RTFM) at http://www.php.net/eval you'll notice the following: " If there is a parse error in the evaluated code, eval() returns FALSE and execution of the following code continues normally. It is not possible to catch a parse error in eval() using set_error_handler(). Note: In case of a fatal error in the evaluated code, the whole script exits. " So, no. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP eval() fatal error
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: Now, I'd like to catch the error made by eval: // ... try { eval($code); } catch (Exception $ex) { var_dump($ex); } // ... Problem persists: a fatal error occurs. Using set_error_handler() and set_exception_handler() is not working either... Is there any way to gracefully catch this error? Fatal errors are exactly that... fatal. You cannot catch them or recover from them. Your best option is to shell out another PHP process, capture the output and parse that for error messages. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP eval() fatal error
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: Now, I'd like to catch the error made by eval: // ... try { eval($code); } catch (Exception $ex) { var_dump($ex); } // ... Problem persists: a fatal error occurs. Using set_error_handler() and set_exception_handler() is not working either... Is there any way to gracefully catch this error? Regards, Maarten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting from one table listing from another
On Monday 20 August 2007, tedd wrote: > Question -- is it redundant to say: > > FROM table a LEFT OUTER JOIN table b > ON(a.column = b.column) > > when "table a" appears first? Wouldn't that be the same as: > > FROM table a OUTER JOIN table b > ON(a.column = b.column) > > ??? > > I'm trying to understand why use LEFT and RIGHT if the tables' order > also has meaning. Basically: JOIN: Pull records from both tables. LEFT OUTER JOIN: Pull records from both tables, but restrict the one on the left (in the order of the SQL string's text). RIGHT OUTER JOIN: Pull records from both tables, but restrict the ones on the right (in the order of the SQL string's text). INNER JOIN: Pull from both tables and restrict on both tables. The join condition itself is what specifies how the tables should be joined. The type of join specifies how the records should be restricted. In practice I really don't remember the last time I used anything but INNER JOIN or LEFT OUTER JOIN. -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Pass $_GET to php cli.
Thijs Lensselink wrote: > I don't see where N0K asks for mapping of $_GET to commandline > parameters. He did't specifically ask, but his attempts seem to suggest that's what he was hoping for. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Pass $_GET to php cli.
On Mon, 20 Aug 2007 14:41:03 +0200, Per Jessen <[EMAIL PROTECTED]> wrote: > N0K wrote: > >> So, im trying to the the same in php command line >>=20 >> i have test with many things, but i dont know how to specify this >> variable to the php cli, >> some tested example: >>=20 >> php administration.php --varpass=3D112233 --checkpass=3DSubmit >> php administration.php --"varpass=3D112233&checkpass=3DSubmit" >> php administration.php --"varpass=3D112233" --"checkpass=3DSubmit >>=20 >> And a lot of more combination. >> Can i do this by php command line ? > > Yes, but not that way. There is no automagic mapping of argv[] > variables to $_GET. Take a look at the 'getopt' function.=20 > > > /Per Jessen, Z=C3=BCrich > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php I don't see where N0K asks for mapping of $_GET to commandline parameters. getopt is a good solution. But not very portable (it only works on *nix systems) And with list() and the argv array you can get the same effect. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Pass $_GET to php cli.
Hello. I trying something without results. I have a zend optimized php script. This script only request you a password, and then you go to admin page. If a do in a browser: http://www.example.com/administration.php Then i go to this web where the password is request. I put the password and go to the administration web. But if i do in a browser: http://www.example.com/administration.php?varpass=112233&checkpass=Submit Then i go directly to the administration web, without request pass. So, im trying to the the same in php command line i have test with many things, but i dont know how to specify this variable to the php cli, some tested example: php administration.php --varpass=112233 --checkpass=Submit php administration.php --"varpass=112233&checkpass=Submit" php administration.php --"varpass=112233" --"checkpass=Submit And a lot of more combination. Can i do this by php command line ? Thanks and regards. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Pass $_GET to php cli.
N0K wrote: > So, im trying to the the same in php command line > > i have test with many things, but i dont know how to specify this > variable to the php cli, > some tested example: > > php administration.php --varpass=112233 --checkpass=Submit > php administration.php --"varpass=112233&checkpass=Submit" > php administration.php --"varpass=112233" --"checkpass=Submit > > And a lot of more combination. > Can i do this by php command line ? Yes, but not that way. There is no automagic mapping of argv[] variables to $_GET. Take a look at the 'getopt' function. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pass $_GET to php cli.
On Mon, 20 Aug 2007 14:15:47 +0200, N0K <[EMAIL PROTECTED]> wrote: > Hello. > > I trying something without results. > > I have a zend optimized php script. This script only request you a > password, and then you go to admin page. > If a do in a browser: > http://www.example.com/administration.php > > Then i go to this web where the password is request. I put the password > and go to the administration web. > > But if i do in a browser: > http://www.example.com/administration.php?varpass=112233&checkpass=Submit > > Then i go directly to the administration web, without request pass. > > So, im trying to the the same in php command line > > i have test with many things, but i dont know how to specify this > variable to the php cli, > some tested example: > > php administration.php --varpass=112233 --checkpass=Submit > php administration.php --"varpass=112233&checkpass=Submit" > php administration.php --"varpass=112233" --"checkpass=Submit > > And a lot of more combination. > > Can i do this by php command line ? > > Thanks and regards. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php You can use the 'argc' and 'argv' arrays for this. http://nl3.php.net/manual/en/features.commandline.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Pass $_GET to php cli.
Hello. I trying something without results. I have a zend optimized php script. This script only request you a password, and then you go to admin page. If a do in a browser: http://www.example.com/administration.php Then i go to this web where the password is request. I put the password and go to the administration web. But if i do in a browser: http://www.example.com/administration.php?varpass=112233&checkpass=Submit Then i go directly to the administration web, without request pass. So, im trying to the the same in php command line i have test with many things, but i dont know how to specify this variable to the php cli, some tested example: php administration.php --varpass=112233 --checkpass=Submit php administration.php --"varpass=112233&checkpass=Submit" php administration.php --"varpass=112233" --"checkpass=Submit And a lot of more combination. Can i do this by php command line ? Thanks and regards. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
FW: [PHP] getting from one table listing from another
[snip] Question -- is it redundant to say: FROM table a LEFT OUTER JOIN table b ON(a.column = b.column) when "table a" appears first? Wouldn't that be the same as: FROM table a OUTER JOIN table b ON(a.column = b.column) [/snip] An OUTER JOIN is essentially a FULL OUTER JOIN which will include matches and non-matches from both tables. The order of tables is only important when specifying LEFT or RIGHT outer join. Some RDBMS implement this differently so for clarity you should always be very specific. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirection with header (was Re: [PHP] Cookies and sent headers)
At 12:42 PM +0200 8/20/07, Wouter van Vliet / Interpotential wrote: Only thing I was trying to do was chip in my two cents. Again, I wasn't the one who originally asked the question and I certainly am not "friggen clueless". Maybe not, but you made some pretty clueless remarks -- like if you could book-mark the page, the annoying refresh remark, and saying the demo displayed "bad practice". None were germane to the intent of the demo, let alone valid. I just came to think about what the teacher at my Flex course from a couple of months ago said about "good and bad practice". He said there is none. If your solution works good for you, that's your good practice. And if mine doesn't work for you, it's your bad practice - while it is still my good practice. That's just an excuse to do what you want and call it good -- but, there are good and bad practices. Something however I am trying to "fight" against, if you let me put it like that - is people approaching "scripts" as if they are "pages". When you are including a "script that is usually called as a page" into another script you should be very aware for any clashes between variables. Another reason why it may be easier to just put in a Location: header and call your script as it was originally intended. Now, I'm clueless as to what you're talking about. I think most people agree as to what a web page is and if we are using web languages to communicate with the user, then that is our medium. There are many ways to use web pages and Location: is only one of them. Limit yourself as you see fit. tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] getting from one table listing from another
[snip] However, the LEFT and RIGHT will take me a while to figure out. [/snip] FROM table a LEFT OUTER JOIN table b ON(a.column = b.column) Just follow the order tedd, a is on the left and b is on the right LEFT OUTER -> a -> b (what may be in a might not be in b) a <- b <- RIGHT OUTER (what may be in b might not be in a) FROM table a INNER JOIN table b ON(a.column = b.column) a -> INNER JOIN -> b (only where in a and b) Jay: Question -- is it redundant to say: FROM table a LEFT OUTER JOIN table b ON(a.column = b.column) when "table a" appears first? Wouldn't that be the same as: FROM table a OUTER JOIN table b ON(a.column = b.column) ??? I'm trying to understand why use LEFT and RIGHT if the tables' order also has meaning. Thanks for your time. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirection with header (was Re: [PHP] Cookies and sent headers)
On 20/08/07, tedd <[EMAIL PROTECTED]> wrote: > > At 10:40 PM +0200 8/19/07, Wouter van Vliet / Interpotential wrote: > >What you're proposing, is to actually display some content on another > page > >then were the content is originally intended? I'm sorry, but I would > >consider that 'bad practice'. To me, it makes perfect sense that you > don't > >want to leave the user on the page where login was originally handled. > For > >various reasons. One very obvious would be the 'refresh thing', where > your > >browser asks the user if they want to send the form again. Quite > annoying. > >Then, what about bookmarks? ... > > > No, what I had proposed was an alternate method to accomplish what > you said you wanted. But, it appears that my efforts and the demo did > not receive sufficient attention for you to understand what wass > being presented. Instead, you tell me that what I've shown you is bad > practice -- interesting. First of all - I didn't ask the initial question ;-). Other than that, I think our philosophies our basically the same. But when you say that you are redirecting the user to another page, while you are actually including a php script - that's not my understanding of redirecting. You said that you wanted to remove login from the browser history, > which is screwing around with the user's browser and is clearly bad > practice. Generally yes, removing a page from the browser's history would be considered bad practice. However, we are not really talking about a page here. What I understood from the initial question is as follows: - http://www.site.com/ contains some login form, action of that form is (for example) /login.php - The user is sent to /login.php where the login is checked - From there, the user either gets to a content page where it would typically show "welcome {user}" or something, or back to the index page when login failed - As you see, login.php is not really a page but more of a 'pseudo page' and therefore I cannot see any reason not to send a proper 303 header. see: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html My method simply stops the user from visiting the same page more than > once during a session and leaves their browser data alone -- nothing > bad practice about that! > > AFTER my demo runs, if you repeatedly refresh the page you are > directed to, then certainly that would become annoying. But that > wasn't the intent, nor part of the demo, which you clearly didn't > read and obviously didn't understand. > > As far as "bookmarking the page", but of course you can bookmark the > page! Did you even try? > > Oh well, so much for trying to help someone understand sessions. As > my mother often said "No good deed ever goes unpunished". I've got another one, "There is no selfless good deed". If you had simply said, I don't understand, please explain; or asked > a question or two; or said thanks, but no thanks, I'm going to do it > another way, then that would have been fine. But to say that the demo > I prepared for you exhibited "bad practice", especially when you are > absolutely friggen clueless as to what it is doing, is a bit too much > -- I'll be sure to pass over your post in the future. I don't think there wasn't anybody who didn't appriciate your suggestion. Only thing I was trying to do was chip in my two cents. Again, I wasn't the one who originally asked the question and I certainly am not "friggen clueless". I just came to think about what the teacher at my Flex course from a couple of months ago said about "good and bad practice". He said there is none. If your solution works good for you, that's your good practice. And if mine doesn't work for you, it's your bad practice - while it is still my good practice. Something however I am trying to "fight" against, if you let me put it like that - is people approaching "scripts" as if they are "pages". When you are including a "script that is usually called as a page" into another script you should be very aware for any clashes between variables. Another reason why it may be easier to just put in a Location: header and call your script as it was originally intended. Wouter tedd > > --- > > > > >I would definately go for the Location: header solution! > > > >On 19/08/07, tedd <[EMAIL PROTECTED]> wrote: > >> > >> At 8:52 AM +0200 8/19/07, Otto Wyss wrote: > >> >In my case I could easilly do without redirection but just exit and > >> >fall back on the calling page. Yet I want to remove the login page > >> >from the browser history. Does the header function have the same > >> >effect? > >> > > >> > >> O. Wyss: > >> > >> Instead of messing with the user's browser (not good IMO), why not > >> use $_SESSION and make it such that if the user selects the log-on > >> page again, they are redirected to another page? You don't even need > >> header() to do that. > >> > >> Here's an example: > >> > > > http://webbytedd.com/bb/one-time > >> > >> You will only see that page only once -- u
Re: [PHP] is this a bug?
On Mon, 20 Aug 2007 02:24:49 -0300, Augusto Morais <[EMAIL PROTECTED]> wrote: > I dont know what is happening... > > > Can somebody clarify the situation for me? > > > here is the situation: > >i have 3 files: > > class.php > foo.php > bar.php > > // - class.php > class globalactions { > > function include_file($module) { > if ($module) { > return > ("modules/".$module."/templates/".$module.".php"); > } else { return include("modules/main/templates/index.php"); } > } > } > > > // - foo.php > include "lib/clients.class.php"; > $clients = new clients(); //instatiating the clients class > > > // - bar.php > include 'class.php'; > $globalactions = new globalactions (); > include $globalactions->include_file("foo"); //return -> > "modules/foo/templates/foo.php" > > var_dump($clients); //will return the object > > > > OK. All this works. but i want make some changes. > > Well.. What i want to do is this: > > class.php: > > change the line: > return ("modules/".$module."/templates/".$module.".php"); > > to: > return include ("modules/".$module."/templates/".$module.".php"); > > and in the bar.php: > > > // - bar.php > include 'class.php'; > $globalactions = new globalactions (); > $globalactions->include_file("foo"); //return -> "include > modules/foo/templates/foo.php" // OK. This works. > > var_dump($clients); //i dont get the object here. I got NULL!!! why?!?!!? > > > > What is happening? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php No this is not a bug. And it also has nothing todo with scoping. The object "client" returns NULL. This can only happen if the object is not instantiated. I guess the foo.php file is not included at all. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is this a bug?
On 8/20/07, aflavio <[EMAIL PROTECTED]> wrote: > > Strange.. > > I'm return a include.. Not exactly... you're returning the return value of an include. Take this: var.php: foo.php > the file will be included in the scope of the class? Because this i cant use > the variables declared in the file ? all declared in the file only can be > access from the method that i use to include the class file. > > example: > > > > Am i right? > > thanks > > ps.: Sorry by the english. > > Augusto Morais > Well, you're quite close, but you expect something different from the return... Like I said above. Tijnema ps. I don't really care about your english, but top posting is annoying. Read the site in my signature to know why. Also snipping irrelevant parts of the original message is important. pps. Make sure you use the "Reply to all" button when making a reply to the list, as for now, I was the only one who got your message. If you don't have a "Reply to all" button, make sure you put the php list in the to or cc address. -- If this is a mailing list: DO NOT TOP POST! why?: http://www.caliburn.nl/topposting.html Vote for PHP Color Coding (aka Syntax Highlighting) in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is this a bug?
On 8/20/07, Augusto Morais <[EMAIL PROTECTED]> wrote: > I dont know what is happening... > > > Can somebody clarify the situation for me? > > > here is the situation: > > i have 3 files: > > class.php > foo.php > bar.php > > // - class.php > class globalactions { > > function include_file($module) { >if ($module) { >return > ("modules/".$module."/templates/".$module.".php"); >} else { return include("modules/main/templates/index.php"); } > } > } > > > // - foo.php > include "lib/clients.class.php"; > $clients = new clients(); //instatiating the clients class > > > // - bar.php > include 'class.php'; > $globalactions = new globalactions (); > include $globalactions->include_file("foo"); //return -> > "modules/foo/templates/foo.php" > > var_dump($clients); //will return the object > > > > OK. All this works. but i want make some changes. > > Well.. What i want to do is this: > > class.php: > > change the line: > return ("modules/".$module."/templates/".$module.".php"); > > to: > return include ("modules/".$module."/templates/".$module.".php"); > > and in the bar.php: > > > // - bar.php > include 'class.php'; > $globalactions = new globalactions (); > $globalactions->include_file("foo"); //return -> "include > modules/foo/templates/foo.php" // OK. This works. > > var_dump($clients); //i dont get the object here. I got NULL!!! why?!?!!? > > > > What is happening? > This is because in the second example, you're including the file in a different scope than the first example. The file included (and so all variables etc. declared in it) will be added to the scope where the include is. This manual page should help you: http://www.php.net/manual/en/language.variables.scope.php Tijnema -- If this is a mailing list: DO NOT TOP POST! why?: http://www.caliburn.nl/topposting.html Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php