RE: [PHP] How do I do this PERL in PHP?

2003-09-17 Thread SLanger
hello

just a side note

instead of 
 ereg( '^$var(.*)$', $line, $matches )
use 
preg_match('/^'.$var.'(.*)$/', $line, $matches)
since it is faster than ereg. 

Regards
Stefan Langer

[PHP] Re: Problem sending HTML formated mail

2003-09-17 Thread SLanger
Hello

Use a mail class to send your mail instead of mail. These classes have a 
lot of workarounds for mail() problems and are fairly easy to manage.
I personally prefer phpmailer (http://phpmailer.sourceforge.net) but there 
are others. Just do a search through the archive for mail or mime classes 
and 
you should come up with plenty.

Regards
Stefan Langer

[PHP] problem with gd

2003-09-17 Thread Harry Wiens
Hi,
i got a problem with the gd library at my isp's server.

I've got the following script, to put a string on a image:

?PHP
header (Content-type: image/png);

$gd_text = $_GET['stadt'];
$font =  /home/stadt-internetde/public_html/bilder/ariblk.ttf;
//ariblk.ttf; ;

$x = imagettfbbox (23, 0, $font, $_GET['stadt']);

if((154 + ($x['2']-$x['0'])+12)  281) $breite = 281; else $breite = 154 +
($x['2']-$x['0']+12);

$im = ImageCreate($breite ,173);
$im2 = ImageCreateFromJPEG(logo.jpg);

$orange = ImageColorAllocate ($im, 220, 167, 23);
$blau = ImageColorAllocate ($im, 51, 102, 153);
$bgc = ImageColorAllocate ($im, 255, 255, 255);
ImageFilledRectangle ($im, 0, 0, ImageSX($im), ImageSY($im), $bgc);

ImageCopyResized($im, $im2, 0, 0, 0, 0, 281, 173, ImageSX($im2),
ImageSY($im2));


//border -
$test = ImageTTFText ($im, 23, 0, 154, 58, $blau,   $font,  $gd_text);
$test = ImageTTFText ($im, 23, 0, 154, 56, $blau,   $font,  $gd_text);
$test = ImageTTFText ($im, 23, 0, 156, 56, $blau,   $font,  $gd_text);
$test = ImageTTFText ($im, 23, 0, 156, 58, $blau,   $font,  $gd_text);
//text 
$test = ImageTTFText ($im, 23, 0, 155, 57, $orange, $font,  $gd_text);

ImageColorTransparent($im , $bgc);
ImagePNG ($im);
ImageDestroy($im);
?

On my localhost, everything works fine, but on the internetserver, the
created image is very ugly!
On the internet-server i got gd-version 2.0 or  higher, so i tried to change
$im = ImageCreate($breite ,173);
to
$im = ImageCreateTrueColor($breite ,173);

but when I use ImageCreateTrueColor the transparency is gone and the image
is still ugly!

Phpinfo shows:
gd supportenabled
gd version2.0 or higher
Freetype supportenabled
Freetype linkagewith Freetype
JPG supportenabled
PNG supportenabled
wbmp supportenabled

Anyone got an idea for me?

mfg.
Harry Wiens

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



Re: [PHP] PHP and Palm

2003-09-17 Thread Raditha Dissanayake
this is not really about PHP and palm but writing a client for the palm. 
You are better off asking this quesition in a palm list.

Charles Kline wrote:

I have a project in mind where I would like to be able to Sync my Palm 
with the calendar in my CRM. Anyone have info on doing this?

Thanks,
Charles


--
http://www.radinks.com/upload
Drag and Drop File Uploader.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Ways to connect to Access DB without using ODBC?

2003-09-17 Thread chris . neale
Has anyone got any idea how I might be able to connect to an access database
without using the ODBC drivers? I logged a bug with the PHP developers
(#25472) about a problem I've been having with memory leaks when using them
for looping through hundreds of queries in sequence.

Does anyone have any suggestions for other methods of connecting to an
Access database, which is at least as fast as ODBC and more stable.

Thanks...

Chris
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



[PHP] ignore_user_abort not working

2003-09-17 Thread Sid
Hello,

I am calling ignore_user_abort(true) in one of my scripts, but the script stops just 
like it would if I did not call it.

Any idea why it is not working?

Thanks

- Sid



RE: [PHP] multiple FORMS on same page problem.

2003-09-17 Thread Ruessel, Jan
You could also redirect with javascript:

echo Script Lang=javascript;
echo window.location.href = 'page5.php';
echo /script;

Grtz
Jan

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Dienstag, 16. September 2003 18:06
To: Golawala, Moiz M (IndSys, GE Interlogix)
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] multiple FORMS on same page problem.


Golawala, Moiz M (IndSys, GE Interlogix) wrote:

 It is almost working.. I can't figure out why I can get the someVal to page5.php.
 
 file: page4.php
 
 ?php
 
 if (isset($_REQUEST['submit1'])){
  echo button 1 was clicked, act accordingly;
  echo this the request values;
  echo $_REQUEST['someVal'];
 }elseif(isset($_REQUEST['submit2'])){
  session_start();
  echo button 2 was clicked, act accordingly;
  $_SESSION['post'] = $_POST;
  header(Location: http://127.0.0.1/Alarms/page5.php??=SID?);  

header(Location: http://127.0.0.1/Alarms/page5.php?; . SID);   

But this is not going to work. You can only redirect with header() if 
there has not been any output. That's why you are getting the errors.

-- 
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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

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



RE: [PHP] Session data getting lost

2003-09-17 Thread Ruessel, Jan
You have to put session_start(); at the VERY TOP of your code. even before alle the 
html tags.
Hope that helps!

Jan

-Original Message-
From: Chris Shiflett [mailto:[EMAIL PROTECTED]
Sent: Dienstag, 16. September 2003 20:17
To: Rich Gray; [EMAIL PROTECTED] Php. Net
Subject: Re: [PHP] Session data getting lost


--- Rich Gray [EMAIL PROTECTED] wrote:
 I'm running v4.2.3 on RedHat v7.0 and am getting some strange
 behaviour with the $_SESSION superglobal...
...
 It works fine on Win2K albeit v4.3.0 of PHP.

Maybe you have register_globals enabled on your Linux server and not on your
Windows PC? Compare php.ini files before giving it too much thought.

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

-- 
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] Control Structure problem

2003-09-17 Thread David Robley
In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] says...
 yeah, i really like using cases they work well and especially if you want to
 do something different for different values, i forgot about that, its a good
 way to do it,
 
 does php have case else? cuz that is a really handy thing in VB that people
 often forget...

You mean 'default'

   switch ($var)  {
 case 'TEST-1': case 'TEST-2': case 'TEST-2':
   do_something();
   break;  // to stop falling through to next option

default:  // any other case not above
  do_other_thing();
  break;  //Not really needed as is last statement but good practice 
   }

And default can appear anywhere in the statement, not just as last item.

Cheers
-- 
Quod subigo farinam

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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



[PHP] SESSION variables losing data on WinXP?

2003-09-17 Thread Jami
I'm working on a project, and up until recently was using my hosting
account to do projects, but decided to update PHP on my comp to be able
to work on projects locally. I'm running WindowsXP, PHP 4.3.2, Apache
1.3, and MySQL 3.23.53. The validation page is called on each page, but
if I go to a page other than the entry page (which the validation page
takes you to when you first log in), it throws me back to the login
page. Has anyone run into this and have you solved it? Anyone have a
suggestion? Code is rather lengthy, if you want it I can send it off
list.
 

Jami Moore
LightSpark Digital Designs
 mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
 http://www.lightsparkdigital.com/ http://www.lightsparkdigital.com/

 


Re: [PHP] ignore_user_abort not working

2003-09-17 Thread Sid
Sorry, a mistake on my part. The script continues to work, but
connection_aborted() does not detect if the host disconnected. It is all
acting very funny. I also kept witing the return from connection_status ()
to a file and it keeps witing 0 to the file even after the user disconnects.

- Sid

- Original Message -
From: Sid [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 17 September 2003 Wednesday 1:04 PM
Subject: [PHP] ignore_user_abort not working


 Hello,

 I am calling ignore_user_abort(true) in one of my scripts, but the script
stops just like it would if I did not call it.

 Any idea why it is not working?

 Thanks

 - Sid



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



Re: [PHP] SESSION variables losing data on WinXP?

2003-09-17 Thread Larry_Li
I believe all pages in your site are protected by session variables. Try 
to login first, then go where you want to go. Or try to remark codes which 
check your login status. 






Jami [EMAIL PROTECTED]
09/17/2003 03:52 PM
Please respond to listmail
 
To: PHP General [EMAIL PROTECTED]
cc: 
Subject:[PHP] SESSION variables losing data on WinXP?
 


I'm working on a project, and up until recently was using my hosting
account to do projects, but decided to update PHP on my comp to be able
to work on projects locally. I'm running WindowsXP, PHP 4.3.2, Apache
1.3, and MySQL 3.23.53. The validation page is called on each page, but
if I go to a page other than the entry page (which the validation page
takes you to when you first log in), it throws me back to the login
page. Has anyone run into this and have you solved it? Anyone have a
suggestion? Code is rather lengthy, if you want it I can send it off
list.
 

Jami Moore
LightSpark Digital Designs
 mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
 http://www.lightsparkdigital.com/ http://www.lightsparkdigital.com/

 



Re: [PHP] SESSION variables losing data on WinXP?

2003-09-17 Thread Larry_Li
Did you open register_globals = On in php.ini?







Larry Li/CNTR/APPLIED [EMAIL PROTECTED]
09/17/2003 04:04 PM
 
To: [EMAIL PROTECTED]
cc: PHP General [EMAIL PROTECTED]
Subject:Re: [PHP] SESSION variables losing data on WinXP?
 


I believe all pages in your site are protected by session variables. Try 
to login first, then go where you want to go. Or try to remark codes which 

check your login status. 






Jami [EMAIL PROTECTED]
09/17/2003 03:52 PM
Please respond to listmail
 
To: PHP General [EMAIL PROTECTED]
cc: 
Subject:[PHP] SESSION variables losing data on WinXP?
 


I'm working on a project, and up until recently was using my hosting
account to do projects, but decided to update PHP on my comp to be able
to work on projects locally. I'm running WindowsXP, PHP 4.3.2, Apache
1.3, and MySQL 3.23.53. The validation page is called on each page, but
if I go to a page other than the entry page (which the validation page
takes you to when you first log in), it throws me back to the login
page. Has anyone run into this and have you solved it? Anyone have a
suggestion? Code is rather lengthy, if you want it I can send it off
list.
 

Jami Moore
LightSpark Digital Designs
 mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
 http://www.lightsparkdigital.com/ http://www.lightsparkdigital.com/

 




[PHP] OCIBindByName pass-by-reference

2003-09-17 Thread Laurent Drouet
Hi,

My Php Version is 4.3.1

When I use ocibindbyname like below

OCIBindByName($stmt,:nb_lines_matched, $nblignes, 32)

I receive the following message :

[Tue Sep 16 13:43:01 2003] [error] PHP Warning:  Call-time
pass-by-reference has been deprecated - argument passed by value;  If you
would like to pass it by reference, modify the declaration of
ocibindbyname().  If you would like to enable call-time pass-by-reference,
you can set allow_call_time_pass_reference to true in your INI file.
However, future versions may not support this any longer.  in
/var/www/ican/automatch.php on line 34

What is the Good Solution to solve it ?

Regards

Laurent Drouet

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



[PHP] Zip library

2003-09-17 Thread Stéphane Paquay
Hi all,

I need to unzip a file on a linux server automatically.

I found the ZZiplib being able to do this but I don't know how to configure
PHP to handle it.

I use PHP 4.2.2.

Thanks in advance,

Stephane.

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



RE: [PHP] SESSION variables losing data on WinXP?

2003-09-17 Thread Jami
Knew I forgot to mention something. No, register_globals are off. Using
$_SESSION[] variables. I am logging in first. I log in fine, its when I
try to go to another page via a link on the entry page that I get booted
back to the login page. My scripts work fine on a Unix server, which is
what I reluctantly had to go back to using as this projects deadline is
too close not to do so. Its just on my computer locally that this does
not work. Code is below, it is fairly long.
 
Example Code:
 
//validation.php
include_once 'db.php';
include_once 'common.php'
 
 session_start();
 
 $uname = isset($_POST['username']) ? $_POST['username'] :
$_SESSION['username']; 
 $pwd = isset($_POST['password']) ? $_POST['password'] :
$_SESSION['password'];
 
 if(!isset($uname))
 {
  header(Location: login.php);
  exit;
 }
 
 $_SESSION['username'] = $uname; 
 $_SESSION['password'] = $pwd;
 
 dbConnect(db); 
 $sql = SELECT * FROM admin WHERE 
 admin_uname = '$uname' AND admin_pword = PASSWORD('$pwd');
 $result = mysql_query($sql); 
 
 if (!$result) { 
  error('A database error occurred while checking your login
details.\\nIf this error persists, please contact
[EMAIL PROTECTED]'); 
 }
 
 while($row = mysql_fetch_array($result))
 {
  $admin_id = $row['admin_id'];
 }
 
 $_SESSION['aid'] = $admin_id;
 
 if (mysql_num_rows($result) == 0) { 
   unset($_SESSION['username']); 
   unset($_SESSION['password']);
   
   header(Location:login.php?item=badlogin);
   exit;  
 }
 
___
//login.php
... this is an html page with the login form. When submitted it goes to
index.php.
 
___
//index.php
include('validation.php');
 
 if(!$_SESSION['aid'])
 {
  header(Location:login.php);
  exit;
 }
 rest of page is HTML with a php include for the navigation
___
//nav.php
.a href=admin_signup.phpAdd Admin/a
 
___
//admin_signup.php
include('validation.php');
 
 if(!$_SESSION['aid'])
 {
  header(Location:admin_login.php);
  exit;
 }
 rest of page is HTML with a form that goes to add_admin.php for
validation and submission to the database. Its when I try to go to this
page via the link that I get sent back to the login page.
 

Jami Moore
LightSpark Digital Designs
 mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
 http://www.lightsparkdigital.com/ http://www.lightsparkdigital.com/

 


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]

Sent: Wednesday, September 17, 2003 3:08 AM


Did you open register_globals = On in php.ini? 


 -Original Message- 
Larry Li/CNTR/APPLIED [EMAIL PROTECTED] 
09/17/2003 04:04 PM   

I believe all pages in your site are protected by session variables. Try

to login first, then go where you want to go. Or try to remark codes
which 
check your login status. 


-Original Message-
Jami [EMAIL PROTECTED]
09/17/2003 03:52 PM

I'm working on a project, and up until recently was using my hosting
account to do projects, but decided to update PHP on my comp to be able
to work on projects locally. I'm running WindowsXP, PHP 4.3.2, Apache
1.3, and MySQL 3.23.53. The validation page is called on each page, but
if I go to a page other than the entry page (which the validation page
takes you to when you first log in), it throws me back to the login
page. Has anyone run into this and have you solved it? Anyone have a
suggestion? Code is rather lengthy, if you want it I can send it off
list.

Jami Moore
LightSpark Digital Designs
mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
http://www.lightsparkdigital.com/ http://www.lightsparkdigital.com/








Re: [PHP] problem with gd

2003-09-17 Thread Jason Wong
On Wednesday 17 September 2003 15:25, Harry Wiens wrote:

 i got a problem with the gd library at my isp's server.

What version of PHP?

[snip]

 but when I use ImageCreateTrueColor the transparency is gone and the image
 is still ugly!

 Phpinfo shows:
 gd supportenabled
 gd version2.0 or higher
 Freetype supportenabled
 Freetype linkagewith Freetype
 JPG supportenabled
 PNG supportenabled
 wbmp supportenabled

 Anyone got an idea for me?

Maybe it's related to this:

With PHP 4.3.2 compiled with the bundled gd libs, there is a problem with 
imagecopymerge(). Instead of merging the images, one image overwrites the 
other.

Recompiling PHP 4.3.2 to use the standard gd libs (not the bundled ones) 
resolves the problem.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
I smell a RANCID CORN DOG!
*/

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



[PHP] Headers, outputting a file ..

2003-09-17 Thread Wouter van Vliet
Hi All,
 
I feel almost ashamed for having to ask this question. Mostlly because I
know it's been asked so many tmes but I just don't seem to be able to get it
working. I want to secure some files from viewing by putting them in a
different folder than the document root. Then, through a simple Content
class output them to the browser, and of course have this browser display
the page correctly. This file comes from an admin user upload, and can be of
any time. pdf, doc, jpg, xls, well .. don't need to name all existing file
extensions, do I? And I just know the answer has been given in a previous
post, which I just cannot find on the archives.
 
Here's the deal:
 
110 $File = $this-Get($User);
111
112 foreach($File['Headers'] as $H) header($H);;
113 readfile($File['Path']);

Which I think is perfectly valid code for outputting this file. Now, several
examples of what $File will contain after the call to $this-Get($User) ;)

1: Array
(
[Headers] = Array
(
[0] = Content-Type: image/pjpeg
[1] = Content-Disposition: attachment; filename=duuude.jpg
[2] = Accept-Ranges: bytes
[3] = Conent-Length: 23256
)

[Path] = /home/wouter/projects/mspa.nl/files/duuude.jpg
)


1: Array
(
[Headers] = Array
(
[0] = Content-Type: application/msword
[1] = Content-Disposition: attachment;
filename=Modulehandleiding.doc
[2] = Accept-Ranges: bytes
[3] = Conent-Length: 156672
)

[Path] = /home/wouter/projects/mspa.nl/files/Modulehandleiding.doc
)


1: Array
(
[Headers] = Array
(
[0] = Content-Type: application/pdf
[1] = Content-Disposition: attachment;
filename=Interviewschema.pdf
[2] = Accept-Ranges: bytes
[3] = Conent-Length: 40141
)

[Path] = /home/wouter/projects/mspa.nl/files/Interviewschema.pdf
)

As for the first one, it works. It shows me the image on my screen .. The
word document and pdf file are shown as they would look like if they're
opened in notepad or such.

Any help is widely appriciated .. ;)
Wouter

Ps. To clearify: $this is the internal instance of my Content class, $User
is passed onto the function to check if he is allowed to view the content.

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



Re: [PHP] problem with gd

2003-09-17 Thread Miroslaw Milewski
Harry Wiens wrote:

  ImageCopyResized($im, $im2, 0, 0, 0, 0, 281, 173, ImageSX($im2),

 You may try imageCopyResampled(); instead.

--

	mm.

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


Re: [PHP] Zip library

2003-09-17 Thread Jason Wong
On Wednesday 17 September 2003 16:38, Sthane Paquay wrote:

 I need to unzip a file on a linux server automatically.

 I found the ZZiplib being able to do this but I don't know how to configure
 PHP to handle it.

You need to recompile php adding 

  --with-zip[=DIR]

If you don't know how to do this then read manual  Installation. Or search 
out some tutorials.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Life is like an onion: you peel off layer after layer and then you find
there is nothing in it.
-- James Huneker
*/

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



Re: [PHP] problem with gd

2003-09-17 Thread Harry Wiens
I have PHP-Version 4.2.2

Jason Wong [EMAIL PROTECTED] schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
 On Wednesday 17 September 2003 15:25, Harry Wiens wrote:

  i got a problem with the gd library at my isp's server.

 What version of PHP?

 [snip]

  but when I use ImageCreateTrueColor the transparency is gone and the
image
  is still ugly!
 
  Phpinfo shows:
  gd supportenabled
  gd version2.0 or higher
  Freetype supportenabled
  Freetype linkagewith Freetype
  JPG supportenabled
  PNG supportenabled
  wbmp supportenabled
 
  Anyone got an idea for me?

 Maybe it's related to this:

 With PHP 4.3.2 compiled with the bundled gd libs, there is a problem with
 imagecopymerge(). Instead of merging the images, one image overwrites the
 other.

 Recompiling PHP 4.3.2 to use the standard gd libs (not the bundled ones)
 resolves the problem.

 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 I smell a RANCID CORN DOG!
 */

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



[PHP] sessions

2003-09-17 Thread phpu
I have a little problem whit this script

...

$sql=INSERT INTO tranzactii (name, email) values 
('.$_POST['name'].','.$_POST['email'].');
$result=mysql_query($sql);
$id_transaction=mysql_insert_id();

for ($i=0; $i  count($_SESSION['id_product']); $i++)
{
if ($_SESSION['nr'][$i]  0)
{
$sql1=INSERT INTO sales values 
('.$id_tranzactie.','.$_SESSION['id_product'][$i].','.$_SESSION['nr'][$i].');
mysql_query($sql1);
}
}
---
The probem is that if i have more products only first id_product is insert into table 
sales. The rest id_product are inserted with 0.

How can I get over it?


[PHP] Object in session and include

2003-09-17 Thread Marco Schuler
Hi

I have to serialize an object in a session. Generally there is no
problem with this if the class-definition file(s) are included _before_
starting the session, as explained in the php-manual:

quoting

 It is strongly recommended that you include the class definitions of
all such registered objects on all of your pages, even if you do not
actually use these classes on all of your pages. If you don't and an
object is being unserialized without its class definition being present,
it will lose its class association and become an object of class
stdClass without any functions available at all, that is, it will become
quite useless.

/quoting

I am using PEAR classes for my project. If I want to store such an
object in a session, I would have to include all the class-definitions
that are included within the class that I am using. There can be a lot
of included classes or also dynamically incldued classes.

Has somebody got an idea or an acceptable solution to handle this
without including all the class-definitions?

--
Cheers!
 Marco

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



[PHP] consistent PHP function names?

2003-09-17 Thread Eugene Lee
One thing that's always bothered me about PHP is that the function names
are not terribly consistent.  For example, when are underscores okay?
strip_tags() has an underscore but stripslashes() does not.  Also,
should inverse functions be named appropriately?  htmlentities() and
html_entity_decode() are inverse functions.  But seems to make more
sense to rename htmlentities() to html_entity_encode().  Something like
a class[_subclass1[_subclass2[...]]]_method nomenclature makes sense.

Then you have really weird stuff.  For example, md5() is listed as a
string function since it takes a string, calculates the MD5 hash, and
returns said hash.  Makes sense.  Then you have md5_file(), which takes
a filename, calculates the MD5 hash of the file's contents, and returns
said hash.  But md5_file() is listed as a string function.  To me, it
makes more sense to be classified as a filesystem function, and maybe
even rename the function to file_md5().

Thoughts?

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



RE: [PHP] Getting part of a string...Was protecting a file via php

2003-09-17 Thread Steve Jackson
Thanks to all so far.
However I am still having problems I have directory outside the root
with PDF's in it. The links to the PDF files are called successfully by
this function in a page I call getlinks.php

function do_non_root_links()
{
define('FILEDIR', '/home/.sites/144/site281/downloads/'); 
//display available files
$d = dir(FILEDIR); 
while($f = $d-read()) 
{ 
   //skip 'hidden' files 
   if($f{0} != '.') 
   {
echo trtd; 
echo a href=\get.php?file=$f\ class=\greenlinks\
target=\_blank\$f/a; 
echo /td/tr;
} 
} 
$d-close(); 
}

The URL displayed is then to be processed by get.php. My problem *I
think* is losing get.php?file= from the URL which I managed to do by
doing $pfile = str_replace('get.php?file=','','$file');
This however then becomes confusing because $pfile I assumed would then
be simply the filename without the URL. I figured that if I exploded the
name and pulled the extension from the file passed that into a switch to
send the appropriate header my problem would be solved. However it
isn't. This is the code and de-bugging I've done.
? 
define('FILEDIR', '/home/.sites/144/site281/downloads/'); 
$path = FILEDIR . $file; 

//check that this file exists and that it doesn't include 
//any special characters 
if(!is_file($path) OR !eregi('^[A-Z_0-9][A-Z_0-9.]*$', $file)) 
{ 
header(Location: error.php); 
exit(); 
} 

/* 
** //check that the user has permission to download file 
** if(user does not have permission) 
** { 
** //redirect to error page 
** header(Location: error.php); 
** exit(); 
** } 
*/ 


$pfile = str_replace('get.php?file=','','$file');
$p = explode('.', $file); 
$extension = $p[sizeof($p)-1];
// debug - remove the headers and test output vars.
echo Test and $extension;
echo brTest and $file;
echo brTest and $p;
echo brTest and $pfile;
/*switch ($extension)
{
// define headers depending on $extension variable.
case doc :
header(Content-type: application/msword\n);
break;
case pdf :
header(Content-type: application/pdf\n);
break;
default :
// force download dialog if no extension defined.
header(Content-type: application/octet-stream\n); 
header(Content-disposition: attachment; filename=\$file\\n);
break; 
} 

header(Content-transfer-encoding: binary\n); 
header(Content-length:  . filesize($path) . \n); 
//send file contents 
$fp=fopen($path, r); 
fpassthru($fp); 
*/
? 

Echoing the vars produces this. The exploded file ($extension) is what I
need to pass to the switch but if I send the headers as is again I get a
blank and corrupted explorer window. 

Test and pdf
Test and EventNotification_01.pdf
Test and Array
Test and $file

Any ideas how to proceed?
Cheers,

Steve.

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



RE: [PHP] Object in session and include

2003-09-17 Thread chris . neale
I was under the impression that if you used include_once then the script
would only include the class definition if it was required within the
script.

You might want to check the manaul or get a second opinion on that, but
that's what I've always done.

Regards

Chris

-Original Message-
From: Marco Schuler [mailto:[EMAIL PROTECTED]
Sent: 17 September 2003 10:45
To: [EMAIL PROTECTED]
Subject: [PHP] Object in session and include


Hi

I have to serialize an object in a session. Generally there is no
problem with this if the class-definition file(s) are included _before_
starting the session, as explained in the php-manual:

quoting

 It is strongly recommended that you include the class definitions of
all such registered objects on all of your pages, even if you do not
actually use these classes on all of your pages. If you don't and an
object is being unserialized without its class definition being present,
it will lose its class association and become an object of class
stdClass without any functions available at all, that is, it will become
quite useless.

/quoting

I am using PEAR classes for my project. If I want to store such an
object in a session, I would have to include all the class-definitions
that are included within the class that I am using. There can be a lot
of included classes or also dynamically incldued classes.

Has somebody got an idea or an acceptable solution to handle this
without including all the class-definitions?

--
Cheers!
 Marco

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



Re: [PHP] consistent PHP function names?

2003-09-17 Thread Justin French
I posted a similar topic a few months back.  I guess the answer is that 
the collaborative nature of open source, and the fact that PHP has 
grown from very humble beginnings has meant that naming standards and 
conventions are a little lacking.

It would've been nice if these issues were rectified in PHP5 with 
deprecated aliases to the old names left in for backwards 
compatibility, but it'd be a HUGE job :)

Justin

On Wednesday, September 17, 2003, at 08:51  PM, Eugene Lee wrote:

One thing that's always bothered me about PHP is that the function 
names
are not terribly consistent.  For example, when are underscores okay?
strip_tags() has an underscore but stripslashes() does not.  Also,
should inverse functions be named appropriately?  htmlentities() and
html_entity_decode() are inverse functions.  But seems to make more
sense to rename htmlentities() to html_entity_encode().  Something like
a class[_subclass1[_subclass2[...]]]_method nomenclature makes sense.

Then you have really weird stuff.  For example, md5() is listed as a
string function since it takes a string, calculates the MD5 hash, and
returns said hash.  Makes sense.  Then you have md5_file(), which takes
a filename, calculates the MD5 hash of the file's contents, and returns
said hash.  But md5_file() is listed as a string function.  To me, it
makes more sense to be classified as a filesystem function, and maybe
even rename the function to file_md5().
Thoughts?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
---
[This E-mail scanned for viruses]

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


RE: [PHP] consistent PHP function names?

2003-09-17 Thread chris . neale
The English language can be just as confusing at times, and is full of
exceptions to rules - people just get used to them. The same can apply to a
programming language. I'm not of why PHP's naming conventions are like this,
but I can only assume it's to do with the way the language has evolved,
perhaps inheriting naming conventions from other languages. I can't imagine
there are any plans to standardise it.

In practice, I find that all my code is wrapped up in custom functions and
objects anyway - I name those quite carefully to avoid confusing myself and
others, but don't need to worry too much about the naming conventions of the
functions inside. When writing complicated scripts, I  often find choosing
variable / function naming conventions takes a long time.

I've got used to the quirks of PHP, but can see your point.

Chris


-Original Message-
From: Eugene Lee [mailto:[EMAIL PROTECTED]
Sent: 17 September 2003 10:51
To: [EMAIL PROTECTED]
Subject: [PHP] consistent PHP function names?


One thing that's always bothered me about PHP is that the function names
are not terribly consistent.  For example, when are underscores okay?
strip_tags() has an underscore but stripslashes() does not.  Also,
should inverse functions be named appropriately?  htmlentities() and
html_entity_decode() are inverse functions.  But seems to make more
sense to rename htmlentities() to html_entity_encode().  Something like
a class[_subclass1[_subclass2[...]]]_method nomenclature makes sense.

Then you have really weird stuff.  For example, md5() is listed as a
string function since it takes a string, calculates the MD5 hash, and
returns said hash.  Makes sense.  Then you have md5_file(), which takes
a filename, calculates the MD5 hash of the file's contents, and returns
said hash.  But md5_file() is listed as a string function.  To me, it
makes more sense to be classified as a filesystem function, and maybe
even rename the function to file_md5().

Thoughts?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] consistent PHP function names?

2003-09-17 Thread Marco Schuler
Am Mit, 2003-09-17 um 14.26 schrieb [EMAIL PROTECTED]:
 
 In practice, I find that all my code is wrapped up in custom functions and
 objects anyway - I name those quite carefully to avoid confusing myself and
 others, but don't need to worry too much about the naming conventions of the
 functions inside. When writing complicated scripts, I  often find choosing
 variable / function naming conventions takes a long time.

I am using the convention proposed by PEAR:

http://pear.php.net/manual/en/standards.naming.php

--
 Marco

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



Re: [PHP] Object in session and include

2003-09-17 Thread Marek Kilimajer
Look at http://sk.php.net/unserialize
Example 1. unserialize_callback_func example
Marco Schuler wrote:

Hi

I have to serialize an object in a session. Generally there is no
problem with this if the class-definition file(s) are included _before_
starting the session, as explained in the php-manual:
quoting

 It is strongly recommended that you include the class definitions of
all such registered objects on all of your pages, even if you do not
actually use these classes on all of your pages. If you don't and an
object is being unserialized without its class definition being present,
it will lose its class association and become an object of class
stdClass without any functions available at all, that is, it will become
quite useless.
/quoting

I am using PEAR classes for my project. If I want to store such an
object in a session, I would have to include all the class-definitions
that are included within the class that I am using. There can be a lot
of included classes or also dynamically incldued classes.
Has somebody got an idea or an acceptable solution to handle this
without including all the class-definitions?
--
Cheers!
 Marco
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Getting part of a string...Was protecting a file via php

2003-09-17 Thread Steve Jackson
I can now download the file as application/octet-stream but it won't
allow me to open the file inline as a PDF. The only way I managed to be
able to download the file at all was by stripping the URL from the front
of the filename (I think).
What am I doing wrong??
$pfile = str_replace('get.php?file=','','$file');
$p = explode('.', $pfile); 
$extension = $p[sizeof($p)-1];

$pfile when echoed is $file
$file when echoed is the correct name of the file which is even more
confusing.
I figured that $file would include the URL which might be why it hanged
explorer.

Steve Jackson
Web Development and Marketing Manager
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159





 -Original Message-
 From: Steve Jackson [mailto:[EMAIL PROTECTED] 
 Sent: 17. syyskuuta 2003 13:53
 To: 'PHP General'; 'Jon Haworth'
 Subject: RE: [PHP] Getting part of a string...Was protecting 
 a file via php
 
 
 Thanks to all so far.
 However I am still having problems I have directory outside 
 the root with PDF's in it. The links to the PDF files are 
 called successfully by this function in a page I call getlinks.php
 
 function do_non_root_links()
 {
 define('FILEDIR', '/home/.sites/144/site281/downloads/'); 
 //display available files
 $d = dir(FILEDIR); 
 while($f = $d-read()) 
 { 
//skip 'hidden' files 
if($f{0} != '.') 
{
   echo trtd; 
 echo a href=\get.php?file=$f\ 
 class=\greenlinks\ target=\_blank\$f/a; 
 echo /td/tr;
   } 
 } 
 $d-close(); 
 }
 
 The URL displayed is then to be processed by get.php. My problem *I
 think* is losing get.php?file= from the URL which I managed 
 to do by doing $pfile = str_replace('get.php?file=','','$file');
 This however then becomes confusing because $pfile I assumed 
 would then be simply the filename without the URL. I figured 
 that if I exploded the name and pulled the extension from the 
 file passed that into a switch to send the appropriate header 
 my problem would be solved. However it isn't. This is the 
 code and de-bugging I've done. ? 
 define('FILEDIR', '/home/.sites/144/site281/downloads/'); 
 $path = FILEDIR . $file; 
 
 //check that this file exists and that it doesn't include 
 //any special characters 
 if(!is_file($path) OR !eregi('^[A-Z_0-9][A-Z_0-9.]*$', $file)) 
 { 
 header(Location: error.php); 
 exit(); 
 } 
 
 /* 
 ** //check that the user has permission to download file 
 ** if(user does not have permission) 
 ** { 
 ** //redirect to error page 
 ** header(Location: error.php); 
 ** exit(); 
 ** } 
 */ 
 
 
   $pfile = str_replace('get.php?file=','','$file');
   $p = explode('.', $file); 
   $extension = $p[sizeof($p)-1];
   // debug - remove the headers and test output vars.
   echo Test and $extension;
   echo brTest and $file;
   echo brTest and $p;
   echo brTest and $pfile;
 /*switch ($extension)
   {
   // define headers depending on $extension variable.
   case doc :
   header(Content-type: application/msword\n);
   break;
   case pdf :
   header(Content-type: application/pdf\n);
   break;
   default :
   // force download dialog if no extension defined.
   header(Content-type: application/octet-stream\n); 
 header(Content-disposition: attachment; filename=\$file\\n);
   break; 
   } 
 
   header(Content-transfer-encoding: binary\n); 
 header(Content-length:  . filesize($path) . \n); 
   //send file contents 
 $fp=fopen($path, r); 
 fpassthru($fp); 
   */
 ? 
 
 Echoing the vars produces this. The exploded file 
 ($extension) is what I need to pass to the switch but if I 
 send the headers as is again I get a blank and corrupted 
 explorer window. 
 
 Test and pdf
 Test and EventNotification_01.pdf
 Test and Array
 Test and $file
 
 Any ideas how to proceed?
 Cheers,
 
 Steve.
 
 -- 
 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] Zip library

2003-09-17 Thread Marek Kilimajer
There are also pure php classes that can handle zip files, for example 
http://www.phpconcept.net/pclzip/index.en.php

Stéphane Paquay wrote:

Hi all,

I need to unzip a file on a linux server automatically.

I found the ZZiplib being able to do this but I don't know how to configure
PHP to handle it.
I use PHP 4.2.2.

Thanks in advance,

Stephane.

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


Re: [PHP] Headers, outputting a file ..

2003-09-17 Thread Adam i Agnieszka Gasiorowski FNORD
Wouter van Vliet wrote:
 
 110 $File = $this-Get($User);
 111
 112 foreach($File['Headers'] as $H) header($H);;
 113 readfile($File['Path']); 

Do I see TWO ; here or it's just a typo?

-- 
Seks, seksi, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info  { iWanToDie }   WiNoNa)   (
http://szatanowskie-ladacznice.0-700.pl  foReVeR(  *  )
Poznaj jej zwiewne ksztaty... http://www.opera.com 007

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



Re: [PHP] Problem sending HTML formated mail

2003-09-17 Thread David T-G
Juan --

...and then Juan Carlos Borrero said...
% 
% Hi People

Hi!


% 
% I'm using the mail() function in order to send HTML formated e-mails to my
% customers in an automatic process, witha aPHP program. Some times the

OK.  HTML mail is evil, but continue on ;-)


% e-mails where produced with  a sort of non intelligible caracters and the
% headers were exposed. Even if i repeat the same e-mail some times where
% produced ok and the next where wrong.

Can you give an example of such a failed email, and perhaps your script?
We may need to see all of the relevant data, such as the message template
and the user info for some that worked and -- more importantly -- some
that didn't, but just the first bits would give us a start.


% 
% I have my site  hoted in detailhosting.com, Versión P.H.P 4.3.2,  Mysql
% 4.0.15 , Apache 1.3.27 ,  Linux Kernel Version 2.4.21-grsec.
% 
% The guys of detailhosting don´t know what to do.

Well, without more info neither do we :-)


% 
% Please help me. I don´t know what to do...

Start by giving us more information.


% 
% Thanks in advace.
% 
% Juan Carlos Borrero
% Webmaster - www.lupajuridica.com


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!



pgp0.pgp
Description: PGP signature


Re: [PHP] webhost --0T--

2003-09-17 Thread David T-G
Ryan --

...and then Ryan A said...
% 
% Hiya everyone,

Hi!


% 
% We are creating a voteing/rateing script for BestWebHosters.com (a
...
% 
% Voteing will be allowed only to clients who register and confirm their email
% addresses, plus only 1 vote per IP and we will be using cookies + other
% security features...to keep things fair. Any suggestions there too will be
% appreciated.

That would be terrible for anyone behind a firewall.  Leave it at once
per email address and just live with the fact that some people have more
than one available.

In addition, I presume you mean that one can only vote once for a given
web host vs having to pick a single one and vote for it and that's it...
I know of a few directly and should be able to vote on all of them.

It would be nice if you saved everyone's votes and let users modify them,
but that gets into a bit more work on your part.  But it would be nice :-)


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!



pgp0.pgp
Description: PGP signature


Re: [PHP] Whats wrong with my code?

2003-09-17 Thread David T-G
Stevie --

You've already been beaten up about posting tons of code, so I won't add
to that (much, anyway; DON'T, and ABSOLUTELY DON'T 'TOFU' POST!).  And
you've heard that you needed the ; on the last line and to correct your
occasional $includes problems, so that's done.

Yes, you should work on reducing the problem to its minimum cause.  While
a default case is not required for a switch statement, you could have the
same problem by replacing all of those cases with a default -- and then
you not only might find the answer yourself but you also wouldn't take so
much heat for posting so much junk :-)

You should also read the manual to see how to use include().  I'll bet a
twinkie that /includes doesn't exist on your server (who would give a web
site access to files right off of the system root directory??) but am not
going to tell you any more because you should go and look it up yourself.

No, this reply is more about style and tricks.  Your code is long and
difficult to debug because of its sheer bulk, and it needn't be.

I would write your entire 200 (or 151) lines of code as

  ?php
$page = $_GET['id'] ;
if ( is_file(/includes/$page.html) )
  { include(/includes/$page.html) ; }
  ?

if you didn't need to exclude any possibilities or, much more sanely,

  ?php
$includes = array ( home, arts, ...  world) ;
$page = $_GET['id'] ;
if ( in_array($page,$includes)  is_file(/includes/$page.html) )
  { include(/includes/$page.html) ; }
  ?

(just from the top of my head, though, without real thought for security)
and in reality I'd probably not bother with the $page temp variable.

Good luck, and enjoy :-)


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!



pgp0.pgp
Description: PGP signature


[PHP] Using system

2003-09-17 Thread Uros
Hello!

I'm pulling my hair. What is the right syntax to set output of some system
call to variable.

I tried everything (system, shell_exec,exec) and always get output to
screen.

Please help.

PHP version 4.3.3 CLI

-- 
Best regards,
 Uros

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



[PHP] How to do Javascript for the HTML/PHP Array (See Below)

2003-09-17 Thread Scott Fletcher
Hi Fellas!

Here's the clipping of an article about putting HTML variables into a
PHP Array upon submission.  Right now, I'm having trouble getting Javascript
to do the error checking of each of the HTML variable if it's variable name
is treated as an array.  Anyone know of a workaround to it where Javascript
can detect and work with the HTML Array-like variable name???

--snip--

3. How do I create arrays in a HTML form?

To get your form result sent as an array to your PHP script you name the
input, select or textarea elements like this: input name=MyArray[]
input name=MyArray[]
input name=MyArray[]
input name=MyArray[]
Notice the square brackets after the variable name, that's what makes it an
array. You can group the elements into different arrays by assigning the
same name to different elements: input name=MyArray[]
input name=MyArray[]
input name=MyOtherArray[]
input name=MyOtherArray[]
This produces two arrays, MyArray and MyOtherArray, that gets sent to the
PHP script. It's also possible to assign specific keys to your arrays:
input name=AnotherArray[]
input name=AnotherArray[]
input name=AnotherArray[email]
input name=AnotherArray[phone]
The AnotherArray array will now contain the keys 0, 1, email and phone.


  Note: Specifying an arrays key is optional in HTML. If you do not specify
the keys, the array gets filled in the order the elements appear in the
form. Our first example will contain keys 0, 1, 2 and 3.


See also Array Functions and Variables from outside PHP.

--snip--

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



Re: [PHP] SESSION variables losing data on WinXP?

2003-09-17 Thread Scott Fletcher
Speaking of your problem, you're using the header() function to exit the
webpage to the login page.  So, it all come down to the either one of these
two or both of these two

 if(!isset($uname)) {
 if (mysql_num_rows($result) == 0) {

Upon closer inspection on the script, it look like either the $_POST['***']
wasn't returning data or the $_SESSION['***'] doesn't have data in it that
tripped the header() function.  So, I'll take the assumption that the
$_POST['***'] does work as it alway does.  So, it narrow down to
$_SESSION['***'].

Since you mentioned that you use it on both Unix and Windows.  So, most
likely it all narrow down to php.ini.  Can you check to verify that the
filepath is correct for Windows and that there is no issue with file
permission.  Here's what I have that work for me on Windows 2000.

--clip--
[Session]
; Handler used to store/retrieve data.
session.save_handler = files

; Argument passed to save_handler.  In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
session.save_path = c:\tmp

; Whether to use cookies.
session.use_cookies = 1

; This option enables administrators to make their users invulnerable to
; attacks which involve passing session ids in URLs; defaults to 0.
; session.use_only_cookies = 1

; Name of the session (used as cookie name).
session.name = PHPSESSID

; Initialize session on request startup.
session.auto_start = 0

; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 0

; The path for which the cookie is valid.
session.cookie_path = c:\tmp

; The domain for which the cookie is valid.
session.cookie_domain =

; Handler used to serialize data.  php is the standard serializer of PHP.
session.serialize_handler = php

; Define the probability that the 'garbage collection' process is started
; on every session initialization.
; The probability is calculated by using gc_probability/gc_divisor,
; e.g. 1/100 means there is a 1% chance that the GC process starts
; on each request.

session.gc_probability = 1
session.gc_divisor = 1000

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 1440

; PHP 4.2 and less have an undocumented feature/bug that allows you to
; to initialize a session variable in the global scope, albeit
register_globals
; is disabled.  PHP 4.3 and later will warn you, if this feature is used.
; You can disable the feature and the warning seperately. At this time,
; the warning is only displayed, if bug_compat_42 is enabled.

session.bug_compat_42 = 0
session.bug_compat_warn = 1

; Check HTTP Referer to invalidate externally stored URLs containing ids.
; HTTP_REFERER has to contain this substring for the session to be
; considered as valid.
session.referer_check =

; How many bytes to read from the file.
session.entropy_length = 0

; Specified here to create the session id.
session.entropy_file =

;session.entropy_length = 16

;session.entropy_file = /dev/urandom

; Set to {nocache,private,public,} to determine HTTP caching aspects.
; or leave this empty to avoid sending anti-caching headers.
session.cache_limiter = nocache

; Document expires after n minutes.
session.cache_expire = 180

; trans sid support is disabled by default.
; Use of trans sid may risk your users security.
; Use this option with caution.
; - User may send URL contains active session ID
;   to other person via. email/irc/etc.
; - URL that contains active session ID may be stored
;   in publically accessible computer.
; - User may access your site with the same session ID
;   always using URL stored in browser's history or bookmarks.
session.use_trans_sid = 0

; The URL rewriter will look for URLs in a defined set of HTML tags.
; form/fieldset are special; if you include them here, the rewriter will
; add a hidden input field with the info which is otherwise appended
; to URLs.  If you want XHTML conformity, remove the form entry.
; Note that all valid entries require a =, even if no value follows.
url_rewriter.tags =
a=href,area=href,frame=src,input=src,form=fakeentry--clip--

One thing I noticed is that I had to create a folder called 'tmp' for it to
work.

Hope that help..
 Scott F.


Jami [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Knew I forgot to mention something. No, register_globals are off. Using
 $_SESSION[] variables. I am logging in first. I log in fine, its when I
 try to go to another page via a link on the entry page that I get booted
 back to the login page. My scripts work fine on a Unix server, which is
 what I reluctantly had to go back to using as this projects deadline is
 too close not to do so. Its just on my computer locally that this does
 not work. Code is below, it is fairly long.

 Example Code:

 //validation.php
 include_once 'db.php';
 include_once 'common.php'

  session_start();

 

Re: [PHP] How to do Javascript for the HTML/PHP Array (See Below)

2003-09-17 Thread Marek Kilimajer
if f = your form then f.elements['MyArray[]'] is a javascript array of 
input elements.

Scott Fletcher wrote:

Hi Fellas!

Here's the clipping of an article about putting HTML variables into a
PHP Array upon submission.  Right now, I'm having trouble getting Javascript
to do the error checking of each of the HTML variable if it's variable name
is treated as an array.  Anyone know of a workaround to it where Javascript
can detect and work with the HTML Array-like variable name???
--snip--

3. How do I create arrays in a HTML form?

To get your form result sent as an array to your PHP script you name the
input, select or textarea elements like this: input name=MyArray[]
input name=MyArray[]
input name=MyArray[]
input name=MyArray[]
Notice the square brackets after the variable name, that's what makes it an
array. You can group the elements into different arrays by assigning the
same name to different elements: input name=MyArray[]
input name=MyArray[]
input name=MyOtherArray[]
input name=MyOtherArray[]
This produces two arrays, MyArray and MyOtherArray, that gets sent to the
PHP script. It's also possible to assign specific keys to your arrays:
input name=AnotherArray[]
input name=AnotherArray[]
input name=AnotherArray[email]
input name=AnotherArray[phone]
The AnotherArray array will now contain the keys 0, 1, email and phone.
  Note: Specifying an arrays key is optional in HTML. If you do not specify
the keys, the array gets filled in the order the elements appear in the
form. Our first example will contain keys 0, 1, 2 and 3.
See also Array Functions and Variables from outside PHP.

--snip--

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


RE: [PHP] Using system

2003-09-17 Thread esctoday.com | Wouter van Vliet
Don't think there's one function for it .. Though, you may want to try the
output buffers.

ob_start();
 ( .. Exec here ..)
$Var = ob_end_clean();

, 
Wouter

-Original Message-
From: Uros [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 17, 2003 3:18 PM
To: PHP General list
Subject: [PHP] Using system

Hello!

I'm pulling my hair. What is the right syntax to set output of some system
call to variable.

I tried everything (system, shell_exec,exec) and always get output to
screen.

Please help.

PHP version 4.3.3 CLI

-- 
Best regards,
 Uros

-- 
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] Headers, outputting a file ..

2003-09-17 Thread Curt Zirzow
* Thus wrote Adam i Agnieszka Gasiorowski FNORD ([EMAIL PROTECTED]):
 Wouter van Vliet wrote:
  
  110 $File = $this-Get($User);
  111
  112 foreach($File['Headers'] as $H) header($H);;
  113 readfile($File['Path']); 
 
   Do I see TWO ; here or it's just a typo?

That doesn't matter, he could have 30 there if he wanted.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] How to do Javascript for the HTML/PHP Array (See Below)

2003-09-17 Thread Scott Fletcher
Ah!  So I do this to make it work where count can be any number...

 f.elements['MyArray[]'][count].value

That does work now.  It's been mind boggling to do the conversion between
JavaScript, HTML and PHP when it come to an array but I'm learning.  :-)

Thanks a million...
Scott F.

Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 if f = your form then f.elements['MyArray[]'] is a javascript array of
 input elements.

 Scott Fletcher wrote:

  Hi Fellas!
 
  Here's the clipping of an article about putting HTML variables into
a
  PHP Array upon submission.  Right now, I'm having trouble getting
Javascript
  to do the error checking of each of the HTML variable if it's variable
name
  is treated as an array.  Anyone know of a workaround to it where
Javascript
  can detect and work with the HTML Array-like variable name???
 
  --snip--
 
  3. How do I create arrays in a HTML form?
 
  To get your form result sent as an array to your PHP script you name
the
  input, select or textarea elements like this: input
name=MyArray[]
  input name=MyArray[]
  input name=MyArray[]
  input name=MyArray[]
  Notice the square brackets after the variable name, that's what makes it
an
  array. You can group the elements into different arrays by assigning the
  same name to different elements: input name=MyArray[]
  input name=MyArray[]
  input name=MyOtherArray[]
  input name=MyOtherArray[]
  This produces two arrays, MyArray and MyOtherArray, that gets sent to
the
  PHP script. It's also possible to assign specific keys to your arrays:
  input name=AnotherArray[]
  input name=AnotherArray[]
  input name=AnotherArray[email]
  input name=AnotherArray[phone]
  The AnotherArray array will now contain the keys 0, 1, email and phone.
 
 
Note: Specifying an arrays key is optional in HTML. If you do not
specify
  the keys, the array gets filled in the order the elements appear in the
  form. Our first example will contain keys 0, 1, 2 and 3.
 
 
  See also Array Functions and Variables from outside PHP.
 
  --snip--
 

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



[PHP] Edit a String

2003-09-17 Thread Shaun
Hi,

I have addresses stored in my database. I am trying to create a page that
generates a letter automatically for the user to print. Given a string of
format ', x, x, xxx' how can I edit it so that the comma's are
replaced with line breaks i.e. /n. This will enable me to display the
address correctly at the top of the page.

Thanks for your help

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



RE: [PHP] Edit a String

2003-09-17 Thread Jay Blanchard
[snip]
I have addresses stored in my database. I am trying to create a page
that
generates a letter automatically for the user to print. Given a string
of
format ', x, x, xxx' how can I edit it so that the comma's
are
replaced with line breaks i.e. /n. This will enable me to display the
address correctly at the top of the page.
[/snip]

http://www.php.net/ereg_replace , or don;t we use the manual? 

Have a pleasant and productive day.

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



[PHP] Re: Edit a String

2003-09-17 Thread Chris Kranz

 format ', x, x, xxx' how can I edit it so that the comma's are
 replaced with line breaks i.e. /n. This will enable me to display the

str_replace ( ,, \n, $address );

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



RE: [PHP] Using system

2003-09-17 Thread Robert Cummings
Backtick style gets you the output...

$passwords = `cat /etc/passwd`;

Cheers,
Rob.


On Wed, 2003-09-17 at 09:55, esctoday.com | Wouter van Vliet wrote:
 Don't think there's one function for it .. Though, you may want to try the
 output buffers.
 
 ob_start();
  ( .. Exec here ..)
 $Var = ob_end_clean();
 
 , 
 Wouter
 
 -Original Message-
 From: Uros [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, September 17, 2003 3:18 PM
 To: PHP General list
 Subject: [PHP] Using system
 
 Hello!
 
 I'm pulling my hair. What is the right syntax to set output of some system
 call to variable.
 
 I tried everything (system, shell_exec,exec) and always get output to
 screen.
 
 Please help.
 
 PHP version 4.3.3 CLI
 
 -- 
 Best regards,
  Uros
 
 -- 
 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
 
 
-- 
.-.
| Worlds of Carnage - http://www.wocmud.org   |
:-:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.|
`-'

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



[PHP] 'while' not picking up on first DB record

2003-09-17 Thread Roger Spears
Hello,

Can anyone from the lists please tell me why this bit of code is not 
picking up on the first record in the database?  If the 'id' I'm looking 
for is '1' it doesn't populate the _SESSION variables.  Any 'id' greater 
then '1' will populate the _SESSION variables.

$q = SELECT * FROM employee;
$r = mysql_query($q);
$row = mysql_fetch_array($r);
while ($row = mysql_fetch_array($r))
 {
   if ($employee == $row[id])
   {
   $_SESSION['dear'] = $row[last_name];
   $_SESSION['to_email'] = $row[email];
   }
 }
Thanks,
Roger
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] 'while' not picking up on first DB record

2003-09-17 Thread Miles Thompson
Please don't cross-post.
See below - M.
At 10:17 AM 9/17/2003 -0400, Roger Spears wrote:
Hello,

Can anyone from the lists please tell me why this bit of code is not 
picking up on the first record in the database?  If the 'id' I'm looking 
for is '1' it doesn't populate the _SESSION variables.  Any 'id' greater 
then '1' will populate the _SESSION variables.

$q = SELECT * FROM employee;
$r = mysql_query($q);
You're picking up first line here, but doing nothing with it.

$row = mysql_fetch_array($r);
So delete it or comment it out.


while ($row = mysql_fetch_array($r))
 {
   if ($employee == $row[id])
   {
   $_SESSION['dear'] = $row[last_name];
   $_SESSION['to_email'] = $row[email];
   }
 }
Thanks,
Roger
--
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] SOLVED= 'while' not picking up on first DB record

2003-09-17 Thread Roger Spears
I'm sorry for the double post.  Other then letting both lists know this 
was solved, it won't happen again.  Sorry.

Thank you for the solution!

I new it was simple.  I've been staring at it too long.  Fresh eyes 
always helps!

Thanks again,
Roger
You are making the fetch twice, and not using the first fetch.

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


[PHP] PHP Worldwide Stats

2003-09-17 Thread Chris Blake
Greetings learned PHP(eople);

Where can I find stats, if any, on the number of sites using PHP as a
server side language ?

I been googling around using PHP global statistics and other
combinations but can`t find anything.

Regards
 
-- 
Chris Blake
Support Consultant
Office : (011) 782-0840
Fax: (011) 782-0841
Mobile : 083 985 0379
Website: http://www.pbpc.co.za

Flame on!
-- Johnny Storm

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



Re[2]: [PHP] Using system

2003-09-17 Thread Uros
Hello Robert,

I think not

here is my code

#!/usr/local/bin/php -q
?php
$ret = `nslookup -timeout=3 www.myhost.com |grep Non-existent host/domain`;
?

I always get automaticaly output. I also try to set implicit_flush to off,
use ob ob_...

nothing works.

best regards

Wednesday, September 17, 2003, 4:16:10 PM, you wrote:

RC Backtick style gets you the output...

RC $passwords = `cat /etc/passwd`;

RC Cheers,
RC Rob.


RC On Wed, 2003-09-17 at 09:55, esctoday.com | Wouter van Vliet wrote:
 Don't think there's one function for it .. Though, you may want to try the
 output buffers.
 
 ob_start();
  ( .. Exec here ..)
 $Var = ob_end_clean();
 
 , 
 Wouter
 
 -Original Message-
 From: Uros [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, September 17, 2003 3:18 PM
 To: PHP General list
 Subject: [PHP] Using system
 
 Hello!
 
 I'm pulling my hair. What is the right syntax to set output of some system
 call to variable.
 
 I tried everything (system, shell_exec,exec) and always get output to
 screen.
 
 Please help.
 
 PHP version 4.3.3 CLI
 
 -- 
 Best regards,
  Uros
 
 -- 
 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] PHP Worldwide Stats

2003-09-17 Thread Jason Wong
On Wednesday 17 September 2003 22:44, Chris Blake wrote:

 Where can I find stats, if any, on the number of sites using PHP as a
 server side language ?

 I been googling around using PHP global statistics and other
 combinations but can`t find anything.

www.netcraft.com

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
The adjective is the banana peel of the parts of speech.
-- Clifton Fadiman
*/

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



Re: Re[2]: [PHP] Using system

2003-09-17 Thread Robert Cummings
Uros,

Run the command from the shell prompt and check your grep against the
output.

Cheers,
Rob.

On Wed, 2003-09-17 at 10:49, Uros wrote:
 Hello Robert,
 
 I think not
 
 here is my code
 
 #!/usr/local/bin/php -q
 ?php
 $ret = `nslookup -timeout=3 www.myhost.com |grep Non-existent host/domain`;
 ?
 
 I always get automaticaly output. I also try to set implicit_flush to off,
 use ob ob_...
 
 nothing works.
 
 best regards
 
 Wednesday, September 17, 2003, 4:16:10 PM, you wrote:
 
 RC Backtick style gets you the output...
 
 RC $passwords = `cat /etc/passwd`;
 
 RC Cheers,
 RC Rob.
 
 
 RC On Wed, 2003-09-17 at 09:55, esctoday.com | Wouter van Vliet wrote:
  Don't think there's one function for it .. Though, you may want to try the
  output buffers.
  
  ob_start();
   ( .. Exec here ..)
  $Var = ob_end_clean();
  
  , 
  Wouter
  
  -Original Message-
  From: Uros [mailto:[EMAIL PROTECTED] 
  Sent: Wednesday, September 17, 2003 3:18 PM
  To: PHP General list
  Subject: [PHP] Using system
  
  Hello!
  
  I'm pulling my hair. What is the right syntax to set output of some system
  call to variable.
  
  I tried everything (system, shell_exec,exec) and always get output to
  screen.
  
  Please help.
  
  PHP version 4.3.3 CLI
  
  -- 
  Best regards,
   Uros

-- 
.-.
| Worlds of Carnage - http://www.wocmud.org   |
:-:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.|
`-'

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



Re: [PHP] ignore_user_abort not working

2003-09-17 Thread Curt Zirzow
* Thus wrote Sid ([EMAIL PROTECTED]):
 Sorry, a mistake on my part. The script continues to work, but
 connection_aborted() does not detect if the host disconnected. It is all
 acting very funny. I also kept witing the return from connection_status ()
 to a file and it keeps witing 0 to the file even after the user disconnects.

The only time php knows that the connection is aborted is when you
attempt to output something.

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] PHP and Palm

2003-09-17 Thread Mark

--- Charles Kline [EMAIL PROTECTED] wrote:
 I have a project in mind where I would like to be able to Sync my
 Palm 
 with the calendar in my CRM. Anyone have info on doing this?
 
 Thanks,
 Charles

You might want to look into the Horde Project (http://www.horde.org).
There's been on-again-off-again development of a conduit for sync'ing
their apps with a Palm. I'm not sure what the status of the project
is.

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


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a right unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



Re: [PHP] PHP Worldwide Stats

2003-09-17 Thread Curt Zirzow
* Thus wrote Chris Blake ([EMAIL PROTECTED]):
 Greetings learned PHP(eople);
 
 Where can I find stats, if any, on the number of sites using PHP as a
 server side language ?
 
 I been googling around using PHP global statistics and other
 combinations but can`t find anything.

netcraft.com

 
 Regards
 
 Flame on!
   -- Johnny Storm
 

Is this an invite :)

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] Using system

2003-09-17 Thread Gal Gur-Arie
Hello,

try this:
?php
$sMyHostname = exec('uname -a 21');
echo \n.$sMyHostname.\n;
?
Uros wrote:
Hello Robert,

I think not

here is my code

#!/usr/local/bin/php -q
?php
$ret = `nslookup -timeout=3 www.myhost.com |grep Non-existent host/domain`;
?
I always get automaticaly output. I also try to set implicit_flush to off,
use ob ob_...
nothing works.

best regards

Wednesday, September 17, 2003, 4:16:10 PM, you wrote:

RC Backtick style gets you the output...

RC $passwords = `cat /etc/passwd`;

RC Cheers,
RC Rob.
RC On Wed, 2003-09-17 at 09:55, esctoday.com | Wouter van Vliet wrote:

Don't think there's one function for it .. Though, you may want to try the
output buffers.
ob_start();
( .. Exec here ..)
$Var = ob_end_clean();
, 
Wouter

-Original Message-
From: Uros [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 17, 2003 3:18 PM
To: PHP General list
Subject: [PHP] Using system

Hello!

I'm pulling my hair. What is the right syntax to set output of some system
call to variable.
I tried everything (system, shell_exec,exec) and always get output to
screen.
Please help.

PHP version 4.3.3 CLI

--
Best regards,
Uros
--
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] PHP Worldwide Stats

2003-09-17 Thread Chris Blake
On Wed, 2003-09-17 at 16:55, Jason Wong wrote:
 On Wednesday 17 September 2003 22:44, Chris Blake wrote:
 
  Where can I find stats, if any, on the number of sites using PHP as a
  server side language ?
 
  I been googling around using PHP global statistics and other
  combinations but can`t find anything.
 
 www.netcraft.com
 
Thank you Mr. Wong..I was such a dumbass...I coulda just gone to
PHP.net in the first place, the link is on the front page...


-- 
Chris Blake
Support Consultant
Office : (011) 782-0840
Fax: (011) 782-0841
Mobile : 083 985 0379
Website: http://www.pbpc.co.za

Data, n.:
Computerspeak for information.  Properly pronounced
the way Bostonians pronounce the word for a female child.

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



Re: [PHP] How do I do this PERL in PHP?

2003-09-17 Thread Don Read

On 16-Sep-2003 Susan Ator wrote:
 I have a text file with the following format:
 
 TO name
 SUBJECT stuff
 MESSAGE
 message text
 message text
 message text
 

snip

If you're sure the format is exactly that, then ...

$pat=array(
  'SUBJECT',
  'MESSAGE',
);

$marker='FOO';

$data=file_get_contents('dafile.txt');

$msgblks=explode('TO', $data);

foreach($msgblks as $blk) {
  list($to, $subj, $msg) = 
explode($marker,preg_replace($pat, $marker, $blk));
  ...
  do__your_stuff($to, $subj, $msg);
  ...
}


Regards,
-- 
Don Read [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

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



Re: [PHP] PHP Worldwide Stats

2003-09-17 Thread Chris Blake
On Wed, 2003-09-17 at 17:11, Curt Zirzow wrote:
 [snip]
  
  Flame on!
   -- Johnny Storm
  
 
 Is this an invite :)
 

I have no idea who Johnny Storm is...but best he stay away from starting
a flame war on my behalf...I`m a lover, not a fighter
:)


-- 
Chris Blake
Support Consultant
Office : (011) 782-0840
Fax: (011) 782-0841
Mobile : 083 985 0379
Website: http://www.pbpc.co.za

Default, n.:
The hardware's, of course.

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



[PHP] Re: Using system

2003-09-17 Thread Gal
try this:

?php
$sMyHostname = exec('uname -a 21');
echo \n.$sMyHostname.\n;
?
Uros wrote:
Hello!

I'm pulling my hair. What is the right syntax to set output of some system
call to variable.
I tried everything (system, shell_exec,exec) and always get output to
screen.
Please help.

PHP version 4.3.3 CLI

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


RE: [PHP] Edit a String

2003-09-17 Thread Mark

--- Jay Blanchard [EMAIL PROTECTED] wrote:
 [snip]
 I have addresses stored in my database. I am trying to create a
 page
 that
 generates a letter automatically for the user to print. Given a
 string
 of
 format ', x, x, xxx' how can I edit it so that the
 comma's
 are
 replaced with line breaks i.e. /n. This will enable me to display
 the
 address correctly at the top of the page.
 [/snip]
 
 http://www.php.net/ereg_replace , or don;t we use the manual? 
 

Or the less demanding str_replace()

 Have a pleasant and productive day.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a right unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



Re: Re[2]: [PHP] Using system

2003-09-17 Thread Jason Wong
On Wednesday 17 September 2003 22:49, Uros wrote:

 I think not

Believe it or not, Robert's answer is correct.

 here is my code

 #!/usr/local/bin/php -q
 ?php
 $ret = `nslookup -timeout=3 www.myhost.com |grep Non-existent
 host/domain`; ?

 I always get automaticaly output. I also try to set implicit_flush to off,
 use ob ob_...

*What* exactly is the output that you're getting?

Newer versions of nslookup on Redhat Linux (and Mandrake, and maybe others as 
well) will give an *error* recommending that you use dig instead. To prevent 
that particular warning from displaying you need the -sil option. To 
redirect all errors elsewhere you can do something like:

nslookup -timeout=3 www.example.com 2/dev/null | grep Non-existent 
host/domain

And on my version of nslookup a non-existent domain gives this error message:

** server can't find www.example.com: NXDOMAIN

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Robert Tappen Morris, Jr., got six months in jail for crashing 10% of the
computers that Bill Gates made $100 million crashing last weekend.
*/

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



[PHP] Code check please

2003-09-17 Thread James Johnson
Hi,

Can anyone see why this code isn't working

$SID = $_SESSION['svUserID'];
$AdID = $_GET['AdID'];

// get the campuses assigned
$qCampusID = SELECT inst_id FROM ads_campuses WHERE ad_id = $AdID;
$CampusIDList = mysql_query($qCampusID, $CCB) or die(mysql_error());
$row_CampusIDList = mysql_fetch_assoc($CampusIDList);
//var_dump($row_CampusIDList);

$tmp = array();
while( $rowData = mysql_fetch_array( $CampusIDList )) {
//print(ROW Data $rowData);
if(!in_array($rowData['inst_id'],$tmp)){
  $tmp[] = $rowData['inst_id'];
 }
}
//var_dump($tmp);
$cidList = implode( ',', $tmp );
//var_dump($cidList);

If I do a var_dump($row_CampusIDList); I get a value, so I know there's data
to work with. But if I do a var_dump($tmp) and var_dump($cidList), they're
both empty.

This particular value query only has 1 inst_id of 100. Other queries with
one value (99,45, etc) will work.

Very strange...
Thanks,
James

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



RE: [PHP] Code check please

2003-09-17 Thread James Johnson
Hmm, ok I took out the 
$row_CampusIDList = mysql_fetch_assoc($CampusIDList); 

and it works But how come?

J

-Original Message-
From: James Johnson [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 17, 2003 9:17 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Code check please


Hi,

Can anyone see why this code isn't working

$SID = $_SESSION['svUserID'];
$AdID = $_GET['AdID'];

// get the campuses assigned
$qCampusID = SELECT inst_id FROM ads_campuses WHERE ad_id = $AdID;
$CampusIDList = mysql_query($qCampusID, $CCB) or die(mysql_error());
$row_CampusIDList = mysql_fetch_assoc($CampusIDList);
//var_dump($row_CampusIDList);

$tmp = array();
while( $rowData = mysql_fetch_array( $CampusIDList )) {
//print(ROW Data $rowData);
if(!in_array($rowData['inst_id'],$tmp)){
  $tmp[] = $rowData['inst_id'];
 }
}
//var_dump($tmp);
$cidList = implode( ',', $tmp );
//var_dump($cidList);

If I do a var_dump($row_CampusIDList); I get a value, so I know there's data
to work with. But if I do a var_dump($tmp) and var_dump($cidList), they're
both empty.

This particular value query only has 1 inst_id of 100. Other queries with
one value (99,45, etc) will work.

Very strange...
Thanks,
James

-- 
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] Session data getting lost

2003-09-17 Thread Rich Gray
Chris

Thanks for your answer which I'm sorry to say makes no sense to me given the
code example I supplied ... can you explain to me why you think register
globals being set to on for the Linux server will cause the $_SESSION
superglobal array to lose data? Am I missing something obvious here?

Thx
Rich

 --- Rich Gray [EMAIL PROTECTED] wrote:
  I'm running v4.2.3 on RedHat v7.0 and am getting some strange
  behaviour with the $_SESSION superglobal...
 ...
  It works fine on Win2K albeit v4.3.0 of PHP.

 Maybe you have register_globals enabled on your Linux server and
 not on your
 Windows PC? Compare php.ini files before giving it too much thought.

 Chris


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



RE: [PHP] Session data getting lost

2003-09-17 Thread Rich Gray
Jan
Sorry - no that doesn't help - as you can see from the code snippet I posted
the session_start() is at the very top of the code...
Thx anyway.
Rich

 You have to put session_start(); at the VERY TOP of your code.
 even before alle the html tags.
 Hope that helps!

 Jan

 --- Rich Gray [EMAIL PROTECTED] wrote:
  I'm running v4.2.3 on RedHat v7.0 and am getting some strange
  behaviour with the $_SESSION superglobal...
 ...
  It works fine on Win2K albeit v4.3.0 of PHP.

 Maybe you have register_globals enabled on your Linux server and
 not on your
 Windows PC? Compare php.ini files before giving it too much thought.

 Chris


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



RE: [PHP] Session data getting lost

2003-09-17 Thread Jay Blanchard
[snip]
?php
session_start();
$test = -1;
.

[/snip]

I think you need to register test 

http://us3.php.net/session_register

HTH!

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



[PHP] sdfs

2003-09-17 Thread Simon
sdfsdf

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



[PHP] template problems

2003-09-17 Thread Simon
hi,

I've got this problem when using templates on my localhost. The code works
on my web server which i rent so the code is fine. I have ran php code for
mysql functions and other for testing purposes.

Below is the code i used in index.php.

INDEX.PHP

?php

switch ($page)

{ 
default : include error.txt; 
break; 
case screenshots : include news.txt; 
break; 

} 




? 


When i type say www.myrentedwebsite.com/index.php?page=main it will display the page 
main.txt 

When i try this on my localhost it displays the error.txt file instead. It doesn't 
recognize the index.php??PAGE=MAIN i think !. 

Could anybody help me with this problem because i wanted the localhost for testing 
purposes. 

thank you in advance

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



[PHP] template problems

2003-09-17 Thread Simon
hi,

I've got this problem when using templates on my localhost. The code works
on my web server which i rent so the code is fine. I have ran php code for
mysql functions and other for testing purposes.

Below is the code i used in index.php.

INDEX.PHP

?php

switch ($page)

{ 
default : include error.txt; 
break; 
case screenshots : include news.txt; 
break; 

} 




? 


When i type say www.myrentedwebsite.com/index.php?page=main it will display the page 
main.txt 

When i try this on my localhost it displays the error.txt file instead. It doesn't 
recognize the index.php??PAGE=MAIN i think !. 

Could anybody help me with this problem because i wanted the localhost for testing 
purposes. 

thank you in advance

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



[PHP] value contained within a variable contained within another variable

2003-09-17 Thread DougD
I may be way off track with what I am trying to do, but here is my scenario
and I sure appreciate any insights.

There is a string stored in $kk1_current and I want to pull from the array
the variable name, add the $ and then retreive the string with the
varialbe $kk1_current. This will allow to echo the contents of each varialbe
contained with the array. Make sense?

$kk1_current = something;

$data = array (kk1_current,kk2_current,mk_current);

$temp = $ . $data[0];

$data_post = strval($temp) . \n; // I want, $data_post = whatever
is inside $kk1_current in this example -- strval obviously doesn't work in
the case

echo $data_post;


THANKS!

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



RE: [PHP] template problems

2003-09-17 Thread Jay Blanchard
[snip]
INDEX.PHP

?php

switch ($page)

{ 
default : include error.txt; 
break; 
case screenshots : include news.txt; 
break; 

} 

? 

When i type say www.myrentedwebsite.com/index.php?page=main it will
display the page main.txt 

When i try this on my localhost it displays the error.txt file instead.
It doesn't recognize the index.php??PAGE=MAIN i think !. 
[/snip]

Try this and report back

?php

switch ($_GET['page'])
{ 
default : include error.txt; 
break; 
case screenshots : include news.txt; 
break; 
} 

? 

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



RE: [PHP] template problems

2003-09-17 Thread Jay Blanchard
[snip]
default : include error.txt; 
break; 
case screenshots : include news.txt; 
break; 
[/snip]

And always put default case last

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



RE: [PHP] Session data getting lost

2003-09-17 Thread Rich Gray
Jay

Thanks, but no I don't think so ... session_register() is deprecated ...

Quote PHP manual:

Caution:
If you want your script to work regardless of register_globals, you need to
instead use the $_SESSION array as $_SESSION entries are automatically
registered. If your script uses session_register(), it will not work in
environments where the PHP directive register_globals is disabled.

Cheers
Rich


 [snip]
 ?php
 session_start();
 $test = -1;
 .

 [/snip]

 I think you need to register test 

 http://us3.php.net/session_register

 HTH!


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



RE: [PHP] Session data getting lost

2003-09-17 Thread Jay Blanchard
[snip]
Thanks, but no I don't think so ... session_register() is deprecated ...
[/snip]

Not depricated, just doesn't work when register_globals is off in the
.ini

Have you done a print_r($_SESSION) to see if in fact the $test variable
is contained?

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



RE: [PHP] Session data getting lost

2003-09-17 Thread Rich Gray
Well a functon that doesn't work under certain conditions should be
deprecated IMO ... I haven't used it for a long time now...

To answer your question ... yep I've used print_r() and after the 1st form
submission the entry is set to -1 however at no time do I ever set
$_SESSION['test'] to -1 in my code example ...

Rich

 [snip]
 Thanks, but no I don't think so ... session_register() is deprecated ...
 [/snip]

 Not depricated, just doesn't work when register_globals is off in the
 .ini

 Have you done a print_r($_SESSION) to see if in fact the $test variable
 is contained?


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



Re: [PHP] webhost --0T--

2003-09-17 Thread Ryan A
Hey David,
Thanks for replying.


% Voteing will be allowed only to clients who register and confirm their
email
% addresses, plus only 1 vote per IP and we will be using cookies...

/*
That would be terrible for anyone behind a firewall.  Leave it at once
per email address and just live with the fact that some people have more
than one available.
*/
Let me explain, when the person registers they wont just recive permission
to vote but also other things as a control panel will be created for them to
save their favourite packages from the differient hosts and even compare the
packages side by side...if the cookie fails then i will try for ip and if
the ip fails then it will go only for the username

/*
In addition, I presume you mean that one can only vote once for a given
web host vs having to pick a single one and vote for it and that's it...
I know of a few directly and should be able to vote on all of them.
*/
Nope, its not that you have limited votes, you can vote for each and every
host on the site...but just one vote per host, dont you think thats fair?

/*
It would be nice if you saved everyone's votes and let users modify them,
*/
Let users modify them? what do you mean? if users can modify a vote whats
the use of a vote?

/*
but that gets into a bit more work on your part.  But it would be nice :-)
*/
Now you've gotten me confused :-(


/*
HTH  HAND
*/
Meant to ask you this before...whats HAND?

Cheers,
-Ryan

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



RE: [PHP] Session data getting lost

2003-09-17 Thread Jay Blanchard
[snip]
Well a functon that doesn't work under certain conditions should be
deprecated IMO ... I haven't used it for a long time now...

To answer your question ... yep I've used print_r() and after the 1st
form
submission the entry is set to -1 however at no time do I ever set
$_SESSION['test'] to -1 in my code example ...
[/snip]

Nope, but $test is a GLOBAL variable, and therefore would be set to -1
within $_SESSION as all GLOBALS are, as you pointed out earlier,
registerd with $_SESSION. If $test is within a function it is a PRIVATE
variable, local to the function only, unless declared as a GLOBAL.

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



Re: [PHP] Code check please

2003-09-17 Thread CPT John W. Holmes
From: James Johnson [EMAIL PROTECTED]

 Can anyone see why this code isn't working

 $SID = $_SESSION['svUserID'];
 $AdID = $_GET['AdID'];

 // get the campuses assigned
 $qCampusID = SELECT inst_id FROM ads_campuses WHERE ad_id = $AdID;

You say down below that this query only selects one row...

 $CampusIDList = mysql_query($qCampusID, $CCB) or die(mysql_error());
 $row_CampusIDList = mysql_fetch_assoc($CampusIDList);

and this mysql_fetch_assoc() call will return that one row into
$row_CampusIDList.

 //var_dump($row_CampusIDList);

 $tmp = array();
 while( $rowData = mysql_fetch_array( $CampusIDList )) {

This while will never execute as there are no more rows to select.

 //print(ROW Data $rowData);
 if(!in_array($rowData['inst_id'],$tmp)){
  $tmp[] = $rowData['inst_id'];
 }
 }
 //var_dump($tmp);
 $cidList = implode( ',', $tmp );
 //var_dump($cidList);

 If I do a var_dump($row_CampusIDList); I get a value, so I know there's
data
 to work with. But if I do a var_dump($tmp) and var_dump($cidList), they're
 both empty.

 This particular value query only has 1 inst_id of 100. Other queries with
 one value (99,45, etc) will work.

---John Holmes...

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



[PHP] How to use file() function with an HTTPS:\\www.example.com

2003-09-17 Thread Rodrigo Nakahodo
How to use file() function with an HTTPS:\\www.example.com

?php

 $lines = file ('https://www.example.com/');

 foreach ($lines as $line_num = $line) {
echo Line #b{$line_num}/b :  . htmlspecialchars($line) . br\n;
 }

?

Thanks a million!

Rodrigo Nakahodo
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.518 / Virus Database: 316 - Release Date: 9/11/2003

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



RE: [PHP] value contained within a variable contained within another variable

2003-09-17 Thread esctoday.com | Wouter van Vliet
You should be able to do something like this:

$kk1_current = something;

$data = array (kk1_current,kk2_current,mk_current);
$data_post = $$data[0]; . \n;  // I want, $data_post = whatever

is inside $kk1_current in this example -- strval obviously doesn't work in
the case

echo $data_post;


-Original Message-
From: DougD [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 17, 2003 7:18 PM
To: [EMAIL PROTECTED]
Subject: [PHP] value contained within a variable contained within another
variable

I may be way off track with what I am trying to do, but here is my scenario
and I sure appreciate any insights.

There is a string stored in $kk1_current and I want to pull from the array
the variable name, add the $ and then retreive the string with the
varialbe $kk1_current. This will allow to echo the contents of each varialbe
contained with the array. Make sense?

$kk1_current = something;

$data = array (kk1_current,kk2_current,mk_current);

$temp = $ . $data[0];

$data_post = strval($temp) . \n; // I want, $data_post = whatever
is inside $kk1_current in this example -- strval obviously doesn't work in
the case

echo $data_post;


THANKS!

-- 
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] How to use file() function with an HTTPS:\\www.example.com

2003-09-17 Thread Jennifer Goodie
 How to use file() function with an HTTPS:\\www.example.com

 ?php

  $lines = file ('https://www.example.com/');

  foreach ($lines as $line_num = $line) {
 echo Line #b{$line_num}/b :  . htmlspecialchars($line)
 . br\n;
  }

My interpretation of the manual page
(http://us3.php.net/manual/en/function.file.php) is as follows:
1.) you need fopen_wrappers enabled
2.) https is only available in versions = 4.3.0

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



RE: [PHP] How to use file() function with an HTTPS:\\www.example.com

2003-09-17 Thread Jay Blanchard
[snip]
How to use file() function with an HTTPS:\\www.example.com
[/snip]

Use cURL http://www.php.net/curl because you will have to login to the
https: location first, before you can use file()

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



[PHP] php and apache...single sign on

2003-09-17 Thread Mike Klein
I would like to piggyback on an Apache realm/dialog authentication and 
feed these credentials to a mysql connection (or connection to anything 
else) in my php scripts.

Is there a way using the php Apache apis (seems like no) or via apache 
itself to make these credentials available/visible to a php script?

I'm not sure if this presents a security risk as I trust the pages in my 
web server to not be malevolent.

mike

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


RE: [PHP] php and apache...single sign on

2003-09-17 Thread Jay Blanchard
[snip]
I would like to piggyback on an Apache realm/dialog authentication and 
feed these credentials to a mysql connection (or connection to anything 
else) in my php scripts.

Is there a way using the php Apache apis (seems like no) or via apache 
itself to make these credentials available/visible to a php script?

I'm not sure if this presents a security risk as I trust the pages in my

web server to not be malevolent.
[/snip]

Should be $PHP_AUTH_USER and $PHP_AUTH_PW, see
http://us4.php.net/features.http-auth

Funny how the manual works for these things! ;)

Have a pleasant and productive day.

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



RE: [PHP] Session data getting lost

2003-09-17 Thread Rich Gray
So your telling me that all variables defined in the global scope are
automatically added to the $_SESSION array...?
Not true I think

 [snip]
 Well a functon that doesn't work under certain conditions should be
 deprecated IMO ... I haven't used it for a long time now...

 To answer your question ... yep I've used print_r() and after the 1st
 form
 submission the entry is set to -1 however at no time do I ever set
 $_SESSION['test'] to -1 in my code example ...
 [/snip]

 Nope, but $test is a GLOBAL variable, and therefore would be set to -1
 within $_SESSION as all GLOBALS are, as you pointed out earlier,
 registerd with $_SESSION. If $test is within a function it is a PRIVATE
 variable, local to the function only, unless declared as a GLOBAL.



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



[PHP] CURL - SSL

2003-09-17 Thread Rodrigo Nakahodo
Anyone knows how to get a simple(HTML) https response using CURL session.

Thanks a million!!


Rodrigo Nakahodo
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.518 / Virus Database: 316 - Release Date: 9/11/2003

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



RE: [PHP] Japanese on a page

2003-09-17 Thread Chris W. Parker
- Edwin - mailto:[EMAIL PROTECTED]
on Tuesday, September 16, 2003 5:53 PM said:

This japanese page thing was a project I started at home so now that I'm
at work I'll do my best to respond using my memory (good luck, me!).

 Did you check if the Japanese characters are readable inside
 html-kit? In other words, Japanese characters should appear as it is
 inside your editor...

No the japanese characters did not appear correctly.  

 7. Save the page
 
 Did you save it as euc-jp or shift_jis?

No. I don't think there is that option in html-kit, but I think that
this may be the key.

If you (a person) can save the file as the proper type there's probably
no reason to send the header() function, or for that matter there would
probably be no REASON to send the header().

 8. open it in the web browser
 
 Before opening it in your browser, did you try opening again in your
 editor just to see whether you saved it correctly? 

No.

 9. cry because it doesn't work
 
 Hmm... If everything is properly declared inside your head tags,
 your browser *should* automatically render the page correctly.
 Anyway, if it doesn't work, check that the character coding in your
 browser is properly selected. (If you're on Netscape or Mozilla,
 choose View - Character coding - your_character_coding_here.)  

Yes this is how I would expect it to work but it ended up not working
that way. But like I said I think it may be because of the type it saves
the file as.

 A friend later figured out that the header() declaration at the top
 of the page was what made the difference.
 
 Did this one work for you?

Yes, adding the header() made the page display correctly from my server.

 Do you know why it wouldn't work until that php code was added?
 
 Not really sure. But think about this. People can write HTML pages
 without the help of php and the like and still have Japanese pages
 correctly rendered by their browsers. In other words, I can write an
 HTML page with Japanese characters in it, save it on my desktop (and
 not on my web server), double click it, my browser starts and show me
 the characters correctly--no php code necessary. 

That's how I expected it to work.


 Btw, iirc, phpedit on Win2k worked for me. Just make sure that you
 have Japanese fonts (and an IME) installed and you chose the correct
 (default) font for phpedit. This works even if you have on English
 version of Win2k (or XP).   

Oh cool. I have that already so I'll try it out.


Chris.

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



Re: [PHP] Session data getting lost

2003-09-17 Thread Curt Zirzow
* Thus wrote Rich Gray ([EMAIL PROTECTED]):
 Chris
 
 Thanks for your answer which I'm sorry to say makes no sense to me given the
 code example I supplied ... can you explain to me why you think register
 globals being set to on for the Linux server will cause the $_SESSION
 superglobal array to lose data? Am I missing something obvious here?

This makes perfect sense (see below for what makes sense since you
top posted.)  This is all explained if you read the session
documentation.

  http://php.net/session

snip for the lazy
If register_globals is enabled, then the global variables and the
$_SESSION entries will automatically reference the same values
which were registered in the prior session instance.
/snip

 
  --- Rich Gray [EMAIL PROTECTED] wrote:
   I'm running v4.2.3 on RedHat v7.0 and am getting some strange
   behaviour with the $_SESSION superglobal...
  ...
   It works fine on Win2K albeit v4.3.0 of PHP.
 
  Maybe you have register_globals enabled on your Linux server and
  not on your
  Windows PC? Compare php.ini files before giving it too much thought.
 

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



RE: [PHP] Session data getting lost

2003-09-17 Thread Jay Blanchard
[snip]
So your telling me that all variables defined in the global scope are
automatically added to the $_SESSION array...?
Not true I think
[/snip]

You're right of course. I went back to your original code and stripped
it back some

?php
session_start();
$test = -1;

echo $_SESSION['test'].\n;

$test = 999;
$_SESSION['test'] = $test;

echo $_SESSION['test'].\n;



?
The logic is incorrect, when you reload the page $test gets set to -1
before your echo statement. After your echo statement it gets set to
999. On reload it again gets set to -1 before your echo. The second echo
is always right (for what you want). If you comment out $test = -1; both
echos come back correctly. Since you have declared $_SESSION['test']
once and the session is still in effect on the reload the first echo
comes back -1 since that is what the declared variable is now worth.
Make sense?

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



Re: [PHP] Session data getting lost

2003-09-17 Thread Curt Zirzow
* Thus wrote Rich Gray ([EMAIL PROTECTED]):
 So your telling me that all variables defined in the global scope are
 automatically added to the $_SESSION array...?
 Not true I think
 

no. read the documentation, in full.

The soluction to your problem was resolved from the first reply (by
Chris Shiflett), but you rejected it because of it not making sense
to you, which seems to be the problem.


  [snip]
  Well a functon that doesn't work under certain conditions should be
  deprecated IMO ... I haven't used it for a long time now...
 
  To answer your question ... yep I've used print_r() and after the 1st
  form
  submission the entry is set to -1 however at no time do I ever set
  $_SESSION['test'] to -1 in my code example ...
  [/snip]
 
  Nope, but $test is a GLOBAL variable, and therefore would be set to -1
  within $_SESSION as all GLOBALS are, as you pointed out earlier,
  registerd with $_SESSION. If $test is within a function it is a PRIVATE
  variable, local to the function only, unless declared as a GLOBAL.
 

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] Session data getting lost

2003-09-17 Thread Curt Zirzow
* Thus wrote Rich Gray ([EMAIL PROTECTED]):
 Well a functon that doesn't work under certain conditions should be
 deprecated IMO ... I haven't used it for a long time now...

this makes absolutly no sense. So if I use a function improperly,
it should become deprecated?

session_register() is used in cases where you haver register_globals
on; it is not useed when it is off.



Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



[PHP] multilanguage site: performance question: included file with cases?

2003-09-17 Thread daniel hahler
Hello listmembers,

I'm building up a site which should be german and english. So I have a
site object which remembers this choice during the session and do a
   include('lang_'.$site-lang.'.php');
in my topmost.php.

This works good, but this file is growing and I thought about how to
handle this.

Two things came in mind:
1. Split the content parts and use a different include file for each
section.
2. Do a switch ($site-curMenu) in the lang_xx.php and define only
what is needed for current section.

The first option is not so good, as I would have up to 10 new files.
And when thinking of the second option, I thought that it could be
even more performant, if you had a static included file, as this could
be cached somehow.

So, what to do?

And: hello to all, it's my first post here. :)


-- 
shinE!
http://www.thequod.de ICQ#152282665
I'm sitting in silence. 

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



Re: [PHP] webhost --0T--

2003-09-17 Thread Curt Zirzow
* Thus wrote Ryan A ([EMAIL PROTECTED]):
 Hey David,
 Thanks for replying.
 
 
 % Voteing will be allowed only to clients who register and confirm their
 email
 % addresses, plus only 1 vote per IP and we will be using cookies...
 
 /*
 That would be terrible for anyone behind a firewall.  Leave it at once
 per email address and just live with the fact that some people have more
 than one available.
 */

hmm.. whats with the weird quoting style?  only david is allowed to
use weird characters :)

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



[PHP] Basic Framework

2003-09-17 Thread Lee Herron QCS
I'm not fond of the phrase framework, but for lack of any other term, this
is what I use ..

Without going to a bloated framework such as fusebox or MVP, have any of you
put together a simple structure to allow very basic template and module
inclusion with menuing?

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



Re: [PHP] webhost --0T--

2003-09-17 Thread Ryan A
Hey,

/*
hmm.. whats with the weird quoting style?  only david is allowed to
 use weird characters :)
*/

Whatdayamean? as far as I know he has not copyrighted the right to be weird
ok? there are a lot of weirdos on this list and why should i be left
out!!!???

:-D

Cheers,
-Ryan

P.SDavid, No offense meant.

We will slaughter you all! - The Iraqi (Dis)information ministers site
http://MrSahaf.com


 * Thus wrote Ryan A ([EMAIL PROTECTED]):
  Hey David,
  Thanks for replying.
 
 
  % Voteing will be allowed only to clients who register and confirm their
  email
  % addresses, plus only 1 vote per IP and we will be using cookies...
 
  /*
  That would be terrible for anyone behind a firewall.  Leave it at once
  per email address and just live with the fact that some people have more
  than one available.
  */

 hmm.. whats with the weird quoting style?  only david is allowed to
 use weird characters :)

 Curt
 -- 
 I used to think I was indecisive, but now I'm not so sure.

 -- 
 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] Q on Regular Expressions

2003-09-17 Thread jsWalter
I have a fairly complicated regular expression that was written for perl.

I've spent the last 4 days trying to convert it to PHP.

I guess I'm just that bright.

I can't even get the sub parts (between the || to work, much less the
conditionals

Would someone mind showing me how I can make this work in PHP?

Thanks

walter

# Does input match this RegEx?

 (($day,$mon,$yr,$hr,$min,$sec,$tz) =
 /^
  (\w{1,3}) # month
 \s+
  (\d\d?)   # day
 \s+
  (\d\d?):(\d\d)# hour:min
  (?::(\d\d))?  # optional seconds
 \s+
  (?:([A-Za-z]+)\s+)?   # optional timezone
  (\d+) # year
 \s*$   # allow trailing whitespace
 /x)


# If not that one, then this RegEx?
||

# Then the Unix 'ls -l' date format
(($mon, $day, $yr, $hr, $min, $sec) =
 /^
  (\w{3})   # month
 \s+
  (\d\d?)   # day
 \s+
  (?:
 (\d\d\d\d) |   # year
 (\d{1,2}):(\d{2})  # hour:min
(?::(\d\d))?   # optional seconds
  )
  \s*$
   /x)

# If not that one, then this RegEx?
||

# ISO 8601 format '1996-02-29 12:00:00 -0100' and variants
(($yr, $mon, $day, $hr, $min, $sec, $tz) =
 /^
   (\d{4})  # year
  [-\/]?
   (\d\d?)  # numerical month
  [-\/]?
   (\d\d?)  # day
  (?:
(?:\s+|[-:Tt])  # separator before clock
 (\d\d?):?(\d\d)# hour:min
 (?::?(\d\d(?:\.\d*)?))?  # optional seconds (and fractional)
  )?# optional clock
 \s*
  ([-+]?\d\d?:?(:?\d\d)?
   |Z|z)?   # timezone  (Z is zero meridian, i.e. GMT)
 \s*$
 /x)

# If not that one, then this RegEx?
||

# Windows 'dir' 11-12-96  03:52PM
(($mon, $day, $yr, $hr, $min, $ampm) =
/^
  (\d{2})# numerical month
 -
  (\d{2})# day
 -
  (\d{2})# year
 \s+
  (\d\d?):(\d\d)([APap][Mm])  # hour:min AM or PM
 \s*$
/x)

# I guess not any. So bale!
||
return;  # unrecognized format

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



Re: [PHP] multilanguage site: performance question: included file with cases?

2003-09-17 Thread Curt Zirzow
* Thus wrote daniel hahler ([EMAIL PROTECTED]):
 Hello listmembers,
 
 I'm building up a site which should be german and english. So I have a
 site object which remembers this choice during the session and do a
include('lang_'.$site-lang.'.php');
 in my topmost.php.
 
 This works good, but this file is growing and I thought about how to
 handle this.
 
 Two things came in mind:
 1. Split the content parts and use a different include file for each
 section.
 2. Do a switch ($site-curMenu) in the lang_xx.php and define only
 what is needed for current section.


 
 The first option is not so good, as I would have up to 10 new files.
 And when thinking of the second option, I thought that it could be
 even more performant, if you had a static included file, as this could
 be cached somehow.
 
 So, what to do?
 

I would suggest using gettext it will make the application real
flexible. I havn't used it but from what I've seen it really is
simple to use. Plus it keeps your translations completely seperate
from your program.

http://php.net/manual/en/ref.gettext.php


 And: hello to all, it's my first post here. :)

Hello and Welcome.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



  1   2   >