[PHP] array_push
Hello, why this array_push($x ? $a : $b, 'value'); produce error(Fatal error: Only variables can be passed by reference) ?php $x = 1; #$x = 0; $a = array(); $b = array(); array_push($x ? $a : $b, 'value'); i must rewrote this in if ($x) array_push($a, 'value'); else array_push($b, 'value'); Regards, Michal Dvoracek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP security bug and patch
Hello, when applying patch on version 4.2.1 then in phpinfo(); is still PHP Version 4.2.1 but SERVER_SOFTWARE: Apache/1.3.26 (Unix) PHP/4.2.2 mod_ssl/2.8.9 OpenSSL/0.9.6d-beta1 Regards, Michal Dvoracek [EMAIL PROTECTED] Capitol Internet Publisher, Korunovacni 6, 170 00 Prague 7, Czech Republic tel.: ++420 2 3337 1117, fax: ++420 2 3337 1112 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Character Array
Hello, IMHO string is array of characters so is possible: $str = 'string'; for ($i = 0; $ count($str); $i++) echo $str[$i]; Regards, Michal Dvoracek [EMAIL PROTECTED] Capitol Internet Publisher, Korunovacni 6, 170 00 Prague 7, Czech Republic tel.: ++420 2 3337 1117, fax: ++420 2 3337 1112 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Session variables
SELECT name=day OPTION value=please select ? if(empty($day)) { echo selected; } ? OPTION value=monday ? if($day == monday) { echo selected; } ? OPTION value=tuesday ? if($day == tuesday) { echo selected; } ? OPTION value=wednesday ? if($day == wednesday) { echo selected; } ? OPTION value=thursday ? if($day == thursday) { echo selected; } ? OPTION value=friday ? if($day == friday) { echo selected; } ? /SELECT better is (IMHO): OPTION value=please select?php echo empty($day) ? ' selected' : ''; ? OPTION value=monday?php echo $day == 'monday' ? ' selected' : '';? Regards, Michal Dvoracek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] bug in sessions
Hello, i discovered bug in sessions: when using unset($_SESSION[...]) insted session_unregister(...) and before calling read _$SESSION[...] variable WILL NOT unset. please try these examples and see result. here is method how to produce this bug (you must have cookies enabled): 1. run script 2. reload page (you should see 2 $_SESSION arrays with the same value) 3. click on unset link 4. now you should see first array filled with test value and second should be empty - that's OK - but variable test should be deleted from session 5. reload page 6. here is BUG: i unset session variable test so i shouldn't exists, but exists. --- 7. comment line marked #fatal and go to repeat process from begining on step 6. both arrays will be empty cut here-- ?php session_start(); echo 'pre'; print_r($_SESSION); if (isset($_GET['submit'])) { $test = $_SESSION['test']; # fatal unset($_SESSION['test']); } else { $_SESSION['test'] = 'this is test'; } echo 'a href='.$_SERVER['PHP_SELF'].'?submit=yesunset/abr'; print_r($_SESSION); echo '/pre'; ? cut here-- replaceunset($_SESSION['test']); with session_unregister('test'); and repeat process - here will be everything OK. http://www.php.net/manual/en/ref.session.php (see Example 3.) Tested on PHP 4.2.1 (win, Debian). Epilogue: using unset at $_SESSION array is NOT safe. Regards, Michal Dvoracek [EMAIL PROTECTED] Capitol Internet Publisher, Korunovacni 6, 170 00 Prague 7, Czech Republic tel.: ++420 2 3337 1117, fax: ++420 2 3337 1112 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php sessions
Hello, i'm using sessions in my application but i found something strange. when creating new session: define('S_USER', 0); define('S_USER_ID', 0); define('S_USER_NAME', 1); session_start(); $_SESSION[S_USER][S_USER_ID] = 1; $_SESSION[S_USER][S_USER_NAME] = 'Michal'; when redirect on next page - session is empty but when a change first define to: define('S_USER', 'user'); everything works ok. So in session isn't possible use numeric indexes ? Regards, Michal Dvoracek [EMAIL PROTECTED] Sorry if this question was here answered. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php performance
Hello, what is better syntax (for perfomance option, not code-style) e.g. html code out of php tags table ?php while (...) { ? tr td?php echo $something; ?/td tdtext/td /tr ?php } ? /table or ?php $table = 'table'; while (...) $table .= 'trtd'.$something.'/tdtdtext/td/tr'; $table .= '/table'; ? Thank you. Regards, Michal Dvoracek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IF Statements
Hello, try this version :) if (($this-checkReferralCB($this-benefitRef, $this-benefitNo, $this-childDOB)) (!$this-checkLocation($this-post, W)) (!empty($this-childDOB)) || ($this-checkPregnancy($this-benefitRef, $this-benefitNo))) Regards, Michal Dvoracek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] building php
Hello, i can't get php binary when installing php on my server. my configure: ./configure --prefix=/usr/local \ --with-config-file-path=/usr/local/etc \ --with-openssl=/usr/local \ --with-zlib-dir=/usr/local \ --with-zlib=/usr/local \ --with-bz2=/usr/local \ --with-mysql=/usr/local \ --with-apache=../apache_1.3.24 \ --with-zip=/usr/local \ --enable-calendar \ --enable-sockets \ --with-mod_charset \ --without-pear configure pass with no errors, make too make install - module is installed, everything is ok but no php binary is installed. when i type make php i got: /bin/sh /usr/local/src/php-4.2.0/libtool --silent --mode=link gcc -I. -I/usr/local/src/php-4.2.0/ -I/usr/local/src/php-4.2.0/main -I/usr/local/src/php-4.2.0 -I/usr/local/src/apache_1.3.24/src/include -I/usr/local/src/apache_1.3.24/src/os/unix -I/usr/local/src/php-4.2.0/Zend -I/usr/local/include -I/usr/local/include/mysql -I/usr/local/src/php-4.2.0/ext/xml/expat -I/usr/local/src/php-4.2.0/TSRM -g -O2 -o php -export-dynamicstub.lo libphp4.la /usr/lib/crt1.o: In function `_start': /usr/lib/crt1.o(.text+0x18): undefined reference to `main' collect2: ld returned 1 exit status make: *** [php] Error 1 Can you help me please ? (I urgent need php binary to execute some scripts from crontab) Thank you. Regards, Michal Dvoracek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] error_reporting()
Hi, error_reporting(E_ALL); BTW: RTFM! Regards Michal Dvoracek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parsing mail files
Hello, try sourceforge.net or freshmeat.net. There are very usefull programs. Try search: mail mime Regards Michal Dvoracek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] compiling php 4.2 with apache 2.0.35
Hello, i have problem with %subj%. It's possible to build php without apxs2 ? Building php with apxs2 - apxs must be instaled before (e.g. apache must be instaled first ?) Regards, Michal Dvoracek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php apache 2
Hello, when will be possible to compile php as static module with apache 2? Regards, Michal Dvoracek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array question
Hello, i think that unset($a['color']); is the best way :) Regards Michal Dvoracek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Variable
Hello, store value in hidden field in form, like this: input type=hidden name=id value=?php echo $_GET['id']; ? when form is submitted field id contains required value. or use cookie (but here is test if cookie enabled) Regards Michal Dvoracek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] register_globals
Hello, in php 4.0.6 on the begin of the script include file called config.php. In config file i have ini_set('register_globals', 'off'); i setup session via session_register('variable') and redirect to another page, where i include the same config (config.php) and call session_start(); but when i make print_r($HTTP_SESSION_VARS); array is empty. When i disable line with ini_set in config file all is ok. It's bug ? I must using two versions of PHP 4.0.6 and 4.1.2. On 4.1.2 is everything OK but on 4.0.6 not. So where is problem ? In myself or between keyboard and chair (that's myself too :)) Regards Michal Dvoracek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] login library
Hello, i want to write some application that requires users login. So i have question how i can check duplicity login (eg. browser crash, login from one computer using two browsers, ...). I need some idea (the best will be some example code :) ). Thank you. Michal Dvoracek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] bug or bad definition ?
Hello, can someone test this code and send me results ? ? function check_session() { global $_SESSION; session_start(); if (isset($_SESSION[id])) return true; else { unset($_SESSION); session_destroy(); return false; } } $sess = check_session(); if (isset($_POST[button]) !$sess) { session_start(); $_SESSION[id] = 1; $_SESSION[name] = name; header(location: http://www.php.net/;); exit(); } ? ?!doctype html public -//W3C//DTD HTML 4.0 Transitional//EN html head titleXXX/title /head body form action=? echo $_SERVER[PHP_SELF]; ? method=post input type=submit name=button /form /body /html i want to know if apache fails (returns no response) or if it passed. And then try please again but with this line in function: //global $_SESSION; # disable global Thank you Lampa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]