[PHP] Recursive array_push?
Has anyone out there stumbled over the issue of making multi-dimensional arrays out of bracket-separated strings? In a less fuzzy way of putting it: $str = [layer1][layer2][layer3][layer4] would become $str_array = Array( [layer1] = Array( [layer2] = Array( [layer3] = Array( [layer4] ) ) ) ); ...or something similar. Passing values is not an issue at the moment, it's just the recursive thinking that keeps bugging me right now, and my temporary solution to this matter is not even mentionable! I would really like PHP to have a function of building expressions with strings, and then execute them through a function - but that's just me it seems :-) -- Kim Christensen [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recursive array_push?
On 1/26/06, Kim Christensen [EMAIL PROTECTED] wrote: I would really like PHP to have a function of building expressions with strings, and then execute them through a function - but that's just me it seems :-) You mean like create_function() ? -robin
Re: [PHP] Recursive array_push?
Kim, May the hack-o-rama commence: ?php $str = [layer1][layer2][layer3][layer4]; $parts = explode(][, substr($str, 1, -1)); $text = ; foreach ($parts as $part) { $text .= 'a:1:{s:' . strlen($part) . ':' . $part . ';'; } $text .= 'b:1;' . str_repeat('}', count($parts)); print_r(unserialize($text)); ? It works, but I'm not proud. :P David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wrapping anchor tags around a URL
On 1/26/06, Richard K Miller [EMAIL PROTECTED] wrote: @(http://\S+)(?!\.)@ -- this still captures everything @(http://\S+?)(?!\.)@-- this captures too little hmm maybe this would work? @http://.+(?=\.)@
[PHP] Re: Recursive array_push?
Kim Christensen wrote: Has anyone out there stumbled over the issue of making multi-dimensional arrays out of bracket-separated strings? In a less fuzzy way of putting it: $str = [layer1][layer2][layer3][layer4] would become $str_array = Array( [layer1] = Array( [layer2] = Array( [layer3] = Array( [layer4] ) ) ) ); ...or something similar. Passing values is not an issue at the moment, it's just the recursive thinking that keeps bugging me right now, and my temporary solution to this matter is not even mentionable! I would really like PHP to have a function of building expressions with strings, and then execute them through a function - but that's just me it seems :-) -- Kim Christensen [EMAIL PROTECTED] how about... $str = '[layer1][layer2][layer3][layer4]'; eval('$str_array'.$str.' = ;'); ? (obviously the value can be anything at the end) - tul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recursive array_push?
Kim Christensen wrote: Has anyone out there stumbled over the issue of making multi-dimensional arrays out of bracket-separated strings? In a less fuzzy way of putting it: $str = [layer1][layer2][layer3][layer4] would become $str_array = Array( [layer1] = Array( [layer2] = Array( [layer3] = Array( [layer4] ) ) ) ); ...or something similar. Passing values is not an issue at the moment, it's just the recursive thinking that keeps bugging me right now, and my temporary solution to this matter is not even mentionable! I would really like PHP to have a function of building expressions with strings, and then execute them through a function - but that's just me it seems :-) you will have to refactor the code below - I cut and paste it from a session wrapper [class] I wrote so it won't work as is (and probably your not wanting to do something specifically with the session) - also its a little different in that rather than using a string like: $str = [layer1][layer2][layer3][layer4] it runs off off an array like so: $str = array('layer1','layer2','layer3','layer4'); // {{{ set /** * set an item in the SESSION array (mutli-dim) * * The $varName param can be an array in which case each * value in the array is a key in one level of a multidimentional * array e.g. * array('my','var','here'); * would point to: * $_SESSION['my']['var']['here']; * * we don't allow numeric indexes because 'they are a head fuck' * - meaning you'll never remember what the value was about and the * chance of overwrite another numeric index is in my approximation quite high * * @param $varName string/array * @param $value mixed * * @return $value on success / false overwise (Exception on numeric key.) */ static public function set($varName, $value = null) { if (self::$started $varName !is_numeric($varName)) { if (is_array( $varName )) { $tmpArr = $_SESSION; while ( 1 ) { self::chkSessionVarName($k = array_shift( $varName )); if ( !count( $varName )) { return ($tmpArr[ $k ] = $value); break; } else if (! isset($tmpArr[ $k ]) || ! is_array($tmpArr[ $k ])) { $tmpArr[ $k ] = array(); } $tmpArr = $tmpArr[ $k ]; } } else { self::chkSessionVarName($varName); return ($_SESSION[ $varName ] = $value); } } } // }}} // {{{ /** * get an item in the SESSION array (multi-dim) * * The $varName param can be an array in which case each * value in the array is a key in one level of a multidimentional * array e.g. * array('my','var','here'); * would point to: * $_SESSION['my']['var']['here']; * * we don't allow numeric indexes because 'they are a head fuck' * * @param $varName string/array * * @return mixed */ static public function get($varName) { self::$lastGetFailed = true; if (self::$started $varName) { if (is_array( $varName )) { $tmpArr = $_SESSION; while ( 1 ) { self::chkSessionVarName($k = array_shift( $varName )); /* endpoint */ if ( !count( $varName )) { if (@is_array($tmpArr) array_key_exists($k, $tmpArr)) { self::$lastGetFailed = false; return $tmpArr[ $k ]; } break; } else if (!array_key_exists($k, $tmpArr) || !is_array($tmpArr[ $k ])) { // we can go no deeper break; } $tmpArr = $tmpArr[ $k ]; } } else { self::chkSessionVarName( $varName ); if (array_key_exists($varName, $_SESSION)) { self::$lastGetFailed = false; return $_SESSION[ $varName ]; } } } return null; } -- Kim Christensen [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recursive array_push?
Kim, After some contemplation (and slightly less crack): ?php $str = [layer1][layer2][layer3][layer4]; $parts = array_reverse(explode(][, substr($str, 1, -1))); $array = FOO; foreach ($parts as $part) { $array = array($part = $array); } print_r($array); ? Array ( [layer1] = Array ( [layer2] = Array ( [layer3] = Array ( [layer4] = FOO ) ) ) ) David David Grant wrote: Kim, May the hack-o-rama commence: ?php $str = [layer1][layer2][layer3][layer4]; $parts = explode(][, substr($str, 1, -1)); $text = ; foreach ($parts as $part) { $text .= 'a:1:{s:' . strlen($part) . ':' . $part . ';'; } $text .= 'b:1;' . str_repeat('}', count($parts)); print_r(unserialize($text)); ? It works, but I'm not proud. :P David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: usr VAR value as a VAR Name
Fisrt thx to all for yours answers, I'm updating the mail because in hte last mail I'didn express my self correctly : EXAMPLE page1.php === form action=/page2.php?form=yes method=post $sql_pro =SELECT Sid FROM table; $res_pro = @mysql_query( $sql_pro); while ($campo_pro = @mysql_fetch_array($res_pro)) { $sid_pro = $campo_pro[Sid]; // $sid_pro = 4 $sid_pro = 'p'.$sid_pro; // I'm trying to use the value of $sid_pro as a VAR name *$sid_pro = p4* print td input name='$sid_pro' type= 'radio' // Here the Imput Name is a VALUE from Database value=''/* /td; // *name = p4 * BLA BLA BLA } page2.php // I Need to access a value from the form witch it's stored in a VAR called $p4 // The Name of the VAR $p4 It's stored in my database, so How can I convert a database string to a VAR NAME === $sqlname = SELECT Sid FROM Table; $res = mysql_query ($sqlname) ; while ($campo_pro = mysql_fetch_array($res)) { $name1 = $campo_pro[Sid]; // *$name1 = 4* $radio = '$'.'p'.$name1 ; // *$radio = $p4 -- Now the Problem **How can I get the Value SOLVE_ME from the submited form ?* echo '$radio'; // == $p4 = WRONG i need // The VALUE of $radio witch is $p4 is the name of the VAR I need to access, how can I export the VALUE $p4 AS a VAR Name ? } James Benson wrote: if(isset($_POST['NAME_OF_FORM_VALUE'])) { // radio button was selected } Fernando Anchorena wrote: I'm stuck trying to get work this : This is an example page1.php === form action=/page2.php?form=yes method=post $sql_pro =SELECT Sid FROM table; $res_pro = @mysql_query( $sql_pro); while ($campo_pro = @mysql_fetch_array($res_pro)) { $sid_pro = $campo_pro[Sid]; // *sid_pro = 4* $sid_pro = 'p'.$sid_pro; // I'm trying to use de value of $sid_pro as a VAR name *$sid_pro = p4* print td *input name='$sid_pro' type= 'radio' value='SOLVE_ME'/* /td; // *name=p4 * BLA BLA BLA } SUBMIT FORM === page2.php === $sqlname = SELECT Sid FROM Table; $res = mysql_query ($sqlname) ; while ($campo_pro = mysql_fetch_array($res)) { $name1 = $campo_pro[Sid]; // *$name1 = 4* $radio = '$'.'p'.$name1 ; // *$radio = $p4 -- Now the Problem **How can I get the Value SOLVE_ME from the submited form ?* } == Thanks in Advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: usr VAR value as a VAR Name
Fernando Anchorena wrote: Fisrt thx to all for yours answers, I'm updating the mail because in hte last mail I'didn express my self correctly : EXAMPLE page1.php === form action=/page2.php?form=yes method=post $sql_pro =SELECT Sid FROM table; $res_pro = @mysql_query( $sql_pro); while ($campo_pro = @mysql_fetch_array($res_pro)) { $sid_pro = $campo_pro[Sid]; // $sid_pro = 4 $sid_pro = 'p'.$sid_pro; // I'm trying to use the value of $sid_pro as a VAR name *$sid_pro = p4* print td input name='$sid_pro' type= 'radio' // Here the Imput Name is a VALUE from Database value=''/* /td; // *name = p4 * BLA BLA BLA } page2.php // I Need to access a value from the form witch it's stored in a VAR called $p4 // The Name of the VAR $p4 It's stored in my database, so How can I convert a database string to a VAR NAME === $sqlname = SELECT Sid FROM Table; $res = mysql_query ($sqlname) ; while ($campo_pro = mysql_fetch_array($res)) { $name1 = $campo_pro[Sid]; // *$name1 = 4* $radio = '$'.'p'.$name1 ; // *$radio = $p4 -- Now the Problem **How can I get the Value SOLVE_ME from the submited form ?* echo '$radio'; // == $p4 = WRONG i need // The VALUE of $radio witch is $p4 is the name of the VAR I need to access, how can I export the VALUE $p4 AS a VAR Name ? } Small example that might help solve it: $foo = bar; $$foo = Hello World!; echo $bar; // Prints out Hello World! Greets Barry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: usr VAR value as a VAR Name
Barry wrote: Fernando Anchorena wrote: Fisrt thx to all for yours answers, I'm updating the mail because in hte last mail I'didn express my self correctly : EXAMPLE page1.php === form action=/page2.php?form=yes method=post $sql_pro =SELECT Sid FROM table; $res_pro = @mysql_query( $sql_pro); while ($campo_pro = @mysql_fetch_array($res_pro)) { $sid_pro = $campo_pro[Sid]; // $sid_pro = 4 $sid_pro = 'p'.$sid_pro; // I'm trying to use the value of $sid_pro as a VAR name *$sid_pro = p4*print td input name='$sid_pro' type= 'radio' // Here the Imput Name is a VALUE from Database value=''/* /td; // *name = p4 * BLA BLA BLA } page2.php // I Need to access a value from the form witch it's stored in a VAR called $p4 // The Name of the VAR $p4 It's stored in my database, so How can I convert a database string to a VAR NAME === $sqlname = SELECT Sid FROM Table; $res = mysql_query ($sqlname) ; while ($campo_pro = mysql_fetch_array($res)) { $name1 = $campo_pro[Sid]; // *$name1 = 4* $radio = '$'.'p'.$name1 ; // *$radio = $p4 -- Now the Problem **How can I get the Value SOLVE_ME from the submited form ?* echo '$radio'; // == $p4 = WRONG i need // The VALUE of $radio witch is $p4 is the name of the VAR I need to access, how can I export the VALUE $p4 AS a VAR Name ? } Small example that might help solve it: $foo = bar; $$foo = Hello World!; echo $bar; // Prints out Hello World! Greets Barry Thx for your answer Berry, What if I don't know the value of $foo (witch is bar) so we have this : $foo = UnKnowName; $$foo = Hello World!; Here is the problem // remember that I dont know the value of $foo echo .'$'.$foo // prints out $UnKnowName but I need to prints out Hello Worlds! so If I don'r know the value of $foo, what can I do tu prints out Hello World! Thx in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: usr VAR value as a VAR Name
Fernando Anchorena wrote: Barry wrote: Fernando Anchorena wrote: Fisrt thx to all for yours answers, I'm updating the mail because in hte last mail I'didn express my self correctly : EXAMPLE page1.php === form action=/page2.php?form=yes method=post $sql_pro =SELECT Sid FROM table; $res_pro = @mysql_query( $sql_pro); while ($campo_pro = @mysql_fetch_array($res_pro)) { $sid_pro = $campo_pro[Sid]; // $sid_pro = 4 $sid_pro = 'p'.$sid_pro; // I'm trying to use the value of $sid_pro as a VAR name *$sid_pro = p4*print td input name='$sid_pro' type= 'radio' // Here the Imput Name is a VALUE from Database value=''/* /td; // *name = p4 * BLA BLA BLA } page2.php // I Need to access a value from the form witch it's stored in a VAR called $p4 // The Name of the VAR $p4 It's stored in my database, so How can I convert a database string to a VAR NAME === $sqlname = SELECT Sid FROM Table; $res = mysql_query ($sqlname) ; while ($campo_pro = mysql_fetch_array($res)) { $name1 = $campo_pro[Sid]; // *$name1 = 4* $radio = '$'.'p'.$name1 ; // *$radio = $p4 -- Now the Problem **How can I get the Value SOLVE_ME from the submited form ?* echo '$radio'; // == $p4 = WRONG i need // The VALUE of $radio witch is $p4 is the name of the VAR I need to access, how can I export the VALUE $p4 AS a VAR Name ? } Small example that might help solve it: $foo = bar; $$foo = Hello World!; echo $bar; // Prints out Hello World! Greets Barry Thx for your answer Berry, What if I don't know the value of $foo (witch is bar) so we have this : $foo = UnKnowName; $$foo = Hello World!; Here is the problem // remember that I dont know the value of $foo echo .'$'.$foo // prints out $UnKnowName but I need to prints out Hello Worlds! so If I don'r know the value of $foo, what can I do tu prints out Hello World! Thx in advance. echo $$foo Greets Barry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Workaround ISP's redirect of 404 Not Found PHP pages?
Hi, I searched archived messages for this, but didn't find an answer. If this should go to the installation list, please advise (and forgive!). I'm working on a site hosted at 1and1. I want to use a PHP-enabled custom 404 page, but something in their configuration is preventing it from working. My .htaccess file includes the directive: ErrorDocument 404 /not_found.php It works for everything but .php files. If I try to browse a .php file that doesn't exist, the server returns 1and1's default 404 page, not my custom page. After a few rounds of support requests and misinformation, their tech support folks told me this: PHP is running as a CGI on the shared hosting servers, which is why your .htaccess isn't working for it. You will have to create the error rule within a php.ini file. Firstly, I can't find anything in their configuration that would suggest what they're doing to acccomplish the redirect. For reference, the phpinfo page (sorry, had to sanitize a few things) can be viewed here: http://www2.jdgcommunications.com/phpexample/phpinfo.html And secondly, how could I incorporate an error rule in a local php.ini file? I know how to change settings for error display, reporting and logging, but I haven't been able to find any configuration directives even remotely related to what I'm trying to do. Thanks, Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP][SOLVED] Re: usr VAR value as a VAR Name
Barry wrote: Fernando Anchorena wrote: Barry wrote: Fernando Anchorena wrote: Fisrt thx to all for yours answers, I'm updating the mail because in hte last mail I'didn express my self correctly : EXAMPLE page1.php === form action=/page2.php?form=yes method=post $sql_pro =SELECT Sid FROM table; $res_pro = @mysql_query( $sql_pro); while ($campo_pro = @mysql_fetch_array($res_pro)) { $sid_pro = $campo_pro[Sid]; // $sid_pro = 4 $sid_pro = 'p'.$sid_pro; // I'm trying to use the value of $sid_pro as a VAR name *$sid_pro = p4*print td input name='$sid_pro' type= 'radio' // Here the Imput Name is a VALUE from Database value=''/* /td; // *name = p4 * BLA BLA BLA } page2.php // I Need to access a value from the form witch it's stored in a VAR called $p4 // The Name of the VAR $p4 It's stored in my database, so How can I convert a database string to a VAR NAME === $sqlname = SELECT Sid FROM Table; $res = mysql_query ($sqlname) ; while ($campo_pro = mysql_fetch_array($res)) { $name1 = $campo_pro[Sid]; // *$name1 = 4* $radio = '$'.'p'.$name1 ; // *$radio = $p4 -- Now the Problem **How can I get the Value SOLVE_ME from the submited form ?* echo '$radio'; // == $p4 = WRONG i need // The VALUE of $radio witch is $p4 is the name of the VAR I need to access, how can I export the VALUE $p4 AS a VAR Name ? } Small example that might help solve it: $foo = bar; $$foo = Hello World!; echo $bar; // Prints out Hello World! Greets Barry Thx for your answer Berry, What if I don't know the value of $foo (witch is bar) so we have this : $foo = UnKnowName; $$foo = Hello World!; Here is the problem // remember that I dont know the value of $foo echo .'$'.$foo // prints out $UnKnowName but I need to prints out Hello Worlds! so If I don'r know the value of $foo, what can I do tu prints out Hello World! Thx in advance. echo $$foo Greets Barry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Workaround ISP's redirect of 404 Not Found PHP pages?
Jim McIntyre wrote: Hi, I searched archived messages for this, but didn't find an answer. If this should go to the installation list, please advise (and forgive!). I'm working on a site hosted at 1and1. I want to use a PHP-enabled custom 404 page, but something in their configuration is preventing it from working. My .htaccess file includes the directive: ErrorDocument 404 /not_found.php It works for everything but .php files. If I try to browse a .php file that doesn't exist, the server returns 1and1's default 404 page, not my custom page. After a few rounds of support requests and misinformation, their tech support folks told me this: PHP is running as a CGI on the shared hosting servers, which is why your .htaccess isn't working for it. You will have to create the error rule within a php.ini file. Firstly, I can't find anything in their configuration that would suggest what they're doing to acccomplish the redirect. For reference, the phpinfo page (sorry, had to sanitize a few things) can be viewed here: http://www2.jdgcommunications.com/phpexample/phpinfo.html And secondly, how could I incorporate an error rule in a local php.ini file? I know how to change settings for error display, reporting and logging, but I haven't been able to find any configuration directives even remotely related to what I'm trying to do. Thanks, Jim Best thing is probably to use a rewrite rule. So if the error.html should be desplayed the rewrite rule opens the .php file. I also don't know what ini attribute should be used since the 404 is a webserver side error afaik. Would be interesting to know if something like that ini attribute does exists. Probably re-config the server side VARS? (HTTP_VARS)? no idea for now, but it's interesting. i will look more into it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP][SOLVED] Re: usr VAR value as a VAR Name
echo $$foo Let me start by saying there is nothing wrong with the above and it's doing exactly what the OP needed. However, when I use variable variables, I prefer to use the following notation: ${$foo} It makes the coder's intention clear and makes it so that it can't be mistaken for a possible typo when someone comes in after the fact to maintain the code. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Workaround ISP's redirect of 404 Not Found PHP pages?
Barry wrote: Thats what i found so far: http://de2.php.net/manual/en/ref.errorfunc.php#ini.error-append-string http://de2.php.net/manual/en/ref.errorfunc.php#ini.error-prepend-string http://de2.php.net/manual/en/ini.php#ini.list Most vars can be changed with ini_set and ini_get http://de2.php.net/ini_set http://de.php.net/ini_get There were some comments about error posting. I think it was there somwhere. but i forgot where -_- Greets Barry -- Smileys rule (cX.x)C --o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP][SOLVED] Re: usr VAR value as a VAR Name
Chris Boget wrote: echo $$foo Let me start by saying there is nothing wrong with the above and it's doing exactly what the OP needed. However, when I use variable variables, I prefer to use the following notation: ${$foo} It makes the coder's intention clear and makes it so that it can't be mistaken for a possible typo when someone comes in after the fact to maintain the code. thnx, Chris And When I use this and when i use that. Oh i like this ^_^ Btw. my working buddys said on first view your example looked more wrong. And on top of that, i wont let anyone code in my PHP docs who doesn't know what $$var is or does!! Greets Barry -- Smileys rule (cX.x)C --o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] copy problem with HTTP wrapper
Hi all, I'm trying to copy a file from my PHP server to another server (a home gateway, called a LiveBox). I've used this code : $livebox = 192.168.1.1; ... ... ... $crontab_livebox = http://.$livebox./cgi-bin/newCrontab;; if (!copy($crontab_temp_name, $crontab_livebox)) { echo br /Impossible to copy the temp crontab file to the Livebox.br /; } I get the following error : HTTP wrapper does not support writeable connections OK can I solve this. Can't I use URLs with the copy function if they don't point to my PHP server (local URLs) ? How can I copy a file from my PHP server to another server (there's no FTP server on the destination machine) ? Thanks, Laurent Vanstaen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Workaround ISP's redirect of 404 Not Found PHP pages?
PHP is running as a CGI on the shared hosting servers, which is why your .htaccess isn't working for it. You will have to create the error rule within a php.ini file. That is so much bull, how then can it work for NON .php files? I know for a fact that CGI does not prevent you using .htaccess or the ErrorDocument directive in apache because Im using one myself right now in CGI mode and it works just fine, does your webhost use a custom error page that advertises its own services or provides a link to their website by any chance? James - Master CIW Designer http://www.ciwcertified.com Zend Certified Engineer http://www.zend.com http://www.jamesbenson.co.uk - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] News
[EMAIL PROTECTED] wrote: Your archive is attached. I wonder how many people opened this. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML Session serializer - XMLDBX
Well, last week or so I noticed that Squirrelmail's session array contained recursive variable references and caused my serializer to crash on infinite recursion. Oh well, that's life. I found the time to add a variable stack for encoding to XML. If a variable is is_ref or has a refcount greater than 1, the variable stack is searched for a previous occurrence. If the variable has not been seen previously, it is push onto the stack. If it has, only a reference ID of the previous variable is saved in the xml stream. is_ref and refcount are now added as attributes in the XML stream. Anyone want to lend a hand and test the serializer? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] way to write mysqli result set to disk
James Benson wrote: jonathan wrote: hmm is this a mysql 5 feature. could be interesting but haven't heard much about it. You cannot see the mysql 5 plastered all over the page? I can see at least 5 different sections that say MySQL 5 http://dev.mysql.com/doc/refman/5.1/en/insert.html Can you see mysql 5.1 plastered all over the page? -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Workaround ISP's redirect of 404 Not Found PHP pages?
At 3:32 PM + 1/26/06, James Benson wrote: PHP is running as a CGI on the shared hosting servers, which is why your .htaccess isn't working for it. You will have to create the error rule within a php.ini file. That is so much bull, how then can it work for NON .php files? I know for a fact that CGI does not prevent you using .htaccess or the ErrorDocument directive in apache because Im using one myself right now in CGI mode and it works just fine, does your webhost use a custom error page that advertises its own services or provides a link to their website by any chance? Well, laboring under the assumption that everything they tell me is bull, I looked the other way and found a solution. Thanks also to Barry for this: At 3:42 PM +0100 1/26/06, Barry wrote: Best thing is probably to use a rewrite rule. So if the error.html should be desplayed the rewrite rule opens the .php file. In .htaccess, I replaced ErrorDocument 404 /not_found.php with RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) /not_found.php and it seems to be working. Many, many thanks to you both. I should have started here - it would have saved me about two weeks. No lie. Peace, Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML Session serializer - XMLDBX
Mark wrote: Well, last week or so I noticed that Squirrelmail's session array contained recursive variable references and caused my serializer to crash on infinite recursion. Oh well, that's life. I found the time to add a variable stack for encoding to XML. If a variable is is_ref or has a refcount greater than 1, the variable stack is searched for a previous occurrence. If the variable has not been seen previously, it is push onto the stack. If it has, only a reference ID of the previous variable is saved in the xml stream. is_ref and refcount are now added as attributes in the XML stream. Anyone want to lend a hand and test the serializer? Doh!! www.mohawksoft.org In the Code and Documentation section, click on CVS Access and follow the instructions for XMLDBX PHP Extension -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTML Question?
Hello, This is totally HTML question but I had to post cause I can't get this one to work myself How to print tables to a page so that they are placed side by side horizontally as long as there is screen width left and then continue to second row below? Like in many image galleries where thumpnails are dumped to screen and the lines of thumpnails scale dynamically according to screen widht. I need to dump my thumpnails to screen and add some image info below every thumpnail and I want to take advantage of the whole screen widht. Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML Question?
William, William Stokes wrote: How to print tables to a page so that they are placed side by side horizontally as long as there is screen width left and then continue to second row below? Like in many image galleries where thumpnails are dumped to screen and the lines of thumpnails scale dynamically according to screen widht. I need to dump my thumpnails to screen and add some image info below every thumpnail and I want to take advantage of the whole screen widht. http://www.alistapart.com/articles/practicalcss/ David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] automating creation of thumbnails
I remember the other day someone was asking for a way to easily create a bunch of thumbnails from image files. I just spotted this: http://www.phpclasses.org/browse/package/2846.html This is a simple class that can be used to generate thumbnails of image files. It can resize the images so they do not exceed a given width or height. The images are loaded as true color to preserve the quality as much as possible during the rescale operation. Currently, the images can be loaded and saved in the JPEG and GIF formats. Geoff. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP][SOLVED] Re: usr VAR value as a VAR Name
Let me start by saying there is nothing wrong with the above and it's doing exactly what the OP needed. However, when I use variable variables, I prefer to use the following notation: ${$foo} It makes the coder's intention clear and makes it so that it can't be mistaken for a possible typo when someone comes in after the fact to maintain the code. And When I use this and when i use that. Oh i like this ^_^ Btw. my working buddys said on first view your example looked more wrong. Try it and see. ;) And on top of that, i wont let anyone code in my PHP docs who doesn't know what $$var is or does!! Agreed. But there have been a few times when I accidently added in an extra $ to the variable and, consequently, didn't get the results I expected. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] header WWW-Authenticate Question
Hi. I have been looking for this in several areas and I can't seem to find it. I'm new to PHP (any programming since FORTRAN, really :) so please forgive my ignorance. I am trying to send username/password credentials to a web server using a PHP script. This is done to automatically log into a web camera from my workstation. I don't know if the header www-authenticate option is the correct one (or if it's even possible) to use for this. Any help is appreciated. Thanks!
Re: [PHP] header WWW-Authenticate Question
I have been looking for this in several areas and I can't seem to find it. I'm new to PHP (any programming since FORTRAN, really :) so please forgive my ignorance. I am trying to send username/password credentials to a web server using a PHP script. This is done to automatically log into a web camera from my workstation. I don't know if the header www-authenticate option is the correct one (or if it's even possible) to use for this. Depending on what you're doing it might be as easy as: http://user:[EMAIL PROTECTED]/path?query=string If all you need to do is suck down a page that would do it. If your POSTING check the HTTP RFC for what headers to send... -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] automating creation of thumbnails
Here are some more to check out :) Dynamic Thumbnail Generation http://www.weberdev.com/ViewArticle-388.html upload one or more files, and show thumbs and html code of images, I images were uploaded. http://www.weberdev.com/get_example-3083.html Image Upload And Resize Script http://www.weberdev.com/get_example-3938.html Sincerely berber Visit the Weber Sites Today, To see where PHP might take you tomorrow. Free Uptime Monitor : http://uptime.weberdev.com PHP content for your site : http://content.weber-sites.com -Original Message- From: Geoff [mailto:[EMAIL PROTECTED] Sent: Thursday, January 26, 2006 8:13 PM To: php-general@lists.php.net Subject: [PHP] automating creation of thumbnails I remember the other day someone was asking for a way to easily create a bunch of thumbnails from image files. I just spotted this: http://www.phpclasses.org/browse/package/2846.html This is a simple class that can be used to generate thumbnails of image files. It can resize the images so they do not exceed a given width or height. The images are loaded as true color to preserve the quality as much as possible during the rescale operation. Currently, the images can be loaded and saved in the JPEG and GIF formats. Geoff. -- 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] HTML Question?
Jawohl :) David Grant [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] William, William Stokes wrote: How to print tables to a page so that they are placed side by side horizontally as long as there is screen width left and then continue to second row below? Like in many image galleries where thumpnails are dumped to screen and the lines of thumpnails scale dynamically according to screen widht. I need to dump my thumpnails to screen and add some image info below every thumpnail and I want to take advantage of the whole screen widht. http://www.alistapart.com/articles/practicalcss/ David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Apache is not parsing .php files
Hi, I have a strange problem while trying to run php based applications. Lets start with phpMyAdmin, a very popular open source tool to manage MySQL written in php. I have already installed phpMyAdmin and was running fine. One day suddenly when I pointed my browser at : http://localhost/phpMyAdmin Instead of running the phpMyAdmin browser opened a message window with options- Open With or Save to disk . I am sure its not browser problem because I tried on Firefox-1.5, Mozilla, Epiphany and Konqueror. One more point I would like to add here that if I write one small php program and save it in as php file (test.php) then http://localhost/test.php executes properly I am using Fedora 2 and apache2, php-4.3x and mysql-3.x were part of the Fedora installation. The only change I made in the /etc/php.ini file was to increase the memory limit from 8MB to 12MB. (Then restarted the http server) Now even php.ini file is in the original state but problem is still there. The http.conf file is unchanged. Can any one give me some sort of idea. Thanks, Sanjay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Connect to AS400
We need to connect to a database on our AS400. Would this be best accomplished with ODBC? If not, what is the preferred method? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Best way to handle PREVIOUS and NEXT processing of database records retrieved
I am retrieving records from a MySQL database and need to just display each record one after the other on a page. I only want to display a maximum of 25 records per page though, and am wondering if there is a way to handle this easily within PHP? I'd like to use something like NEXT and PREVIOUS as links to go back and forth from each of the pages if there is more than 1 page of data to display. Any examples/ideas would be greatly appreciated. Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] header WWW-Authenticate Question
On Thu, January 26, 2006 1:02 pm, News1 wrote: I am trying to send username/password credentials to a web server using a PHP script. This is done to automatically log into a web camera from my workstation. I don't know if the header www-authenticate option is the correct one (or if it's even possible) to use for this. I think www-authenticate is what the server sends to the browser, not the other way around. I'm guessing that since it's called PHP_AUTH_USER and PHP_AUTH_PW in PHP, that you would need to send: GET / HTTP/1.0 AUTH_USER: $username PATH_PW: $password Host: example.com You may also want to look into: http://php.net/curl -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML Question?
On Thu, January 26, 2006 11:35 am, William Stokes wrote: This is totally HTML question but I had to post cause I can't get this one to work myself How to print tables to a page so that they are placed side by side horizontally as long as there is screen width left and then continue to second row below? Like in many image galleries where thumpnails are dumped to screen and the lines of thumpnails scale dynamically according to screen widht. I need to dump my thumpnails to screen and add some image info below every thumpnail and I want to take advantage of the whole screen widht. Those aren't tables, that's CSS, almost for sure... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy problem with HTTP wrapper
On Thu, January 26, 2006 9:28 am, Laurent Vanstaen wrote: Hi all, I'm trying to copy a file from my PHP server to another server (a home gateway, called a LiveBox). I've used this code : $livebox = 192.168.1.1; ... ... ... $crontab_livebox = http://.$livebox./cgi-bin/newCrontab;; if (!copy($crontab_temp_name, $crontab_livebox)) { echo br /Impossible to copy the temp crontab file to the Livebox.br /; } I get the following error : HTTP wrapper does not support writeable connections OK can I solve this. Can't I use URLs with the copy function if they don't point to my PHP server (local URLs) ? How can I copy a file from my PHP server to another server (there's no FTP server on the destination machine) ? Put it this way: If what you typed above *DID* work, what's to stop *ME* from copying whatever I want onto your server?... You probably need to use cURL to login to your livebox, and then POST the data into the newCrontab form handler. The basic idea is to use cURL to fake out the LiveBox into thinking that it's really you sitting there typing things. So you would want to have your browser open and go through the process by hand while you code your cURL script, and look at View Source in your browser for the LiveBox login, and what the cURL script gets, and then you POST the username/password to mimic a login, and then you will get back some Cookies, most likely, and then you should be able to send back those cookies and your new crontab into the form -- Essentially walking your PHP script through the exact same steps you would take to do it by hand. http://php.net/curl -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] header WWW-Authenticate Question
Hello, I am trying to send username/password credentials to a web server using a PHP script. This is done to automatically log into a web camera from my workstation. I don't know if the header www-authenticate option is the correct one (or if it's even possible) to use for this. You may want to try this HTTP client class. It comes with HTTP authentication support using the SASL library package. The example test_http.php has some comments to let you know how to configure the authetication support: http://www.phpclasses.org/httpclient http://www.phpclasses.org/sasl -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Workaround ISP's redirect of 404 Not Found PHP pages?
On Thu, January 26, 2006 9:32 am, James Benson wrote: PHP is running as a CGI on the shared hosting servers, which is why your .htaccess isn't working for it. You will have to create the error rule within a php.ini file. That is so much bull, how then can it work for NON .php files? I know for a fact that CGI does not prevent you using .htaccess or the ErrorDocument directive in apache because Im using one myself right now in CGI mode and it works just fine, does your webhost use a custom error page that advertises its own services or provides a link to their website by any chance? Perhaps his host has somehow managed to force PHP CGI to kick in *BEFORE* the ErrorDocument of Apache... Now, I got no idea how they would manage to do that, but it seems like a reasonable assumption... WILD GUESS: If they do PHP CGI with EngineRewrite, and if that takes effect before the ErrorDocument handler, as I suspect it would, then it would explain this behaviour, and their response, without the sinister implications James suggests. They may even be laboring under the impression that that's the only way to make PHP CGI work. More likely, they think it's the best way to make it work for them and their customers. I'm not aware of any kind of 404 settings avaiable in php.ini, but perhaps they just assumed it could be done in php.ini to handle non-existent files in some way. From the phpinfo URL provided by the OP, it looks like they are giving him PHP CGI with his own php.ini file to tinker with, which could be quite handy, compared to some shard hosting environments I've suffered through... What's that old saying? Never assign to malice what can be explained by sheer stupidity. Something like that. I've come to realize, as I get older, that what we often perceive as some sort of diabolical plot to foil us, is just some other poor guy doing the best they can with what they've got, and our failure to appreciate what it is they are offering/doing and why. Jeez, now I feel like I gotta go watch Karate Kid or something... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best way to handle PREVIOUS and NEXT processing of database records retrieved
You could always use the LIMIT functionality in MySQL SELECT * FROM table LIMIT 0,25 Then just pass the variables for the limit to start at and how many you want returned in your query. SELECT * FROM table LIMIT $start,$num_returned So looking at records 26 through 50 your links would look like below. a href=file.php?start=51num_returned=25Next/a | a href=file.php?start=0num_returned=25Previous Just make sure you check your variables so they are numbers to avoid any kind of SQL injection. On 1/26/06 2:27 PM, Sue [EMAIL PROTECTED] wrote: I am retrieving records from a MySQL database and need to just display each record one after the other on a page. I only want to display a maximum of 25 records per page though, and am wondering if there is a way to handle this easily within PHP? I'd like to use something like NEXT and PREVIOUS as links to go back and forth from each of the pages if there is more than 1 page of data to display. Any examples/ideas would be greatly appreciated. Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: adapting some code from a phpbb mod to my site
On Thu, January 26, 2006 7:46 am, Barry wrote: 7BoZaR secret wrote: Hello, I wish to integrate some code of MOD for phpbb forum named gf-portail: http://www.gf-phpbb.info/dlfile.php?id=31 , to my HTML website. In the menus of right-hand side (Last subjects, Which is on line?, Statistics) however variables models and models files make me mad ( i am beginner at PHP ) (root\modportal: mod_recent_topics.php, mod_whoisonline.php, mod_statistiques.php and \root\templates\subSilver\modportal: mod_recent_topics.tpl, mod_whoisonline.tpl, mod_statistiques.tpl) could you help me??? Because your question is so specific, you probably should check in a phpBB forum, or even one specfically for gf-portail... PS The English word you are using mad should probably be crazy to avoid confusion for American readers... mad == angry Though I suspect the Brits would disagree with me on that. :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Use VAR string value AS VAR Name
On Wed, January 25, 2006 6:11 pm, Fernando Anchorena wrote: I'm stuck trying to get work this : This is an example page1.php === form action=/page2.php?form=yes method=post $sql_pro =SELECT Sid FROM table; $res_pro = @mysql_query( $sql_pro); while ($campo_pro = @mysql_fetch_array($res_pro)) { $sid_pro = $campo_pro[Sid]; // *sid_pro = 4* $sid_pro = 'p'.$sid_pro; // I'm trying to use de value of $sid_pro as a VAR name *$sid_pro = p4* print td *input name='$sid_pro' type= 'radio' value='SOLVE_ME'/* /td; // *name=p4 * BLA BLA BLA } SUBMIT FORM === page2.php === $sqlname = SELECT Sid FROM Table; $res = mysql_query ($sqlname) ; while ($campo_pro = mysql_fetch_array($res)) { $name1 = $campo_pro[Sid]; // *$name1 = 4* $radio = '$'.'p'.$name1 ; // *$radio = $p4 -- Now the Problem **How can I get the Value SOLVE_ME from the submited form ?* } == While Variable Variables solve the original question, as asked, I suspect you'd be better off using: ... NAME=camp_pro[?php echo $sid_pro?] ... in your radio buttons. HTML and browsers will treat the radio buttons as the same if the camp_pro part matches, and you'll have $sid_pro I confess the formatting left me a bit confused as to which variable you want where, but I suspect resorting to Variable Variables is not needed at all. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Basic OOP Question
Hi, This is my first post so a cheery hello, this script from php.net: [www.php.net] ?php class SimpleClass { // member declaration public $var = 'a default value'; // method declaration public function displayVar() { echo $this-var; } } mySimpleClass = new SimpleClass(); ? Returned this: Parse error: parse error, unexpected T_STRING, expecting T_FUNCTION in /Users/chris/Sites/php/oop/simple.php on line 4 I'm running PHP Version 5.0.4, with MAC OS 10.4.4 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recursive array_push?
On Thu, January 26, 2006 2:50 am, Kim Christensen wrote: Has anyone out there stumbled over the issue of making multi-dimensional arrays out of bracket-separated strings? In a less fuzzy way of putting it: $str = [layer1][layer2][layer3][layer4] would become $str_array = Array( [layer1] = Array( [layer2] = Array( [layer3] = Array( [layer4] ) ) ) ); ...or something similar. Passing values is not an issue at the moment, it's just the recursive thinking that keeps bugging me right now, and my temporary solution to this matter is not even mentionable! To keep in theme with the hack-o-rama, even though I think it's a lousy way to do this... $str = substr($str, 1, -1); //chop off lead/end square brackets $layers = explode('][', $str); $str_array = array(); $layers = array_reverse($layers); foreach($layers as $layer){ $str_array[] = $layer; $str_array = array($str_array); //or something like that... } I would really like PHP to have a function of building expressions with strings, and then execute them through a function - but that's just me it seems :-) I think you mean this one: http://php.net/eval :-) Though the other suggestion might be more suitable to what you are doing: http://php.net/create_function You may want to post the Big Picture of what you are doing and how you got that string in the first place, because 99 times out of 100, when people use eval, there's an easier way to do it. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic OOP Question
On 26 Jan 2006, at 21:42, Chris Kennon wrote: mySimpleClass = new SimpleClass(); $mySimpleClass ^ ^ ^ Cheers, Rich -- http://www.corephp.co.uk Zend Certified Engineer PHP Development Services -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Best way to handle PREVIOUS and NEXT processing of database records retrieved
Check out : Pagination http://www.weberdev.com/get_example-4242.html Sincerely berber Visit the Weber Sites Today, To see where PHP might take you tomorrow. PHP code examples : http://www.weberdev.com Free Uptime Monitor : http://uptime.weberdev.com PHP content for your site : http://content.weber-sites.com -Original Message- From: Sue [mailto:[EMAIL PROTECTED] Sent: Thursday, January 26, 2006 10:27 PM To: php-general@lists.php.net Subject: [PHP] Best way to handle PREVIOUS and NEXT processing of database records retrieved I am retrieving records from a MySQL database and need to just display each record one after the other on a page. I only want to display a maximum of 25 records per page though, and am wondering if there is a way to handle this easily within PHP? I'd like to use something like NEXT and PREVIOUS as links to go back and forth from each of the pages if there is more than 1 page of data to display. Any examples/ideas would be greatly appreciated. Thanks in advance! -- 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] Best way to handle PREVIOUS and NEXT processing of database records retrieved
On Thu, January 26, 2006 2:27 pm, Sue wrote: I am retrieving records from a MySQL database and need to just display each record one after the other on a page. I only want to display a maximum of 25 records per page though, and am wondering if there is a way to handle this easily within PHP? I'd like to use something like NEXT and PREVIOUS as links to go back and forth from each of the pages if there is more than 1 page of data to display. Any examples/ideas would be greatly appreciated. There are probably a few thousand PHP / MySQL pagination classes out there... http://info.com/php+mysql+pagination -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Connect to AS400
On Thu, January 26, 2006 2:23 pm, Justin Cook wrote: We need to connect to a database on our AS400. Would this be best accomplished with ODBC? If not, what is the preferred method? Thanks! The AS400 was discussed on this list, or possible on the predecessor list which was just [EMAIL PROTECTED] back in the day when there was only one PHP mailing list (not counting internal developer lists). As I recall, a straight ODBC connection was not quite enough, and some Voodoo had to be performed to get it to work, but it was possible. I also vaguely recall that the AS400 ended up being READ-ONLY, at least under one variant of that voodoo... But this is going WAAY back in time, so you'll need to search the archives to confirm. But, for sure, some developers have faced and at least partially solved this at some time in the past, so it's worth digging for it. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache is not parsing .php files
On Thu, January 26, 2006 2:19 pm, sanjay wrote: I have a strange problem while trying to run php based applications. Lets start with phpMyAdmin, a very popular open source tool to manage MySQL written in php. I have already installed phpMyAdmin and was running fine. One day suddenly when I pointed my browser at : http://localhost/phpMyAdmin Instead of running the phpMyAdmin browser opened a message window with options- Open With or Save to disk . I am sure its not browser problem because I tried on Firefox-1.5, Mozilla, Epiphany and Konqueror. One more point I would like to add here that if I write one small php program and save it in as php file (test.php) then http://localhost/test.php executes properly I am using Fedora 2 and apache2, php-4.3x and mysql-3.x were part of the Fedora installation. The only change I made in the /etc/php.ini file was to increase the memory limit from 8MB to 12MB. (Then restarted the http server) Now even php.ini file is in the original state but problem is still there. The http.conf file is unchanged. Can any one give me some sort of idea. My first WILD GUESS is that way long time ago, you changed httpd.conf and/or php.ini, but forgot to re-start Apache, and then tested, and everything worked, so you went on. Now, when you HAVE re-started Apache, your fix from ages ago is finally kicking in, and you have no recollection of that change. If you have log files or notes of changes made previously, especially to httpd.conf, php.ini, or .htaccess, review them -- Keep in mind that what you are calling your original httpd.conf and php.ini file are, in fact, the ones you modified oh so long ago. Another tack you can take is to go ahead and save what the browser is sending you and look at it and see what it looks like. PHP Source? Or something else? Also use telnet or curl (from another box) or similar to get the headers and HTML that is coming out from the broken pages. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic OOP Question
Hi, This is my first post so a cheery hello, this script from php.net: [www.php.net] ?php class SimpleClass { // member declaration public $var = 'a default value'; // method declaration public function displayVar() { echo $this-var; } } mySimpleClass = new SimpleClass(); ? You need to change the last line there. $mySimpleClass = new SimpleClass(); There's no '$' Returned this: Parse error: parse error, unexpected T_STRING, expecting T_FUNCTION in /Users/chris/Sites/php/oop/simple.php on line 4 I'm running PHP Version 5.0.4, with MAC OS 10.4.4 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache is not parsing .php files
On Thursday 26 January 2006 03:28 pm, Richard Lynch wrote: On Thu, January 26, 2006 2:19 pm, sanjay wrote: I have a strange problem while trying to run php based applications. Lets start with phpMyAdmin, a very popular open source tool to manage MySQL written in php. I have already installed phpMyAdmin and was running fine. One day suddenly when I pointed my browser at : http://localhost/phpMyAdmin Instead of running the phpMyAdmin browser opened a message window with options- Open With or Save to disk . I am sure its not browser problem because I tried on Firefox-1.5, Mozilla, Epiphany and Konqueror. One more point I would like to add here that if I write one small php program and save it in as php file (test.php) then http://localhost/test.php executes properly I am using Fedora 2 and apache2, php-4.3x and mysql-3.x were part of the Fedora installation. The only change I made in the /etc/php.ini file was to increase the memory limit from 8MB to 12MB. (Then restarted the http server) Now even php.ini file is in the original state but problem is still there. The http.conf file is unchanged. Can any one give me some sort of idea. My first WILD GUESS is that way long time ago, you changed httpd.conf and/or php.ini, but forgot to re-start Apache, and then tested, and everything worked, so you went on. Now, when you HAVE re-started Apache, your fix from ages ago is finally kicking in, and you have no recollection of that change. If you have log files or notes of changes made previously, especially to httpd.conf, php.ini, or .htaccess, review them -- Keep in mind that what you are calling your original httpd.conf and php.ini file are, in fact, the ones you modified oh so long ago. Another tack you can take is to go ahead and save what the browser is sending you and look at it and see what it looks like. PHP Source? Or something else? Also use telnet or curl (from another box) or similar to get the headers and HTML that is coming out from the broken pages. -- Like Music? http://l-i-e.com/artists.htm I ran into this a while ago. My hosting company did some updates and messed up the httpd.conf file. I eventually tracked it down to the php directives being a bit mangled. Make sure that Apache is loading the PHP module, and that you are telling apache how to handle php files. Since you have apache2, check the /etc/httpd/conf.d/php.conf file to make sure that LoadModule, AddHandler, AddType, and DirectoryIndex are all in there. HTH -- Ray Hauge Programmer/Systems Administrator American Student Loan Services http://www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Isolating a php directory on a main server
How can one do this ?? CLient wants to isolate away so development code so that only he can upload it and no one in the world can see it. -- Member - Liberal International This is [EMAIL PROTECTED] Ici [EMAIL PROTECTED] God Queen and country! Beware Anti-Christ rising! Born 29 Jan 1969 Redhill Surrey UK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Isolating a php directory on a main server
On Thursday 26 January 2006 03:48 pm, The Doctor wrote: How can one do this ?? CLient wants to isolate away so development code so that only he can upload it and no one in the world can see it. -- Member - Liberal International This is [EMAIL PROTECTED] Ici [EMAIL PROTECTED] God Queen and country! Beware Anti-Christ rising! Born 29 Jan 1969 Redhill Surrey UK If I'm reading this right, this sounds like more of a webserver issue. If you're using Apache, then you could probably put in a Directory directive to lock it down to his IP (if he is static). You could also put the user/pass authentication in there. -- Ray Hauge Programmer/Systems Administrator American Student Loan Services http://www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Connect to AS400
On 1/26/06, Justin Cook [EMAIL PROTECTED] wrote: We need to connect to a database on our AS400. Would this be best accomplished with ODBC? If not, what is the preferred method? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Talking from a Windows point of view, you will need the AS400 Client Access software (or similar - I think it has a new name now!) installed on the machine you are trying to connect from. Once this is done, you need to set up a data source in ODBC - System DSN works best, then use the standard ODBC calls within PHP to access the database. If you need further detail, I should be able to help you once I get to work in about 8 hours!
Re: [PHP] Connect to AS400
On 1/26/06, Richard Lynch [EMAIL PROTECTED] wrote: On Thu, January 26, 2006 2:23 pm, Justin Cook wrote: We need to connect to a database on our AS400. Would this be best accomplished with ODBC? If not, what is the preferred method? Thanks! The AS400 was discussed on this list, or possible on the predecessor list which was just [EMAIL PROTECTED] back in the day when there was only one PHP mailing list (not counting internal developer lists). As I recall, a straight ODBC connection was not quite enough, and some Voodoo had to be performed to get it to work, but it was possible. I also vaguely recall that the AS400 ended up being READ-ONLY, at least under one variant of that voodoo... From my experience, when the ODBC driver (for windows at least) is installed, it defaults to read-only. From memory, this can be changed simply by ticking a check box to allow writes.
Re: [PHP] Google using PHP @ http://www.google-store.com
Oscommerce itself hasn't released a new version for an age. I am guessing their next release will be better. Still ive seen a lot worse... Strange javascript with frames aggh! I think it was a quick knock-up job to see if anyone else would buy their tat. I don't see the google radio they sent me the other year for spendng so much on adwords though. ;) On 1/25/06, tedd [EMAIL PROTECTED] wrote: They are using oscommerce specifically. An open source PHP shopping cart. ben: Not that you said or implied otherwise. soapbox PHP or not, there's no reason I know of for not complying with w3c -- especially if you're high profile like Google. It's clear that they are not concerned with disability issues. /soapbox tedd I have also come accross php errrors when accessing googles suggest feature, some strange reaction with greesemonkey. On 1/25/06, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: Looks like google are using PHP and oscommerce for their web store: http://www.google-store.comhttp://www.google-store.com Nice to see :) James It would be nice to see them being w3c compliant, but they aren't. tedd -- http://sperling.com/http://sperling.com/ -- PHP General Mailing List (http://www.php.net/ http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phphttp://www.php.net/unsub.php -- http://sperling.com/
[PHP] Re: $_SESSION saves all values but Class -- works on one server butnot another?! [SOLVED]
UGH After a WEEK of wasted time, I finally tracked this down. If you have a __destructor() on a class object that you're saving in a $_SESSION, then that object will have all it's values NULL'd out when you call session_start() and retrieve it. http://www.php.net/session-set-save-handler Write and Close handlers are called AFTER destructing objects since PHP 5.0.5. Thus destructors can use sessions but session handler can't use objects. In prior versions, they were called in the opposite order. It is possible to call session_write_close() from the destructor to solve this chicken and egg problem. Why wouldn't you save the session values out BEFORE destroying them? Why should the programmer be burdened with this crap? It worked just fine in prior versions and now it's broken in my opinion. So you have to do something like this now: function __destruct() { session_write_close(); foreach($this as $key = $value) unset($this-$key); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php