Re: [PHP] Register Globals

2004-10-27 Thread Curt Zirzow
* Thus wrote Matthew Sims:
 
 I just signed up with a new hosting site. So first thing I did was check
 what phpinfo() had to say.
 
 I see that register_globals is turned on. Now I always use the $_GET and
 $_POST vars but will this still affect me?

As long as you dont use third party software you will be perfectly
fine.  As Mr. Holmes pointed out, its all depends on how the code
was written, having register gobals off makes it more obvious of the
insesurity:

globals == on:

/script.php?loggedin=1
?php

/* a major mistake  when one uses 
 * session_register('loggedin'); 
 * which forces any variable that is defined in
 * global scope aka, _GET, _POST, SESSION...
 */
if ($loggedin) {
  echo Display confidential information;
}
?


globals == off; secured
?php
/* know exactly where the loggedin variable comes from */
$loggedin = $_SESSION['loggedin'];
if ($loggedin) {
  echo Display confidential information;
}


The major differnce between the two is that in the first example
the variable is never officially defined within the php code, and
where it actually is being set is rather undpredictable.

With the latter example, you are ensuring that the variable
$loggedin is from the session variable. But then now the quesion
arises, was that session variable set properly...

So in summary, register_globals=off ensures the script how the
variables are being accessed, but it doesn't mean they were set
properly in the first place.

HTH,

Curt
-- 
Quoth the Raven, Nevermore.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] HTTP AUTH in PHP5

2004-10-27 Thread Christophe Chisogne
Nunners wrote:
I'm having some problems with using HTTP Auth in PHP5
IIRC, php 5.0 had a bug related to HTTP auth, corrected in php 5.0.1: [1]
Fixed bug #29132 [http://bugs.php.net/29132]
 ($_SERVER[PHP_AUTH_USER] isn't defined). (Stefan)
Note, I cant access bugs.php.net right now.
If you use PHP 5, upgrade to PHP 5.0.2 (released 23-Sep-2004),
which correct a (security) pblm related to GPC processing.
Christophe
[1] Changelog for 5.0.1
http://www.php.net/ChangeLog-5.php#5.0.1
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Sessions problem bug

2004-10-27 Thread Jason Barnett
Are you using cookie-based sessions?  Thus sayeth the manual:
Note:  When using session cookies, specifying an id for session_id() will always 
send a new cookie when session_start() is called, regardless if the current 
session id is identical to the one being set.

Thanks google.
Reinhart Viane wrote:
Some days ago I asked some questions concerning php and sessions
Apparently it seems to be a bug:
'When you use a session name that has only numbers, each call to
session_start seems to regenerate a new session id, so the session does
not persist.'
http://bugs.php.net/search.php?search_for=sessionboolean=0limit=10ord
er_by=direction=ASCcmd=displaystatus=Openbug_type%5B%5D=Session+rela
tedphp_os=phpver=assign=author_email=bug_age=0
And there you pick bug with ID 27688
Just to let everyone know.
Greetz,
Reinhart Viane

Reinhart Viane 
[EMAIL PROTECTED] 
Domos || D-Studio 
Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01 --
fax +32 15 43 25 26 

STRICTLY PERSONAL AND CONFIDENTIAL 
This message may contain confidential and proprietary material for the
sole use of the intended 
recipient.  Any review or distribution by others is strictly prohibited.
If you are not the intended 
recipient please contact the sender and delete all copies.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Classes and Interface tool

2004-10-27 Thread Jason Barnett
Jonel Rienton wrote:
hi again guys, is there a tool that can allow you view the available
interfaces of a class, like an object/class browser that can help you view
the signatures of those interfaces?
thanks and regards,
Jonel

You should be able to use the Reflection API to find out what you want to know 
about Interfaces.  Specifically, you can use

ReflectionClass::export('nameOfYourInterface');
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Parsing

2004-10-27 Thread Jason Barnett
Jerry Swanson wrote:
I have huge html file.  I want to parse the data and get everything between
b class=class1 and !-- Comments --
What function is good for this purpose?
TH

preg_match() is a good choice.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] [SOLUTION] Re: [PHP] Convert an array in an object instance

2004-10-27 Thread Francisco M. Marzoa Alonso
Ok, I've write a function that emulates the Perl's bless one. It works 
pretty well.

The idea comes to me when Rob suggest to parse the serialized data. I 
think this is better -or at least faster- than parsing all serialized 
data to modify object values: Just convert the object to an array, 
modify whatever values you want -no matter about member visibility-, and 
then convert the array again in an object.

Note that you should NEVER modify private and protected members outside 
its visibility environment... well, never UNLESS you're writting your 
own serialization routines indeed (that's exactly because I need to do 
it ;-) )

?
function bless ( $Instance, $Class ) {
   $serdata = serialize ( $Instance );
   /* For an array serialized data seems to meant:
array_tag:array_count:{array_elems}
   array_tag is always 'a'
   array_count is the number of elements in the array
   array_elems are the elemens in the array
 For an object seems to meant:
 
object_tag:object_class_name_len:object_class_name:object_count:{object_members}

   object_tag is always 'O'
   object_class_name_len is the length in chars of 
object_class_name string
   object_class_name is a string with the name of the class
   object_count is the number of object members
   object_members is the object_members itself (exactly equal to 
array_elems)
   */

   list ($array_params, $array_elems) = explode ('{', $serdata, 2);
   list ($array_tag, $array_count) = explode (':', $array_params, 3 );
   $serdata = O:.strlen 
($Class).:\$Class\:$array_count:{.$array_elems;

   $Instance = unserialize ( $serdata );
   return $Instance;
}
class TestClass {
   private $One=1;
   protected $Two=2;
   public $Three=3;
   public function sum() {
   return $this-One+$this-Two+$this-Three;
   }
}
$Obj = new TestClass ();
$Clone = (array) $Obj;
echo As an array:br;
print_r ($Clone);
bless ( $Clone, TestClass );
echo brbrAfter blessing as a TestClass instance:br;
print_r ($Clone);
echo brbrCalling sum method: ;
echo $Clone-sum();
echo brThe array was blessed! miracle!!! ;-)br;
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Serializing objects with protected members

2004-10-27 Thread Jason Barnett
Francisco M. Marzoa Alonso wrote:
Hi,
I'm trying to wrote my own serialization routines and I've found a 
previsible problem: protected members are not visible to my 
serialization routine. This is ok and it should be as is, but I've seen 
that PHP's serialize function have access to that members anyway, so the 
question is: Is there any kind of hack that I can use to access those 
variables from my own serialization routine?

Thx. a lot in advance,

An easy hack to get private / protected members:
class read_only_hack {
  // overload the get magic function
  function __get($var) {
return $this-$var;
  }
}
Another way that should work (untested):
class serialize_me {
  function __sleep() {
$copy = clone($this);
// inside your class, so you can access private and push onto array
$copy-_private_vars = array();
$copy-_protected_vars = array();
return $copy;
  }
  // object being unserialized, so now you assign the properties
  function __wakeup() {
foreach ($this-_protected_vars as $key=$val) {
  $this-$key = $val;
}
foreach ($this-_private_vars as $key=$val) {
  $this-$key = $val;
}
unset ($this-_private_vars, $this-_protected_vars);
  }
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Newbie: get no $QUERY_STRING

2004-10-27 Thread Horst Jäger
Hi,
I'm afraid this might be a stupid question but this is my first PHP-day.
I get no $QUERY_STRING (and no GET- or POST-Params).
I'm using PHP 4.3.3 on a SUSE LINUX 9.0 Machine. When I view the following 
page:

htmlhead/headbody
?php
echo gettype($QUERY_STRING);
 ?
/body/html
I get:
NULL
I copy my phpinfo below in case someone wants to have a look at it.
Thanks
Horst

PHP Version 4.3.3
System  Linux wittgenstein 2.4.21-99-smp4G #1 SMP Wed Sep 24 14:13:20 UTC 
2003 i686
Build Date  Sep 24 2003 00:27:33
Configure Command  './configure' '--prefix=/usr/share' 
'--datadir=/usr/share/php' '--bindir=/usr/bin' '--libdir=/usr/share' 
'--includedir=/usr/include' '--sysconfdir=/etc' '--with-_lib=lib' 
'--with-config-file-path=/etc' '--with-exec-dir=/usr/lib/php/bin' 
'--disable-debug' '--enable-bcmath' '--enable-calendar' '--enable-ctype' 
'--enable-dbase' '--enable-discard-path' '--enable-exif' '--enable-filepro' 
'--enable-force-cgi-redirect' '--enable-ftp' '--enable-gd-imgstrttf' 
'--enable-gd-native-ttf' '--enable-inline-optimization' 
'--enable-magic-quotes' '--enable-mbstr-enc-trans' '--enable-mbstring' 
'--enable-mbregex' '--enable-memory-limit' '--enable-safe-mode' 
'--enable-shmop' '--enable-sigchild' '--enable-sysvsem' '--enable-sysvshm' 
'--enable-track-vars' '--enable-trans-sid' '--enable-versioning' 
'--enable-wddx' '--enable-yp' '--with-bz2' 
'--with-dom=/usr/include/libxml2' '--with-ftp' '--with-gdbm' 
'--with-gettext' '--with-gmp' '--with-imap=yes' '--with-iodbc' 
'--with-jpeg-dir=/usr' '--with-ldap=yes' '--with-mcal=/usr' '--with-mcrypt' 
'--with-mhash' '--with-mysql=/usr' '--with-ndbm' '--with-pgsql=/usr' 
'--with-png-dir=/usr' '--with-readline' '--with-snmp' '--with-t1lib' 
'--with-tiff-dir=/usr' '--with-ttf' '--with-freetype-dir=yes' '--with-xml' 
'--with-xpm-dir=/usr/X11R6' '--with-zlib=yes' '--with-qtdom=/usr/lib/qt3' 
'--with-gd' '--with-openssl' '--with-curl' 
'--with-swf=/usr/src/packages/BUILD/swf/dist/' '--with-imap-ssl' 
'--enable-xslt' '--with-xslt-sablot' '--with-iconv' '--with-mm' 
'--with-apxs=/usr/sbin/apxs' 'i586-suse-linux'
Server API  Apache
Virtual Directory Support  disabled
Configuration File (php.ini) Path  /etc/php.ini
PHP API  20020918
PHP Extension  20020429
Zend Extension  20021010
Debug Build  no
Thread Safety  disabled
Registered PHP Streams  php, http, ftp, https, ftps, compress.bzip2, 
compress.zlib

 This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies

PHP Credits

Configuration
PHP Core
Directive Local Value Master Value
allow_call_time_pass_reference On On
allow_url_fopen On On
always_populate_raw_post_data Off Off
arg_separator.input  
arg_separator.output  
asp_tags Off Off
auto_append_file no value no value
auto_prepend_file no value no value
browscap no value no value
default_charset no value no value
default_mimetype text/html text/html
define_syslog_variables Off Off
disable_classes no value no value
disable_functions no value no value
display_errors On On
display_startup_errors Off Off
doc_root no value no value
docref_ext no value no value
docref_root no value no value
enable_dl On On
error_append_string no value no value
error_log no value no value
error_prepend_string no value no value
error_reporting 2039 2039
expose_php On On
extension_dir /usr/share/extensions/no-debug-non-zts-20020429 
/usr/share/extensions/no-debug-non-zts-20020429
file_uploads On On
gpc_order GPC GPC
highlight.bg #FF #FF
highlight.comment #FF8000 #FF8000
highlight.default #BB #BB
highlight.html #00 #00
highlight.keyword #007700 #007700
highlight.string #DD #DD
html_errors On On
ignore_repeated_errors Off Off
ignore_repeated_source Off Off
ignore_user_abort Off Off
implicit_flush Off Off
include_path .:/usr/share/php .:/usr/share/php
log_errors Off Off
log_errors_max_len 1024 1024
magic_quotes_gpc On On
magic_quotes_runtime Off Off
magic_quotes_sybase Off Off
max_execution_time 30 30
max_input_time 60 60
memory_limit 8M 8M
open_basedir no value no value
output_buffering no value no value
output_handler no value no value
post_max_size 8M 8M
precision 12 12
register_argc_argv On On
register_globals Off Off
report_memleaks On On
safe_mode Off Off
safe_mode_exec_dir no value no value
safe_mode_gid Off Off
safe_mode_include_dir no value no value
sendmail_from [EMAIL PROTECTED] [EMAIL PROTECTED]
sendmail_path /usr/sbin/sendmail -t -i  /usr/sbin/sendmail -t -i
serialize_precision 100 100
short_open_tag On On
SMTP localhost localhost
smtp_port 25 25
sql.safe_mode Off Off
track_errors Off Off
unserialize_callback_func no value no value
upload_max_filesize 2M 2M
upload_tmp_dir no value no value
user_dir no value no value

[PHP] file upload

2004-10-27 Thread Akshay
I've been trying to come up with an algorithm that will allow me to upload  
all the files in a folder.

The scheme I have in mind is to use a feedback form that will let me pick  
out a target folder on my local machine. Upon submitting the form, I'd  
like the script to upload all the files in that folder into a  
predetermined folder on the host machine. Its easy with a single file, but  
I've run into a conundrum of sorts for a complete folder. Is there any way  
to pass the source path as a parameter in PHP, and have PHP upload all the  
files in that path?
--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: relative paths with require

2004-10-27 Thread Jason Barnett
If you need relative require's, I have always found the constant __FILE__ to be 
useful.  Just something like:

require_once (__FILE__ . ../b/b.php);
If you go this route, be sure to check out the user notes on the page here:
http://us2.php.net/constants
Joey Morwick wrote:
Hello, I'm experiencing a problem with PHP4.  On the server where our code
used to reside, the relative path used in an include started from the
directory in which the file containing the require statement resided.  On
our new server, the relative paths seem to start from where the first php
script in the chain of require's resides.  

An example would be three files in two directories as follows:
/test/index.php
/test/a/a.php
/test/b/b.php
index.php:  
require(a/a.php);

a.php:
require(../b/b.php);
On our old server, this would be fine, as the path searched in a.php would
start in /test/a.  On the new server, if you start processing index.php,
you will get a file not found error in a.php since it's starting from the
path /test.
I've tried every config option I can think of and am nearly ready to try to
hack in a workaround.  Does anyone know how this could be configured?
Thanks,
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Newbie: get no $QUERY_STRING

2004-10-27 Thread John Holmes
Horst Jger wrote:
I get no $QUERY_STRING (and no GET- or POST-Params).
$_SERVER['QUERY_STRING'], $_GET['param'], $_POST['param'], etc..
register_globals Off Off
Or turn this on.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Extracting relevant text from a text file

2004-10-27 Thread Jason Barnett
Stuart Felenstein wrote:
Best way for me to explain this is by example - 
I just applied for a job and cut and past my resume
into a textarea.
After submitting it had extracted all the information
and placed them into textfields.  So my first name was
now in the first name textfield, city was in the city
field.
Also , work experience and companies were also
extracted to certain areas.

How sophisticted a search is this and are there
functions within PHP that make this accomplishable ?
preg_match()
The only question that remains is, what pattern do you want to use to match 
against the resume / text?  A resume has a predictable format of newlines, 
commas and so forth so preg_match should be fairly reliable for this purpose.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Newbie again: get no $QUERY_STRING

2004-10-27 Thread Horst Jäger
Date: Wed, 27 Oct 2004 12:50:36 +0200
To: [EMAIL PROTECTED]
From: Horst Jäger [EMAIL PROTECTED]
Subject: Newbie: get no $QUERY_STRING
Hi,
when I received my own mail back from the list I found that my example page 
has been removed. Maybe my mail program thought I was sending styled text. 
So I'm using these brackets [] in my example in order to fool the damned thing.

I'm afraid this might be a stupid question but this is my first PHP-day.
I get no $QUERY_STRING (and no GET- or POST-Params).
I'm using PHP 4.3.3 on a SUSE LINUX 9.0 Machine. When I view the following 
page:

[html][head][/head][body]
[?php
echo gettype($QUERY_STRING);
 ?]
[/body][/html]
I get:
NULL
I copy my phpinfo below in case someone wants to have a look at it.
Thanks
Horst

PHP Version 4.3.3
System  Linux wittgenstein 2.4.21-99-smp4G #1 SMP Wed Sep 24 14:13:20 UTC 
2003 i686
Build Date  Sep 24 2003 00:27:33
Configure Command  './configure' '--prefix=/usr/share' 
'--datadir=/usr/share/php' '--bindir=/usr/bin' '--libdir=/usr/share' 
'--includedir=/usr/include' '--sysconfdir=/etc' '--with-_lib=lib' 
'--with-config-file-path=/etc' '--with-exec-dir=/usr/lib/php/bin' 
'--disable-debug' '--enable-bcmath' '--enable-calendar' '--enable-ctype' 
'--enable-dbase' '--enable-discard-path' '--enable-exif' '--enable-filepro' 
'--enable-force-cgi-redirect' '--enable-ftp' '--enable-gd-imgstrttf' 
'--enable-gd-native-ttf' '--enable-inline-optimization' 
'--enable-magic-quotes' '--enable-mbstr-enc-trans' '--enable-mbstring' 
'--enable-mbregex' '--enable-memory-limit' '--enable-safe-mode' 
'--enable-shmop' '--enable-sigchild' '--enable-sysvsem' '--enable-sysvshm' 
'--enable-track-vars' '--enable-trans-sid' '--enable-versioning' 
'--enable-wddx' '--enable-yp' '--with-bz2' 
'--with-dom=/usr/include/libxml2' '--with-ftp' '--with-gdbm' 
'--with-gettext' '--with-gmp' '--with-imap=yes' '--with-iodbc' 
'--with-jpeg-dir=/usr' '--with-ldap=yes' '--with-mcal=/usr' '--with-mcrypt' 
'--with-mhash' '--with-mysql=/usr' '--with-ndbm' '--with-pgsql=/usr' 
'--with-png-dir=/usr' '--with-readline' '--with-snmp' '--with-t1lib' 
'--with-tiff-dir=/usr' '--with-ttf' '--with-freetype-dir=yes' '--with-xml' 
'--with-xpm-dir=/usr/X11R6' '--with-zlib=yes' '--with-qtdom=/usr/lib/qt3' 
'--with-gd' '--with-openssl' '--with-curl' 
'--with-swf=/usr/src/packages/BUILD/swf/dist/' '--with-imap-ssl' 
'--enable-xslt' '--with-xslt-sablot' '--with-iconv' '--with-mm' 
'--with-apxs=/usr/sbin/apxs' 'i586-suse-linux'
Server API  Apache
Virtual Directory Support  disabled
Configuration File (php.ini) Path  /etc/php.ini
PHP API  20020918
PHP Extension  20020429
Zend Extension  20021010
Debug Build  no
Thread Safety  disabled
Registered PHP Streams  php, http, ftp, https, ftps, compress.bzip2, 
compress.zlib

 This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies

PHP Credits

Configuration
PHP Core
Directive Local Value Master Value
allow_call_time_pass_reference On On
allow_url_fopen On On
always_populate_raw_post_data Off Off
arg_separator.input  
arg_separator.output  
asp_tags Off Off
auto_append_file no value no value
auto_prepend_file no value no value
browscap no value no value
default_charset no value no value
default_mimetype text/html text/html
define_syslog_variables Off Off
disable_classes no value no value
disable_functions no value no value
display_errors On On
display_startup_errors Off Off
doc_root no value no value
docref_ext no value no value
docref_root no value no value
enable_dl On On
error_append_string no value no value
error_log no value no value
error_prepend_string no value no value
error_reporting 2039 2039
expose_php On On
extension_dir /usr/share/extensions/no-debug-non-zts-20020429 
/usr/share/extensions/no-debug-non-zts-20020429
file_uploads On On
gpc_order GPC GPC
highlight.bg #FF #FF
highlight.comment #FF8000 #FF8000
highlight.default #BB #BB
highlight.html #00 #00
highlight.keyword #007700 #007700
highlight.string #DD #DD
html_errors On On
ignore_repeated_errors Off Off
ignore_repeated_source Off Off
ignore_user_abort Off Off
implicit_flush Off Off
include_path .:/usr/share/php .:/usr/share/php
log_errors Off Off
log_errors_max_len 1024 1024
magic_quotes_gpc On On
magic_quotes_runtime Off Off
magic_quotes_sybase Off Off
max_execution_time 30 30
max_input_time 60 60
memory_limit 8M 8M
open_basedir no value no value
output_buffering no value no value
output_handler no value no value
post_max_size 8M 8M
precision 12 12
register_argc_argv On On
register_globals Off Off
report_memleaks On On
safe_mode Off Off
safe_mode_exec_dir no value no value
safe_mode_gid Off Off
safe_mode_include_dir no value no 

[PHP] Newbie again: get no $QUERY_STRING

2004-10-27 Thread Horst Jäger
Date: Wed, 27 Oct 2004 12:50:36 +0200
To: [EMAIL PROTECTED]
From: Horst Jäger [EMAIL PROTECTED]
Subject: Newbie: get no $QUERY_STRING
Hi,
when I received my own Mail back from the list I found that my example page 
has been removed. Maybe my mail program thought I was sending styled text. 
So I'm using these brackets [] in my example in order to fool the damned thing.

I'm afraid this might be a stupid question but this is my first PHP-day.
I get no $QUERY_STRING (and no GET- or POST-Params).
I'm using PHP 4.3.3 on a SUSE LINUX 9.0 Machine. When I view the following 
page:

[html][head][/head][body]
[?php
echo gettype($QUERY_STRING);
 ?]
[/body][/html]
I get:
NULL
I copy my phpinfo below in case someone wants to have a look at it.
Thanks
Horst

PHP Version 4.3.3
System  Linux wittgenstein 2.4.21-99-smp4G #1 SMP Wed Sep 24 14:13:20 UTC 
2003 i686
Build Date  Sep 24 2003 00:27:33
Configure Command  './configure' '--prefix=/usr/share' 
'--datadir=/usr/share/php' '--bindir=/usr/bin' '--libdir=/usr/share' 
'--includedir=/usr/include' '--sysconfdir=/etc' '--with-_lib=lib' 
'--with-config-file-path=/etc' '--with-exec-dir=/usr/lib/php/bin' 
'--disable-debug' '--enable-bcmath' '--enable-calendar' '--enable-ctype' 
'--enable-dbase' '--enable-discard-path' '--enable-exif' '--enable-filepro' 
'--enable-force-cgi-redirect' '--enable-ftp' '--enable-gd-imgstrttf' 
'--enable-gd-native-ttf' '--enable-inline-optimization' 
'--enable-magic-quotes' '--enable-mbstr-enc-trans' '--enable-mbstring' 
'--enable-mbregex' '--enable-memory-limit' '--enable-safe-mode' 
'--enable-shmop' '--enable-sigchild' '--enable-sysvsem' '--enable-sysvshm' 
'--enable-track-vars' '--enable-trans-sid' '--enable-versioning' 
'--enable-wddx' '--enable-yp' '--with-bz2' 
'--with-dom=/usr/include/libxml2' '--with-ftp' '--with-gdbm' 
'--with-gettext' '--with-gmp' '--with-imap=yes' '--with-iodbc' 
'--with-jpeg-dir=/usr' '--with-ldap=yes' '--with-mcal=/usr' '--with-mcrypt' 
'--with-mhash' '--with-mysql=/usr' '--with-ndbm' '--with-pgsql=/usr' 
'--with-png-dir=/usr' '--with-readline' '--with-snmp' '--with-t1lib' 
'--with-tiff-dir=/usr' '--with-ttf' '--with-freetype-dir=yes' '--with-xml' 
'--with-xpm-dir=/usr/X11R6' '--with-zlib=yes' '--with-qtdom=/usr/lib/qt3' 
'--with-gd' '--with-openssl' '--with-curl' 
'--with-swf=/usr/src/packages/BUILD/swf/dist/' '--with-imap-ssl' 
'--enable-xslt' '--with-xslt-sablot' '--with-iconv' '--with-mm' 
'--with-apxs=/usr/sbin/apxs' 'i586-suse-linux'
Server API  Apache
Virtual Directory Support  disabled
Configuration File (php.ini) Path  /etc/php.ini
PHP API  20020918
PHP Extension  20020429
Zend Extension  20021010
Debug Build  no
Thread Safety  disabled
Registered PHP Streams  php, http, ftp, https, ftps, compress.bzip2, 
compress.zlib

 This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies

PHP Credits

Configuration
PHP Core
Directive Local Value Master Value
allow_call_time_pass_reference On On
allow_url_fopen On On
always_populate_raw_post_data Off Off
arg_separator.input  
arg_separator.output  
asp_tags Off Off
auto_append_file no value no value
auto_prepend_file no value no value
browscap no value no value
default_charset no value no value
default_mimetype text/html text/html
define_syslog_variables Off Off
disable_classes no value no value
disable_functions no value no value
display_errors On On
display_startup_errors Off Off
doc_root no value no value
docref_ext no value no value
docref_root no value no value
enable_dl On On
error_append_string no value no value
error_log no value no value
error_prepend_string no value no value
error_reporting 2039 2039
expose_php On On
extension_dir /usr/share/extensions/no-debug-non-zts-20020429 
/usr/share/extensions/no-debug-non-zts-20020429
file_uploads On On
gpc_order GPC GPC
highlight.bg #FF #FF
highlight.comment #FF8000 #FF8000
highlight.default #BB #BB
highlight.html #00 #00
highlight.keyword #007700 #007700
highlight.string #DD #DD
html_errors On On
ignore_repeated_errors Off Off
ignore_repeated_source Off Off
ignore_user_abort Off Off
implicit_flush Off Off
include_path .:/usr/share/php .:/usr/share/php
log_errors Off Off
log_errors_max_len 1024 1024
magic_quotes_gpc On On
magic_quotes_runtime Off Off
magic_quotes_sybase Off Off
max_execution_time 30 30
max_input_time 60 60
memory_limit 8M 8M
open_basedir no value no value
output_buffering no value no value
output_handler no value no value
post_max_size 8M 8M
precision 12 12
register_argc_argv On On
register_globals Off Off
report_memleaks On On
safe_mode Off Off
safe_mode_exec_dir no value no value
safe_mode_gid Off Off
safe_mode_include_dir no value no 

Re: [PHP] [SOLUTION] Re: [PHP] Convert an array in an object instance

2004-10-27 Thread Francisco M. Marzoa Alonso
Erm... I've seen there're some aspects to perform... it fails because
the name of the members is changed during conversion to the array. It 
puts the class name using '\0' (0 is a zero, not a caps 'o') character 
as separator before member name in private and an '*' in protected.

It's not an unaffordable issue, because you still can modify array 
values having this in account. For example, if you want to modify the 
$One private member in the array, you cannot do:

$Clone['One']=5;
you should do
$Clone[\0TestClass\0One]=5;
instead.
Anyway I think it should be easily fixed (when I've time to do it, now I 
must work in another thing :-| )

Francisco M. Marzoa Alonso wrote:
Ok, I've write a function that emulates the Perl's bless one. It works 
pretty well.

The idea comes to me when Rob suggest to parse the serialized data. I 
think this is better -or at least faster- than parsing all serialized 
data to modify object values: Just convert the object to an array, 
modify whatever values you want -no matter about member visibility-, 
and then convert the array again in an object.

Note that you should NEVER modify private and protected members 
outside its visibility environment... well, never UNLESS you're 
writting your own serialization routines indeed (that's exactly 
because I need to do it ;-) )

?
function bless ( $Instance, $Class ) {
   $serdata = serialize ( $Instance );
   /* For an array serialized data seems to meant:
array_tag:array_count:{array_elems}
   array_tag is always 'a'
   array_count is the number of elements in the array
   array_elems are the elemens in the array
 For an object seems to meant:
 
object_tag:object_class_name_len:object_class_name:object_count:{object_members} 

   object_tag is always 'O'
   object_class_name_len is the length in chars of 
object_class_name string
   object_class_name is a string with the name of the class
   object_count is the number of object members
   object_members is the object_members itself (exactly equal to 
array_elems)
   */

   list ($array_params, $array_elems) = explode ('{', $serdata, 2);
   list ($array_tag, $array_count) = explode (':', $array_params, 3 );
   $serdata = O:.strlen 
($Class).:\$Class\:$array_count:{.$array_elems;

   $Instance = unserialize ( $serdata );
   return $Instance;
}
class TestClass {
   private $One=1;
   protected $Two=2;
   public $Three=3;
   public function sum() {
   return $this-One+$this-Two+$this-Three;
   }
}
$Obj = new TestClass ();
$Clone = (array) $Obj;
echo As an array:br;
print_r ($Clone);
bless ( $Clone, TestClass );
echo brbrAfter blessing as a TestClass instance:br;
print_r ($Clone);
echo brbrCalling sum method: ;
echo $Clone-sum();
echo brThe array was blessed! miracle!!! ;-)br;
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Problem with Regular expression

2004-10-27 Thread kioto
Hi all.
I have a problem: i want subs any characters from a string but i don't 
have fix the problem.
The string that i want to manipulate is the value from a text field of a 
search engine.
The characters that i want to try substitute is , , +, -, |, ||, or, 
and, not in not case-sensitive mode with .
I have create a  pattern like this:

$str = Sybase and PHP not ASP or JSP  Oracle not Andy | Perl || 
Python + Ruby;
$pattern = 
/(\band\b)|(\bnot\b)|(\bor\b)|(\b\b)|(\b\b)|(\b\.\b)|(\b\+\b)|(\b\|\|\b)|(\b\|\b)/i;
echo $str = preg_replace($pattern, , $str, -1);

But characters like +  don't subs with .
Thanks to all and sorry my bad language
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Validation and session variables

2004-10-27 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



 -Original Message-
 From: Stuart Felenstein [mailto:[EMAIL PROTECTED] 
 Sent: 27 October 2004 00:01
 
 Having some odd behaviour. 
 First , let me mention this is a multi page form using
 session variables. (This might be important)
 
 So I am doing a page by page validation, and have
 tried putting the code before session_start or after. 
 Either way my session variables are getting lost.
 
 Now in order to do my validation on the same page, I
 have set form action to nothing action=
 And upon sucess of happy validation added this code:
 
 if ($_SERVER[REQUEST_METHOD] == POST) {
  $url = success.php;
  Header(Location: $url);
 }
 ?
 
 The page progresses correctly but it seems the
 variables are gone.  
 Sound like it makes sense ? Any suggestions or ideas.

The only circumstance under which I can think this might happen is if the
session id is not being propagated by cookie -- either because they're
blocked in the browser, or because you have them switched off in php.ini.
Even if you have session.use_trans_sid enabled, PHP cannot rewrite URLs in
the header() call, so you have to include the session ID manually.  You
should do this regardless of whether you expect cookies to be enabled, so
that it will work ok even in the unexpected situation of having cookies
turned off.

Fortunately, the standard PHP constant SID is provided for exactly this
purpose, so your header call above should be:

   header(Location: $url?.SID);

Finally, you should note that HTTP requires the Location: URL to be a full
absolute one (i.e. starting http://) -- whilst it's true that all current
mainstream browsers do the expected with a relative URL, it's better
defensive programming to use only absolute URLs (just in case someone
produces a browser that adheres to the standard!).

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services, JG125, James
Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS,
LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Validation and session variables

2004-10-27 Thread Stuart Felenstein
See inline:

--- Ford, Mike [EMAIL PROTECTED] wrote:


 The only circumstance under which I can think this
 might happen is if the
 session id is not being propagated by cookie --
 either because they're
 blocked in the browser, or because you have them
 switched off in php.ini.

They are not switched off in php.ini.  I do have them
semi blocked in the browser, i.e. set to allow for
session

 Even if you have session.use_trans_sid enabled,

It is enabled.

 PHP cannot rewrite URLs in the header() call, so you
 have to include the session ID manually.  
 You should do this regardless of whether you expect
 cookies to be enabled, so that it will work ok even
  in the unexpected situation of having cookies
 turned off.
 
 Fortunately, the standard PHP constant SID is
 provided for exactly this
 purpose, so your header call above should be:
 
header(Location: $url?.SID);

This is all I need to include the SID ?

Thank you 
Stuart

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Validation and session variables

2004-10-27 Thread Marek Kilimajer
Stuart Felenstein wrote:
Yes the session variables are set with $SESSION[''}.
The way it works is the variable gets set on the
follwing pages:
So, example on page 1:
I have this user input field: 
td width=172input name=ListingName type=text
id=ListingName maxlength=20 //td

On the following page (page 2):
$_SESSION['f1a'] = $_POST['ListingName'];
And all the pages follow the same method.  Inputs on
page 2 are $_SESSION[''] = $_POST['']; on page 3.
I did try putting the session_start() at the top of
the page.  Didn't seem to make any difference.
You MUST have session_start() at the beginning of every page that uses 
session, and if you allow session id to be included in urls you MUST 
have session_start() in every page.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Validation and session variables

2004-10-27 Thread Stuart Felenstein
Yes I do have session_start on every page at the top.

Stuart
--- Marek Kilimajer [EMAIL PROTECTED] wrote:

 Stuart Felenstein wrote:
  Yes the session variables are set with
 $SESSION[''}.
  The way it works is the variable gets set on the
  follwing pages:
  
  So, example on page 1:
  I have this user input field: 
  td width=172input name=ListingName
 type=text
  id=ListingName maxlength=20 //td
  
  On the following page (page 2):
  $_SESSION['f1a'] = $_POST['ListingName'];
  
  And all the pages follow the same method.  Inputs
 on
  page 2 are $_SESSION[''] = $_POST['']; on page 3.
  
  I did try putting the session_start() at the top
 of
  the page.  Didn't seem to make any difference.
 
 You MUST have session_start() at the beginning of
 every page that uses 
 session, and if you allow session id to be included
 in urls you MUST 
 have session_start() in every page.
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem with Regular expression

2004-10-27 Thread Francisco M. Marzoa Alonso
Try with \s instead of \b, I meant:
$pattern = 
/(\sand\s)|(\snot\s)|(\sor\s)|(\s\s)|(\s\s)|(\s\.\s)|(\s\+\s)|(\s\|\|\s)|(\s\|\s)/i;

kioto wrote:
Hi all.
I have a problem: i want subs any characters from a string but i don't 
have fix the problem.
The string that i want to manipulate is the value from a text field of 
a search engine.
The characters that i want to try substitute is , , +, -, |, ||, 
or, and, not in not case-sensitive mode with .
I have create a  pattern like this:

$str = Sybase and PHP not ASP or JSP  Oracle not Andy | Perl || 
Python + Ruby;
$pattern = 
/(\band\b)|(\bnot\b)|(\bor\b)|(\b\b)|(\b\b)|(\b\.\b)|(\b\+\b)|(\b\|\|\b)|(\b\|\b)/i; 

echo $str = preg_replace($pattern, , $str, -1);
But characters like +  don't subs with .
Thanks to all and sorry my bad language
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Validation and session variables

2004-10-27 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



 -Original Message-
 From: Stuart Felenstein [mailto:[EMAIL PROTECTED] 
 Sent: 27 October 2004 12:18
 
 --- Ford, Mike [EMAIL PROTECTED] wrote:

 header(Location: $url?.SID);
 
 This is all I need to include the SID ?

Yup.  If PHP thinks cookies are enabled, SID will actually evaluate to a
blank string; otherwise it will contain the sessionname=sessionid pair.

Oh, and it can't hurt to do a session_write_close() just before the
redirect.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services, JG125, James
Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS,
LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] alias a function

2004-10-27 Thread Justin French
On 27/10/2004, at 1:46 PM, Curt Zirzow wrote:
Instead of aliasing, I would deprecate the function, so the old
function would be:
really hoping to alias rather than deprecate, but since it's not too 
easy, I'll just ditch the idea I think :)

Thanks,
Justin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Validation and session variables

2004-10-27 Thread Stuart Felenstein
Okay, I altered the code.  Same thing, session
variables gone.
I then deleted the session only cookie. Also took
the rule out in the browser , so browser is accepting
all cookies from site.
Still no change.

Not to be redundant but here is the code again:(I
xxx'ed out some fields in the restrict access line so
they are not public)

?php
//Connection statement
require_once('Connections/MYSQLWH.php');

//Aditional Functions
require_once('includes/functions.inc.php');

//load the tNG classes
require_once('tNG/KT_tNG.inc.php');

//Start the Session - begin Block
@session_start();


restrictAccessToPage($MYSQLWH,'x','AccessDenied.php','x','SignUpID','Username','password','level',false,array(x));
?
?php
require_once(WA_ValidationToolkit/WAVT_Scripts_PHP.php);
?
?php
require_once(WA_ValidationToolkit/WAVT_ValidatedForm_PHP.php);
?
?php 
if ($_SERVER[REQUEST_METHOD] == POST)  {
  $WAFV_Redirect = ;
  $_SESSION['WAVT_TestMulti2'] = ;
  if ($WAFV_Redirect == )  {
$WAFV_Redirect = $_SERVER[SCRIPT_NAME];
  }
  $WAFV_Errors = ;
  $WAFV_Errors .=
WAValidateRQ(((isset($_POST[LurkerEdu]))?$_POST[LurkerEdu]:)
. ,false,1);
  $WAFV_Errors .=
WAValidateRQ(((isset($_POST[LurkerAuth]))?$_POST[LurkerAuth]:)
. ,false,2);
  $WAFV_Errors .=
WAValidateRQ(((isset($_POST[LurkerExperience]))?$_POST[LurkerExperience]:)
. ,false,3);
  $WAFV_Errors .=
WAValidateRQ(((isset($_POST[LurkerLevel]))?$_POST[LurkerLevel]:)
. ,false,4);

  if ($WAFV_Errors != )  {
   
PostResult($WAFV_Redirect,$WAFV_Errors,TestMulti2);
  }
}
?
?php
if ($_SERVER[REQUEST_METHOD] == POST) {
 $url = TestMulti3.php;
 Header(Location: $url?.SID);
}
?


Stuart

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: Sessions problem bug

2004-10-27 Thread Reinhart Viane
On the server i use:

Session.auto_start is off
Session.use_cookie is on
Session.use_trans_sid is 1

I do not set the session id myself
All pages that requite the sessions have session_start() at the very
first line

-Original Message-
From: Jason Barnett [mailto:[EMAIL PROTECTED] 
Sent: woensdag 27 oktober 2004 11:41
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Sessions problem bug


Are you using cookie-based sessions?  Thus sayeth the manual:

Note:  When using session cookies, specifying an id for session_id()
will always 
send a new cookie when session_start() is called, regardless if the
current 
session id is identical to the one being set.

Thanks google.


Reinhart Viane wrote:
 Some days ago I asked some questions concerning php and sessions
 
 Apparently it seems to be a bug:
 'When you use a session name that has only numbers, each call to 
 session_start seems to regenerate a new session id, so the session 
 does not persist.'
 
 http://bugs.php.net/search.php?search_for=sessionboolean=0limit=10o
 rd

er_by=direction=ASCcmd=displaystatus=Openbug_type%5B%5D=Session+rela
 tedphp_os=phpver=assign=author_email=bug_age=0
 
 And there you pick bug with ID 27688
 
 Just to let everyone know.
 Greetz,
 
 Reinhart Viane
 
 
 
 Reinhart Viane
 [EMAIL PROTECTED] 
 Domos || D-Studio 
 Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01
--
 fax +32 15 43 25 26 
 
 STRICTLY PERSONAL AND CONFIDENTIAL
 This message may contain confidential and proprietary material for the
 sole use of the intended 
 recipient.  Any review or distribution by others is strictly
prohibited.
 If you are not the intended 
 recipient please contact the sender and delete all copies.

-- 
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



[PHP] PHP5 on IBM PowerPC; good combination?

2004-10-27 Thread Aaron Gould
My company is considering the purchase of a fairly nice IBM PowerPC 
system, running SuSe Linux (presumably version 9.2 by the time we get 
it). This will be replacing our aging Compaq as our main server for our 
mission-critical apps.

Does anyone here have experience compiling PHP 5.x on a Linux-based 
PowerPC architecture?  My primary concern is that it actually compiles 
without trouble; all we have here now are x86 systems, so we can't test 
this combination!

--
Aaron Gould
Parts Canada - Web Developer
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] DOM XML/XSL questions

2004-10-27 Thread Dusty Bin
I have a requirement to create an XML file which looks approximately like:
?xml version=1.0 ?
?xml-stylesheet type='text/xsl' href='article.xsl' ?
article
  itemItem Text/item
  ...
/article
The file needs to be formatted.
I built a dom using the Dom extension, creating a document, adding 
nodes, and I got a nicely formatted XML file from $dom-saveXML();

The only problem I had, was that I could see no way to add the 
stylesheet definition to the XML.  I'm not sure that a DOM should know 
anything about stylesheets, but an XML file probably should.

I managed to bypass the problem, by loading the dom from a file, with 
the style sheet and the root element included, and then proceeding to 
build the dom by adding the extra nodes.  This also worked fine, but now 
the output from $dom-saveXML() is no longer formatted.
Here is some sample code:

?php
$txt =EOT
?xml version=1.0?
?xml-stylesheet type='text/xsl' href='../../../article.xsl' ?
Article
xmlns='http://www.example.com/xml'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://www.example.com/test/xml article.xsd'
/Article
EOT;
$dom = new DOMDocument();
$dom-preserveWhiteSpace = FALSE;
$dom-resolveExternals = TRUE;
$dom-loadXML($txt);
$item = $dom-createElement(Item);
$itemText = $dom-createTextNode(Item Text);
$item-appendChild($itemText);
$dom-documentElement-appendChild($item);
$dom-formatOutput = TRUE;
echo $dom-saveXML();
?
My questions are:
1) How should I add a stylesheet to this type of document? (I do not 
need to process the stylesheet in php, it is for the guidance of the end 
user of the document, who may use it or modify it),
and,
2) Is this a (dare I say bug in an experimental extension) that if I 
load the dom, and perform operations on the dom, I lose formatting(A dom 
that is just loaded, or just created by dom operations, is correctly 
formatted, a dom with mixed processes is not).

TIA for any advice...   Dusty
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP5 on IBM PowerPC; good combination?

2004-10-27 Thread Pierre Ancelot

yes, use debian: http://www.debian.org and study the apt system you'll get no 
problem. (php 5 is not in sarge which is what you should use but compiling 
php5 on it gives no problem.) and debian supports very well ppc...



On Wednesday 27 October 2004 15:25, Aaron Gould wrote:
 My company is considering the purchase of a fairly nice IBM PowerPC
 system, running SuSe Linux (presumably version 9.2 by the time we get
 it). This will be replacing our aging Compaq as our main server for our
 mission-critical apps.

 Does anyone here have experience compiling PHP 5.x on a Linux-based
 PowerPC architecture?  My primary concern is that it actually compiles
 without trouble; all we have here now are x86 systems, so we can't test
 this combination!

 --
 Aaron Gould
 Parts Canada - Web Developer

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Newbie again: get no $QUERY_STRING

2004-10-27 Thread Ben Ramsey
Horst Jäger wrote:
I get no $QUERY_STRING (and no GET- or POST-Params).
I'm using PHP 4.3.3 on a SUSE LINUX 9.0 Machine. When I view the 
following page:

[html][head][/head][body]
[?php
echo gettype($QUERY_STRING);
 ?]
[/body][/html]

register_globals Off Off
You have register_globals turned off so $QUERY_STRING won't work. DO NOT 
turn on register_globals. Instead, use $_SERVER['QUERY_STRING'] as a 
replacement for $QUERY_STRING.

Read here for more info: http://www.php.net/variables.predefined
--
Regards,
Ben Ramsey
http://benramsey.com
---
Atlanta PHP - http://www.atlphp.org/
The Southeast's premier PHP community.
---
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] file upload

2004-10-27 Thread raditha dissanayake
Akshay wrote:
I've been trying to come up with an algorithm that will allow me to 
upload  all the files in a folder.

The scheme I have in mind is to use a feedback form that will let me 
pick  out a target folder on my local machine. Upon submitting the 
form, I'd  like the script to upload all the files in that folder into 
a  predetermined folder on the host machine. Its easy with a single 
file, but  I've run into a conundrum of sorts for a complete folder. 
Is there any way  to pass the source path as a parameter in PHP, and 
have PHP upload all the  files in that path?
The answer is no you cannot because. PHP does not have access to the 
remote machine, because PHP runs on the server. The only way to do this 
is with an activex or with a java applet (SHAMLESS PLUG: such as rad 
upload).


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP5 on IBM PowerPC; good combination?

2004-10-27 Thread Brent Clements
Just so we are all clear. It doesn't matter which linux distribution you use
as long as the distribution supports the ppc architecture which most do. As
long as you have the gnu compiler suite and all associated tools and
libraries, php will compile fine.

It will also compile using the ibm compilers but it  takes a bit of
wrangling to get it to compile.

-Brent
- Original Message - 
From: Pierre Ancelot [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, October 27, 2004 8:09 AM
Subject: Re: [PHP] PHP5 on IBM PowerPC; good combination?



 yes, use debian: http://www.debian.org and study the apt system you'll get
no
 problem. (php 5 is not in sarge which is what you should use but
compiling
 php5 on it gives no problem.) and debian supports very well ppc...



 On Wednesday 27 October 2004 15:25, Aaron Gould wrote:
  My company is considering the purchase of a fairly nice IBM PowerPC
  system, running SuSe Linux (presumably version 9.2 by the time we get
  it). This will be replacing our aging Compaq as our main server for our
  mission-critical apps.
 
  Does anyone here have experience compiling PHP 5.x on a Linux-based
  PowerPC architecture?  My primary concern is that it actually compiles
  without trouble; all we have here now are x86 systems, so we can't test
  this combination!
 
  --
  Aaron Gould
  Parts Canada - Web Developer

 -- 
 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] Validation and session variables

2004-10-27 Thread Chris Shiflett
--- Stuart Felenstein [EMAIL PROTECTED] wrote:
 Having some odd behaviour. 
 First , let me mention this is a multi page form using
 session variables. (This might be important)
 
 So I am doing a page by page validation, and have
 tried putting the code before session_start or after. 
 Either way my session variables are getting lost.
 
 Now in order to do my validation on the same page, I
 have set form action to nothing action=
 And upon sucess of happy validation added this code:
 
 if ($_SERVER[REQUEST_METHOD] == POST) {
  $url = success.php;
  Header(Location: $url);
 }
 ?
 
 The page progresses correctly but it seems the
 variables are gone.

This is most likely due to your malformed Location header. It requires an
absolute URL, and some browsers (notably several versions of IE, but there
may be others) do not send the proper Cookie header when requesting the
new URL if you use a relative one.

So, the first thing to try is using a proper Location header:

header('Location: http://example.org/success.php');

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming December 2004http://httphandbook.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP5 on IBM PowerPC; good combination?

2004-10-27 Thread Pierre Ancelot

Yes and welcome troubles with rpm when you use suse or redhat... that's why i 
preconise debian, not have troubles this wise, when you need a lib


On Wednesday 27 October 2004 15:15, Brent Clements wrote:
 Just so we are all clear. It doesn't matter which linux distribution you
 use as long as the distribution supports the ppc architecture which most
 do. As long as you have the gnu compiler suite and all associated tools and
 libraries, php will compile fine.

 It will also compile using the ibm compilers but it  takes a bit of
 wrangling to get it to compile.

 -Brent
 - Original Message -
 From: Pierre Ancelot [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, October 27, 2004 8:09 AM
 Subject: Re: [PHP] PHP5 on IBM PowerPC; good combination?

  yes, use debian: http://www.debian.org and study the apt system you'll
  get

 no

  problem. (php 5 is not in sarge which is what you should use but

 compiling

  php5 on it gives no problem.) and debian supports very well ppc...
 
  On Wednesday 27 October 2004 15:25, Aaron Gould wrote:
   My company is considering the purchase of a fairly nice IBM PowerPC
   system, running SuSe Linux (presumably version 9.2 by the time we get
   it). This will be replacing our aging Compaq as our main server for our
   mission-critical apps.
  
   Does anyone here have experience compiling PHP 5.x on a Linux-based
   PowerPC architecture?  My primary concern is that it actually compiles
   without trouble; all we have here now are x86 systems, so we can't test
   this combination!
  
   --
   Aaron Gould
   Parts Canada - Web Developer
 
  --
  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] PHP5 on IBM PowerPC; good combination?

2004-10-27 Thread Aaron Gould
Brent Clements wrote:
Just so we are all clear. It doesn't matter which linux
distribution you use as long as the distribution supports the
ppc architecture which most do. As long as you have the gnu
compiler suite and all associated tools and libraries, php will
compile fine.
That makes sense; I had a suspicion this might be the case. I have no 
experience with SUSE (just RedHat and Gentoo), but I'd imagine it has 
all the requisite GNU compilation tools.

From: Pierre Ancelot [EMAIL PROTECTED]

yes, use debian: http://www.debian.org and study the apt system
you'll get no problem. (php 5 is not in sarge which is what
you should use but compiling php5 on it gives no problem.) and
debian supports very well ppc...
Unfortunately we're stuck with SUSE (pre-installed with the IBM 
OpenPower series servers). My company wants to stick with it. I won't 
complain too much though; as long as it's linux, I'm ok.

--
Aaron Gould
Parts Canada - Web Developer
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP5 on IBM PowerPC; good combination?

2004-10-27 Thread Brent Clements
This has nothing to do with packaging systems or your choice of
distribution. His question was if it compiled on a linux-based ppc
architecture.

I answered his question. You told him to use a specific distribution with a
specific packaging system. That was not his question.

-Brent


- Original Message - 
From: Pierre Ancelot [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, October 27, 2004 8:40 AM
Subject: Re: [PHP] PHP5 on IBM PowerPC; good combination?



 Yes and welcome troubles with rpm when you use suse or redhat... that's
why i
 preconise debian, not have troubles this wise, when you need a lib


 On Wednesday 27 October 2004 15:15, Brent Clements wrote:
  Just so we are all clear. It doesn't matter which linux distribution you
  use as long as the distribution supports the ppc architecture which most
  do. As long as you have the gnu compiler suite and all associated tools
and
  libraries, php will compile fine.
 
  It will also compile using the ibm compilers but it  takes a bit of
  wrangling to get it to compile.
 
  -Brent
  - Original Message -
  From: Pierre Ancelot [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Wednesday, October 27, 2004 8:09 AM
  Subject: Re: [PHP] PHP5 on IBM PowerPC; good combination?
 
   yes, use debian: http://www.debian.org and study the apt system you'll
   get
 
  no
 
   problem. (php 5 is not in sarge which is what you should use but
 
  compiling
 
   php5 on it gives no problem.) and debian supports very well ppc...
  
   On Wednesday 27 October 2004 15:25, Aaron Gould wrote:
My company is considering the purchase of a fairly nice IBM PowerPC
system, running SuSe Linux (presumably version 9.2 by the time we
get
it). This will be replacing our aging Compaq as our main server for
our
mission-critical apps.
   
Does anyone here have experience compiling PHP 5.x on a Linux-based
PowerPC architecture?  My primary concern is that it actually
compiles
without trouble; all we have here now are x86 systems, so we can't
test
this combination!
   
--
Aaron Gould
Parts Canada - Web Developer
  
   --
   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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Validation and session variables

2004-10-27 Thread Stuart Felenstein

--- Chris Shiflett [EMAIL PROTECTED] wrote:
 So, the first thing to try is using a proper
 Location header:
 
 header('Location: http://example.org/success.php');
 
 Hope that helps.
 
 Chris
 
Thank Chris , but met with same behaviour.
2 Questions:
1- Should I drop the $url line ? I tried both ways ,
no change though.
2- Do I still need to call the SID ?

?php
if ($_SERVER[REQUEST_METHOD] == POST) {
 $url = nextpage.php;
Header ('Location:
http://www.mysite.com/nextpage.php);

}
?

Stuart

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem with Regular expression

2004-10-27 Thread Tom Rogers
Hi,

Wednesday, October 27, 2004, 9:04:14 PM, you wrote:
k Hi all.
k I have a problem: i want subs any characters from a string but i don't 
k have fix the problem.
k The string that i want to manipulate is the value from a text field of a 
k search engine.
k The characters that i want to try substitute is , , +, -, |, ||, or, 
k and, not in not case-sensitive mode with .
k I have create a  pattern like this:

k $str = Sybase and PHP not ASP or JSP  Oracle not Andy | Perl || 
k Python + Ruby;
k $pattern = 
k 
/(\band\b)|(\bnot\b)|(\bor\b)|(\b\b)|(\b\b)|(\b\.\b)|(\b\+\b)|(\b\|\|\b)|(\b\|\b)/i;
k echo $str = preg_replace($pattern, , $str, -1);

k But characters like +  don't subs with .
k Thanks to all and sorry my bad language


this may get you started

preg_replace('!\s(and|not|or||\||\|\||)\s|(\+|-\s*)!i',' ',$string);

you have to replace with ' ' or the words will run into each other and you may
also get the + or - with no trailing space.


-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Validation and session variables

2004-10-27 Thread Philip Thompson
Stuart,
On Oct 27, 2004, at 6:57 AM, Stuart Felenstein wrote:
Not to be redundant but here is the code again:(I
xxx'ed out some fields in the restrict access line so
they are not public)
?php
Put session_start() here!
//Connection statement
require_once('Connections/MYSQLWH.php');
//Aditional Functions
require_once('includes/functions.inc.php');
//load the tNG classes
require_once('tNG/KT_tNG.inc.php');
//Start the Session - begin Block
@session_start();
You should move your session_start() to the VERY top. =D
Just see if that makes any difference. You might also make sure there 
is a session_id:

if (session_id())
// do stuff
else
// throw computer out the window
Have fun!
~Philip
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] bless function

2004-10-27 Thread Francisco M. Marzoa Alonso
Ok, I think I've got it now. The code is autoexplicative, the only 
restriction is that the object must be converted to an array using the 
function obj2array instead of a direct cast. There's another ways to do 
this without the needless of that obj2array function, but I think this 
is not really a limitation.

Here it is:
?
function obj2array ( $Instance ) {
   $clone = (array) $Instance;
   $rtn = $clone;
   while ( list ($key, $value) = each ($clone) ) {
   $aux = explode (\0, $key);
   $newkey = $aux[count($aux)-1];
   if ( $newkey != $key ) {
   $rtn[$newkey] = $rtn[$key];
   $rtn['___FAKE_KEYS_'][] = $newkey;
   }
   }
   return $rtn;
}

function bless ( $Instance, $Class ) {
   if ( ! (is_array ($Instance) ) ) {
   return NULL;
   }
   // First drop faked keys if available
   foreach ( $Instance['___FAKE_KEYS_'] as $fake_key ) {
   unset ($Instance[$fake_key]);
   }
   unset ( $Instance['___FAKE_KEYS_'] );
   // Get serialization data from array
   $serdata = serialize ( $Instance );
   /* For an array serialized data seems to meant:
array_tag:array_count:{array_elems}
   array_tag is always 'a'
   array_count is the number of elements in the array
   array_elems are the elemens in the array
 For an object seems to meant:
 
object_tag:object_class_name_len:object_class_name:object_count:{object_members}

   object_tag is always 'O'
   object_class_name_len is the length in chars of 
object_class_name string
   object_class_name is a string with the name of the class
   object_count is the number of object members
   object_members is the object_members itself (exactly equal to 
array_elems)
   */

   list ($array_params, $array_elems) = explode ('{', $serdata, 2);
   list ($array_tag, $array_count) = explode (':', $array_params, 3 );
   $serdata = O:.strlen 
($Class).:\$Class\:$array_count:{.$array_elems;

   $Instance = unserialize ( $serdata );
   return $Instance;
}
class TestClass {
   private $One=1;
   protected $Two=2;
   public $Three=3;
   public function sum() {
   return $this-One+$this-Two+$this-Three;
   }
}
$Obj = new TestClass ();
//$Clone = (array) $Obj;
$Clone = obj2array ( $Obj );
echo As the original object:br;
print_r ($Obj);
echo brbrAs an array:br;
print_r ($Clone);
$Clone[One]=7;
$Clone[Two]=7;
$Clone[Three]=7;
bless ( $Clone, TestClass );
echo brbrAfter blessing as a TestClass instance:br;
print_r ($Clone);
echo brbrCalling sum method: ;
echo $Clone-sum();
echo brThe array was blessed! miracle!!! ;-)br;
?
Hope someone appart from me find it useful. :-)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Validation and session variables

2004-10-27 Thread Jason Wong
On Wednesday 27 October 2004 11:31, Stuart Felenstein wrote:

Please do not top post.

 Yes I do have session_start on every page at the top.

As I have pointed out in a previous thread and Mike has pointed out in this 
thread you MUST use

  session_write_close()

before you do a redirect.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Please come home with me ... I have Tylenol!!
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Trying to Integrate PHP 4.3.4 w/ JDK 1.5.0

2004-10-27 Thread Andrew Hauger
Still having trouble with this. I have tried to
compile the standard java extension in ext/java, and
I have tried to compile php-java-bridge v1.0.5.

The 'phpize' script fails for the standard java
extension with the following messages:

  Can't locate object method path via package
Request at
/usr/local/share/autoconf/Autom4te/C4che.pm line 69,
GEN1 line 94.
  aclocal: autom4te failed with exit status: 1

The 'phpize' and 'configure' scripts complete
successfully for php-java-bridge, and then 'make'
fails with the following messages:

 
/opt/php/php-4.3.9/php-java-bridge_1.0.5/server/natcJavaBridge.c:202:
too many arguments to function `sigwait'
  make: *** [server/natcJavaBridge.lo] Error 1

I back-revved from PHP 4.3.10-dev to PHP 4.3.9, and I
upgraded the supporting tools as follows:

m4: 1.4.2
autoconf: 2.59
automake: 1.9
libtool: 1.5

As a reminder, I am running Solaris 9 for Sparc.

Any help would be appreciated.

--- Andrew Hauger [EMAIL PROTECTED] wrote:

 Thanks Raditha. Unfortunately, I am still having
 problems. I am new to building extensions, and now
 my
 problem is an error during the java extension build
 process.
 
 I got the message :
 
 configure.in:65: error: possibly undefined macro:
 AC_PROG_LIBTOOL
 
 when I ran phpize in the ext/java directory. I'm not
 sure at this point how I managed to build the
 extension the first time, because now I can't build
 it.
 
 I researched this message, and I found bug report
 #16552. I followed the instructions in the bug
 report
 that said the fix was to download the latest
 snapshot,
 but no luck. I am still getting the error.
 
 Here's my configuration:
 
 OS: Solaris 9 on Sparc
 PHP: 4.3.10-dev (as of this morning, was 4.3.4)
 automake: 1.62
 autoconf: 2.53
 
 Again, I would appreciate any useful suggestions.
 
 --- raditha dissanayake [EMAIL PROTECTED] wrote:
 
  Andrew Hauger wrote:
  
  Everything compiled okay, and I think everything
 is
  installed in the right places. When I try to run
 a
  test program, I get the error:
  
  [error] PHP Fatal error: 
  java.lang.UnsatisfiedLinkError: no php_java in
  java.library.path in
  /usr/local/apache/htdocs/java_test2.php on line 5
  
  The file php_java.jar is in that directory!

  
  And what is that directory? :-)
  
  here is what worked for me
  http://www.raditha.com/php/java.php  i 
  originally wrote it for version 1.4.2 but use thed
  same settings with 1.5.0
  
  

  
  
  
  -- 
  Raditha Dissanayake.
 


  http://www.radinks.com/sftp/ |
  http://www.raditha.com/megaupload
  Lean and mean Secure FTP applet with | Mega Upload
 -
  PHP file uploader
  Graphical User Inteface. Just 128 KB | with
 progress
  bar.
  
  -- 
  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] Validation and session variables

2004-10-27 Thread Stuart Felenstein
Okay, first, sorry, but what is top post? Writing
before the reply or after ?

Second, I'm not entirely sure where the
session_write_close() belongs, because here below,
isn't this a redirect? back to page2 if there are
validation errors:

  if ($WAFV_Errors != )  {
PostResult($WAFV_Redirect,$WAFV_Errors,page2);


or is it solely in:

session_write_close()
if ($_SERVER[REQUEST_METHOD] == POST) {
 $url = TestMulti3.php;
Header ('Location: http://www.mysite.com/page3.php);

Thank you ,
Stuart

--- Jason Wong [EMAIL PROTECTED] wrote:

 On Wednesday 27 October 2004 11:31, Stuart
 Felenstein wrote:
 
 Please do not top post.
 
  Yes I do have session_start on every page at the
 top.
 
 As I have pointed out in a previous thread and Mike
 has pointed out in this 
 thread you MUST use
 
   session_write_close()
 
 before you do a redirect.
 
 -- 
 Jason Wong - Gremlins Associates -
 www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet
 Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 Please come home with me ... I have Tylenol!!
 */
 
 -- 
 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] Validation and session variables

2004-10-27 Thread Chris Shiflett
--- Jason Wong [EMAIL PROTECTED] wrote:
 As I have pointed out in a previous thread and Mike has pointed
 out in this thread you MUST use
 
   session_write_close()
 
 before you do a redirect.

Are you certain? If this is true, it is a bug in PHP, and we should fix
it.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming December 2004http://httphandbook.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Validation and session variables

2004-10-27 Thread Chris Shiflett
--- Stuart Felenstein [EMAIL PROTECTED] wrote:
 Thank Chris , but met with same behaviour.

Well, it was certainly a problem, so at least it's one less thing to worry
about. :-)

 2 Questions:
 1- Should I drop the $url line ? I tried both ways ,
 no change though.

It doesn't matter. Your method was fine, but $url needs to be an absolute
one (http://example.org/path/to/script.php).

 2- Do I still need to call the SID ?

This was a separate suggestion given by someone else, the idea being that
perhaps the browser is not sending the cookie. This is a good suggestion,
because most of these lost session problems are a result of the browser
not identifying itself (by sending the session identifier by some means).
The causes of this problem range, but this is the first thing to check.

On each page, it might be good to add some debugging information near the
top (where session_start() is):

?php
session_start();
echo 'pre' . htmlentities(print_r($_COOKIE, true)) . '/pre';
echo 'pre' . htmlentities(print_r($_GET, true)) . '/pre';
echo session_id();
...

What you may notice is a lack of a session identifier in the $_COOKIE
superglobal or $_GET superglobal and/or the session identifier (from the
session_id() call) changing for every page.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming December 2004http://httphandbook.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] urlencode and google search query

2004-10-27 Thread Joel CARNAT
Hi,

I have a submit form from where I can search things to several sites
(google, freshmeat, ...). I use PHP4/urlencode to generate the correct
query. But it seems google does not use the right encoding :(

example - query=programme télé:

$engine = $_POST[engine];
$query = urlencode($_POST[query]);
switch($engine) {
case google:
echo htmlmeta http-equiv=\refresh\ 
content=\0;url=http://www.google.fr/search?q=$query\;/html;
break;
case freshmeat:
echo htmlmeta http-equiv=\refresh\ 
content=\0;url=http://freshmeat.net/search/?q=$query\;/html;
break;
}


when I use my code, the final URL is:
http://www.google.fr/search?q=programme+t%E9l%E9
when I search programme télé straight from google's page, the URL is:

http://www.google.fr/search?num=20hl=frq=programme+t%C3%A9l%C3%A9btnG=Recherchermeta=
i also tried (by hand):
http://www.google.fr/search?q=programme+t%C3%A9l%C3%A9
which is working.
how comes urlencode generates %E9 and google generates %C3%A9 ?
is google using some specific encoding ? any tweak to encode the google way ?

TIA,
Jo

PS: I'm running OpenBSD/sparc64 with Apache 1 and PHP 4 (if it matters)

-- 
,-- This mail runs -.
` NetBSD/i386 --'

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Validation and session variables

2004-10-27 Thread Chris Shiflett
--- Stuart Felenstein [EMAIL PROTECTED] wrote:
 Okay, first, sorry, but what is top post? Writing
 before the reply or after?

Top posting is writing your reply above what you are replying to. It's
really not worth discussing the advantages of bottom posting, but I will
say that trimming your posts makes people not mind so much. :-)

For example, you were really only replying to two things Jason said.

This:

 Please do not top post.

and this:

 As I have pointed out in a previous thread and Mike
 has pointed out in this thread you MUST use

 session_write_close()
 
 before you do a redirect.

Everything else in the email just gets in the way and makes it harder to
follow. That's all.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming December 2004http://httphandbook.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP + Javascript, immediate database update

2004-10-27 Thread Steve McGill
Hi everyone,

I have a webform which my users are expecting to act like a Windows program,
they only need to check the box and it is automatically written to the
database.

So I'd like to use a combination of javascript, like this, but it isn't
quite elegent enough:

- Tick the box.
- Javascript opens up a popup window, SQL query is made, popup window closes
again

Or a second method:

- Register an onexit() function, and auto-submit the form.

The only problem there is to remember to redirect them to their intended
destination, after having submitted the form. (i.e. they pressed back,
forward, or entered in another URL).

Can anybody point me in the right direction?

Many thanks,
Steve

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] DOM XML/XSL questions

2004-10-27 Thread Christian Stocker
On Wed, 27 Oct 2004 13:52:13 +0100, Dusty Bin [EMAIL PROTECTED] wrote:
 I have a requirement to create an XML file which looks approximately like:
 
 ?xml version=1.0 ?
 ?xml-stylesheet type='text/xsl' href='article.xsl' ?
 article
itemItem Text/item
...
 /article
 
 The file needs to be formatted.
 
 I built a dom using the Dom extension, creating a document, adding
 nodes, and I got a nicely formatted XML file from $dom-saveXML();
 
 The only problem I had, was that I could see no way to add the
 stylesheet definition to the XML.  I'm not sure that a DOM should know
 anything about stylesheets, but an XML file probably should.
 
 I managed to bypass the problem, by loading the dom from a file, with
 the style sheet and the root element included, and then proceeding to
 build the dom by adding the extra nodes.  This also worked fine, but now
 the output from $dom-saveXML() is no longer formatted.
 Here is some sample code:
 
 ?php
 $txt =EOT
 ?xml version=1.0?
 ?xml-stylesheet type='text/xsl' href='../../../article.xsl' ?
 Article
 xmlns='http://www.example.com/xml'
 xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
 xsi:schemaLocation='http://www.example.com/test/xml article.xsd'
 /Article
 EOT;
 
 $dom = new DOMDocument();
 $dom-preserveWhiteSpace = FALSE;
 $dom-resolveExternals = TRUE;
 $dom-loadXML($txt);
 
 $item = $dom-createElement(Item);
 $itemText = $dom-createTextNode(Item Text);
 $item-appendChild($itemText);
 $dom-documentElement-appendChild($item);
 
 $dom-formatOutput = TRUE;
 
 echo $dom-saveXML();
 ?
 
 My questions are:
 1) How should I add a stylesheet to this type of document? (I do not
 need to process the stylesheet in php, it is for the guidance of the end
 user of the document, who may use it or modify it),
 and,

Use $dom-createProcessingInstruction($target, $data) ;
and then append this to the document.
that could maybe work
see
http://ch.php.net/manual/en/function.dom-domdocument-createprocessinginstruction.php
for more details.


 2) Is this a (dare I say bug in an experimental extension) that if I
 load the dom, and perform operations on the dom, I lose formatting(A dom
 that is just loaded, or just created by dom operations, is correctly
 formatted, a dom with mixed processes is not).

The extension is not experimental anymore ;)
And the formatting is not lost. you didn't provide any ;) The DOM
Extension doesn't make any assumptions about the formatting of your
XML document (or correctly said, it doesn't insert whitespace
automagically ) but you can try to set the property formatOutput
just before saveXML:

$doc-formatOutput = true;

Never tested, but should work

chregu

 TIA for any advice...   Dusty
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
phone +41 1 240 56 70 | mobile +41 76 561 88 60  | fax +41 1 240 56 71
http://www.bitflux.ch  |  [EMAIL PROTECTED]  |  gnupg-keyid 0x5CE1DECB

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP + Javascript, immediate database update

2004-10-27 Thread Matt M.
 I have a webform which my users are expecting to act like a Windows program,
 they only need to check the box and it is automatically written to the
 database.

you could try this
http://developer.apple.com/internet/webcontent/iframe.html

or this

http://jibbering.com/2002/4/httprequest.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] bless function: a better aproach

2004-10-27 Thread Francisco M. Marzoa Alonso
Giving it a round, this seems to be a better aproach than the previous 
one. It has the advantage of provide direct access to the original array 
obtained from casting without boring about ___FAKE_KEYS_.

?
function obj2array ( $Instance ) {
   $clone = (array) $Instance;
   $rtn = array ();
   $rtn['___SOURCE_KEYS_'] = $clone;
   while ( list ($key, $value) = each ($clone) ) {
   $aux = explode (\0, $key);
   $newkey = $aux[count($aux)-1];
   $rtn[$newkey] = $rtn['___SOURCE_KEYS_'][$key];
   }
   return $rtn;
}
function bless ( $Instance, $Class ) {
   if ( ! (is_array ($Instance) ) ) {
   return NULL;
   }
   // First get source keys if available
   if ( isset ($Instance['___SOURCE_KEYS_'])) {
   $Instance = $Instance['___SOURCE_KEYS_'];
   }
   // Get serialization data from array
   $serdata = serialize ( $Instance );
   /* For an array serialized data seems to meant:
array_tag:array_count:{array_elems}
   array_tag is always 'a'
   array_count is the number of elements in the array
   array_elems are the elemens in the array
 For an object seems to meant:
 
object_tag:object_class_name_len:object_class_name:object_count:{object_members}

   object_tag is always 'O'
   object_class_name_len is the length in chars of 
object_class_name string
   object_class_name is a string with the name of the class
   object_count is the number of object members
   object_members is the object_members itself (exactly equal to 
array_elems)
   */

   list ($array_params, $array_elems) = explode ('{', $serdata, 2);
   list ($array_tag, $array_count) = explode (':', $array_params, 3 );
   $serdata = O:.strlen 
($Class).:\$Class\:$array_count:{.$array_elems;

   $Instance = unserialize ( $serdata );
   return $Instance;
}
class TestClass {
   private $One=1;
   protected $Two=2;
   public $Three=3;
   public function sum() {
   return $this-One+$this-Two+$this-Three;
   }
}
$Obj = new TestClass ();
//$Clone = (array) $Obj;
$Clone = obj2array ( $Obj );
echo As the original object:br;
print_r ($Obj);
echo brbrAs an array:br;
print_r ($Clone);
$Clone[One]=7;
$Clone[Two]=7;
$Clone[Three]=7;
bless ( $Clone, TestClass );
echo brbrAfter blessing as a TestClass instance:br;
print_r ($Clone);
echo brbrCalling sum method: ;
echo $Clone-sum();
echo brThe array was blessed! miracle!!! ;-)br;
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Validation and session variables

2004-10-27 Thread Jason Wong
On Wednesday 27 October 2004 14:36, Chris Shiflett wrote:
 --- Jason Wong [EMAIL PROTECTED] wrote:
  As I have pointed out in a previous thread and Mike has pointed
  out in this thread you MUST use
 
session_write_close()
 
  before you do a redirect.

 Are you certain? If this is true, it is a bug in PHP, and we should fix
 it.

OK I just did a quick test using PHP 4.3.8 and you do NOT have to close 
session before redirect. But IIRC this was an issue with older versions of 
PHP so this probably got fixed somewhere along the line. 

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Udall's Fourth Law:
 Any change or reform you make is going to have consequences you
 don't like.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Validation and session variables

2004-10-27 Thread Greg Donald
On Wed, 27 Oct 2004 07:51:48 -0700 (PDT), Chris Shiflett
[EMAIL PROTECTED] wrote:
 It's
 really not worth discussing the advantages of bottom posting, but I will
 say that trimming your posts makes people not mind so much. :-)

I love discussing the advantages of documented standards, and 'known
best practices' of doing things Chris.. whatever do you mean 'not
worth discussing' ?  :)

Bottom posting gives context.. first you read the question, then you
read the answer.  It's very helpful to those of us who read top to
bottom and left to right.

But yeah, trimming posts goes a long way towards consideration. 
Nothing's worse than scrolling two or three pages to read a one line
response.

And most of all..  if you participate in a list serv like php-general,
please use a 'threaded' mail client.  The list serv messages contain a
unique message id and thread capable mail clients will thread them for
you based on that message id.  This somewhat prevents multiple
(correct) answers to the same questions over and over throughout the
day.  And don't forget to turn threading 'on' in your mail client. 
Like in Pine for example, you _have_ to turn it on before it begins to
work.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Validation and session variables

2004-10-27 Thread Stuart Felenstein

--- Chris Shiflett [EMAIL PROTECTED] wrote:

 On each page, it might be good to add some debugging
 information near the
 top (where session_start() is):
 
 ?php
 session_start();
 echo 'pre' . htmlentities(print_r($_COOKIE, true))
 . '/pre';
 echo 'pre' . htmlentities(print_r($_GET, true)) .
 '/pre';
 echo session_id();
 ...
 
I added this in , on top, right under session_start()
as shown and get this error:

Warning: Cannot modify header information - headers
already sent by (output started at
/home/lurkkcom/public_html/page1.php:6) in
/home/lurkkcom/public_html/page1.php on line 54

So it's clashing with the redirect:

Header ('Location:
http://www.mysite.com/page2.php?'.SID);

Stuart

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] output htmkl file as text

2004-10-27 Thread Jerry Swanson
I want to output html file on the screen like text not like html file. 
I want a program to read html file and output source code to the screen.

Any ideas how to fake browser, so browser will print html tags on the screen?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP Command Line Scripts 'Aborting' at end ...

2004-10-27 Thread Marc G. Fournier
Note that the following is based on php installed via the FreeBSD ports 
system ...

I have a really simple PHP script that, when you run it, generates an 
Abort at the end of it:

ams# /tmp/test.php
testAbort (core dumped)
ams# cat /tmp/test.php
#!/usr/local/bin/php
?php
echo test;
?
Even if I change the script slightly, so that last line isn't being run 
via php, it does the same:

ams# cat /tmp/test.php
#!/usr/local/bin/php
?php
echo test;
?
test
ams# /tmp/test.php
test
test
Abort (core dumped)
I'm getting a core file, but if I try:
gdb /usr/local/bin/php php.core ... its definitely not looking good:
s# gdb /usr/local/bin/php php.core
GNU gdb 4.18 (FreeBSD)
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type show copying to see the conditions.
There is absolutely no warranty for GDB.  Type show warranty for details.
This GDB was configured as i386-unknown-freebsd...Deprecated bfd_read called at 
/usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb/gdb/dbxread.c line 2627 in 
elfstab_build_psymtabs
Deprecated bfd_read called at 
/usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb/gdb/dbxread.c line 933 in 
fill_symbuf
Core was generated by `php'.
Program terminated with signal 6, Abort trap.
Reading symbols from /usr/lib/libcrypt.so.2...done.
Reading symbols from /usr/lib/libm.so.2...done.
Reading symbols from /usr/lib/libc.so.4...done.
Reading symbols from /usr/local/lib/php/20020429/interbase.so...done.
Reading symbols from /usr/local/firebird/lib/libfbembed.so.1...Deprecated bfd_read 
called at /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb/gdb/dwarf2read.c 
line 3049 in dwarf2_read_section
Error while reading shared library symbols:
Dwarf Error: Cannot handle DW_FORM_strp in DWARF reader.
Reading symbols from /usr/lib/libncurses.so.5...done.
Error while reading shared library symbols:
ì: No such file or directory.
Error while reading shared library symbols:
ynamic: No such file or directory.
Segmentation fault (core dumped)
mod_php4 appears to work fine, just the command line version seems to be 
off ... and its running, producing expected output, its just that last 
'Abort' that tends to screw things up a bit ...

Not sure how to debug ... help?
Thanks ...

Marc G. Fournier   Hub.Org Networking Services (http://www.hub.org)
Email: [EMAIL PROTECTED]   Yahoo!: yscrappy  ICQ: 7615664
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] output htmkl file as text

2004-10-27 Thread John Nichel
Jerry Swanson wrote:
I want to output html file on the screen like text not like html file. 
I want a program to read html file and output source code to the screen.

Any ideas how to fake browser, so browser will print html tags on the screen?
ASCII
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Validation and session variables

2004-10-27 Thread Stuart Felenstein

--- Chris Shiflett [EMAIL PROTECTED] wrote:
 This is most likely due to your malformed Location
 header. It requires an
 absolute URL, and some browsers (notably several
 versions of IE, but there
 may be others) do not send the proper Cookie header
 when requesting the
 new URL if you use a relative one.
 
 So, the first thing to try is using a proper
 Location header:
 
 header('Location: http://example.org/success.php');
 

I'm ready for the fork in the eye now ! ;)

Moved session_start() to way on top.

Placed the following in the redirect area:

?php
if ($_SERVER[REQUEST_METHOD] == POST) {
Header ('Location:
http://www.mysite.com/page2.php?'.SID);
}
?
Following Jason's last post, based on my server using
4.3.8 I did not include the session_write_close()

This is defintely a tough one!

Stuart

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Command Line Scripts 'Aborting' at end ...

2004-10-27 Thread Greg Donald
On Wed, 27 Oct 2004 13:44:54 -0300 (ADT), Marc G. Fournier
[EMAIL PROTECTED] wrote:
 
 Not sure how to debug ... help?

You said you installed in via ports, so did you happen to check the
'debug' option when you installed it?

[ ] DEBUG Enable debug

Just a question.. as that might help explain more what's going on.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] output htmkl file as text

2004-10-27 Thread Greg Donald
On Wed, 27 Oct 2004 13:41:20 -0400, Jerry Swanson [EMAIL PROTECTED] wrote:
 I want to output html file on the screen like text not like html file.
 I want a program to read html file and output source code to the screen.
 
 Any ideas how to fake browser, so browser will print html tags on the screen?

You need to send the Content-Type header for text instead of html.

php.net/header


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] DOM XML/XSL questions

2004-10-27 Thread Dusty Bin
Christian Stocker wrote:
snip
/snip
Use $dom-createProcessingInstruction($target, $data) ;
and then append this to the document.
that could maybe work
see
http://ch.php.net/manual/en/function.dom-domdocument-createprocessinginstruction.php
for more details.
Thank you Christian, the following code worked fine.
(From within the DOM object)
$this-preserveWhiteSpace = false;
$this-resolveExternals = true;
$styleSheet = $this-createProcessingInstruction(xml-stylesheet, 
type='text/xsl' href='../../../course.xsl');
$this-appendChild($styleSheet);
$this-createRoot();
$this-formatOutput = TRUE;
snip
/snip
And the formatting is not lost. you didn't provide any ;) The DOM
Extension doesn't make any assumptions about the formatting of your
XML document (or correctly said, it doesn't insert whitespace
automagically ) but you can try to set the property formatOutput
just before saveXML:
$doc-formatOutput = true;
Never tested, but should work
I already had formatOutput = true; in the sample code.  Of course when I 
am loading the DOM from a string, I am providing the formatting, which 
DOM is honouring but when I am creating the DOM completely from php, you 
are right, I am providing no formatting.  In this case, the formatOutput 
works as I would have expected, (default??)formatted output when true, 
and not formatted when false.  It would seem that if you provide some 
formatting, DOM expects you to provide it all.  When I have finished 
this current assignment, I'll try to follow the calls through from PHP 
to libxml2, and see if I can find something more.

Once again, thanks for your help...   Dusty
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP Command Line Scripts 'Aborting' at end ...

2004-10-27 Thread Greg Donald
On Wed, 27 Oct 2004 13:44:54 -0300 (ADT), Marc G. Fournier
[EMAIL PROTECTED] wrote:
 
 I have a really simple PHP script that, when you run it, generates an
 Abort at the end of it:
 
 ams# /tmp/test.php
 testAbort (core dumped)

I just installed php4-cgi on a FreeBSD 4.10 system I have.  The same
test.php script runs fine for me.

 cat test.php
#!/usr/local/bin/php
?php
echo test;
?

 ./test.php
Content-type: text/html
X-Powered-By: PHP/4.3.9

test


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Validation and session variables

2004-10-27 Thread Graham Cossey

 --- Chris Shiflett [EMAIL PROTECTED] wrote:

  On each page, it might be good to add some debugging
  information near the
  top (where session_start() is):
 
  ?php
  session_start();
  echo 'pre' . htmlentities(print_r($_COOKIE, true))
  . '/pre';
  echo 'pre' . htmlentities(print_r($_GET, true)) .
  '/pre';
  echo session_id();
  ...
 
 I added this in , on top, right under session_start()
 as shown and get this error:

 Warning: Cannot modify header information - headers
 already sent by (output started at
 /home/lurkkcom/public_html/page1.php:6) in
 /home/lurkkcom/public_html/page1.php on line 54

 So it's clashing with the redirect:

 Header ('Location:
 http://www.mysite.com/page2.php?'.SID);


If your script outputs anything and then tries to redirect it WILL throw
that error. I believe if you want to do echos AND redirects you'll have to
use output buffering (see the manual: http://uk.php.net/outcontrol) and only
output the buffer if you do not redirect.

HTH
Graham

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP4 PHP4ISAPI Extensions

2004-10-27 Thread George Hester
In Windows 2000 Server SP3 I tried to set up the php4isapi.dll redirector.  I can get 
it to work as long as there are no extensions loaded.  But if there are from my 
php.ini then I get ./extensions\php_gd2.dll not found for example.  But if I run ?php 
phpinfo();? all the extensions I am using are found and enabled.  Can anyone explain 
what is going on and suggest a fix?  Thanks.

-- 
George Hester
__

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP XML

2004-10-27 Thread Dan Joseph
Hi All,

Just looking to be pointed in the right direction...  I've googled and
all that, but don't know what exactly I should be looking for.

I am writing an XML application with PHP.  

Side one - send XML To side two and wait for a response:

Side two - sit and wait for side one to send XML, then process and
send a response.

I guess I don't know what functions with PHP I should be focusing on. 
Everything I read tells me to point the code to file.xml, but there is
no file. I'll be receiving the XML string from another place on the
internet.

Help?

-Dan Joseph

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] @session_start generates a new session_id

2004-10-27 Thread Lizet Peña de Sola
I'll try that, thanks a lot.


-Original Message-
From: Reinhart Viane [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 26, 2004 12:49 PM
To: 'Lizet Peña de Sola'; [EMAIL PROTECTED]
Subject: RE: [PHP] @session_start generates a new session_id


Instead of:
? $_SESSION['validlogin']=; $_SESSION['username']=;
$_SESSION['password']=; unset($_SESSION['validlogin']);
unset($_SESSION['username']); unset($_SESSION['password']);
session_unset(); print(username=.$_SESSION['username']);
print(password=.$_SESSION['password']);

if(session_id()){
session_destroy();}
?

Try this:

//unregister the sessions
$_SESSION['validlogin']=; $_SESSION['username']=;
$_SESSION['password']=; //destroy the sessions array $_SESSION = array(); 
//destroy the session
session_destroy(); 

Greetings
Reinhart Viane






-- 
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


-- 
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



[PHP] Millisecond in PHP

2004-10-27 Thread Victor C.
Hi,

I'm trying to get PHP to display the millisecond of current time.  I can't
find that option in Date().. Any hints?

Thanks a lot

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] @session_start generates a new session_id

2004-10-27 Thread Lizet Peña de Sola

It still doesn't work :(... When I try to destroy the session without asking
if there's a session_id, it gives me a warning, I fixed it with the
if(session_id()) but still, when the user logs in again with a different
profile, in the same browser window, the profile that is loaded is the
previous one...
Here I copy the logout.php code:
?
$_SESSION['validlogin']=; 
$_SESSION['username']=; 
$_SESSION['password']=; //destroy the sessions array 
$_SESSION = array(); 
//destroy the session
if(session_id()){
session_destroy(); 
}
?

And the code that runs when the user logs in:
?
$username=trim($_POST['user']);
$password=trim($_POST['pwd']);

if(session_id()){echo('Error, please contact tech support'); exit();}
if(validateuser()){   
  session_start();
  
  $_SESSION['validlogin']=true;
  $_SESSION['username']=$username;
  $_SESSION['password']=$password;
}
...
?
Any ideas why the session variables get set to their first value after
starting the session for the second time? Should I create a different
session id each time?
Tia, Lizet

-Original Message-
From: Reinhart Viane [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 26, 2004 12:49 PM
To: 'Lizet Peña de Sola'; [EMAIL PROTECTED]
Subject: RE: [PHP] @session_start generates a new session_id


Instead of:
? $_SESSION['validlogin']=; $_SESSION['username']=;
$_SESSION['password']=; unset($_SESSION['validlogin']);
unset($_SESSION['username']); unset($_SESSION['password']);
session_unset(); print(username=.$_SESSION['username']);
print(password=.$_SESSION['password']);

if(session_id()){
session_destroy();}
?

Try this:

//unregister the sessions
$_SESSION['validlogin']=; $_SESSION['username']=;
$_SESSION['password']=; //destroy the sessions array $_SESSION = array(); 
//destroy the session
session_destroy(); 

Greetings
Reinhart Viane






-- 
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


-- 
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] Millisecond in PHP

2004-10-27 Thread John Nichel
Victor C. wrote:
Hi,
I'm trying to get PHP to display the millisecond of current time.  I can't
find that option in Date().. Any hints?
Thanks a lot
http://us4.php.net/manual/en/function.microtime.php
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Millisecond in PHP

2004-10-27 Thread Jim Grill
 Hi,

 I'm trying to get PHP to display the millisecond of current time.  I can't
 find that option in Date().. Any hints?

 Thanks a lot


Take a look at

http://us2.php.net/manual/en/function.microtime.php

Jim Grill
ZCE

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Millisecond in PHP

2004-10-27 Thread Marek Kilimajer
Victor C. wrote:
Hi,
I'm trying to get PHP to display the millisecond of current time.  I can't
find that option in Date().. Any hints?
Thanks a lot
microtime()
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Millisecond in PHP

2004-10-27 Thread Victor C.
Thank you all for answering! Really appreciate it.
John Nichel [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Victor C. wrote:
  Hi,
 
  I'm trying to get PHP to display the millisecond of current time.  I
can't
  find that option in Date().. Any hints?
 
  Thanks a lot
 

 http://us4.php.net/manual/en/function.microtime.php

 --
 John C. Nichel
 ÜberGeek
 KegWorks.com
 716.856.9675
 [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP XML

2004-10-27 Thread Dan Joseph
 how is the xml being sent to you from the other place on the internet? is
 it being posted in a form, etc.?

It won't be thru a form.  I guess it'll be a direct send, he'll format
something like...

request
   nameJack/name
   account239048098324/account
/request

... in a string and send it over.

What methods are best suited for something like that?  Would it be
best Side One to open a socket up to Side Two and send it thru that
way?  I'm open to suggestions...

-Dan Joseph

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SOLVED - Validation and session variables

2004-10-27 Thread Stuart Felenstein
I guess this was the one thing I overlooked.  
Since the page had to return to itself if validation
errors, it was already set in the validation script to
do so.  So, as I had shown in my original post the
form action was blank ..well 

Simple solution to keeping my session vars, set action
to page itself. i.e. Page1 , form action = page1.php

then the redirect like you all help me with.  Sweet
and working ! I might be back when i get to page 5 :)

Thanks to all!
Stuart

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Timezone

2004-10-27 Thread Victor C.
Is there a way to get PHP to display the full name of time zone?
date(t) only displays in the format of 'EDT', 'PDT', etc.. But I need the
full name of the timezone, ie. Pacific daylight saving time.
I know I can hard code all of these using switch statemetns.  I'm just
wondering if there is a function that's already build in.

Thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] @session_start generates a new session_id

2004-10-27 Thread Lizet Peña de Sola
session_id($username);
session_start();
Solved the problem...
Thank you all for the replies...

-Original Message-
From: Lizet Peña de Sola [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 27, 2004 3:55 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] @session_start generates a new session_id



It still doesn't work :(... When I try to destroy the session without asking
if there's a session_id, it gives me a warning, I fixed it with the
if(session_id()) but still, when the user logs in again with a different
profile, in the same browser window, the profile that is loaded is the
previous one... Here I copy the logout.php code: ?
$_SESSION['validlogin']=; 
$_SESSION['username']=; 
$_SESSION['password']=; //destroy the sessions array 
$_SESSION = array(); 
//destroy the session
if(session_id()){
session_destroy(); 
}
?

And the code that runs when the user logs in:
?
$username=trim($_POST['user']);
$password=trim($_POST['pwd']);

if(session_id()){echo('Error, please contact tech support'); exit();}
if(validateuser()){   
  session_start();
  
  $_SESSION['validlogin']=true;
  $_SESSION['username']=$username;
  $_SESSION['password']=$password;
}
...
?
Any ideas why the session variables get set to their first value after
starting the session for the second time? Should I create a different
session id each time? Tia, Lizet

-Original Message-
From: Reinhart Viane [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 26, 2004 12:49 PM
To: 'Lizet Peña de Sola'; [EMAIL PROTECTED]
Subject: RE: [PHP] @session_start generates a new session_id


Instead of:
? $_SESSION['validlogin']=; $_SESSION['username']=;
$_SESSION['password']=; unset($_SESSION['validlogin']);
unset($_SESSION['username']); unset($_SESSION['password']);
session_unset(); print(username=.$_SESSION['username']);
print(password=.$_SESSION['password']);

if(session_id()){
session_destroy();}
?

Try this:

//unregister the sessions
$_SESSION['validlogin']=; $_SESSION['username']=;
$_SESSION['password']=; //destroy the sessions array $_SESSION = array(); 
//destroy the session
session_destroy(); 

Greetings
Reinhart Viane






-- 
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


-- 
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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] https://...

2004-10-27 Thread Afan Pasalic
hi,
how can I check using php that I use SSL?
tried with
REQUEST_URI
HTTP_HOST
PATH_INFO
but any of these does show http://
Thanks!
-afan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] urlencode and google search query

2004-10-27 Thread Marek Kilimajer
Joel CARNAT wrote:
Hi,
I have a submit form from where I can search things to several sites
(google, freshmeat, ...). I use PHP4/urlencode to generate the correct
query. But it seems google does not use the right encoding :(
example - query=programme télé:

$engine = $_POST[engine];
$query = urlencode($_POST[query]);
switch($engine) {
case google:
echo htmlmeta http-equiv=\refresh\ 
content=\0;url=http://www.google.fr/search?q=$query\;/html;
break;
case freshmeat:
echo htmlmeta http-equiv=\refresh\ 
content=\0;url=http://freshmeat.net/search/?q=$query\;/html;
break;
}

when I use my code, the final URL is:
http://www.google.fr/search?q=programme+t%E9l%E9
when I search programme télé straight from google's page, the URL is:

http://www.google.fr/search?num=20hl=frq=programme+t%C3%A9l%C3%A9btnG=Recherchermeta=
i also tried (by hand):
http://www.google.fr/search?q=programme+t%C3%A9l%C3%A9
which is working.
how comes urlencode generates %E9 and google generates %C3%A9 ?
is google using some specific encoding ? any tweak to encode the google way ?
you can specify your encoding to google using ie parameter. and output 
encoding with oe. google usualy uses UTF-8, that's why some single 
characters are encoded in two bytes.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] https://...

2004-10-27 Thread Robby Russell
On Wed, 2004-10-27 at 16:35 -0500, Afan Pasalic wrote:
 hi,
 how can I check using php that I use SSL?
 tried with
 REQUEST_URI
 HTTP_HOST
 PATH_INFO
 but any of these does show http://
 
 Thanks!
 
 -afan
 

Have you looked at $_SERVER['SERVER_PORT'] and
$_SERVER['SERVER_PROTOCOL']
?

-Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
/



signature.asc
Description: This is a digitally signed message part


Re: [PHP] https://...

2004-10-27 Thread Greg Donald
On Wed, 27 Oct 2004 16:35:14 -0500, Afan Pasalic [EMAIL PROTECTED] wrote:
 hi,
 how can I check using php that I use SSL?
 tried with
 REQUEST_URI
 HTTP_HOST
 PATH_INFO
 but any of these does show http://

phpinfo() describes my SSL stuff pretty well if that's what you mean.

And I also found:
http://marc.theaimsgroup.com/?l=php-generalm=109767486431095w=2


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] https://...

2004-10-27 Thread Vail, Warren
Depends on the server and the release, but my apache shows

If($_SERVER[HTTPS] == on) // if true is secure

Lots of other information like cypher key size, etc.

Look in the $_SERVER array.

Keep in mind that lots of servers are setup to use the same htdocs base
directory for both secure and insecure pages, what happens if someone comes
to your unsecured page using https?  Another example is, if you have coded
full urls for images, the browser will usually complain if the page is
accessed via https and the image via http.

Warren Vail


-Original Message-
From: Greg Donald [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 27, 2004 3:01 PM
To: php-general
Subject: Re: [PHP] https://...


On Wed, 27 Oct 2004 16:35:14 -0500, Afan Pasalic [EMAIL PROTECTED] wrote:
 hi,
 how can I check using php that I use SSL?
 tried with
 REQUEST_URI
 HTTP_HOST
 PATH_INFO
 but any of these does show http://

phpinfo() describes my SSL stuff pretty well if that's what you mean.

And I also found:
http://marc.theaimsgroup.com/?l=php-generalm=109767486431095w=2


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
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



[PHP] Re: simplexml question.

2004-10-27 Thread Bill McCuistion
[EMAIL PROTECTED] wrote:

 
 Hello,
 
 I looking to get the data out of this test.xml file but dont
 know how to get the data out because of the bo: namespaces.
 If I remove all bo: from the xml then it works fine...
 Is anyone can tell me how to do it?
 
 
 ?php
 $file = test.xml;
 $xml = simplexml_load_file($file) or die (Unable to load XML file!);
 echo Name:  . $xml-UserAuthRequest-UserLoginName . \n;
 ?
 
 
 test.xml:
 
 ?xml version=1.0 encoding=UTF-8?
 bo:TXLife xsi:schemaLocation=http://ACORD.org/Standards/Life/2
 TXLife2.9.90.XSD xmlns:bo=http://ACORD.org/Standards/Life/2;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 bo:UserAuthRequest
 bo:UserLoginNameTest login/bo:UserLoginName
 
 
 
 Thanks,
 
 Andras Kende

I couldn't get SimpleXML (nor the SimpleXMLIterator) to work with NS-enabled
xml.  Had to use DOM functions.  Sorry if this is bad news.  Would be
interested if I missed a setting that enabled NS-support for SimpleXML.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Q re: php-5.0.2 ./configure --with-soap --with-openssl --with-tidy (copy)

2004-10-27 Thread Bill McCuistion
Q re: php-5.0.2 ./configure --with-soap --with-openssl --with-tidy 

Hello all.  Hoping for some direction with the above step.

Have PHP-5.0.2 and can configure the soap and openssl options, but when I
add the tidy option, the operation stops with the following message.

 -- checking for TIDY support... yes
 -- configure: error: Cannot find libtidy

I have of course gotten the latest tidy source (1.1) from sourceforge, but
don't understand what to do with it.   The rpm doen't seel to load the
libtidy as I was hoping it would.  Further to my confusion, the PHP docs
speak to using tidy 2.0 with PHP5, but can not locate any other refs to
tidy 2.x)

My system is Fedora Core 2 (and is pretty standard and otherwise
up-to-date).

I of course would like to get the TidyLib functions enabled within the PHP5 
core.  The command-line version works just fine, but I don't remember from 
whence it came.

Any help would be most appreciated.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] User Screen Resolution

2004-10-27 Thread Web Guy
I am new to PHP and couldn't find any Globals for the User's Screen
Resolution. (don't laugh at me please)

I used to use a Javascript function to pass the resolution using
screen.width and screen.height.

What I am actually trying to do is make a page resize depending on screen
resolution, in case that helps anyone.

 

Thanks for your help.

 

Ben

 



Re: Re: [PHP] urlencode and google search query

2004-10-27 Thread Joel CARNAT
On Wed, Oct 27 2004 - 23:41, Marek Kilimajer wrote:
 how comes urlencode generates %E9 and google generates %C3%A9 ?
 is google using some specific encoding ? any tweak to encode the google 
 way ?
 
 you can specify your encoding to google using ie parameter. and output 

 hum... I don't get what you mean :(
 there is no parameter to the urlencode php function, isn't it ?

 encoding with oe. google usualy uses UTF-8, that's why some single 
 characters are encoded in two bytes.
 
 I tried :
echo htmlmeta http-equiv=\refresh\ 
content=\0;url=http://www.google.fr/search?q=.utf8_encode($query).\/html;
 which acts the same, aka %E9

 and
$query = utf8_encode($_POST[query]);
 which is worse than ever :)
 it produces : %20t%C3%83%C6%92%C3%82%C2%A9   %-)

 can you clarify what you mean when you say use the ie param and encoding with oe.

 sorry if those questions seems sily, but I'm not a heavy php coder ;)

TIA,
Jo
-- 

,-- This mail runs -.
` OpenBSD/sparc64 --'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP XML

2004-10-27 Thread Bill McCuistion
Dan Joseph wrote:

 how is the xml being sent to you from the other place on the internet? is
 it being posted in a form, etc.?
 
 It won't be thru a form.  I guess it'll be a direct send, he'll format
 something like...
 
 request
nameJack/name
account239048098324/account
 /request
 
 ... in a string and send it over.
 
 What methods are best suited for something like that?  Would it be
 best Side One to open a socket up to Side Two and send it thru that
 way?  I'm open to suggestions...
 
 -Dan Joseph

Look at the SOAP functions.  There's a SOAP client  SOAP server.  The
applications use SOAP calls to transfer their XML messages over the
Intenet, typically http/https, but could also use smtp for transport.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] urlencode and google search query

2004-10-27 Thread Marek Kilimajer
Joel CARNAT wrote:
On Wed, Oct 27 2004 - 23:41, Marek Kilimajer wrote:
how comes urlencode generates %E9 and google generates %C3%A9 ?
is google using some specific encoding ? any tweak to encode the google 
way ?
you can specify your encoding to google using ie parameter. and output 

 hum... I don't get what you mean :(
 there is no parameter to the urlencode php function, isn't it ?

encoding with oe. google usualy uses UTF-8, that's why some single 
characters are encoded in two bytes.
 
 I tried :
echo htmlmeta http-equiv=\refresh\ content=\0;url=http://www.google.fr/search?q=.utf8_encode($query).\/html;
 which acts the same, aka %E9

 and
$query = utf8_encode($_POST[query]);
 which is worse than ever :)
 it produces : %20t%C3%83%C6%92%C3%82%C2%A9   %-)
 can you clarify what you mean when you say use the ie param and encoding with oe.
 sorry if those questions seems sily, but I'm not a heavy php coder ;)
I meant get parameters to google:
http://www.google.com/search?q=helpie=utf-8oe=utf-8
you need to change ie parameter ^^ to whatever encoding you are using.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] User Screen Resolution

2004-10-27 Thread Larry E . Ullman
I am new to PHP and couldn't find any Globals for the User's Screen
Resolution. (don't laugh at me please)
I used to use a Javascript function to pass the resolution using
screen.width and screen.height.
What I am actually trying to do is make a page resize depending on 
screen
resolution, in case that helps anyone.
Using PHP you can neither find the screen resolution nor resize the 
browser window. Both must be accomplished using JavaScript.

Larry
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] User Screen Resolution

2004-10-27 Thread Matthew Sims
 I am new to PHP and couldn't find any Globals for the User's Screen
 Resolution. (don't laugh at me please)

 I used to use a Javascript function to pass the resolution using
 screen.width and screen.height.

 What I am actually trying to do is make a page resize depending on screen
 resolution, in case that helps anyone.



The reason why this worked for javascript is because it is a client side
instruction set. PHP is a server side instruction set. PHP has no idea
what resolution the user's screen is nor can it resize the browser. In
fact, PHP can't do anything with the browser.

I should just copy and save the above and paste it into everyone one of
these types of questions. ;)

-- 
--Matthew Sims
--http://killermookie.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] User Screen Resolution

2004-10-27 Thread Robby Russell
On Wed, 2004-10-27 at 15:25 -0700, Web Guy wrote:
 I am new to PHP and couldn't find any Globals for the User's Screen
 Resolution. (don't laugh at me please)
 
 I used to use a Javascript function to pass the resolution using
 screen.width and screen.height.
 
 What I am actually trying to do is make a page resize depending on screen
 resolution, in case that helps anyone.
 

go back and find your javascript function. PHP is server side not client
side.

-Robby


-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
* --- Now supporting PHP5 and PHP4 ---
/


signature.asc
Description: This is a digitally signed message part


RE: [PHP] User Screen Resolution

2004-10-27 Thread Vail, Warren
This is because there is no way for PHP to run in the browser.  Wouldn't it
be nice to have a plug-in that allowed PHP to run there, perhaps as a
JavaScript replacement?  Guess it would have to be a throttled back version
of PHP to adhere to sandbox security concerns.  Sigh

Warren Vail


-Original Message-
From: Larry E. Ullman [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 27, 2004 3:40 PM
To: Web Guy
Cc: PHP
Subject: Re: [PHP] User Screen Resolution


 I am new to PHP and couldn't find any Globals for the User's Screen 
 Resolution. (don't laugh at me please)

 I used to use a Javascript function to pass the resolution using 
 screen.width and screen.height.

 What I am actually trying to do is make a page resize depending on
 screen
 resolution, in case that helps anyone.

Using PHP you can neither find the screen resolution nor resize the 
browser window. Both must be accomplished using JavaScript.

Larry

-- 
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: RE: [PHP] User Screen Resolution

2004-10-27 Thread Vail, Warren
One aspect of this list that I really enjoy is finding out that everyone but
me is on vacation or out of the office. 

8-b

Warren Vail


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 27, 2004 4:22 PM
To: Vail, Warren
Subject: Re: RE: [PHP] User Screen Resolution


Phil Ewington will be out of the office until 1st November.

If your enquiry is urgent please email Ian Lowe ([EMAIL PROTECTED]).

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] User Screen Resolution

2004-10-27 Thread Brad Bonkoski
There has been talk in the past about making a phpscript that would run on 
the client, but then there are all the problems with browser integration, 
and universal support.  I say this is a good niche for javascript, so make 
use of it if you need it just like you don't use a hammer to tighten a 
screw...

- Original Message - 
From: Vail, Warren [EMAIL PROTECTED]
To: 'Larry E. Ullman' [EMAIL PROTECTED]; Web Guy 
[EMAIL PROTECTED]
Cc: PHP [EMAIL PROTECTED]
Sent: Wednesday, October 27, 2004 7:05 PM
Subject: RE: [PHP] User Screen Resolution


This is because there is no way for PHP to run in the browser.  Wouldn't 
it
be nice to have a plug-in that allowed PHP to run there, perhaps as a
JavaScript replacement?  Guess it would have to be a throttled back 
version
of PHP to adhere to sandbox security concerns.  Sigh

Warren Vail
-Original Message-
From: Larry E. Ullman [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 27, 2004 3:40 PM
To: Web Guy
Cc: PHP
Subject: Re: [PHP] User Screen Resolution

I am new to PHP and couldn't find any Globals for the User's Screen
Resolution. (don't laugh at me please)
I used to use a Javascript function to pass the resolution using
screen.width and screen.height.
What I am actually trying to do is make a page resize depending on
screen
resolution, in case that helps anyone.
Using PHP you can neither find the screen resolution nor resize the
browser window. Both must be accomplished using JavaScript.
Larry
--
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Default value if parameter is not passed in

2004-10-27 Thread Quanah Gibson-Mount
Right now, I'm tweaking a function that has a bunch of optional parameters. 
I would like to be able to set a default value for the very last one if it 
is not passed in.  This essentially looks like:

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r|ssl, link, arg1, 
arg1_len, arg2, arg2_len, long, long_len) == FAILURE { RETURN_FALSE; }

if (!long || long==NULL) {
long=DEFAULT_VALUE;
}
However, what I found when printing out the value of long is that it has 
been set to 1?!  I imagine this was by the zend_parse_parameters function. 
Is there a way to disable it from setting values to optional parameters?

--Quanah
--
Quanah Gibson-Mount
Principal Software Developer
ITSS/Shared Services
Stanford University
GnuPG Public Key: http://www.stanford.edu/~quanah/pgp.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] User Screen Resolution

2004-10-27 Thread Vail, Warren
Good point, I suspect much of the desirability of having PHP on the client,
is it seems almost cruel and unusual punishment to have to learn how to use
a screwdriver, after having spent valuable time learning all about a hammer.
I wonder if I would have been so enthusiastic about learning and using PHP
if I had known in the beginning that I'd need to learn JavaScript as well.

Warren Vail

-Original Message-
From: Brad Bonkoski [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 27, 2004 4:33 PM
To: Vail, Warren; 'Larry E. Ullman'; Web Guy
Cc: PHP
Subject: Re: [PHP] User Screen Resolution


There has been talk in the past about making a phpscript that would run on 
the client, but then there are all the problems with browser integration, 
and universal support.  I say this is a good niche for javascript, so make 
use of it if you need it just like you don't use a hammer to tighten a 
screw...

- Original Message - 
From: Vail, Warren [EMAIL PROTECTED]
To: 'Larry E. Ullman' [EMAIL PROTECTED]; Web Guy 
[EMAIL PROTECTED]
Cc: PHP [EMAIL PROTECTED]
Sent: Wednesday, October 27, 2004 7:05 PM
Subject: RE: [PHP] User Screen Resolution


 This is because there is no way for PHP to run in the browser.  
 Wouldn't
 it
 be nice to have a plug-in that allowed PHP to run there, perhaps as a
 JavaScript replacement?  Guess it would have to be a throttled back 
 version
 of PHP to adhere to sandbox security concerns.  Sigh

 Warren Vail


 -Original Message-
 From: Larry E. Ullman [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, October 27, 2004 3:40 PM
 To: Web Guy
 Cc: PHP
 Subject: Re: [PHP] User Screen Resolution


 I am new to PHP and couldn't find any Globals for the User's Screen 
 Resolution. (don't laugh at me please)

 I used to use a Javascript function to pass the resolution using 
 screen.width and screen.height.

 What I am actually trying to do is make a page resize depending on 
 screen resolution, in case that helps anyone.

 Using PHP you can neither find the screen resolution nor resize the 
 browser window. Both must be accomplished using JavaScript.

 Larry

 --
 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
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Default value if parameter is not passed in

2004-10-27 Thread Vail, Warren
I notice that none of your variables use the PHP convention of $ preceding
the variable name, I also do not see you defining a value for DEFAULT_VALUE,
which by the upper case convention seems to be referring to a global
constant.  Is it not true (no pun intended) that if a variable (or constant)
has not been defined, that assigning the contents of that variable (or value
of the constant) will return a false (i.e. a 1)?

Not sure I remember it all correctly but it seems to ring an ancient bell
for me.

HTH,

Warren Vail

-Original Message-
From: Quanah Gibson-Mount [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 27, 2004 4:35 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Default value if parameter is not passed in


Right now, I'm tweaking a function that has a bunch of optional parameters. 
I would like to be able to set a default value for the very last one if it 
is not passed in.  This essentially looks like:


if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r|ssl, link, arg1, 
arg1_len, arg2, arg2_len, long, long_len) == FAILURE { RETURN_FALSE; }

if (!long || long==NULL) {
 long=DEFAULT_VALUE;
}

However, what I found when printing out the value of long is that it has 
been set to 1?!  I imagine this was by the zend_parse_parameters function. 
Is there a way to disable it from setting values to optional parameters?

--Quanah

--
Quanah Gibson-Mount
Principal Software Developer
ITSS/Shared Services
Stanford University
GnuPG Public Key: http://www.stanford.edu/~quanah/pgp.html

-- 
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] Default value if parameter is not passed in

2004-10-27 Thread Quanah Gibson-Mount

--On Wednesday, October 27, 2004 4:53 PM -0700 Vail, Warren 
[EMAIL PROTECTED] wrote:

I notice that none of your variables use the PHP convention of $ preceding
the variable name, I also do not see you defining a value for
DEFAULT_VALUE, which by the upper case convention seems to be referring
to a global constant.  Is it not true (no pun intended) that if a
variable (or constant) has not been defined, that assigning the contents
of that variable (or value of the constant) will return a false (i.e. a
1)?
This is inside the C source code for PHP.  C does not prefix variables with 
a $.

The DEFAULT_VALUE was simply shorthand for what I'm setting it to, and is 
not representative of an actual value, and that bit doesn't particularly 
matter, since it was never getting executed (although it was for a global 
constant from a header file).

--Quanah
--
Quanah Gibson-Mount
Principal Software Developer
ITSS/Shared Services
Stanford University
GnuPG Public Key: http://www.stanford.edu/~quanah/pgp.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Default value if parameter is not passed in

2004-10-27 Thread Vail, Warren
OK, so it was C code on a PHP list, isn't there a PHP developers list that
would work better?

Warren Vail

-Original Message-
From: Quanah Gibson-Mount [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 27, 2004 4:56 PM
To: Vail, Warren; [EMAIL PROTECTED]
Subject: RE: [PHP] Default value if parameter is not passed in




--On Wednesday, October 27, 2004 4:53 PM -0700 Vail, Warren 
[EMAIL PROTECTED] wrote:

 I notice that none of your variables use the PHP convention of $ 
 preceding the variable name, I also do not see you defining a value 
 for DEFAULT_VALUE, which by the upper case convention seems to be 
 referring to a global constant.  Is it not true (no pun intended) that 
 if a variable (or constant) has not been defined, that assigning the 
 contents of that variable (or value of the constant) will return a 
 false (i.e. a 1)?

This is inside the C source code for PHP.  C does not prefix variables with 
a $.

The DEFAULT_VALUE was simply shorthand for what I'm setting it to, and is 
not representative of an actual value, and that bit doesn't particularly 
matter, since it was never getting executed (although it was for a global 
constant from a header file).

--Quanah

--
Quanah Gibson-Mount
Principal Software Developer
ITSS/Shared Services
Stanford University
GnuPG Public Key: http://www.stanford.edu/~quanah/pgp.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Default value if parameter is not passed in

2004-10-27 Thread Robby Russell
On Wed, 2004-10-27 at 16:56 -0700, Quanah Gibson-Mount wrote:
 
 --On Wednesday, October 27, 2004 4:53 PM -0700 Vail, Warren 
 [EMAIL PROTECTED] wrote:
 
  I notice that none of your variables use the PHP convention of $ preceding
  the variable name, I also do not see you defining a value for
  DEFAULT_VALUE, which by the upper case convention seems to be referring
  to a global constant.  Is it not true (no pun intended) that if a
  variable (or constant) has not been defined, that assigning the contents
  of that variable (or value of the constant) will return a false (i.e. a
  1)?
 
 This is inside the C source code for PHP.  C does not prefix variables with 
 a $.
 
 The DEFAULT_VALUE was simply shorthand for what I'm setting it to, and is 
 not representative of an actual value, and that bit doesn't particularly 
 matter, since it was never getting executed (although it was for a global 
 constant from a header file).
 
 --Quanah
 

So, you're asking for help on modifications to the source code for PHP,
not how to help with modifications of PHP code, correct?

If so, you might want to try the PHP developers list. 

-Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
* --- Now supporting PHP5 and PHP4 ---
/


signature.asc
Description: This is a digitally signed message part


[PHP] Re: https://...

2004-10-27 Thread Bill McCuistion
Afan Pasalic wrote:

 hi,
 how can I check using php that I use SSL?
 tried with
 REQUEST_URI
 HTTP_HOST
 PATH_INFO
 but any of these does show http://
 
 Thanks!
 
 -afan

from the command line...
php -m
should list openssl if ./configure --with-openssl option specified.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP Compiler?

2004-10-27 Thread Bill McCuistion
Sorry if this is an old question:  

Where can I find information on any plans to create a compiler for PHP,
especially v5.x?

Barring that, is there a PHP syntax checker that would enforce some of the
types of things that a compiler would find?  

I remember from back in my MS-DOS days the very good Clipper compiler for
the dBase III language.  dBase III, not unlike PHP, was an interpretive
language, and along the way some bright folks figured out how to write a
true dBase language compiler, which then allowed for all sorts of nice
things to happen.  One of the nicest things for me was that the compiler
caught all sorts of little things before the same code in the interpreter
would find them at run-time.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



  1   2   >