[PHP] Re: Freshmeat question

2003-01-21 Thread Martin Thoma
 I am not new to programming, just to scripting languages. I have seen that Perl has 
some high advanced sintaxes for string processing, for example, but I don't know if 
the same level can also be achieved in PHP...?

Sorry, I don't know that. I know that Perl has some regular-expressions, but php has 
this, too.

 As for the script below, could I run it inside a (my) browser? This could be in any 
browser?

Well, it depends ;-) Generally: Yes. But you have to let a web-browser (like apache) 
process the php-script.

Martin


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




[PHP] How to make id/name table into array?

2003-01-21 Thread Daevid Vincent
Is there a better way to do this in PHP? It seems that a single number
(key) and single name (value) would lend itself perfectly to an (indexed
or associative) array. I would think there is some PHP API call that I'm
unaware of that will just take the whole result set and stuff it into an
array for me no? If not, there should be. Perfect for things like
ListBoxes, or table lookups so you don't have to hit the database
constantly with joins et. al.

$sql = SELECT id, name FROM mytable ORDER BY id;
if ( !($result = mysql_query($sql,$link)) ) { echo failed\n; }
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) 
  $myarray[$row['id']] = $row['name'];



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




[PHP] PHP Sessions

2003-01-21 Thread Tim Thorburn
Hi,

After a day and a half of pounding my head against the wall I believe I've 
identified the source of the problem.  When I create and register the 
session in my login page - it does not carry forward to any other 
pages.  I've found this by going through several different tutorials for 
making password protected areas using PHP and Sessions that I've found both 
online and in books - all produce the same result on the server with 
attitude - yet all work on all other servers I'm currently using for my 
hosting.

So, since this is an eCommerce site for my client and they're getting 
increasingly impatient with the progress made I'm left with little choice 
in this matter - as moving the site now would be unthinkable, and tech 
support at the hosting company is less than stellar, and generally not in 
English.  Are there any obvious PHP settings that I'd need to adjust to 
ensure that Sessions can be carried forward to additional pages?  My only 
other option now is to force my client to login to each screen in the admin 
area (conceivably this could mean the client would need to log in to a 
minimum of 8 different pages to observe their records and make changes to 
the site).

I'm at the point of desperation and sleep deprivation ... If there are no 
obvious PHP settings that need to be altered - what else could be producing 
this problem?

Thanks
-Tim



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



RE: [PHP] How to make id/name table into array?

2003-01-21 Thread John W. Holmes
 Is there a better way to do this in PHP? It seems that a single number
 (key) and single name (value) would lend itself perfectly to an
(indexed
 or associative) array. I would think there is some PHP API call that
I'm
 unaware of that will just take the whole result set and stuff it into
an
 array for me no? If not, there should be. Perfect for things like
 ListBoxes, or table lookups so you don't have to hit the database
 constantly with joins et. al.
 
 $sql = SELECT id, name FROM mytable ORDER BY id;
 if ( !($result = mysql_query($sql,$link)) ) { echo failed\n; }
 while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
   $myarray[$row['id']] = $row['name'];

That's the way to do it.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




RE: [PHP] PHP Sessions

2003-01-21 Thread Timothy Hitchens \(HiTCHO\)
What version of PHP are you using and do you have globals turned on?


Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: [EMAIL PROTECTED]

 -Original Message-
 From: Tim Thorburn [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, 21 January 2003 6:59 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] PHP Sessions
 
 
 Hi,
 
 After a day and a half of pounding my head against the wall I 
 believe I've 
 identified the source of the problem.  When I create and register the 
 session in my login page - it does not carry forward to any other 
 pages.  I've found this by going through several different 
 tutorials for 
 making password protected areas using PHP and Sessions that 
 I've found both 
 online and in books - all produce the same result on the server with 
 attitude - yet all work on all other servers I'm currently 
 using for my 
 hosting.
 
 So, since this is an eCommerce site for my client and they're getting 
 increasingly impatient with the progress made I'm left with 
 little choice 
 in this matter - as moving the site now would be unthinkable, 
 and tech 
 support at the hosting company is less than stellar, and 
 generally not in 
 English.  Are there any obvious PHP settings that I'd need to 
 adjust to 
 ensure that Sessions can be carried forward to additional 
 pages?  My only 
 other option now is to force my client to login to each 
 screen in the admin 
 area (conceivably this could mean the client would need to 
 log in to a 
 minimum of 8 different pages to observe their records and 
 make changes to 
 the site).
 
 I'm at the point of desperation and sleep deprivation ... If 
 there are no 
 obvious PHP settings that need to be altered - what else 
 could be producing 
 this problem?
 
 Thanks
 -Tim
 
 
 
 -- 
 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] PHP Sessions

2003-01-21 Thread Jason Wong
On Tuesday 21 January 2003 16:58, Tim Thorburn wrote:
 Hi,

 After a day and a half of pounding my head against the wall I believe I've
 identified the source of the problem.  When I create and register the
 session in my login page - it does not carry forward to any other
 pages.  I've found this by going through several different tutorials for
 making password protected areas using PHP and Sessions that I've found both
 online and in books - all produce the same result on the server with
 attitude - yet all work on all other servers I'm currently using for my
 hosting.

Does the simple example from the manual work? If not, what does the php.log 
say? If it does work then what does your code look like?

What is the config of the server with an attitude? phpinfo()? Did you check 
for any differences between that and the servers that do work?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
lisp, v.:
To call a spade a thpade.
*/


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




[PHP] Re: PHP Sessions

2003-01-21 Thread Foong
I used to have the same problem(sort of)
I am not sure if my solution applies to you.

Here is what i did,

to pass session to one page to another you must call
session_start();
ON EVERY PAGE

to access registered session variables use the session super global array
like:
$_SESSION['userid'];

Sorry if it's not relevant.

Foong


Tim Thorburn [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 After a day and a half of pounding my head against the wall I believe I've
 identified the source of the problem.  When I create and register the
 session in my login page - it does not carry forward to any other
 pages.  I've found this by going through several different tutorials for
 making password protected areas using PHP and Sessions that I've found
both
 online and in books - all produce the same result on the server with
 attitude - yet all work on all other servers I'm currently using for my
 hosting.

 So, since this is an eCommerce site for my client and they're getting
 increasingly impatient with the progress made I'm left with little choice
 in this matter - as moving the site now would be unthinkable, and tech
 support at the hosting company is less than stellar, and generally not in
 English.  Are there any obvious PHP settings that I'd need to adjust to
 ensure that Sessions can be carried forward to additional pages?  My only
 other option now is to force my client to login to each screen in the
admin
 area (conceivably this could mean the client would need to log in to a
 minimum of 8 different pages to observe their records and make changes to
 the site).

 I'm at the point of desperation and sleep deprivation ... If there are no
 obvious PHP settings that need to be altered - what else could be
producing
 this problem?

 Thanks
 -Tim





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




[PHP] Session Question

2003-01-21 Thread Sancar Saran
Hi,
I'm working on a project. It uses large sql data to create pages. Last week I 
create some kind of cache info to create faster execution. It really works 
(system runs more than 10 times faster)

But stroring cache data is problem. I use the session to store cache info. 
With using cache data session files growing 60K, I think it can be 100K or 
more. 

I need advice about using large session data. Or is there any way to store 
large array (10 or more dimestion) into memory or someting.

Thanks.

Sancar Delifisek Saran.



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




[PHP] DOWNLOAD

2003-01-21 Thread Shaun van den Berg
Hi ,

Im not sure if this can be done in PHP , i know PHP has upload features !
Does it have download features , wat i mean is the following : i want a
link - click here to download - when you click on it , the download dialog
box must appear - how do i do this ?

Thanks
Shaun van den Berg

--
Novtel Consulting
Tel: +27 21 9822373
Fax: +27 21 9815846
Please visit our website:
www.novtel.co.za



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




RE: [PHP] PHP Sessions

2003-01-21 Thread Tim Thorburn
Hi,

I'm using PHP 4.1.2 on the server with problems - it's hosted on a shared 
server and thus I have no direct access to much of anything.  I have had 
this script running on versions 4.0.6 thru 4.2.2 with no problems until now.

Here are the settings attained from phpinfo(); for the server that does not 
work - 4.1.2 ... and from the server that does work 4.2.2

After the Configure Command of each is a list of settings that differ.

Much thanks for responding so quickly and at such a late hour!!

Thanks
-Tim

PHP 4.2.2 (works fine)

'./configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-mcrypt' 
'--enable-bcmath' '--enable-calendar' '--with-xml' 
'--with-swf=/usr/local/flash' '--with-gd=../gd-1.8.4' 
'--with-jpeg-dir=/usr/local' 
'--with-imap=../imap-2001.BETA.SNAP-0107112053' '--with-ming=../ming-0.1.1' 
'--enable-magic-quotes' '--with-mysql' '--enable-safe-mode' 
'--enable-track-vars' '--with-ttf' '--enable-versioning' '--with-curl' 
'--with-zlib'

Settings:
allow_call_time_pass_reference ON
extension_dir ./
magic_quotes_gpc ON
register_argc_argv ON
sendmail_from no value
unserialize_callback_func no value
variables_order EGPCS

PHP 4.1.2 (doesn't work)

'./configure' '--prefix=/usr' '--with-apxs=/usr/sbin/apxs' '--with-gd' 
'--with-gettext=/usr' '--enable-safe-mode' 
'--with-config-file-path=/etc/httpd' '--with-exec-dir=/usr/bin' 
'--with-zlib' '--enable-magic-quotes' '--with-regex=system' '--with-ttf' 
'--with-db' '--with-gdbm' '--enable-mbstring' '--enable-mbstr-enc-trans' 
'--enable-track-vars' '--enable-wddx=shared' '--enable-mm=shared' 
'--enable-xml' '--enable-ftp' '--disable-debug' '--with-libdir=/usr/lib' 
'--with-db3' '--with-interbase=shared' '--with-pgsql=shared' '--with-ldap' 
'--with-imap' '--with-curl=shared' '--with-pdflib=shared'

Settings:
allow_call_time_pass_reference OFF
extension_dir /usr/lib/apache/php
magic_quotes_gpc OFF
register_argc_argv OFF
sendmail_from [EMAIL PROTECTED]
variables_order GPCS


At 07:11 PM 1/21/2003 +1000, Timothy Hitchens \(HiTCHO\) wrote:
What version of PHP are you using and do you have globals turned on?


Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: [EMAIL PROTECTED]

 -Original Message-
 From: Tim Thorburn [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, 21 January 2003 6:59 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] PHP Sessions


 Hi,

 After a day and a half of pounding my head against the wall I
 believe I've
 identified the source of the problem.  When I create and register the
 session in my login page - it does not carry forward to any other
 pages.  I've found this by going through several different
 tutorials for
 making password protected areas using PHP and Sessions that
 I've found both
 online and in books - all produce the same result on the server with
 attitude - yet all work on all other servers I'm currently
 using for my
 hosting.

 So, since this is an eCommerce site for my client and they're getting
 increasingly impatient with the progress made I'm left with
 little choice
 in this matter - as moving the site now would be unthinkable,
 and tech
 support at the hosting company is less than stellar, and
 generally not in
 English.  Are there any obvious PHP settings that I'd need to
 adjust to
 ensure that Sessions can be carried forward to additional
 pages?  My only
 other option now is to force my client to login to each
 screen in the admin
 area (conceivably this could mean the client would need to
 log in to a
 minimum of 8 different pages to observe their records and
 make changes to
 the site).

 I'm at the point of desperation and sleep deprivation ... If
 there are no
 obvious PHP settings that need to be altered - what else
 could be producing
 this problem?

 Thanks
 -Tim



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




RE: [PHP] DOWNLOAD

2003-01-21 Thread Timothy Hitchens \(HiTCHO\)
Create a script that reads the contents of a file after sending headers
eg:

header(Content-type: text/plain);
header(Content-Disposition: attachment; filename=downloaded.txt);
readfile(downloaded.txt);
exit();

The downloaded.txt can be any file subject to sending the correct
headers and IE
and other browsers will pop up a download (save) window.

See your mime.types file for headers for each file type.


Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: [EMAIL PROTECTED]

 -Original Message-
 From: Shaun van den Berg [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, 21 January 2003 4:39 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] DOWNLOAD
 
 
 Hi ,
 
 Im not sure if this can be done in PHP , i know PHP has 
 upload features ! Does it have download features , wat i mean 
 is the following : i want a link - click here to download - 
 when you click on it , the download dialog box must appear - 
 how do i do this ?
 
 Thanks
 Shaun van den Berg
 
 --
 Novtel Consulting
 Tel: +27 21 9822373
 Fax: +27 21 9815846
 Please visit our website:
 www.novtel.co.za
 
 
 
 -- 
 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] PHP Sessions

2003-01-21 Thread Timothy Hitchens \(HiTCHO\)
Are globals turned on or off.. I don't see that setting in your copy and
paste.

Are you trying to access the session vars as $name or
$_SESSION['name']??


Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: [EMAIL PROTECTED]

 -Original Message-
 From: Tim Thorburn [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, 21 January 2003 7:39 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; 
 [EMAIL PROTECTED]
 Subject: RE: [PHP] PHP Sessions
 
 
 Hi,
 
 I'm using PHP 4.1.2 on the server with problems - it's hosted 
 on a shared 
 server and thus I have no direct access to much of anything.  
 I have had 
 this script running on versions 4.0.6 thru 4.2.2 with no 
 problems until now.
 
 Here are the settings attained from phpinfo(); for the server 
 that does not 
 work - 4.1.2 ... and from the server that does work 4.2.2
 
 After the Configure Command of each is a list of settings that differ.
 
 Much thanks for responding so quickly and at such a late hour!!
 
 Thanks
 -Tim
 
 PHP 4.2.2 (works fine)
 
 './configure' '--with-apxs=/usr/local/apache/bin/apxs' 
 '--with-mcrypt' 
 '--enable-bcmath' '--enable-calendar' '--with-xml' 
 '--with-swf=/usr/local/flash' '--with-gd=../gd-1.8.4' 
 '--with-jpeg-dir=/usr/local' 
 '--with-imap=../imap-2001.BETA.SNAP-0107112053' 
 '--with-ming=../ming-0.1.1' 
 '--enable-magic-quotes' '--with-mysql' '--enable-safe-mode' 
 '--enable-track-vars' '--with-ttf' '--enable-versioning' 
 '--with-curl' 
 '--with-zlib'
 
 Settings:
 allow_call_time_pass_reference ON
 extension_dir ./
 magic_quotes_gpc ON
 register_argc_argv ON
 sendmail_from no value
 unserialize_callback_func no value
 variables_order EGPCS
 
 PHP 4.1.2 (doesn't work)
 
 './configure' '--prefix=/usr' '--with-apxs=/usr/sbin/apxs' 
 '--with-gd' 
 '--with-gettext=/usr' '--enable-safe-mode' 
 '--with-config-file-path=/etc/httpd' '--with-exec-dir=/usr/bin' 
 '--with-zlib' '--enable-magic-quotes' '--with-regex=system' 
 '--with-ttf' 
 '--with-db' '--with-gdbm' '--enable-mbstring' 
 '--enable-mbstr-enc-trans' 
 '--enable-track-vars' '--enable-wddx=shared' '--enable-mm=shared' 
 '--enable-xml' '--enable-ftp' '--disable-debug' 
 '--with-libdir=/usr/lib' 
 '--with-db3' '--with-interbase=shared' '--with-pgsql=shared' 
 '--with-ldap' 
 '--with-imap' '--with-curl=shared' '--with-pdflib=shared'
 
 Settings:
 allow_call_time_pass_reference OFF
 extension_dir /usr/lib/apache/php
 magic_quotes_gpc OFF
 register_argc_argv OFF
 sendmail_from [EMAIL PROTECTED]
 variables_order GPCS
 
 
 At 07:11 PM 1/21/2003 +1000, Timothy Hitchens \(HiTCHO\) wrote:
 What version of PHP are you using and do you have 
als turned on?
 
 
 Timothy Hitchens (HiTCHO)
 Open Source Consulting
 e-mail: [EMAIL PROTECTED]
 
   -Original Message-
   From: Tim Thorburn [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, 21 January 2003 6:59 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP] PHP Sessions
  
  
   Hi,
  
   After a day and a half of pounding my head against the wall I 
   believe I've identified the source of the problem.  When I create 
   and register the session in my login page - it does not carry 
   forward to any other pages.  I've found this by going through 
   several different tutorials for
   making password protected areas using PHP and Sessions that
   I've found both
   online and in books - all produce the same result on the 
 server with
   attitude - yet all work on all other servers I'm currently
   using for my
   hosting.
  
   So, since this is an eCommerce site for my client and they're 
   getting increasingly impatient with the progress made I'm 
 left with 
   little choice in this matter - as moving the site now would be 
   unthinkable, and tech
   support at the hosting company is less than stellar, and
   generally not in
   English.  Are there any obvious PHP settings that I'd need to
   adjust to
   ensure that Sessions can be carried forward to additional
   pages?  My only
   other option now is to force my client to login to each
   screen in the admin
   area (conceivably this could mean the client would need to
   log in to a
   minimum of 8 different pages to observe their records and
   make changes to
   the site).
  
   I'm at the point of desperation and sleep deprivation ... 
 If there 
   are no obvious PHP settings that need to be altered - what else
   could be producing
   this problem?
  
   Thanks
   -Tim
  
  
  
   --
   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] PHP Sessions

2003-01-21 Thread Jason Wong
On Tuesday 21 January 2003 17:39, Tim Thorburn wrote:
 Hi,

 I'm using PHP 4.1.2 on the server with problems - it's hosted on a shared
 server and thus I have no direct access to much of anything.  I have had
 this script running on versions 4.0.6 thru 4.2.2 with no problems until
 now.

 Here are the settings attained from phpinfo(); for the server that does not
 work - 4.1.2 ... and from the server that does work 4.2.2

 After the Configure Command of each is a list of settings that differ.

Again, does the simple example from the manual work? If it works we can 
eliminate config settings and concentrate on your code.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Endless the world's turn, endless the sun's spinning
Endless the quest;
I turn again, back to my own beginning,
And here, find rest.
*/


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




[PHP] $header = Location:........ being ignored!

2003-01-21 Thread Shams
Hi Group,

I basically have some simple code such as:

==

if ( $_POST['passwd'] != $db['password']
{header(Location: loginfailed.html);
}

//else

$header = Location: success.html;

==

however, when I run this code, using a FORM to submit password, username,
etc.. if the passwords do not match, the page is forwarded to
success.html !

Is there anything obvious that I am doing wrong?

Thanks,
Shams

p.s. I don't want to use else{} because I have lots of if() checks!



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




Re: [PHP] PHP Sessions

2003-01-21 Thread Tim Thorburn
Yes, the examples from the manual do work on the server using PHP 4.2.2 - 
however they do not work on the server using PHP 4.1.2.

I've been using this same script for many sites with PHP versions 4.0.6 
thru 4.2.2 with no problems until now which leads me to believe that I must 
attempt to change a PHP setting through .htaccess since it is hosted on a 
shared server.

I've tried the example from the manual on several other sites - works 
everywhere but on this problem server.

Thanks
-Tim

At 05:56 PM 1/21/2003 +0800, you wrote:
On Tuesday 21 January 2003 17:39, Tim Thorburn wrote:
 Hi,

 I'm using PHP 4.1.2 on the server with problems - it's hosted on a shared
 server and thus I have no direct access to much of anything.  I have had
 this script running on versions 4.0.6 thru 4.2.2 with no problems until
 now.

 Here are the settings attained from phpinfo(); for the server that does not
 work - 4.1.2 ... and from the server that does work 4.2.2

 After the Configure Command of each is a list of settings that differ.

Again, does the simple example from the manual work? If it works we can
eliminate config settings and concentrate on your code.

--
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Endless the world's turn, endless the sun's spinning
Endless the quest;
I turn again, back to my own beginning,
And here, find rest.
*/


--
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] $header = Location:........ being ignored!

2003-01-21 Thread Stain

try with exit() after header().

bye, stain.

Il 10:48, martedì 21 gennaio 2003, Shams ha scritto:
 Hi Group,

 I basically have some simple code such as:

 ==

 if ( $_POST['passwd'] != $db['password']
 {header(Location: loginfailed.html);
 }

 //else

 $header = Location: success.html;

 ==

 however, when I run this code, using a FORM to submit password, username,
 etc.. if the passwords do not match, the page is forwarded to
 success.html !

 Is there anything obvious that I am doing wrong?

 Thanks,
 Shams

 p.s. I don't want to use else{} because I have lots of if() checks!

-- 
If there is any, error is human

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




Re: [PHP] $header = Location:........ being ignored!

2003-01-21 Thread Tom Rogers
Hi,

Tuesday, January 21, 2003, 7:48:04 PM, you wrote:
S Hi Group,

S I basically have some simple code such as:

S ==

S if ( $_POST['passwd'] != $db['password']
S {header(Location: loginfailed.html);
S }

S //else

S $header = Location: success.html;

S ==

S however, when I run this code, using a FORM to submit password, username,
S etc.. if the passwords do not match, the page is forwarded to
S success.html !

S Is there anything obvious that I am doing wrong?

S Thanks,
S Shams

S p.s. I don't want to use else{} because I have lots of if() checks!




put exit(); after the failed header.

-- 
regards,
Tom


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




RE: [PHP] PHP Sessions

2003-01-21 Thread John W. Holmes
 Yes, the examples from the manual do work on the server using PHP
4.2.2 -
 however they do not work on the server using PHP 4.1.2.
 
 I've been using this same script for many sites with PHP versions
4.0.6
 thru 4.2.2 with no problems until now which leads me to believe that I
 must
 attempt to change a PHP setting through .htaccess since it is hosted
on a
 shared server.
 
 I've tried the example from the manual on several other sites - works
 everywhere but on this problem server.

Wasn't it 4.1.2 that had broken sessions? I remember one version that
came out that was just broke and you had to do a bunch of workarounds to
get things to work normally. Was that it?

Are you using the $_SESSION array or relying on register_globals?

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




RE: [PHP] PHP Sessions

2003-01-21 Thread Tim Thorburn
There is some discussion as to whether my globals are on or not ... I am 
using session_register to name my sessions, and then the global command 
later on on the individual pages to remember which session it is we're 
looking for.

It would be simply priceless if sessions were broken in 4.1.2 - and make 
much sense in the long run.

Thanks
-Tim

At 05:19 AM 1/21/2003 -0500, you wrote:
 Yes, the examples from the manual do work on the server using PHP
4.2.2 -
 however they do not work on the server using PHP 4.1.2.

 I've been using this same script for many sites with PHP versions
4.0.6
 thru 4.2.2 with no problems until now which leads me to believe that I
 must
 attempt to change a PHP setting through .htaccess since it is hosted
on a
 shared server.

 I've tried the example from the manual on several other sites - works
 everywhere but on this problem server.

Wasn't it 4.1.2 that had broken sessions? I remember one version that
came out that was just broke and you had to do a bunch of workarounds to
get things to work normally. Was that it?

Are you using the $_SESSION array or relying on register_globals?

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.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




Re: [PHP] PHP Sessions

2003-01-21 Thread Jason Wong
On Tuesday 21 January 2003 17:59, Tim Thorburn wrote:
 Yes, the examples from the manual do work on the server using PHP 4.2.2 -
 however they do not work on the server using PHP 4.1.2.

 I've been using this same script for many sites with PHP versions 4.0.6
 thru 4.2.2 with no problems until now which leads me to believe that I must
 attempt to change a PHP setting through .htaccess since it is hosted on a
 shared server.

 I've tried the example from the manual on several other sites - works
 everywhere but on this problem server.

It's time to see some code :)

Does sessions work at all for the other people on your shared server? Ask your 
host whether anybody else has complained.

 PHP 4.1.2 (doesn't work)
 '--enable-mm=shared' 

Would this have anything to do with it? Apparently there could be problems 
with storing sessions in mm:

  http://marc.theaimsgroup.com/?l=php-generalm=104311365417871w=2

Check in php.ini whether sessions are file based or using mm.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Goals... Plans... they're fantasies, they're part of a dream world...
-- Wally Shawn
*/


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




Re: [PHP] PHP Sessions

2003-01-21 Thread Justin French
on 21/01/03 9:25 PM, Tim Thorburn ([EMAIL PROTECTED]) wrote:

 There is some discussion as to whether my globals are on or not ... I am
 using session_register to name my sessions, and then the global command
 later on on the individual pages to remember which session it is we're
 looking for.

No no no... check the output of phpinfo(), or check your php.ini file to see
if the directive register_globals has a value of ON or OFF.

This is more than likely the problem I think.

Also check the same value on your local machine.

Justin


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




RE: [PHP] PHP Sessions

2003-01-21 Thread Ford, Mike [LSS]
 -Original Message-
 From: John W. Holmes [mailto:[EMAIL PROTECTED]]
 Sent: 21 January 2003 10:20
 
 Wasn't it 4.1.2 that had broken sessions? I remember one version that
 came out that was just broke and you had to do a bunch of 
 workarounds to
 get things to work normally. Was that it?

Yes, I believe you're right -- but on Windows only.  Sessions in that specific version 
of PHP were accidentally read-only -- so you could appear to set values in the 
session, but they'd never show up in subsequent pages...!

Bug reports http://bugs.php.net/bug.php?id=16043, http://bugs.php.net/bug.php?id=16102 
and http://bugs.php.net/bug.php?id=16202 are relevant.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] PHP Sessions

2003-01-21 Thread Rich Gray
Sorry I'm a bit late in on this thread but I know there is a problem with
sessions with 4.1.2 with IIS 5 over Win2K... is that your platform? I
encountered it a while back and there is a hack/workaround which I can dig
up if you need it...

HTH
Rich
-Original Message-
From: Tim Thorburn [mailto:[EMAIL PROTECTED]]
Sent: 21 January 2003 10:26
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] PHP Sessions


There is some discussion as to whether my globals are on or not ... I am
using session_register to name my sessions, and then the global command
later on on the individual pages to remember which session it is we're
looking for.

It would be simply priceless if sessions were broken in 4.1.2 - and make
much sense in the long run.

Thanks
-Tim


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




Re: [PHP] Re: Re: Freshmeat question

2003-01-21 Thread David T-G
Deco --

...and then De deco said...
% 
% I am not new to programming, just to scripting languages. I have seen that Perl has 
some high advanced sintaxes for string processing, for example, but I don't know if 
the same level can also be achieved in PHP...?

PHP is quite perl-ish, and supports some extended functions borrowed
straight from Perl.


% 
% As for the script below, could I run it inside a (my) browser? This could be in any 
browser?

A browser won't run a php script; in a web surfing context it's the
server that runs it, just like a mod_perl script.

Just like Perl, though, you can

  php /path/to/myscript.php

from the command line (if you built php to not only install a web server
module but also generate a standalone executable) and away you go.  You
might want to use -q to turn off the http header output.

So the short answer is no, but don't let it throw you.


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg93725/pgp0.pgp
Description: PGP signature


[PHP] serious problem with mbstring functions

2003-01-21 Thread Simon Dedeyne
When trying to do a search in a mbstring, I sometimes(!) get the following error:
 

Warning: mb_ereg_search()[function.mb-ereg-search]:mbregex compile err: premature end 
of regular expression in c:\myfile.php on line 12.

 
It's only the case for some strings. Why is this? I assume it must something related 
to the word itself interacting with the mbfunctions
I'm using PHP 4.3.0.
 
 
Thanks a lot!
Simon
 
 
 
Maybe this little file helps to see what i'm talking about: Copy  paste away
 
html
head
meta http-equiv=Content-Type content=Text/Html; Charset=UTF-8
titlecoding-problem/title
/head
body
?php
$examplesnt=わたしわ;
$word=愛犬;
//**FUNCTIONS***
function find_word($word,$sentence)
{ mb_ereg_search_init ($sentence);
$result=mb_ereg_search($word);
if($result==1){
echo $sentence contains $wordbr;
} 
return $result;
}
 
//MAIN**
/* Set internal character encoding to UTF-8 */
mb_internal_encoding(UTF-8);
/* Display current internal character encoding */
echo mb_internal_encoding().br; 
echo $examplesnt. is the example sentencebr;
echo $word. is the word we're looking for in the sentencebr;// i know the word is 
not in it, but that doesn't matter
find_word($word,$examplesnt);
?
/body
/html
 
 
 



RE: [PHP] DOWNLOAD

2003-01-21 Thread Timothy Hitchens \(HiTCHO\)
Change the link to form_download.php then create a file called
form_download.php and do this:

?php

header(Content-type: application/msword);
header(Content-Disposition: attachment; filename=form.doc); 
readfile(form.doc);
exit();

?

That will do it for you.

Also you should reply to all and include the list when replying so all
get to see
how to do these things.



Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: [EMAIL PROTECTED]


 -Original Message-
 From: Shaun van den Berg [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, 21 January 2003 8:19 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] DOWNLOAD
 
 
 Hi Timothy,
 
 I dont understand , im a rookie so go easy on me. I have a 
 form.doc file ! My code looks like this a 
 href=form.docclick to download/a, this was wat somebody 
 else told me to do , but when i click on the link it opens 
 the document in word rather than downloading it ? I dont 
 under stand these headers yet , do i need to configure the 
 ini file , can i do this with doc containing pics ect.
 
 Thanks
 Shaun
 
 - Original Message -
 From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED]
 To: 'Shaun van den Berg' [EMAIL PROTECTED]; 
 [EMAIL PROTECTED]
 Sent: Tuesday, January 21, 2003 11:44 AM
 Subject: RE: [PHP] DOWNLOAD
 
 
  Create a script that reads the contents of a file after sending 
  headers
  eg:
 
  header(Content-type: text/plain);
  header(Content-Disposition: attachment; filename=downloaded.txt); 
  readfile(downloaded.txt); exit();
 
  The downloaded.txt can be any file subject to sending the correct 
  headers and IE and other browsers will pop up a download (save) 
  window.
 
  See your mime.types file for headers for each file type.
 
 
  Timothy Hitchens (HiTCHO)
  Open Source Consulting
  e-mail: [EMAIL PROTECTED]
 
   -Original Message-
   From: Shaun van den Berg [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, 21 January 2003 4:39 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP] DOWNLOAD
  
  
   Hi ,
  
   Im not sure if this can be done in PHP , i know PHP has upload 
   features ! Does it have download features , wat i mean is the 
   following : i want a link - click here to download - when 
 you click 
   on it , the download dialog box must appear - how do i do this ?
  
   Thanks
   Shaun van den Berg
  
   --
   Novtel Consulting
   Tel: +27 21 9822373
   Fax: +27 21 9815846
   Please visit our website:
   www.novtel.co.za
  
  
  
   --
   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] $header = Location:........ being ignored!

2003-01-21 Thread Neil Freeman
Looks like you're missing a closing bracket on the IF statement as well.

Neil

Shams wrote:

**
This Message Was Virus Checked With : SAVI 3.61 September 2002 
Last Updated 17th January 2003
**

Hi Group,

I basically have some simple code such as:

==

if ( $_POST['passwd'] != $db['password']
{header(Location: loginfailed.html);
}

//else

$header = Location: success.html;

==

however, when I run this code, using a FORM to submit password, username,
etc.. if the passwords do not match, the page is forwarded to
success.html !

Is there anything obvious that I am doing wrong?

Thanks,
Shams

p.s. I don't want to use else{} because I have lots of if() checks!




--
--
 www.curvedvision.com
--


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




Re: [PHP] Help with Error, I am Trying!!

2003-01-21 Thread Chris Hewitt
Karl James wrote:


Parse error: parse error, unexpected '}' in
/home/virtual/site12/fst/var/www/html/Create_Account.php on line 5

http://www.ultimatefootballleague.com/Create_Account.phps

I'm Trying to get the values of the form to echo out and to insert into my
managers table.


If you don't see where the unexpected bracket is around line 5, then I 
suggest you post a few lines of code starting before line 5 here, and we 
will see if we can spot it.

Others may do differently, but on a dial-up line, I'm not going on-line 
to look at a URL often, so code pasted into you email would be likely to 
get more people looking at it. I'm afraid that there are just too many 
posts to do that.

Regards

Chris


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



Re: [PHP] Select multiple boxes

2003-01-21 Thread Chris Hewitt
John W. Holmes wrote:



How does php know what suitable form data is?

I guess it could look for multiple names in the GET or POST data. But
then that would mean for every variable it goes to create, it would have
to go and look if it's already created one by that name. If it did,
erase the old one and make these two an array now. 

I guess this is what Oracle 8i must do since if there is more than one 
element of the same name then an array is automatically made. Seems fine 
except that the special case of when you are expecting more than one but 
only one exists. It is no longer an array. Either extra code to handle 
it, or what I often do is add a hidden dummy element of the same name to 
force an array.

Rather than doing that, it can just look for [] in the name and it knows
to make that an array.


All in all, I think the [] syntax ends up with less work for me to do. 
So IMHO I feel PHP has it right.

Regards

Chris



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



[PHP] ADV SQL Help Needed.

2003-01-21 Thread [-^-!-%-

Hello everyone,

I need help with the following query.

I have a table with a column named 'RISK_LEVEL'.
RISK_LEVEL can hold three values: Low, Moderate, and High.

I need a query that counts the number of occurences of each option.
Now, I know I can do

'select count(risk_level) as levelCount where risk_level=low'

for each level (low, moderate, and high). But, I was wondering if there's
anyway to merge the queries into one.

I'm looking for something like

select count(risk_level='low') as lowCount, count(risk_level='moderate')as
modCount, count(risk_level='high') as highCount 

Which will return, lowCount = 1 , modCount=3, and highCount=1, for table
with

 id | risk_level
 1  | low
 2  | moderate
 3  | moderate
 4  | high
 5  | moderate

How do you do it? Can tha be done?

When I run the code above, I get the same number for each record. i.e.
lowCount, modCount, and highCount all come out to 5--which is the number
of records in the table.

Is this possible, or should I just run multiple queries?
Please help.


=P e p i e  D e s i g n s
 www.pepiedesigns.com
 Providing Solutions That Increase Productivity

 Web Developement. Database. Hosting. Multimedia.




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




Fw: [PHP] DOWNLOAD

2003-01-21 Thread Rick Emery
Neither HTML nor PHP open the download (Save/Save As) dialog.  This is a function of 
the browser
upon clicking any file link, other than an HTML file.

- Original Message -
From: Shaun van den Berg [EMAIL PROTECTED]
To: 
Sent: Tuesday, January 21, 2003 12:39 AM
Subject: [PHP] DOWNLOAD


Hi ,

Im not sure if this can be done in PHP , i know PHP has upload features !
Does it have download features , wat i mean is the following : i want a
link - click here to download - when you click on it , the download dialog
box must appear - how do i do this ?

Thanks
Shaun van den Berg

--
Novtel Consulting
Tel: +27 21 9822373
Fax: +27 21 9815846
Please visit our website:
www.novtel.co.za



--
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] Help with e-mail

2003-01-21 Thread Dankshit
Is there a way to autenticate an SMTP server in my PHP.ini???

In my development site, i need to autenticate a SMTP, but in the PHP.INI does not have 
an option to autenticate..does anybody has any solution for this??


Thanks, Rodrigo


Equipe Pratic Sistemas
Rodrigo Corrêa
Fone: (14) 441-1700
[EMAIL PROTECTED]
[EMAIL PROTECTED] 
 




Re: [PHP] Help with e-mail

2003-01-21 Thread Jason Wong
On Tuesday 21 January 2003 20:13, Dankshit wrote:
 Is there a way to autenticate an SMTP server in my PHP.ini???

 In my development site, i need to autenticate a SMTP, but in the PHP.INI
 does not have an option to autenticate..does anybody has any solution for
 this??


There is at least one class at www.phpclasses.org which allows you to use 
SMTP-AUTH.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
You buttered your bread, now lie in it.
*/


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




Re: [PHP] ADV SQL Help Needed.

2003-01-21 Thread Tim Ward
off the top of my head
SELECT risk_level, COUNT(risk_level) AS rl_count GROUP BY risk_level
should do it, though I'd have to experiment with what's inside the
COUNT().

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message -
From: [-^-!-%- [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, January 21, 2003 12:06 PM
Subject: [PHP] ADV SQL Help Needed.



 Hello everyone,

 I need help with the following query.

 I have a table with a column named 'RISK_LEVEL'.
 RISK_LEVEL can hold three values: Low, Moderate, and High.

 I need a query that counts the number of occurences of each option.
 Now, I know I can do

 'select count(risk_level) as levelCount where risk_level=low'

 for each level (low, moderate, and high). But, I was wondering if there's
 anyway to merge the queries into one.

 I'm looking for something like

 select count(risk_level='low') as lowCount,
count(risk_level='moderate')as
 modCount, count(risk_level='high') as highCount 

 Which will return, lowCount = 1 , modCount=3, and highCount=1, for table
 with

  id | risk_level
  1  | low
  2  | moderate
  3  | moderate
  4  | high
  5  | moderate

 How do you do it? Can tha be done?

 When I run the code above, I get the same number for each record. i.e.
 lowCount, modCount, and highCount all come out to 5--which is the number
 of records in the table.

 Is this possible, or should I just run multiple queries?
 Please help.


 =P e p i e  D e s i g n s
  www.pepiedesigns.com
  Providing Solutions That Increase Productivity

  Web Developement. Database. Hosting. Multimedia.




 --
 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] Adding a variable to oracle that contains quotation marks??

2003-01-21 Thread Rea_David
Hi All,

I'm trying to add a variable to an oracle database but it fails due
to the fact that it contains quotation marks.  These have to be present for
the end user. My Script is as follows:
===
if ($conn == true)
{

$query = UPDATE ACTIVITY
SET COMMENTS = '$updatecomments' WHERE ACTIVITY_ID =
'$actcode';
$cursor = Ora_Open ($conn);
$result = Ora_Parse ($cursor, $query); 
$result = Ora_Exec ($cursor); 

ora_close($cursor);
Ora_Logoff($conn);
} 
===

Can anyone tell me what to do!

Thank you 
Dave

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




Re: [PHP] Adding a variable to oracle that contains quotation marks??

2003-01-21 Thread Rick Emery
$query = UPDATE ACTIVITY SET COMMENTS = \'$updatecomments\' WHERE ACTIVITY_ID 
=\'$actcode\';

- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, January 21, 2003 6:53 AM
Subject: [PHP] Adding a variable to oracle that contains quotation marks??


Hi All,

I'm trying to add a variable to an oracle database but it fails due
to the fact that it contains quotation marks.  These have to be present for
the end user. My Script is as follows:
===
if ($conn == true)
{

$query = UPDATE ACTIVITY
SET COMMENTS = '$updatecomments' WHERE ACTIVITY_ID =
'$actcode';
$cursor = Ora_Open ($conn);
$result = Ora_Parse ($cursor, $query); 
$result = Ora_Exec ($cursor); 

ora_close($cursor);
Ora_Logoff($conn);
} 
===

Can anyone tell me what to do!

Thank you 
Dave

-- 
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] Adding a variable to oracle that contains quotation marks??

2003-01-21 Thread Henry
Once you use double quota mark the character BackSlash doesn't need anymore
that's my experience ^_^

- Original Message -
From: Rick Emery [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, January 21, 2003 8:56 PM
Subject: Re: [PHP] Adding a variable to oracle that contains quotation
marks??


 $query = UPDATE ACTIVITY SET COMMENTS = \'$updatecomments\' WHERE
ACTIVITY_ID =\'$actcode\';

 - Original Message -
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, January 21, 2003 6:53 AM
 Subject: [PHP] Adding a variable to oracle that contains quotation marks??


 Hi All,

 I'm trying to add a variable to an oracle database but it fails due
 to the fact that it contains quotation marks.  These have to be present
for
 the end user. My Script is as follows:
 ===
 if ($conn == true)
 {

 $query = UPDATE ACTIVITY
 SET COMMENTS = '$updatecomments' WHERE ACTIVITY_ID =
 '$actcode';
 $cursor = Ora_Open ($conn);
 $result = Ora_Parse ($cursor, $query);
 $result = Ora_Exec ($cursor);

 ora_close($cursor);
 Ora_Logoff($conn);
 }
 ===

 Can anyone tell me what to do!

 Thank you
 Dave

 --
 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] Multi-Byte String Functions

2003-01-21 Thread Naqashzade, Sadeq
Hi all,
I'm newbie of PHP. Can any one help me and explain how can use Multi-Byte
String Functions?
My national language is Farsi and I force to use UTF-8 for my works. but I
have several problem when I need use it in PHP. I think Multi-Byte String
Functions are designed for some ones like me. but I can not use it :-(

I'm using Windows 2000 and Apache 1.3 plus PHP installed as module on my PC.

-Sadeq



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




[PHP] changing a key in an array

2003-01-21 Thread David T-G
Hi, all --

If I have an associative array

  Array
  (
  [t] = Array
  (
  [t1] = temp1
  [t2] = temp2
  )
  
  [f] = Array
  (
  [f1] = foo1
  [f2] = foo2
  )
  
  )

and I want to change the key 't' to, say, 'tmp', is there a way to change
it or do I have to use the brute force

  $a[tmp] = $a[t] ;
  unset $a[t] ;

approach?

I expect that, however it's done, it works the same way on just a 1-d
assoc array like

  Array
  (
[t1] = temp1
[t2] = temp2
  )

but in particular I have the 2-d array case that I need to play with
today.


TIA  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg93740/pgp0.pgp
Description: PGP signature


[PHP] odbc..

2003-01-21 Thread Edward Peloke
Hello all,

I know I can connect to another db through an odbc connection in php.  Can I
use php to create the connection initially?  I will be uploading an access
db from the users and then moving the data over into my mysql db.  Since
this will all be done automatically, I will need php to upload the
file,create the odbc connection, connect, pump over the data, then delete
the connection.

Thanks,
Eddie


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




[PHP] re-ordering keys in an array

2003-01-21 Thread David T-G
Hi, all --

If I have an associative array $a like

  Array
  (
[t] = temp1
[u] = ugh
[m] = moo
  )

is there any way to re-order the keys so that

  foreach (array_keys($a) as $k)
{ print $k\n ; }

will print

  t
  m
  u

for me?  At the moment it seems my only option is

  sort(array_keys($a))

and that's a start but finding another order spec would be lovely...


TIA  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg93742/pgp0.pgp
Description: PGP signature


[PHP] Form Validating Class (OOP misunderstandings...)

2003-01-21 Thread Nicholas Wieland
Hello everybody,
I'm working on a class but having a lot of problems... probably my 
understanding of PhP-OOP is not so good ...
Here's the class: I found it on the web and I've tried to personalize 
it to fit my needs...

?php

class FormV
{
	var $errorList;
	 
	function FormV()
	{
		$this-reset_errorList();
	}
	 
	function getValue( $field )
	{
		$value = $HTTP_POST_VARS[ $field ];
		return $value;
	}
	 
	function isEmpty( $field, $msg )
	{
		$value = $this-getValue( $field );
		 
		if( trim( $value ) ==  )
		{
			$this-errorList[] = array( field = $field, 
value = $value, msg = $msg );
			return true;
		} 	 
		else
			return false;
	 
	}
	 
	function isString( $field, $msg )
	{
		$value = $this-getValue( $field );
		 
		if( is_string( $value ) )
			return true;
		 
		else
		{
			$this-errorList[] = array( field = $field, 
value = $value, msg = $msg );
			return false;
		}
	}
		 
	function isEmail( $field, $msg )
	{
		$value = $this-getValue( $field );
		$pattern = 
/^([a-zA-Z0-9])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/;
		 
		if( preg_match( $pattern, $value ) )
			return true;
			 
		else
		{
			$this-errorList[] = array( field = $field, 
value = $value, msg = $msg );
			return false;
		}
	}
	 
	function isError()
	{
		if( sizeof( $this-errorList )  0 )
			return true;
			 
		else
			return false;
	}
	 
	function get_errorList()
	{
		return $this-errorList;
	}
	 
	function reset_errorList()
	{
		$this-errorList = array();
	}
	 
	function stringConvert( $field )
	{
		$value = $this-getValue( $field );
		 
		$value = html_special_chars( $value );
		 
		$value = stripslashes( $value );
		 
		$value = strtolower( $value );
		 
		return $value;
	}
	 
};

?

Ok.
I think that the getter is *totally* wrong but I'm not able to debug 
it, because it's private (I think...). Also the stringConvert() method 
sucks, maybe I'll split it in some others accessor methods, for a 
better design.
Now I'm totally lost, I don't have a clue how to continue, I've tried 
for hours and hours to make it work, but didn't succeed :(
Any suggestion on improving and other enhancment for a good form 
validating class is really really appreciated.

TIA,
	Nicholas

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



Re: [PHP] re-ordering keys in an array

2003-01-21 Thread Jason k Larson
There are many pre-defined functions to manipulate the sort order of 
arrays and it's keys.  However sometimes, to fit special needs, you just 
have to do it manually.  Here's the useful PHP reference manual links to 
better understand what's available.

http://www.php.net/manual/en/ref.array.php

http://www.php.net/manual/en/function.asort.php
http://www.php.net/manual/en/function.arsort.php

http://www.php.net/manual/en/function.ksort.php
http://www.php.net/manual/en/function.krsort.php

http://www.php.net/manual/en/function.usort.php
http://www.php.net/manual/en/function.uksort.php


HTH,
Jason k Larson


David T-G wrote:
Hi, all --

If I have an associative array $a like

  Array
  (
[t] = temp1
[u] = ugh
[m] = moo
  )

is there any way to re-order the keys so that

  foreach (array_keys($a) as $k)
{ print $k\n ; }

will print

  t
  m
  u

for me?  At the moment it seems my only option is

  sort(array_keys($a))

and that's a start but finding another order spec would be lovely...


TIA  HAND

:-D




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




Re: [PHP] changing a key in an array

2003-01-21 Thread Jason k Larson
My first question back would be why you create on array with keys you 
know you want to change, or why in that case it became necessary to 
dereference the original key.

$a['tmp'] = $a['t']; // exact same values by reference (no copy)

Only other way I can think of at the moment is to create a copy and 
unset the original as you described as brute force.

HTH,
Jason k Larson


David T-G wrote:
Hi, all --

If I have an associative array

  Array
  (
  [t] = Array
  (
  [t1] = temp1
  [t2] = temp2
  )
  
  [f] = Array
  (
  [f1] = foo1
  [f2] = foo2
  )
  
  )

and I want to change the key 't' to, say, 'tmp', is there a way to change
it or do I have to use the brute force

  $a[tmp] = $a[t] ;
  unset $a[t] ;

approach?

I expect that, however it's done, it works the same way on just a 1-d
assoc array like

  Array
  (
[t1] = temp1
[t2] = temp2
  )

but in particular I have the 2-d array case that I need to play with
today.


TIA  HAND

:-D



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




RE: [PHP] Form Validating Class (OOP misunderstandings...)

2003-01-21 Thread Rich Gray
PHP does not yet support private methods ... your problem with getValue() is
most probably because register_globals is off in your php.ini try
substituting $_POST[] for $HTTP_POST_VARS[] and it may start to work...
HTH
Rich

-Original Message-
From: Nicholas Wieland [mailto:[EMAIL PROTECTED]]
Sent: 21 January 2003 14:13
To: [EMAIL PROTECTED]
Subject: [PHP] Form Validating Class (OOP misunderstandings...)


Hello everybody,
I'm working on a class but having a lot of problems... probably my
understanding of PhP-OOP is not so good ...
Here's the class: I found it on the web and I've tried to personalize
it to fit my needs...

?php

class FormV
{
var $errorList;

function FormV()
{
$this-reset_errorList();
}

function getValue( $field )
{
$value = $HTTP_POST_VARS[ $field ];
return $value;
}

function isEmpty( $field, $msg )
{
$value = $this-getValue( $field );

if( trim( $value ) ==  )
{
$this-errorList[] = array( field = $field,
value = $value, msg = $msg );
return true;
}
else
return false;

}

function isString( $field, $msg )
{
$value = $this-getValue( $field );

if( is_string( $value ) )
return true;

else
{
$this-errorList[] = array( field = $field,
value = $value, msg = $msg );
return false;
}
}

function isEmail( $field, $msg )
{
$value = $this-getValue( $field );
$pattern =
/^([a-zA-Z0-9])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/;

if( preg_match( $pattern, $value ) )
return true;

else
{
$this-errorList[] = array( field = $field,
value = $value, msg = $msg );
return false;
}
}

function isError()
{
if( sizeof( $this-errorList )  0 )
return true;

else
return false;
}

function get_errorList()
{
return $this-errorList;
}

function reset_errorList()
{
$this-errorList = array();
}

function stringConvert( $field )
{
$value = $this-getValue( $field );

$value = html_special_chars( $value );

$value = stripslashes( $value );

$value = strtolower( $value );

return $value;
}

};

?

Ok.
I think that the getter is *totally* wrong but I'm not able to debug
it, because it's private (I think...). Also the stringConvert() method
sucks, maybe I'll split it in some others accessor methods, for a
better design.
Now I'm totally lost, I don't have a clue how to continue, I've tried
for hours and hours to make it work, but didn't succeed :(
Any suggestion on improving and other enhancment for a good form
validating class is really really appreciated.

TIA,
Nicholas


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




Re: [PHP] changing a key in an array

2003-01-21 Thread David T-G
Jason --

...and then Jason k Larson said...
% 
% My first question back would be why you create on array with keys you 
% know you want to change, or why in that case it became necessary to 
% dereference the original key.

A fair question :-)

I'm writing a picture gallery add-on which will allow users to create
favorite pictures baskets.  For each basket, the user throws in a bunch
of pictures in an array.  Then I make an array of baskets, where the name
of the basket is the key and the array that is the basket is the value.

When a user wants to rename a basket, the new version of that basket
appaers at the bottom of the list instead of in its original place --
wherever that was.


% 
% $a['tmp'] = $a['t']; // exact same values by reference (no copy)

I don't think I can do this, since I eventually save the array of arrays
to a file for the user to reload on another visit.  Thanks, though.


% 
% Only other way I can think of at the moment is to create a copy and 
% unset the original as you described as brute force.

Ah.  Well, that's what they get, then :-)


% 
% HTH,
% Jason k Larson


Thanks  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg93747/pgp0.pgp
Description: PGP signature


[PHP] Page Rendering

2003-01-21 Thread Bill Arbuckle, Jr.
Hi all.  I am having some problems with a script which reads information
from a database and creates a table.  It works in IE but not Netscape.  I
call myself going through the tags to make sure all that were open were
closed because Netscape doesn't like unfinished business.  What I have is a
script that outputs the previous page, 1, 2, ..., next page link (if there
are more than x table items per page).  It has worked in both browsers but
now I have broke something. :o)  Any ideas are appreciated.  The code is
like this ...

?php

function pagelinks($prev_page, $num_pages, $next_page, $page) {

  // This displays the Previous link
  if ($prev_page)  {
echo a
href=\$PHP_SELF?page=$prev_page\lt;nbsp;Prev/anbsp;|nbsp;;
  }

  // No need to output the page number if there is only one page
  if ($num_pages1) {
for ($i = 1; $i = $num_pages; $i++) {
  if ($i != $page) {
echo  a href=$PHP_SELF?page=$i$i/a;
  } else {
echo  $i ;
  }
}
  }

  // Display the Next link.
  if ($page != $num_pages) {
   echo nbsp;|nbsp;a
href=\$PHP_SELF?page=$next_page\nbsp;Nextnbsp;gt;/a ;
  }
}

?

This code is at the top of an include file which is included in pics.php.
It seems that $PHP_SELF is interpreted differently in *some* instances
between the two browsers.  I can't figure it out because PHP_SELF is a
server side evaluation.  The links are output correctly in IE ...
http://www.xyz.com/pics.php?page=2 ... but in Netscape I get ...
http://www.xyz.com/?page=2  I had this problem once before and inadvertently
fixed it with something else that I was doing.  Any hints are appreciated.

TIA,

Bill



Re: [PHP] re-ordering keys in an array

2003-01-21 Thread David T-G
Jason, et al --

...and then Jason k Larson said...
% 
% There are many pre-defined functions to manipulate the sort order of 
% arrays and it's keys.  However sometimes, to fit special needs, you just 
% have to do it manually.  Here's the useful PHP reference manual links to 
% better understand what's available.
% 
% http://www.php.net/manual/en/ref.array.php
% 
% http://www.php.net/manual/en/function.asort.php
% http://www.php.net/manual/en/function.arsort.php
% 
% http://www.php.net/manual/en/function.ksort.php
% http://www.php.net/manual/en/function.krsort.php
% 
% http://www.php.net/manual/en/function.usort.php
% http://www.php.net/manual/en/function.uksort.php

Thanks for the pointers.  All of those are great (I hadn't read up on
asort yet; quite nice, and I may offer a sort these pictures by name
option based on that or a nat sort) but don't help me with the problem of
reordering keys based on a position, and I don't think I want to try
writing the sort function that will take arbitrary input and spit it back
out with the purpose of moving a single key around :-)


% 
% 
% HTH,
% Jason k Larson


Thanks  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg93749/pgp0.pgp
Description: PGP signature


[PHP] Input field array ends up as Array string

2003-01-21 Thread Dan Delaney
Hi every body. I have a form that was originally working just fine. It 
had a series of input checkboxes with the same name (interests[]). 
These values then ended up in an array ($_POST['interests']), which I 
then imploded into a comma separated list ($interests = implode(', ', 
$_POST['interests']); ). Well, that was working just fine until 
yesterday when I started getting an error on that implode function 
(Bad arguments to implode()). So I did a gettype on 
$_POST['interests'] and it revealed that it is now ending up as a 
string variable. So I printed it and it contains the string Array!

Anyone know what's going on here?

Thanks
--Dan


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



Re: [PHP] Input field array ends up as Array string

2003-01-21 Thread Rick Emery
show us code
- Original Message - 
From: Dan Delaney [EMAIL PROTECTED]
To: 
Sent: Tuesday, January 21, 2003 8:33 AM
Subject: [PHP] Input field array ends up as Array string


Hi every body. I have a form that was originally working just fine. It 
had a series of input checkboxes with the same name (interests[]). 
These values then ended up in an array ($_POST['interests']), which I 
then imploded into a comma separated list ($interests = implode(', ', 
$_POST['interests']); ). Well, that was working just fine until 
yesterday when I started getting an error on that implode function 
(Bad arguments to implode()). So I did a gettype on 
$_POST['interests'] and it revealed that it is now ending up as a 
string variable. So I printed it and it contains the string Array!

Anyone know what's going on here?

Thanks
--Dan


-- 
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] Form Validating Class (OOP misunderstandings...)

2003-01-21 Thread Joseph W. Goff
For the most part I found two errors
The first was a scope problem.  $HTTP_*_VARS hashes are not accessible
inside functions unless you source them in.  i.e. global
The other was an extra line in an if statement that did not contain braces.
I did a little formating while I checked the code.  Try this to see if it
works as you expected it to.
?php
class FormV {
var $errorList;

function FormV() {
$this-reset_errorList();
}

function getValue($field) {
global $HTTP_POST_VARS;
return $HTTP_POST_VARS[$field];
}

function isEmpty($field, $msg) {
$value = $this-getValue($field);
if(!trim($value)) {
$this-errorList[] = array('field'=$field,
'value'=$value, 'msg'=$msg);
return true;
} else
return false;
}

function isString($field, $msg) {
$value = $this-getValue($field);
if(is_string($value))
return true;
else {
$this-errorList[] = array('field'=$field,
'value'=$value,'msg'=$msg);
return false;
}
}

function isEmail($field, $msg) {
$value = $this-getValue($field);
$pattern = '/^([a-zA-Z0-9])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/';
if(preg_match($pattern, $value))
return true;
else {
$this-errorList[] = array('field'=$field,
'value'=$value, 'msg'=$msg);
return false;
}
}

function isError() {
if(sizeof($this-errorList)  0)
return true;
else
return false;
}

function get_errorList() {
return $this-errorList;
}

function reset_errorList() {
$this-errorList = array();
}

function stringConvert($field) {
$value = $this-getValue($field);
$value = html_special_chars($value);
$value = stripslashes($value);
$value = strtolower($value);

return $value;
}
}
?


- Original Message -
From: Nicholas Wieland [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, January 21, 2003 8:12 AM
Subject: [PHP] Form Validating Class (OOP misunderstandings...)


 Hello everybody,
 I'm working on a class but having a lot of problems... probably my
 understanding of PhP-OOP is not so good ...
 Here's the class: I found it on the web and I've tried to personalize
 it to fit my needs...

 ?php

 class FormV
 {
 var $errorList;

 function FormV()
 {
 $this-reset_errorList();
 }

 function getValue( $field )
 {
 $value = $HTTP_POST_VARS[ $field ];
 return $value;
 }

 function isEmpty( $field, $msg )
 {
 $value = $this-getValue( $field );

 if( trim( $value ) ==  )
 {
 $this-errorList[] = array( field = $field,
 value = $value, msg = $msg );
 return true;
 }
 else
 return false;

 }

 function isString( $field, $msg )
 {
 $value = $this-getValue( $field );

 if( is_string( $value ) )
 return true;

 else
 {
 $this-errorList[] = array( field = $field,
 value = $value, msg = $msg );
 return false;
 }
 }

 function isEmail( $field, $msg )
 {
 $value = $this-getValue( $field );
 $pattern =
 /^([a-zA-Z0-9])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/;

 if( preg_match( $pattern, $value ) )
 return true;

 else
 {
 $this-errorList[] = array( field = $field,
 value = $value, msg = $msg );
 return false;
 }
 }

 function isError()
 {
 if( sizeof( $this-errorList )  0 )
 return true;

 else
 return false;
 }

 function get_errorList()
 {
 return $this-errorList;
 }

 function reset_errorList()
 {
 $this-errorList = array();
 }

 function stringConvert( $field )
 {
 $value = $this-getValue( $field );

 $value = html_special_chars( $value );

 $value = stripslashes( $value );

 $value = strtolower( $value );

 return $value;
 }

 };

 ?

 Ok.
 I think that the getter is *totally* wrong but I'm not able to debug
 it, because it's private (I think...). Also the stringConvert() method
 sucks, maybe I'll split it in some others accessor methods, for a
 better design.
 Now I'm totally lost, I don't have a clue how to continue, I've tried
 for hours and hours to make it work, but didn't succeed :(
 Any suggestion on improving and other enhancment for a good form
 validating class is really really appreciated.

 TIA,
 Nicholas

 --
 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] No data being found

2003-01-21 Thread Roddie Grant
I have a small site in development which takes details of coming church
services from a MySQL database. This bit is at the bottom of
http://www.rugbyurc.org.uk/spirit/spirit_intro.php (hosted by an ISP) and
works fine.

I've just got OSX working on my Mac and want to get the site running on that
so that I can develop it further. I am using the code below (this is a much
reduced version of what's on the live site), but getting no data. Nor am I
getting any error message.

I can access and use the database from Terminal. I can also get the data
from the same query using Lasso (a middleware program similar to php), so I
know the data is there to be found.

Any suggestions about why the data is not showing up in the browser with php
will be much appreciated.

table border=0

?php
  $userName='xxx';
  $pswd='yyy';
  error_reporting(E_ALL);
   
  require_once('DB.php');
  $db =  DB::connect(Mysql://$userName:$[EMAIL PROTECTED]/rurcdb);

  if (DB::iserror($db)) {
  die($db-getMessage());
  }

  $sql =  SELECT speaker
  FROM rurcdb.diary;

  $q = $db-query($sql);
  if (DB::iserror($q)){
  die($q-getMessage());
  }
  while ($q-fetchInto($row)){
  echo trtd.($row[0])./td/tr;
  }
?
/table

Roddie Grant
[EMAIL PROTECTED]


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




Re: [PHP] Page Rendering

2003-01-21 Thread Rick Emery
$PHP_SELF is not interpreted by the browser.  The browser shows only what is sent to 
it; PHP
variables are not sent to the browser.

Take the simple solution: don't use PHP_SELF; just use the file name

- Original Message -
From: Bill Arbuckle, Jr. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, January 21, 2003 8:26 AM
Subject: [PHP] Page Rendering


Hi all.  I am having some problems with a script which reads information
from a database and creates a table.  It works in IE but not Netscape.  I
call myself going through the tags to make sure all that were open were
closed because Netscape doesn't like unfinished business.  What I have is a
script that outputs the previous page, 1, 2, ..., next page link (if there
are more than x table items per page).  It has worked in both browsers but
now I have broke something. :o)  Any ideas are appreciated.  The code is
like this ...

?php

function pagelinks($prev_page, $num_pages, $next_page, $page) {

  // This displays the Previous link
  if ($prev_page)  {
echo a
href=\$PHP_SELF?page=$prev_page\lt;nbsp;Prev/anbsp;|nbsp;;
  }

  // No need to output the page number if there is only one page
  if ($num_pages1) {
for ($i = 1; $i = $num_pages; $i++) {
  if ($i != $page) {
echo  a href=$PHP_SELF?page=$i$i/a;
  } else {
echo  $i ;
  }
}
  }

  // Display the Next link.
  if ($page != $num_pages) {
   echo nbsp;|nbsp;a
href=\$PHP_SELF?page=$next_page\nbsp;Nextnbsp;gt;/a ;
  }
}

?

This code is at the top of an include file which is included in pics.php.
It seems that $PHP_SELF is interpreted differently in *some* instances
between the two browsers.  I can't figure it out because PHP_SELF is a
server side evaluation.  The links are output correctly in IE ...
http://www.xyz.com/pics.php?page=2 ... but in Netscape I get ...
http://www.xyz.com/?page=2  I had this problem once before and inadvertently
fixed it with something else that I was doing.  Any hints are appreciated.

TIA,

Bill



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




[PHP] download script

2003-01-21 Thread Martin
i need a script that make downloads from files but it must support resuming
for getright and download acelerator pro.
Thanks...
I have this classic download script , but does not support resuming
   error_reporting(0);
   header(Last-Modified:  . gmdate(D, d M Y H:i:s T,
filemtime($filename)));
   header(Accept-Ranges: bytes);
   header(Content-Length:  . filesize($filename));
   header(Content-Disposition: attachment; filename= . $download);
// header(Content-Type: application/octet-stream);
   readfile($filename);
   header(Connection: close);



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




Re: [PHP] Input field array ends up as Array string

2003-01-21 Thread Leon Mergen

Rick Emery [EMAIL PROTECTED] wrote in message
024801c2c15b$1a770e70$0500a8c0@honeybee">news:024801c2c15b$1a770e70$0500a8c0@honeybee...
 show us code

Learn how to quote. :)



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




Re: [PHP] Page Rendering

2003-01-21 Thread Jason Wong
On Tuesday 21 January 2003 22:26, Bill Arbuckle, Jr. wrote:

 This code is at the top of an include file which is included in pics.php.
 It seems that $PHP_SELF is interpreted differently in *some* instances
 between the two browsers.  I can't figure it out because PHP_SELF is a
 server side evaluation.  The links are output correctly in IE ...
 http://www.xyz.com/pics.php?page=2 ... but in Netscape I get ...
 http://www.xyz.com/?page=2  I had this problem once before and
 inadvertently fixed it with something else that I was doing.  Any hints are
 appreciated.

Most likely $PHP_SELF is in fact blank. If you're using a relatively new 
version of PHP use $_SERVER['PHP_SELF'] instead.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
On the road, ZIPPY is a pinhead without a purpose, but never without a POINT.
*/


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




[PHP] str_replace an include

2003-01-21 Thread jesse
Hello all,

I'm trying to replace a tag with an include in a template scenario.  For 
 example:

str_replace(!--linkTag--!, include links.php, $string);

This obviously doesn't work, but I'm wondering if anybody knows of a 
good way to do this.

Thanks a bunch,

Jesse Lawrence


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



Re: [PHP] Input field array ends up as Array string

2003-01-21 Thread Jason Wong
On Tuesday 21 January 2003 22:33, Dan Delaney wrote:
 Hi every body. I have a form that was originally working just fine. It
 had a series of input checkboxes with the same name (interests[]).
 These values then ended up in an array ($_POST['interests']), which I
 then imploded into a comma separated list ($interests = implode(', ',
 $_POST['interests']); ). Well, that was working just fine until
 yesterday when I started getting an error on that implode function
 (Bad arguments to implode()). So I did a gettype on
 $_POST['interests'] and it revealed that it is now ending up as a
 string variable. So I printed it and it contains the string Array!

 Anyone know what's going on here?

Undo any configuration changes made recently, downgrade any recent upgrades 
etc. To paraphrase Newtown's First Law of Motion:

Any working system tends to remain in that state unless external force is 
applied to it.

So what was it that you did yesterday to cause it stop working?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Isn't it nice that people who prefer Los Angeles to San Francisco live there?
-- Herb Caen
*/


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




Re: [PHP] Page Rendering

2003-01-21 Thread David T-G
Bill --

...and then Bill Arbuckle, Jr. said...
% 
...
% This code is at the top of an include file which is included in pics.php.
% It seems that $PHP_SELF is interpreted differently in *some* instances
% between the two browsers.  I can't figure it out because PHP_SELF is a

Dunno much about your code (I haven't taken the time to really read it),
but you could be missing pics.php under NS if the server will hand that
up as a default index name (or if you have an index.php as a copy).  That
is,

  http://www.xyz.com/

might be a perfectly valid link to your script.  Meanwhile, you're right
that PHP_SELF (in either form) is a server-side variable and the browser
won't ever see it.

Worth checking out just to be sure...


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg93760/pgp0.pgp
Description: PGP signature


RE: [PHP] download script

2003-01-21 Thread Timothy Hitchens \(HiTCHO\)
I have never done a script that supports resume but this is the logic
you need to follow to work out the protocol behaviour.

- Create a download script as per below start downloading then stop the
web server.
- Change the script to e-mail you the headers from the script request.
- Restart the web server and tell Get Right to resume.

You should now know what it sends and you simply need to read in the
file to that point
in the data and start the stream again.

I hope this helps. (Trial and Error)


Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: [EMAIL PROTECTED]

 -Original Message-
 From: Martin [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, 22 January 2003 12:50 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] download script
 
 
 i need a script that make downloads from files but it must 
 support resuming for getright and download acelerator pro. 
 Thanks... I have this classic download script , but does not 
 support resuming
error_reporting(0);
header(Last-Modified:  . gmdate(D, d M Y H:i:s T, 
 filemtime($filename)));
header(Accept-Ranges: bytes);
header(Content-Length:  . filesize($filename));
header(Content-Disposition: attachment; filename= . 
 $download);
 // header(Content-Type: application/octet-stream);
readfile($filename);
header(Connection: close);
 
 
 
 -- 
 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: str_replace an include

2003-01-21 Thread J Smith

I'd recommend looking at the output buffering functions. Something like this 
would probably work...

ob_start();
include(links.php);
$file = ob_get_contents();
ob_end_clean();

The result of parsing and executing links.php will be in $file. Do with it 
what you will.

J


Jesse wrote:

 Hello all,
 
 I'm trying to replace a tag with an include in a template scenario.  For
   example:
 
 str_replace(!--linkTag--!, include links.php, $string);
 
 This obviously doesn't work, but I'm wondering if anybody knows of a
 good way to do this.
 
 Thanks a bunch,
 
 Jesse Lawrence


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




RE: [PHP] Adding a variable to oracle that contains quotation marks??

2003-01-21 Thread Rea_David
Thanks Rick  Henry, but I am still unable to add single quotation marks '.
When I added the \' to the variable as given below (thanks again Rick) I get
the following error when trying to add anything, regardless of ':

Warning: Ora_Parse failed (ORA-00911: invalid character -- while processing
OCI function OPARSE) in
/services/apache_1.3.22/www-dev/isg/isg_tools/activitytracker/admin/selectac
tivity.php on line 28

Perhaps I'm missing something very small? I have done a stripslash on the
variable also, but with no extra success!

Any ideas?
Dave

P.S. Henry, the double quotation is ok.


-Original Message-
From: Henry [mailto:[EMAIL PROTECTED]]
Sent: 21 January 2003 13:12
To: Rick Emery; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] Adding a variable to oracle that contains quotation
marks??


Once you use double quota mark the character BackSlash doesn't need anymore
that's my experience ^_^

- Original Message -
From: Rick Emery [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, January 21, 2003 8:56 PM
Subject: Re: [PHP] Adding a variable to oracle that contains quotation
marks??


 $query = UPDATE ACTIVITY SET COMMENTS = \'$updatecomments\' WHERE
ACTIVITY_ID =\'$actcode\';

 - Original Message -
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, January 21, 2003 6:53 AM
 Subject: [PHP] Adding a variable to oracle that contains quotation marks??


 Hi All,

 I'm trying to add a variable to an oracle database but it fails due
 to the fact that it contains quotation marks.  These have to be present
for
 the end user. My Script is as follows:
 ===
 if ($conn == true)
 {

 $query = UPDATE ACTIVITY
 SET COMMENTS = '$updatecomments' WHERE ACTIVITY_ID =
 '$actcode';
 $cursor = Ora_Open ($conn);
 $result = Ora_Parse ($cursor, $query);
 $result = Ora_Exec ($cursor);

 ora_close($cursor);
 Ora_Logoff($conn);
 }
 ===

 Can anyone tell me what to do!

 Thank you
 Dave

 --
 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] Page Rendering

2003-01-21 Thread Chris Shiflett
--- Bill Arbuckle, Jr. [EMAIL PROTECTED] wrote:
 It works in IE but not Netscape.

Nearly every time this happens, you have invalid HTML.

Try stripping out all of the HTML, leaving only the plain
text content of the page in question. Then, slowly add back
the markup, testing each change.

Also, never test in IE unless you have a restricted user
base that is only going to use IE. It is one of the most
lenient browsers with regard to standards, so it will just
give you a false positive.

Chris

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




Re: [PHP] Input field array ends up as Array string

2003-01-21 Thread Jason Wong
On Tuesday 21 January 2003 23:03, Jason Wong wrote:
 Undo any configuration changes made recently, downgrade any recent upgrades
 etc. To paraphrase Newtown's First Law of Motion:

Sorry, Newton's First Law of Motion :)

 Any working system tends to remain in that state unless external force is
 applied to it.

 So what was it that you did yesterday to cause it stop working?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Loud burping while walking around the airport is prohibited in Halstead, 
Kansas.
*/


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




RE: [PHP] str_replace an include

2003-01-21 Thread Timothy Hitchens \(HiTCHO\)
There a few ways of doing this but the following is one of the easier
and quickest off the
top of my head.

If you know the name of the tag and the include this will work if you
don't or want it to
be dynamic you will need to have some reg for the following. (how are
you getting the $string)?

// $string holds your html page you wish to replace

ob_start();

include('links.php');

$links = ob_get_contents();

ob_end_clean();

str_replace('!--linkTag--!', $links, $string);

echo $string;


I hope this gives you a direction.




Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: [EMAIL PROTECTED]

 -Original Message-
 From: jesse [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, 22 January 2003 1:05 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] str_replace an include
 
 
 Hello all,
 
 I'm trying to replace a tag with an include in a template 
 scenario.  For 
   example:
 
 str_replace(!--linkTag--!, include links.php, $string);
 
 This obviously doesn't work, but I'm wondering if anybody knows of a 
 good way to do this.
 
 Thanks a bunch,
 
 Jesse Lawrence
 
 
 -- 
 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] $header = Location:........ being ignored!

2003-01-21 Thread Chris Shiflett
--- Shams [EMAIL PROTECTED] wrote:
 if ( $_POST['passwd'] != $db['password']
 {header(Location: loginfailed.html);
 }

You never add the closing parenthesis to your if statement.

Chris

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




[PHP] dreading OOP

2003-01-21 Thread Larry Brown
I hope this is not too far OT, however, you are the best resource I have for
PHP and if anyone would know, it would be you guys.  I have been writing
scripts off and on for the past year and have an application written in PHP
for a business' internal use.  I have used snippets of Object oriented code
from other people here and there to get by and I have read information on
OOP in a couple of different places.  However, my mind apparently works
different and I keep trying to relate the OOP structure to what I already
know which equates an object to a function.  I am resolving to purchase a
book dedicated to instruction in the inns and outs of OOP.  Specifically at
it relates to PHP would be great but my emphasis is towards something that
teaches someone that is stubborn in his reliance on previously learned
methods.  I hope this makes sense and I'm not alone on this. :)  Any
suggestions would be greatly appreciated!

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388




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




[PHP] Re: str_replace an include

2003-01-21 Thread jesse
Thanks a lot, I think that will be the trick, but I'm still having a bit 
of a problem.

Here's my scenario:

class mainReplace{

   function feedLinks(){
  ob_start();
  include('links.php');
  $file = ob_get_contents();
  ob_end_clean();
  return $file;
   }
}

$replace = new mainReplace;

$read = str_replace('!--feedLinks--!', $replace-feedLinks(), $read);
print $read;


Unfortunately, this is not printing the results of the file include 
where is should have been replaced.  If, however, I say:
 print $replace-feedLinks()
it prints out the results.

Any suggestions?

Thanks again,

Jesse Lawrence




J Smith wrote:
I'd recommend looking at the output buffering functions. Something like this 
would probably work...

ob_start();
include(links.php);
$file = ob_get_contents();
ob_end_clean();

The result of parsing and executing links.php will be in $file. Do with it 
what you will.

J


Jesse wrote:


Hello all,

I'm trying to replace a tag with an include in a template scenario.  For
 example:

str_replace(!--linkTag--!, include links.php, $string);

This obviously doesn't work, but I'm wondering if anybody knows of a
good way to do this.

Thanks a bunch,

Jesse Lawrence






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




[PHP] array_sum, multidimensional arrays?

2003-01-21 Thread Chad Day
Is it possible to use array_sum to add up values in multidimensional arrays?
I have an array like:

$array[0][VALUE] = 10;
$array[1][VALUE] = 8;
$array[2][VALUE] = 5;

$array[0][OTHERVALUE] = 20;
$array[1][OTHERVALUE] = 15;
$array[2][OTHERVALUE] = 9;

Thanks,
Chad


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




RE: [PHP] Re: str_replace an include

2003-01-21 Thread Timothy Hitchens \(HiTCHO\)
Where are you getting $read from??

That should be $replace = new mainReplace(); // notice the brackets


Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: [EMAIL PROTECTED]

 -Original Message-
 From: jesse [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, 22 January 2003 1:38 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: str_replace an include
 
 
 Thanks a lot, I think that will be the trick, but I'm still 
 having a bit 
 of a problem.
 
 Here's my scenario:
 
 class mainReplace{
 
 function feedLinks(){
ob_start();
include('links.php');
$file = ob_get_contents();
ob_end_clean();
return $file;
 }
 }
 
 $replace = new mainReplace;
 
 $read = str_replace('!--feedLinks--!', 
 $replace-feedLinks(), $read); print $read;
 
 
 Unfortunately, this is not printing the results of the file include 
 where is should have been replaced.  If, however, I say:
   print $replace-feedLinks()
 it prints out the results.
 
 Any suggestions?
 
 Thanks again,
 
 Jesse Lawrence
 
 
 
 
 J Smith wrote:
  I'd recommend looking at the output buffering functions. Something 
  like this
  would probably work...
  
  ob_start();
  include(links.php);
  $file = ob_get_contents();
  ob_end_clean();
  
  The result of parsing and executing links.php will be in $file. Do 
  with it
  what you will.
  
  J
  
  
  Jesse wrote:
  
  
 Hello all,
 
 I'm trying to replace a tag with an include in a template 
 scenario.  
 For
   example:
 
 str_replace(!--linkTag--!, include links.php, $string);
 
 This obviously doesn't work, but I'm wondering if anybody 
 knows of a 
 good way to do this.
 
 Thanks a bunch,
 
 Jesse Lawrence
  
  
 
 
 -- 
 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] dreading OOP

2003-01-21 Thread Johnson, Kirk


 -Original Message-
 
However, my mind apparently works different and I keep trying to relate the
OOP structure to 
 what I already know which equates an object to a function.  I am resolving

 to purchase a book dedicated to instruction in the inns and outs of OOP.  
 Specifically at it relates to PHP would be great but my emphasis is
towards 
 something that teaches someone that is stubborn in his reliance on
previously learned
 methods.  I hope this makes sense and I'm not alone on this. :)

My only suggestion is that you re-consider why you want to take up OOP. If a
procedural approach works for you, go with it. It's not like we're building
air traffic control systems here ;)

Kirk 

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




Re: [PHP] dreading OOP

2003-01-21 Thread Peter Hutnick
Larry Brown said:
 equates an object to a function

You'd be better off trying to equate an object to a data type.

-Peter



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




[PHP] Newbie Questions

2003-01-21 Thread Bryan Cassidy
Could someone point me to a VERY good doc for learning PHP for a
NEWBIE!!! Something I can understand from the beginning to the end. YES
I am willing to put my time into learning and reading docs as long as
they are clear and made for what they say they are made for. I wont
waste my time with something for a second if it isn't clear to me and
easy to understand. Thanks in advance.



msg93774/pgp0.pgp
Description: PGP signature


Re: [PHP] dreading OOP

2003-01-21 Thread Chris Boget
  equates an object to a function
 You'd be better off trying to equate an object to a data type.

Why is that?  Please explain?
I do not mean to sound trite.  I do not know and am very curious
to hear more.

Chris


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




[PHP] Can't get HTTPS -- driving me mad -- please help

2003-01-21 Thread Jonathan Boles
PHP 4.3.0, Apache, Win32.

I'm driving myself mad trying to work out why I can't get HTTPS pages. I
understand there are two options, using fopen() with openssl installed, and
using curl. I've installed openssl extension, but using fopen STILL won't
work. Don't have a clue why. Using curl, I can get the page easily enough,
but I can't put it into the file. If I try to set a file resource to save it
to, Apache crashes.

Here's the error message I get using fopen(https://[securewebsite];, r);

Warning: fopen(https://blahblahblah) [function.fopen]: failed to create
stream: No such file or directory in blah\blah\blah.php on line 50



And when I try to use Curl to save the https file, I get this:

APACHE caused an invalid page fault in
module KERNEL32.DLL at 0187:bff7b9a6.
Registers:
EAX= CS=0187 EIP=bff7b9a6 EFLGS=0246
EBX=02af796c SS=018f ESP=0167f398 EBP=0167f3b0
ECX=00fe6770 DS=018f ESI=7803b730 FS=19a7
EDX=7803b710 ES=018f EDI=100be740 GS=
Bytes at CS:EIP:
ff 76 04 e8 13 89 ff ff 5e c2 04 00 56 8b 74 24
Stack dump:
0032 00fd5131 7803b730 00fd523b 7803b710 0032 0001 00fc1ee8
00ff48ac 0001 0032 7803b710 0032 00ff4240 00ff48ac 00ff4801


Here is the code I'm using at that section:

 $ch = curl_init (https://blahblahblah;);
 $fp = fopen (output.txt, w);
 curl_setopt ($ch, CURLOPT_FILE, $fp);
 curl_setopt ($ch, CURLOPT_HEADER, 0);
 curl_exec ($ch);
 $ce = curl_error($ch);
 curl_close ($ch);
 fclose ($fp);



This is really driving me mad, someone please help :-(





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




Re: [PHP] Input field array ends up as Array string

2003-01-21 Thread Dan Delaney
Well, in the process of pulling out some code into a sample page to 
send to the list I found the problem. It was yesterday when someone who 
was testing it told me about the problem, but the problem must have 
been going on for a week, because a week ago I added code to a global 
include script that checked to see if magic quotes was on and then did 
a stripslashes on all the values in $_POST if they were. So that ended 
up doing a stripslashes on the string Array and replacing 
$_POST['interests']. So I expanded the routine that striped the slashes 
so that it checks first to see if the element is an array.

Cheers
--Dan
 


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



Re: [PHP] Newbie Questions

2003-01-21 Thread Neil Freeman
Have a look on devshed.com

Bryan Cassidy wrote:

Could someone point me to a VERY good doc for learning PHP for a
NEWBIE!!! Something I can understand from the beginning to the end. YES
I am willing to put my time into learning and reading docs as long as
they are clear and made for what they say they are made for. I wont
waste my time with something for a second if it isn't clear to me and
easy to understand. Thanks in advance.


--
--
 www.curvedvision.com
--


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




RE: [PHP] Newbie Questions

2003-01-21 Thread Edward Peloke

This is geared to php and mysql but I started by downloading the first four
chapters of this book, which are free.

http://sitepoint.com/books/?bookid=kevinyank

Eddie
-Original Message-
From: Neil Freeman [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 21, 2003 10:52 AM
To: Bryan Cassidy
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Newbie Questions


Have a look on devshed.com

Bryan Cassidy wrote:
 Could someone point me to a VERY good doc for learning PHP for a
 NEWBIE!!! Something I can understand from the beginning to the end. YES
 I am willing to put my time into learning and reading docs as long as
 they are clear and made for what they say they are made for. I wont
 waste my time with something for a second if it isn't clear to me and
 easy to understand. Thanks in advance.

--
--
  www.curvedvision.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




Re: [PHP] Newbie Questions

2003-01-21 Thread David T-G
Bryan --

[BTW, I could not find your key on us.php.net or eu.php.net; is it on a
keyserver?]

...and then Bryan Cassidy said...
% 
% Could someone point me to a VERY good doc for learning PHP for a
% NEWBIE!!! Something I can understand from the beginning to the end. YES

Do you have any programming or scripting experience?  If you know even a
bit of something it's generally helpful when you want to pick up something
else.

I speak perl and shell well, do a lot of scripting, and can read some C
(plus other things that have faded into memory :-)  When I hadn't yet met
php at all, a buddy bought me the PHP Developer's Cookbook from SAMS and
it was easy to understand and presented some useful examples, and I was
able to get started and do the work he wanted me to do (when I tried
twice to thank him for the book he told me to shut up because it's a
self-serving gift :-)  It's no Learning Perl, but then again it isn't
supposed to be.

Having worked my way through that, currently my only reference is the php
manual from the web site; a quick search will take me to any function
that I want to use, and only rarely am I stumped with a how would I even
approach this task? problem -- and then this mailing list is wonderfully
helpful.


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg93780/pgp0.pgp
Description: PGP signature


[PHP] encrypt data with pgp

2003-01-21 Thread ermelir
Hello everyody,

I search to encode a string with a strong alogrythm. I choose pgp my 
desktop is a windows computer; I have found a function but I can't use it 
because on windows, pgp cant encrypt on commandline.
have you found something for windows station?
your help will be helpfull.

greetings




_
GRAND JEU SMS : Pour gagner un NOKIA 7650, envoyez le mot IF au 61321
(prix d'un SMS + 0.35 euro). Un SMS vous dira si vous avez gagné.
Règlement : http://www.ifrance.com/_reloc/sign.sms


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



Re: [PHP] Can't get HTTPS -- driving me mad -- please help

2003-01-21 Thread Stephan Seidt
Is fopen_wrapper in php.ini set to yes ?

Jonathan Boles wrote:

PHP 4.3.0, Apache, Win32.

I'm driving myself mad trying to work out why I can't get HTTPS pages. I
understand there are two options, using fopen() with openssl installed, and
using curl. I've installed openssl extension, but using fopen STILL won't
work. Don't have a clue why. Using curl, I can get the page easily enough,
but I can't put it into the file. If I try to set a file resource to save it
to, Apache crashes.

Here's the error message I get using fopen(https://[securewebsite];, r);

Warning: fopen(https://blahblahblah) [function.fopen]: failed to create
stream: No such file or directory in blah\blah\blah.php on line 50



And when I try to use Curl to save the https file, I get this:

APACHE caused an invalid page fault in
module KERNEL32.DLL at 0187:bff7b9a6.
Registers:
EAX= CS=0187 EIP=bff7b9a6 EFLGS=0246
EBX=02af796c SS=018f ESP=0167f398 EBP=0167f3b0
ECX=00fe6770 DS=018f ESI=7803b730 FS=19a7
EDX=7803b710 ES=018f EDI=100be740 GS=
Bytes at CS:EIP:
ff 76 04 e8 13 89 ff ff 5e c2 04 00 56 8b 74 24
Stack dump:
0032 00fd5131 7803b730 00fd523b 7803b710 0032 0001 00fc1ee8
00ff48ac 0001 0032 7803b710 0032 00ff4240 00ff48ac 00ff4801


Here is the code I'm using at that section:

 $ch = curl_init (https://blahblahblah;);
 $fp = fopen (output.txt, w);
 curl_setopt ($ch, CURLOPT_FILE, $fp);
 curl_setopt ($ch, CURLOPT_HEADER, 0);
 curl_exec ($ch);
 $ce = curl_error($ch);
 curl_close ($ch);
 fclose ($fp);



This is really driving me mad, someone please help :-(








--
IPv6 + TCPA + wrecked Palladium server = NO COFFE!


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




[PHP] security question regarding including files..

2003-01-21 Thread Chad Day
I want to give my users the ability to submit a URL to a database, then when
they pull up their page, their photo is included .. what I'm worried about
is them pointing the link to some malicious code or something..

Obviously I can validate the file extension (.gif or .jpg) .. and I'm going
to force the files to be stored offsite -  they dont get to upload anything
to the server.  I'm just a bit paranoid about this, so I'm hoping someone
more security-minded can tell me what to watch out for, what to check, if
I'm missing anything..

Thanks,
Chad


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




Re: [PHP] Newbie Questions

2003-01-21 Thread Bryan Cassidy
I just know some very basic html. lol. ya i know i know. I just havent
had time to set down and learn the things I want to learn until now.

On Tue, 21 Jan 2003 11:00:29 -0500
David T-G [EMAIL PROTECTED] wrote:

 Bryan --
 
 [BTW, I could not find your key on us.php.net or eu.php.net; is it on
 a keyserver?]
 
 ...and then Bryan Cassidy said...
 % 
 % Could someone point me to a VERY good doc for learning PHP for a
 % NEWBIE!!! Something I can understand from the beginning to the end.
 YES
 
 Do you have any programming or scripting experience?  If you know even
 a bit of something it's generally helpful when you want to pick up
 something else.
 
 I speak perl and shell well, do a lot of scripting, and can read some
 C(plus other things that have faded into memory :-)  When I hadn't yet
 met php at all, a buddy bought me the PHP Developer's Cookbook from
 SAMS and it was easy to understand and presented some useful examples,
 and I was able to get started and do the work he wanted me to do (when
 I tried twice to thank him for the book he told me to shut up because
 it's a self-serving gift :-)  It's no Learning Perl, but then
 again it isn't supposed to be.
 
 Having worked my way through that, currently my only reference is the
 php manual from the web site; a quick search will take me to any
 function that I want to use, and only rarely am I stumped with a how
 would I even approach this task? problem -- and then this mailing
 list is wonderfully helpful.
 
 
 HTH  HAND
 
 :-D
 -- 
 David T-G  * There is too much animal courage in 
 (play) [EMAIL PROTECTED] * society and not sufficient moral
 courage.(work) [EMAIL PROTECTED]  -- Mary Baker Eddy,
 Science and Health http://justpickone.org/davidtg/  Shpx gur
 Pbzzhavpngvbaf Qrprapl Npg!
 
 



msg93784/pgp0.pgp
Description: PGP signature


RE: [PHP] Adding a variable to oracle that contains quotation mar ks??

2003-01-21 Thread Ford, Mike [LSS]
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: 21 January 2003 15:05
 
 Thanks Rick  Henry, but I am still unable to add single 
 quotation marks '.
 When I added the \' to the variable as given below (thanks 
 again Rick) I get
 the following error when trying to add anything, regardless of ':

Oracle does its quote-escaping different!  To insert a single-quote within a
single-quoted value, you have to double it, so:

   $query = UPDATE ACTIVITY SET COMMENTS = 'That''s right' WHERE ...;

So, you either have to run a str_replace(', '', $updatecomments) before
constructing the query, or you can use addslashes() and turn on the
magic_quotes_sybase option -- if you do the latter, and also have
magic_quotes_gpc and/or magic_quotes_runtime turned on, magic quoting will
also escape with a second quote rather than a backslash.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, 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] Re: str_replace an include

2003-01-21 Thread jesse


Timothy Hitchens ) wrote:

Where are you getting $read from??

That should be $replace = new mainReplace(); // notice the brackets


$read is the contents of the file that I'm reading.  I actually do have
$replace = new mainReplace(); in my code, I just forgot the brackets in 
my last message;)
















Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: [EMAIL PROTECTED]



-Original Message-
From: jesse [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, 22 January 2003 1:38 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: str_replace an include


Thanks a lot, I think that will be the trick, but I'm still 
having a bit 
of a problem.

Here's my scenario:

class mainReplace{

   function feedLinks(){
  ob_start();
  include('links.php');
  $file = ob_get_contents();
  ob_end_clean();
  return $file;
   }
}

$replace = new mainReplace;

$read = str_replace('!--feedLinks--!', 
$replace-feedLinks(), $read); print $read;


Unfortunately, this is not printing the results of the file include 
where is should have been replaced.  If, however, I say:
 print $replace-feedLinks()
it prints out the results.

Any suggestions?

Thanks again,

Jesse Lawrence




J Smith wrote:

I'd recommend looking at the output buffering functions. Something 
like this
would probably work...

ob_start();
include(links.php);
$file = ob_get_contents();
ob_end_clean();

The result of parsing and executing links.php will be in $file. Do 
with it
what you will.

J


Jesse wrote:



Hello all,

I'm trying to replace a tag with an include in a template 


scenario.  

For
example:

str_replace(!--linkTag--!, include links.php, $string);

This obviously doesn't work, but I'm wondering if anybody 


knows of a 

good way to do this.

Thanks a bunch,

Jesse Lawrence





--
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] security question regarding including files..

2003-01-21 Thread Stephan Seidt
I guess you use some webserver, let's take apache.
Apache's mime.conf has set several extensions,
also php extensions. So only .php, .php3, .php4
 files will be parsed by php.

Chad Day wrote:

I want to give my users the ability to submit a URL to a database, then when
they pull up their page, their photo is included .. what I'm worried about
is them pointing the link to some malicious code or something..

Obviously I can validate the file extension (.gif or .jpg) .. and I'm going
to force the files to be stored offsite -  they dont get to upload anything
to the server.  I'm just a bit paranoid about this, so I'm hoping someone
more security-minded can tell me what to watch out for, what to check, if
I'm missing anything..

Thanks,
Chad





--
IPv6 + TCPA + wrecked Palladium server = NO COFFE!


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




Re: [PHP] encrypt data with pgp

2003-01-21 Thread David T-G
ermelir --

[You know, this message really has nothing to do with converting ASP to
PHP...]

...and then ermelir said...
% 
% Hello everyody,

Hi!


% 
% I search to encode a string with a strong alogrythm. I choose pgp my 
% desktop is a windows computer; I have found a function but I can't use it 
% because on windows, pgp cant encrypt on commandline.
% have you found something for windows station?
% your help will be helpfull.

I don't use pgp at all or windows much, but IIRC gnupg will work from the
command line with no problem.  You might try that instead.  Check out

  http://gnupg.org/

for info and downloads.


% 
% greetings


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg93788/pgp0.pgp
Description: PGP signature


RE: [PHP] Re: str_replace an include

2003-01-21 Thread Timothy Hitchens \(HiTCHO\)
I can't see what else to suggest just quickly.

- what about just as a function not a class??



Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: [EMAIL PROTECTED]

 -Original Message-
 From: jesse [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, 22 January 2003 2:12 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Re: str_replace an include
 
 
 
 
 Timothy Hitchens ) wrote:
  Where are you getting $read from??
  
  That should be $replace = new mainReplace(); // notice the brackets
 
 $read is the contents of the file that I'm reading.  I 
 actually do have $replace = new mainReplace(); in my code, I 
 just forgot the brackets in 
 my last message;)
 
 
 
 
 
 
 
 
 

 
 
 
 
  
  
  Timothy Hitchens (HiTCHO)
  Open Source Consulting
  e-mail: [EMAIL PROTECTED]
  
  
 -Original Message-
 From: jesse [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, 22 January 2003 1:38 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: str_replace an include
 
 
 Thanks a lot, I think that will be the trick, but I'm still
 having a bit 
 of a problem.
 
 Here's my scenario:
 
 class mainReplace{
 
 function feedLinks(){
ob_start();
include('links.php');
$file = ob_get_contents();
ob_end_clean();
return $file;
 }
 }
 
 $replace = new mainReplace;
 
 $read = str_replace('!--feedLinks--!',
 $replace-feedLinks(), $read); print $read;
 
 
 Unfortunately, this is not printing the results of the file include
 where is should have been replaced.  If, however, I say:
   print $replace-feedLinks()
 it prints out the results.
 
 Any suggestions?
 
 Thanks again,
 
 Jesse Lawrence
 
 
 
 
 J Smith wrote:
 
 I'd recommend looking at the output buffering functions. Something
 like this
 would probably work...
 
 ob_start();
 include(links.php);
 $file = ob_get_contents();
 ob_end_clean();
 
 The result of parsing and executing links.php will be in $file. Do
 with it
 what you will.
 
 J
 
 
 Jesse wrote:
 
 
 
 Hello all,
 
 I'm trying to replace a tag with an include in a template
 
 scenario.
 
 For
  example:
 
 str_replace(!--linkTag--!, include links.php, $string);
 
 This obviously doesn't work, but I'm wondering if anybody
 
 knows of a
 
 good way to do this.
 
 Thanks a bunch,
 
 Jesse Lawrence
 
 
 
 --
 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] Re: str_replace an include

2003-01-21 Thread jesse
I'll give it a try.  I might just put the contents of the include file 
into the main file, and approach it like that.

Thanks a lot for your help.

Timothy Hitchens ) wrote:
I can't see what else to suggest just quickly.

- what about just as a function not a class??



Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: [EMAIL PROTECTED]



-Original Message-
From: jesse [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, 22 January 2003 2:12 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: str_replace an include




Timothy Hitchens ) wrote:

Where are you getting $read from??

That should be $replace = new mainReplace(); // notice the brackets


$read is the contents of the file that I'm reading.  I 
actually do have $replace = new mainReplace(); in my code, I 
just forgot the brackets in 
my last message;)
















Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: [EMAIL PROTECTED]




-Original Message-
From: jesse [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 22 January 2003 1:38 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: str_replace an include


Thanks a lot, I think that will be the trick, but I'm still
having a bit 
of a problem.

Here's my scenario:

class mainReplace{

  function feedLinks(){
 ob_start();
 include('links.php');
 $file = ob_get_contents();
 ob_end_clean();
 return $file;
  }
}

$replace = new mainReplace;

$read = str_replace('!--feedLinks--!',
$replace-feedLinks(), $read); print $read;


Unfortunately, this is not printing the results of the file include
where is should have been replaced.  If, however, I say:
print $replace-feedLinks()
it prints out the results.

Any suggestions?

Thanks again,

Jesse Lawrence




J Smith wrote:


I'd recommend looking at the output buffering functions. Something
like this
would probably work...

ob_start();
include(links.php);
$file = ob_get_contents();
ob_end_clean();

The result of parsing and executing links.php will be in $file. Do
with it
what you will.

J


Jesse wrote:





Hello all,

I'm trying to replace a tag with an include in a template



scenario.



For
example:

str_replace(!--linkTag--!, include links.php, $string);

This obviously doesn't work, but I'm wondering if anybody



knows of a



good way to do this.

Thanks a bunch,

Jesse Lawrence




--
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] ADV SQL Help Needed.

2003-01-21 Thread [-^-!-%-


 This sample also work in PhpMyAdmin, but not from the php code.
 Please advise.

 **see previous post, for sample code**

 Thanks Rick.

 -john

=P e p i e  D e s i g n s
 www.pepiedesigns.com
 Providing Solutions That Increase Productivity

 Web Developement. Database. Hosting. Multimedia.

On Tue, 21 Jan 2003, Rick Emery wrote:

 SELECT risk_level, COUNT(*) FROM mytable GROUP BY risk_level;

 - Original Message -
 From: [-^-!-%- [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, January 21, 2003 6:06 AM
 Subject: [PHP] ADV SQL Help Needed.



 Hello everyone,

 I need help with the following query.

 I have a table with a column named 'RISK_LEVEL'.
 RISK_LEVEL can hold three values: Low, Moderate, and High.

 I need a query that counts the number of occurences of each option.
 Now, I know I can do

 'select count(risk_level) as levelCount where risk_level=low'

 for each level (low, moderate, and high). But, I was wondering if there's
 anyway to merge the queries into one.

 I'm looking for something like

 select count(risk_level='low') as lowCount, count(risk_level='moderate')as
 modCount, count(risk_level='high') as highCount 

 Which will return, lowCount = 1 , modCount=3, and highCount=1, for table
 with

  id | risk_level
  1  | low
  2  | moderate
  3  | moderate
  4  | high
  5  | moderate

 How do you do it? Can tha be done?

 When I run the code above, I get the same number for each record. i.e.
 lowCount, modCount, and highCount all come out to 5--which is the number
 of records in the table.

 Is this possible, or should I just run multiple queries?
 Please help.


 =P e p i e  D e s i g n s
  www.pepiedesigns.com
  Providing Solutions That Increase Productivity

  Web Developement. Database. Hosting. Multimedia.




 --
 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] Newbie Questions

2003-01-21 Thread [-^-!-%-

 Also checkout
 webmonkey.com and devarticles.com


=P e p i e  D e s i g n s
 www.pepiedesigns.com
 Providing Solutions That Increase Productivity

 Web Developement. Database. Hosting. Multimedia.

On Tue, 21 Jan 2003, Neil Freeman wrote:

 Have a look on devshed.com

 Bryan Cassidy wrote:
  Could someone point me to a VERY good doc for learning PHP for a
  NEWBIE!!! Something I can understand from the beginning to the end. YES
  I am willing to put my time into learning and reading docs as long as
  they are clear and made for what they say they are made for. I wont
  waste my time with something for a second if it isn't clear to me and
  easy to understand. Thanks in advance.

 --
 --
   www.curvedvision.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




Re: [PHP] security question regarding including files..

2003-01-21 Thread Chris Shiflett
--- Chad Day [EMAIL PROTECTED] wrote:
 I want to give my users the ability to submit a URL
 to a database, then when they pull up their page,
 their photo is included .. what I'm worried about
 is them pointing the link to some malicious code or
 something..

Your instincts serve you well.

There are two types of attacks to worry about in this
situation, depending on who can see this image. If only
the user who submitted the URL can see it, then your users
only risk CSRF attacks, which are not very common (yet) but
are very dangerous.

If everyone can see the image, then your application is
also at risk of XSS.

If you realize that an embedded image is requested
separately by a Web client, you can see that this basically
allows an attacker the opportunity of forcing another user
to visit a URL of the attacker's choice. For example,
consider an image that looks like this:

img src=http://bookstore.xxx/buy.php?book=httphandbook;

A browser will try to load that image by sending a request
for that URL to bookstore.xxx. So, every user who happens
to have a prior relationship with bookstore.xxx (maybe they
have one-click ordering) will unknowingly purchase HTTP
Developer's Handbook. All the victim will see is a broken
image.

Even if you check for file extensions, the attacker can
have a URL that looks legitimate but is really a PHP script
in disguise (their Apache treates .jpg as PHP, for example)
and uses header(Location: ...) to redirect to the URL
mentioned above.

Also, this same attack can be used against one of your
users to make them unknowingly submit such a URL to your
site. Thus, even if you only show the image to the user who
submitted it, that user may still be a victim.

For more information on CSRF, check out
http://www.tux.org/~peterw/csrf.txt.

For more information on XSS, check out
http://httpd.apache.org/info/css-security/ and
http://www.cert.org/advisories/CA-2000-02.html.

My advice would be to require human intervention in the way
of a moderation system. Even with this, a URL that returns
an image today may not tomorrow. A safer alternative might
be to host the images yourself, so that you can check that
they are in fact images.

Good luck.

Chris

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




Re: [PHP] Can't get HTTPS -- driving me mad -- please help

2003-01-21 Thread Jonathan Boles
Do you mean allow_url_fopen? It is set to 'on'. There's no fopen_wrapper
setting

Reading from http:// using fopen works fine. It's the https:// that doesn't
work.

- Original Message -
From: Stephan Seidt [EMAIL PROTECTED]
To: Jonathan Boles [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, January 22, 2003 3:02 AM
Subject: Re: [PHP] Can't get HTTPS -- driving me mad -- please help


 Is fopen_wrapper in php.ini set to yes ?

 Jonathan Boles wrote:
  PHP 4.3.0, Apache, Win32.
 
  I'm driving myself mad trying to work out why I can't get HTTPS pages. I
  understand there are two options, using fopen() with openssl installed,
and
  using curl. I've installed openssl extension, but using fopen STILL
won't
  work. Don't have a clue why. Using curl, I can get the page easily
enough,
  but I can't put it into the file. If I try to set a file resource to
save it
  to, Apache crashes.
 
  Here's the error message I get using fopen(https://[securewebsite];,
r);
 
  Warning: fopen(https://blahblahblah) [function.fopen]: failed to create
  stream: No such file or directory in blah\blah\blah.php on line 50
 
 
 
  And when I try to use Curl to save the https file, I get this:
 
  APACHE caused an invalid page fault in
  module KERNEL32.DLL at 0187:bff7b9a6.
  Registers:
  EAX= CS=0187 EIP=bff7b9a6 EFLGS=0246
  EBX=02af796c SS=018f ESP=0167f398 EBP=0167f3b0
  ECX=00fe6770 DS=018f ESI=7803b730 FS=19a7
  EDX=7803b710 ES=018f EDI=100be740 GS=
  Bytes at CS:EIP:
  ff 76 04 e8 13 89 ff ff 5e c2 04 00 56 8b 74 24
  Stack dump:
  0032 00fd5131 7803b730 00fd523b 7803b710 0032 0001 00fc1ee8
  00ff48ac 0001 0032 7803b710 0032 00ff4240 00ff48ac 00ff4801
 
 
  Here is the code I'm using at that section:
 
   $ch = curl_init (https://blahblahblah;);
   $fp = fopen (output.txt, w);
   curl_setopt ($ch, CURLOPT_FILE, $fp);
   curl_setopt ($ch, CURLOPT_HEADER, 0);
   curl_exec ($ch);
   $ce = curl_error($ch);
   curl_close ($ch);
   fclose ($fp);
 
 
 
  This is really driving me mad, someone please help :-(
 
 
 
 
 


 --
 IPv6 + TCPA + wrecked Palladium server = NO COFFE!




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




Re: [PHP] dreading OOP

2003-01-21 Thread Peter Hutnick
Chris Boget said:
  equates an object to a function
 You'd be better off trying to equate an object to a data type.

 Why is that?  Please explain?
 I do not mean to sound trite.  I do not know and am very curious
 to hear more.

Consider two approaches to extending your procedural programming knowledge
to OOP.

   Think of an object as a user-defined data type (that also includes
functions).

   Think of an object as a bunch of functions (and some variables).

The second is awkward and doesn't capture the purpose of OO.

The real beauty of OO is that it is data centric and it allows the
member functions of an object to be easily testable black-boxes.

Good luck!

-Peter



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




Re: [PHP] Can't get HTTPS -- driving me mad -- please help

2003-01-21 Thread Jonathan Boles
This seems to have fixed the problem :-) But there's another error. fopen
works now, but fgets won't. I'm getting this error:

Warning: fgets() [function.fgets]: SSL: fatal protocol error in
blah\blah\blah.php on line 51

Does anyone know what could be causing this?


 PHP 4.3.0, Apache, Win32.

 Here's the error message I get using fopen(https://[securewebsite];,
r);

 Warning: fopen(https://blahblahblah) [function.fopen]: failed to create
 stream: No such file or directory in blah\blah\blah.php on line 50

Hi Jonathan,

Don't know what the problem is, but other people seem to have the same
problem. Read the user note on the bottom of this page:
http://uk.php.net/manual/en/wrappers.php

Hope this helps;
JOn


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-







Jonathan Boles [EMAIL PROTECTED] wrote in message
000f01c2c16a$ea4b6920$5c8dadcb@grayw">news:000f01c2c16a$ea4b6920$5c8dadcb@grayw...
 Do you mean allow_url_fopen? It is set to 'on'. There's no fopen_wrapper
 setting

 Reading from http:// using fopen works fine. It's the https:// that
doesn't
 work.

 - Original Message -
 From: Stephan Seidt [EMAIL PROTECTED]
 To: Jonathan Boles [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Wednesday, January 22, 2003 3:02 AM
 Subject: Re: [PHP] Can't get HTTPS -- driving me mad -- please help


  Is fopen_wrapper in php.ini set to yes ?
 
  Jonathan Boles wrote:
   PHP 4.3.0, Apache, Win32.
  
   I'm driving myself mad trying to work out why I can't get HTTPS pages.
I
   understand there are two options, using fopen() with openssl
installed,
 and
   using curl. I've installed openssl extension, but using fopen STILL
 won't
   work. Don't have a clue why. Using curl, I can get the page easily
 enough,
   but I can't put it into the file. If I try to set a file resource to
 save it
   to, Apache crashes.
  
   Here's the error message I get using fopen(https://[securewebsite];,
 r);
  
   Warning: fopen(https://blahblahblah) [function.fopen]: failed to
create
   stream: No such file or directory in blah\blah\blah.php on line 50
  
  
  
   And when I try to use Curl to save the https file, I get this:
  
   APACHE caused an invalid page fault in
   module KERNEL32.DLL at 0187:bff7b9a6.
   Registers:
   EAX= CS=0187 EIP=bff7b9a6 EFLGS=0246
   EBX=02af796c SS=018f ESP=0167f398 EBP=0167f3b0
   ECX=00fe6770 DS=018f ESI=7803b730 FS=19a7
   EDX=7803b710 ES=018f EDI=100be740 GS=
   Bytes at CS:EIP:
   ff 76 04 e8 13 89 ff ff 5e c2 04 00 56 8b 74 24
   Stack dump:
   0032 00fd5131 7803b730 00fd523b 7803b710 0032 0001
00fc1ee8
   00ff48ac 0001 0032 7803b710 0032 00ff4240 00ff48ac
00ff4801
  
  
   Here is the code I'm using at that section:
  
$ch = curl_init (https://blahblahblah;);
$fp = fopen (output.txt, w);
curl_setopt ($ch, CURLOPT_FILE, $fp);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_exec ($ch);
$ce = curl_error($ch);
curl_close ($ch);
fclose ($fp);
  
  
  
   This is really driving me mad, someone please help :-(
  
  
  
  
  
 
 
  --
  IPv6 + TCPA + wrecked Palladium server = NO COFFE!
 
 






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




Re: [PHP] DOWNLOAD

2003-01-21 Thread Jim Lucas
People often for get about a little problem that happens with the

?

$name_the_file = the name you want the file to be called when prompted to
download;
$file_to_download = /path/to/file/filename.scp;

// test for internet explorer in the conditional for the following
if..then..else
if (msie) {
  $attachment=;
} else {
  $attachment= attachment;;
}

header(Content-Type: application/download\n);
header(Content-Disposition:$attachment filename=\$name_the_file\);
readfile($file_to_download);
exit();
?


I found a bug when developing a download script a year or so ago.

You can't have the 'attachment;' part in IE.  It did some funky stuff

and netscape 4 would die without it.

Jim

- Original Message -
From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED]
To: 'Shaun van den Berg' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, January 21, 2003 1:44 AM
Subject: RE: [PHP] DOWNLOAD


 Create a script that reads the contents of a file after sending headers
 eg:

 header(Content-type: text/plain);
 header(Content-Disposition: attachment; filename=downloaded.txt);
 readfile(downloaded.txt);
 exit();

 The downloaded.txt can be any file subject to sending the correct
 headers and IE
 and other browsers will pop up a download (save) window.

 See your mime.types file for headers for each file type.


 Timothy Hitchens (HiTCHO)
 Open Source Consulting
 e-mail: [EMAIL PROTECTED]

  -Original Message-
  From: Shaun van den Berg [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, 21 January 2003 4:39 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] DOWNLOAD
 
 
  Hi ,
 
  Im not sure if this can be done in PHP , i know PHP has
  upload features ! Does it have download features , wat i mean
  is the following : i want a link - click here to download -
  when you click on it , the download dialog box must appear -
  how do i do this ?
 
  Thanks
  Shaun van den Berg
 
  --
  Novtel Consulting
  Tel: +27 21 9822373
  Fax: +27 21 9815846
  Please visit our website:
  www.novtel.co.za
 
 
 
  --
  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] Finding out if a table exists

2003-01-21 Thread Mako Shark
Is there a way of finding if a table exists with only
one command in MySQL? I've looked through the MySQL
functions, and the closest I've gotten to what I need
is mysql_list_tables or mysql_tablename (I'll have to
check into these a little more), but I was hopefully
looking for something that returns a boolean value,
and to be able to use it like:

if(mysql_table_exists(tablename)) {
...
}

Any ideas, short of creating my own function?

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




Re: [PHP] Can't get HTTPS -- driving me mad -- please help

2003-01-21 Thread Stephan Seidt
ah sorry, mixed some configuration files ;)

Jonathan Boles wrote:

Do you mean allow_url_fopen? It is set to 'on'. There's no fopen_wrapper
setting

Reading from http:// using fopen works fine. It's the https:// that doesn't
work.

- Original Message -
From: Stephan Seidt [EMAIL PROTECTED]
To: Jonathan Boles [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, January 22, 2003 3:02 AM
Subject: Re: [PHP] Can't get HTTPS -- driving me mad -- please help




Is fopen_wrapper in php.ini set to yes ?

Jonathan Boles wrote:


PHP 4.3.0, Apache, Win32.

I'm driving myself mad trying to work out why I can't get HTTPS pages. I
understand there are two options, using fopen() with openssl installed,


and


using curl. I've installed openssl extension, but using fopen STILL


won't


work. Don't have a clue why. Using curl, I can get the page easily


enough,


but I can't put it into the file. If I try to set a file resource to


save it


to, Apache crashes.

Here's the error message I get using fopen(https://[securewebsite];,


r);


Warning: fopen(https://blahblahblah) [function.fopen]: failed to create
stream: No such file or directory in blah\blah\blah.php on line 50



And when I try to use Curl to save the https file, I get this:

APACHE caused an invalid page fault in
module KERNEL32.DLL at 0187:bff7b9a6.
Registers:
EAX= CS=0187 EIP=bff7b9a6 EFLGS=0246
EBX=02af796c SS=018f ESP=0167f398 EBP=0167f3b0
ECX=00fe6770 DS=018f ESI=7803b730 FS=19a7
EDX=7803b710 ES=018f EDI=100be740 GS=
Bytes at CS:EIP:
ff 76 04 e8 13 89 ff ff 5e c2 04 00 56 8b 74 24
Stack dump:
0032 00fd5131 7803b730 00fd523b 7803b710 0032 0001 00fc1ee8
00ff48ac 0001 0032 7803b710 0032 00ff4240 00ff48ac 00ff4801


Here is the code I'm using at that section:

$ch = curl_init (https://blahblahblah;);
$fp = fopen (output.txt, w);
curl_setopt ($ch, CURLOPT_FILE, $fp);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_exec ($ch);
$ce = curl_error($ch);
curl_close ($ch);
fclose ($fp);



This is really driving me mad, someone please help :-(








--
IPv6 + TCPA + wrecked Palladium server = NO COFFE!









--
IPv6 + TCPA + wrecked Palladium server = NO COFFE!


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




Re: [PHP] Form Validating Class (OOP misunderstandings...)

2003-01-21 Thread Nicholas Wieland
On 2003.01.21 15:42 Joseph W. Goff wrote:

For the most part I found two errors
The first was a scope problem.  $HTTP_*_VARS hashes are not accessible
inside functions unless you source them in.  i.e. global
The other was an extra line in an if statement that did not contain
braces.
I did a little formating while I checked the code.  Try this to see if
it
works as you expected it to.



snip, it's perfect 


Yes, it works. I misunderstood the visibility of $HTTP_POST_VARS.
Thank you Joseph ! I really appreciate your help :)

I've read the paper from OWASP and now I'm a little paranoid about form 
validating and user input... does someone have other suggestions about 
improving the class ?

TIA,
	Nicholas

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



RE: [PHP] Form Validating Class (OOP misunderstandings...)

2003-01-21 Thread @ Nilaab
Nicholas,

I think I know where you found this code. I have the same code, except I
modified it a little to work for me. You may need to change it for your
needs. When I first used it, it didn't work. I had to modify it to make it
work. My code is usually kind of sloppy, but maybe you would get better use
of the following class:

?php

class FormValidator {

var $_errorList;


function FormValidator() {
   $this-resetErrorList();
}


function isEmpty($field, $msg) {
   if (trim($field) == ) {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return true;
   } else {
  return false;
   }
}


function isZero($field, $msg) {
   if($field == 0) {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return true;
   } else {
  return false;
   }
}


function isUploadedFile($img, $img_type, $img_size, $msg) {
   $pattern = /(pjpeg)$/;
   if (is_uploaded_file($img)  preg_match($pattern, $img_type) 
$img_size = 100) {
  return true;
   } else {
  $this-_errorList[] = array(value = $img, msg = $msg);
  return false;
   }
}


function isString($field, $msg) {
   if(!is_string($field)) {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return false;
   } else {
  return true;
   }
}


function isNumber($field, $msg) {
   if(!is_numeric($field)) {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return false;
   } else {
  return true;
}
}


function isInteger($field, $msg) {
   if(!is_integer($field)) {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return false;
   } else {
  return true;
   }
}


function isFloat($field, $msg) {
   if(!is_float($field)) {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return false;
   } else {
  return true;
   }
}


function isWithinRange($field, $msg, $min, $max) {
   if(!is_numeric($field) || $field  $min || $field  $max) {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return false;
   } else {
  return true;
   }
}


function isStringWithinRange($field, $msg, $min, $max) {
   if(strlen($field)  $min || strlen($field)  $max) {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return false;
   } else {
  return true;
   }
}


function isAlpha($field, $msg, $special_chars=) {
   $pattern = /^[a-zA-Z\s . $special_chars . ]+$/;
   if(preg_match($pattern, $field)) {
  return true;
   } else {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return false;
   }
}


function isAlphaNum($field, $msg, $special_chars=) {
   $pattern = /^[a-zA-Z0-9\s . $special_chars . ]+$/;
   if(preg_match($pattern, $field)) {
  return true;
   } else {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return false;
   }
}


function isEmailAddress($field, $msg) {
   $pattern =
/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/;
   if(preg_match($pattern, $field)) {
  return true;
   } else {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return false;
   }
}


function isError() {
   if (sizeof($this-_errorList)  0) {
  return true;
   } else {
  return false;
   }
}


function getErrorList() {
   return $this-_errorList;
}


function resetErrorList() {
   $this-_errorList = array();
}



}

?




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




  1   2   >