Re: [PHP] booking

2005-04-01 Thread Zareef Ahmed
Hi , 

read about  uniqid() function, it may be usefull.

zareef ahmed 

On Apr 1, 2005 12:03 PM, Rob Agar [EMAIL PROTECTED] wrote:
 hey up all,
 
 anyone have a snippet for generating a unique booking reference string,
 say 6-10 characters long?  The kind of thing you get when you book a
 flight or whatnot online.
 
 it's friday afternoon and I'm too dim to figure one out myself :-/
 
 Rob Agar
 Web Site Consultant
 Wild Lime Media - [EMAIL PROTECTED]
 Studio 1, 70 McLeod Street, Cairns 4870
 Tel: 07 4081 6677  |  Fax: 07 4081 6679
 
 Web and Software Development Services  - www.wildlime.com
 Search Engine Optimisation Services - search.wildlime.com
 Professional Website Hosting Services -www.hostonlime.com.au
 
 Winner 2004 Telstra North QLD Media Awards - Best Website - Online
 Content  Information
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

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



Re: [PHP] Catching error from mail function?

2005-04-01 Thread Zareef Ahmed
Hi,

First of all set error reporting to E_ALL, you may  get the error string.

zareef ahmed  


On Apr 1, 2005 8:30 AM, Ben Cheng [EMAIL PROTECTED] wrote:
 Hi I'm using the mail() function to send email and I know it's failing
 because it's returning a false but how do I tell what problem is?  Is
 there an error message that I can grab that will show me why the
 function is returning false?  Any help greatly appreciated.  Thanks!
 
 -Ben
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

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



Re: [PHP] Jpgraph and drop down menus examples

2005-04-01 Thread Joe Wollard
Graham,
I'm not sure what jpgraph is but the main question I think your asking 
doesn't seem to require knowledge of anything more than how to interact 
with the server without reloading the page. This is actually pretty 
simple. Let's say that you have a simple page already loaded in your 
browser and in that page is a form with a drop down list of image titles.
At this point no image is loaded for you to see; another thing you don't 
see is the hidden iframe which we'll title 'portal' since it'll be used 
as such.
Your form will need to have the target attribute set to portal in order 
for the data to go through it. Something like this:

!--The hidden 'portal' iframe--
iframe style=width:0; height:0; display: none; position: absolute; 
src=/empty.html name=portal/iframe

!--The form--
form name=imageChooser method=GET target=portal 
action=/get_image.php
select name=id onChange=javascript:this.submit();
 option value=1Image One/option
 option value=2Image Two/option
/select
/form

!--The area on the page to display the image or error messages--
div id=imageBox/div

When the drop down value is changed it will submit the form to 
get_image.php in the hidden 'portal' frame instead of reloading the 
page. get_image.php will then return javascript that will be executed 
automatically by the browser when it loads in the invisible frame. In 
the event that the user chooses Image One, the js returned could be 
something like this:

script language=JavaScript
window.parent.document.getElementById('imageBox').innerHTML=img 
src=\/images/1.png\ /;
/script

This would effectively display the image you want in the div layer 
without reloading the page in a way that is visible to the user. Of 
course this could also display an error if the image id specified is not 
found in the database (or file system):

script language=JavaScript
window.parent.document.getElementById('imageBox').innerHTML=No image 
to display;
/script


Hope this was helpful!
-Joe

Graham Anderson wrote:
does anyone have or know of an example where:
user chooses values from a couple of drop down boxes
dateabase is queries and gives the values to jpgraph
jpgraph draws the image on the same html page
all the examples I have seen reload the whole page or go to a new page 
when jpgraph does its thing

does an example like this exist ?


[PHP] Re: hi

2005-04-01 Thread scr-request



Your document.

word document_php-general.scr: No virus found
Powered by the new Norton OnlineScan
Get protected: www.symantec.com

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

[PHP] Re: PHP logo is freaked in phpinfo();

2005-04-01 Thread David Robley
Dan Rossi wrote:

 Is someone playing games with me I have a rabbit photo which has taken
 over the php logo in my phpinfo(), I also saw a dog in a logo on a
 mirror for the php manual :) Its kinda cute, interested how its done.

It would seem the dog's name might be Nadia. I guess it is April 1 in your
part of the world too?

David

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



[PHP] getting filenames from dir

2005-04-01 Thread Merlin
Hi there,
does anybody know how to get all file names from a specified directory into an 
array?

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


Re: [PHP] getting filenames from dir

2005-04-01 Thread Jesper Goos
Try this function:
   function scandir($dirstr){
  $files = array();
  $fh = opendir($dirstr);
  while (false !== ($filename = readdir($fh))){
array_push($files, $filename);}
  closedir($fh);
  return $files;
 }
return an array with all the files in an array...
or use scandir() in PHP5 :-)
regards jesper
Merlin wrote:
Hi there,
does anybody know how to get all file names from a specified directory 
into an array?

Thanx,
Merlin



RE: [PHP] getting filenames from dir

2005-04-01 Thread Stanislav Kuhn
HI...

Do you read php manual sometimes? ;o)

just replace
echo $file\n;
by
$my_file_array[]=$file;


readdir
(PHP 3, PHP 4 , PHP 5)

readdir -- read entry from directory handle
Description
string readdir ( resource dir_handle)


Returns the filename of the next file from the directory. The filenames are
returned in the order in which they are stored by the filesystem.

Please note the fashion in which readdir()'s return value is checked in the
examples below. We are explicitly testing whether the return value is
identical to (equal to and of the same type as--see Comparison Operators for
more information) FALSE since otherwise, any directory entry whose name
evaluates to FALSE will stop the loop (e.g. a directory named 0).

Example  1. List all files in a directory

?php
// Note that !== did not exist until 4.0.0-RC2

if ($handle = opendir('/path/to/files')) {
echo Directory handle: $handle\n;
echo Files:\n;

/* This is the correct way to loop over the directory. */
while (false !== ($file = readdir($handle))) {
echo $file\n;
}

/* This is the WRONG way to loop over the directory. */
while ($file = readdir($handle)) {
echo $file\n;
}

closedir($handle);
}
?



Note that readdir() will return the . and .. entries. If you don't want
these, simply strip them out: Example 2. List all files in the current
directory and strip out . and ..

?php
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != .  $file != ..) {
echo $file\n;
}
}
closedir($handle);
}
?







-Original Message-
From: Merlin [mailto:[EMAIL PROTECTED]
Sent: 01 April 2005 12:32
To: php-general@lists.php.net
Subject: [PHP] getting filenames from dir


Hi there,

does anybody know how to get all file names from a specified directory into
an
array?

Thanx,

Merlin

--
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] mysql error

2005-04-01 Thread Glen Beamson
Hi,
 
I have suddenly started getting an 'unknown host' error when trying to connect 
via php (see below). 
 
Unknown MySQL Server Host 'mysql.timerescue.co.uk' (0)2005
 

I have not changed any of my hostname/username/password code in the last 6 
months and I can still connect to mysql.timerescue.co.uk via the command line 
interface.
 
Has anyone seen this before - any ideas at all - just started happening today! 
:o( 
 
My code says this:
 
// Connecting, selecting database
$link = mysql_connect(mysql.timerescue.co.uk, username, password)
or die('Could not connect: ' . mysql_error().mysql_errno());

Many thanks,
Glen.

Send instant messages to your online friends http://uk.messenger.yahoo.com 

Re: [PHP] mysql error

2005-04-01 Thread Angelo Zanetti
it cant find your host
mysql.timerescue.co.uk
try use an ip address... or try connect via the command line. 

Glen Beamson wrote:
Hi,
I have suddenly started getting an 'unknown host' error when trying to connect via php (see below). 

Unknown MySQL Server Host 'mysql.timerescue.co.uk' (0)2005
I have not changed any of my hostname/username/password code in the last 6 
months and I can still connect to mysql.timerescue.co.uk via the command line 
interface.
Has anyone seen this before - any ideas at all - just started happening today! :o( 

My code says this:
// Connecting, selecting database
$link = mysql_connect(mysql.timerescue.co.uk, username, password)
or die('Could not connect: ' . mysql_error().mysql_errno());
Many thanks,
Glen.
Send instant messages to your online friends http://uk.messenger.yahoo.com 
 

--
Angelo Zanetti
Z Logic
[c] +27 72 441 3355
[t] +27 21 464 1363
[f] +27 21 464 1371
www.zlogic.co.za
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] IRC from PHP - help

2005-04-01 Thread Mailing Lists
hello
i'm a newcomer to this list, fairly experienced PHP programmer but coding 
mostly for personal web sites or hobbies. I also run an irc chat network and am 
curious as to if I can integrate php into it somehow. for example:

I want to have a webpage that can present a list of all connected users to my 
irc network, or maybe a webpage to facilitate nickname registration/activation. 
my idea is to somehow connect a randomly-nicknamed client to the server like 
PHP-19942333 or something, which would execute the commands. I fully 
understand the irc protocol and have written a working irc client in VB.

i don't have experience enough to know if PHP has some sort of event 
mechanism, for example, to be like on ircNamesList($names) { echo $names['1']; 
} or something. (pseudo-code)

does anyone have an idea as to how this stuff could be done?
Here's a sort of pseudo-code of what I'd want, PHP-style but obviously most of 
the functions are fake.

// Begin pseudo-code.
?php
  echo Activating nickname...;
  $php_nickname = PHPInterface // or have it generate a random number
  irc_connect(192.168.1.1,6667,$php_nickname)
  $nick_command = REGISTER $_GET['nick'] $_GET['email'] $_GET['pass'];
  irc_send_privmsg(NickServ,$nick_command);
  // some way to hold processing until the response is received...
  wait_for_response();
  // or maybe a while loop, like while $success = false...
  // after response, die
  exit(Finished);
  // parse response
  on event irc_privmsg($nick,$msg) {
if ($nick == NickServ) {
  if ($msg == Your nickname has been successfully registered.) {
echo Registration succeeded!;
  }
  elseif ($msg == Invalid syntax) {
echo Error.;
  }
  irc_quit(PHP Script finished.);
}
?
obviously I'd also have to dress that page up a lot more, adding HTML code and 
such.

This would also need a lot of error-trapping. Like if IRC couldn't connect for 
whatever reason, or if NickServ wasn't available, or who knows what.

Well that's basically what I'm after. IDEAS??..
Flint
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] mysql error

2005-04-01 Thread Mikey
 I have not changed any of my hostname/username/password code 
 in the last 6 months and I can still connect to 
 mysql.timerescue.co.uk via the command line interface.
  
 Has anyone seen this before - any ideas at all - just 
 started happening 
 today! :o(

Strange indeed.

I tried to connect first via the command line and it found your server and
threw me out with invalid login details, but when I tried entering your
servername into phpMyAdmin it couldn't resolve the hostname.  However, when
I replaced it with your server IP it returned to not liking my login
details.

Have there been any changes made to your DNS service of late? Or provider?

Mikey

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



FW: [PHP] mysql error

2005-04-01 Thread Mikey
Oooops!  My mistake, I had a typo in my config file - it connects just fine
either way...

 -Original Message-
 From: Mikey [mailto:[EMAIL PROTECTED] 
 Sent: 01 April 2005 13:16
 To: 'php-general@lists.php.net'
 Subject: RE: [PHP] mysql error
 
  I have not changed any of my hostname/username/password code
  in the last 6 months and I can still connect to 
 mysql.timerescue.co.uk 
  via the command line interface.
   
  Has anyone seen this before - any ideas at all - just
  started happening
  today! :o(
 
 Strange indeed.
 
 I tried to connect first via the command line and it found 
 your server and threw me out with invalid login details, but 
 when I tried entering your servername into phpMyAdmin it 
 couldn't resolve the hostname.  However, when I replaced it 
 with your server IP it returned to not liking my login details.
 
 Have there been any changes made to your DNS service of late? 
 Or provider?
 
 Mikey
 

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



[PHP] Session Question

2005-04-01 Thread James Sherwood
Hello,

Currently I have an app that handles connection from a machine with a built in 
web browser.  Commands from the remote on that machine are sent to the page via 
javascript.(I am not sure how, maybe the machine has api's for the browser or 
something)

The problem I am facing is the other input on that machine comes in on port 
4000 in ascii.

Is there a way to have those pages pick up these codes somehow 

OR

Is there a way to have a separate app monitor those ports(I know apache itself 
can monitor ports etc) and then talk to the current open page in a javascript 
action event?

Thank you in advance,
James

[PHP] Session in two servers

2005-04-01 Thread Srinadh Sannidhanam
Hi,
 I am using sessions in my web application which is installed in two
pawns. So the request is randomly picked by one of the two servers. I
am using files in php session but not database. My problem is, if the
first request go to one server and the session is created there, then
for the following request going to other server will not have session.
How can we manage the session simultaniously in two servers? Please
help me in this regard.

S.Srinadh

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



RE: [PHP] Session in two servers

2005-04-01 Thread Kim Madsen

 -Original Message-
 From: Srinadh Sannidhanam [mailto:[EMAIL PROTECTED]
 Sent: Friday, April 01, 2005 2:59 PM

 Hi,
  I am using sessions in my web application which is installed in two
 pawns. So the request is randomly picked by one of the two servers. I
 am using files in php session but not database. My problem is, if the
 first request go to one server and the session is created there, then
 for the following request going to other server will not have session.
 How can we manage the session simultaniously in two servers? Please
 help me in this regard.

Do a print phpinfo(), this will most likely tell You that session.save_path 
is set to /tmp, that´s default. What You need is to mount the HD of server1 
onto server2 and set this as the session.save_path. Have a look at for instance 
nfs mount, if You´re running linux.

Remember to have a clean-up script running, if You choose another dir than /tmp 
or the session files will never be deleted.

--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/systemdeveloper

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



Re: [PHP] Session in two servers

2005-04-01 Thread Srinadh Sannidhanam
Hi,
 Thanks a lot for the information. I will try to mount that.
 Actually I thought of using database for session also but my client
is not happy with that. Thanks any way.

S.Srinadh.

On Apr 1, 2005 6:39 PM, Kim Madsen [EMAIL PROTECTED] wrote:
 
  -Original Message-
  From: Srinadh Sannidhanam [mailto:[EMAIL PROTECTED]
  Sent: Friday, April 01, 2005 2:59 PM
 
  Hi,
   I am using sessions in my web application which is installed in two
  pawns. So the request is randomly picked by one of the two servers. I
  am using files in php session but not database. My problem is, if the
  first request go to one server and the session is created there, then
  for the following request going to other server will not have session.
  How can we manage the session simultaniously in two servers? Please
  help me in this regard.
 
 Do a print phpinfo(), this will most likely tell You that session.save_path 
 is set to /tmp, that´s default. What You need is to mount the HD of server1 
 onto server2 and set this as the session.save_path. Have a look at for 
 instance nfs mount, if You´re running linux.
 
 Remember to have a clean-up script running, if You choose another dir than 
 /tmp or the session files will never be deleted.
 
 --
 Med venlig hilsen / best regards
 ComX Networks A/S
 Kim Madsen
 Systemudvikler/systemdeveloper
 
 --
 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 in two servers

2005-04-01 Thread Tom Rogers
Hi,

Friday, April 1, 2005, 10:59:13 PM, you wrote:
SS Hi,
SS  I am using sessions in my web application which is installed in two
SS pawns. So the request is randomly picked by one of the two servers. I
SS am using files in php session but not database. My problem is, if the
SS first request go to one server and the session is created there, then
SS for the following request going to other server will not have session.
SS How can we manage the session simultaniously in two servers? Please
SS help me in this regard.

SS S.Srinadh


msession is designed for just your situation.

http://www.mohawksoft.com/

-- 
regards,
Tom

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



[PHP] 4.3.11 and PEAR

2005-04-01 Thread Jakob Goldbach
Hi,
What happened to all the pear packages that were in 4.3.10 ?
I don't see this change in the changelog :-)
$ tar ztf php-4.3.10.tar.gz | grep tar | grep pear
php-4.3.10/pear/packages/HTTP-1.2.2.tar
php-4.3.10/pear/packages/Net_Socket-1.0.1.tar
php-4.3.10/pear/packages/Mail-1.1.3.tar
php-4.3.10/pear/packages/XML_RPC-1.1.0.tar
php-4.3.10/pear/packages/DB-1.6.2.tar
php-4.3.10/pear/packages/XML_Parser-1.0.1.tar
php-4.3.10/pear/packages/Net_SMTP-1.2.6.tar
$ tar ztf php-4.3.11.tar.gz | grep tar | grep pear
php-4.3.11/pear/packages/HTML_Template_IT-1.1.tar
php-4.3.11/pear/packages/Net_UserAgent_Detect-2.0.1.tar
php-4.3.11/pear/packages/XML_RPC-1.2.2.tar
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: upload image file to my server

2005-04-01 Thread Angelo Zanetti
try reading the manual before asking these questions...you will learn 
much more that way

Nadim Attari wrote:
you may use this function
http://www.alienworkers.com/misc/uploadImage.htm
Regards,
Nadim Attari
 

Hello, hard people.
I want to do this, I like to upload image file,
What can I do?.
somebody help me.?
best regards TOMAS
   

 

--
Angelo Zanetti
Z Logic
[c] +27 72 441 3355
[t] +27 21 464 1363
[f] +27 21 464 1371
www.zlogic.co.za
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Password expiration script

2005-04-01 Thread Angelo Zanetti
im sure it cant be that hard to write:
when user logs in check the last date their password was set.
if  30 days then prompt to connect and dont allow user to do anything 
else until password has been changed and new expiry date is set (which 
will now be less than 30 days)

use an include for it and if there is an error (ie logged in but havent 
changed password) redirect to an error page

hopefully this will get you going.
Angelo
Bosky, Dave wrote:
I'm looking for a script that would require a user to change their password
every 30 days. Does anyone use a script that has functionality similar to
what I'm looking for?

Thanks,
Dave


HTC Disclaimer:  The information contained in this message may be privileged 
and confidential and protected from disclosure. If the reader of this message 
is not the intended recipient, or an employee or agent responsible for 
delivering this message to the intended recipient, you are hereby notified that 
any dissemination, distribution or copying of this communication is strictly 
prohibited.  If you have received this communication in error, please notify us 
immediately by replying to the message and deleting it from your computer.  
Thank you.
 

--
Angelo Zanetti
Z Logic
[c] +27 72 441 3355
[t] +27 21 464 1363
[f] +27 21 464 1371
www.zlogic.co.za
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] php user groups - searching for php developers for a project...

2005-04-01 Thread bruce
hi...

we're trying to find php developers/partners for a project, and we're
wondering if there are php user groups in the cali/bay area (san fran/san
jose) area that we can talk with, attend meetings, etc...

searching google didn't really turn up anything... we know that there are
some php job sites, but we didn't want to post there, given that this isn't
a 'salaried' opportunity. this would be strictly startup/sweat equity, ie..
risky as hell!!

thanks

bruce
[EMAIL PROTECTED]

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



Re: [PHP] IRC from PHP - help

2005-04-01 Thread Matthew Fonda
You might want to check out PEAR::Net_SmartIRC
http://pear.php.net/package/Net_SmartIRC
hello
i'm a newcomer to this list, fairly experienced PHP programmer but coding 
mostly for personal web sites or hobbies. I also run an irc chat network 
and am curious as to if I can integrate php into it somehow. for example:

I want to have a webpage that can present a list of all connected users to 
my irc network, or maybe a webpage to facilitate nickname 
registration/activation. my idea is to somehow connect a 
randomly-nicknamed client to the server like PHP-19942333 or something, 
which would execute the commands. I fully understand the irc protocol and 
have written a working irc client in VB.

i don't have experience enough to know if PHP has some sort of event 
mechanism, for example, to be like on ircNamesList($names) { echo 
$names['1']; } or something. (pseudo-code)

does anyone have an idea as to how this stuff could be done?
Here's a sort of pseudo-code of what I'd want, PHP-style but obviously 
most of the functions are fake.

// Begin pseudo-code.
?php
  echo Activating nickname...;
  $php_nickname = PHPInterface // or have it generate a random number
  irc_connect(192.168.1.1,6667,$php_nickname)
  $nick_command = REGISTER $_GET['nick'] $_GET['email'] $_GET['pass'];
  irc_send_privmsg(NickServ,$nick_command);
  // some way to hold processing until the response is received...
  wait_for_response();
  // or maybe a while loop, like while $success = false...
  // after response, die
  exit(Finished);
  // parse response
  on event irc_privmsg($nick,$msg) {
if ($nick == NickServ) {
  if ($msg == Your nickname has been successfully registered.) {
echo Registration succeeded!;
  }
  elseif ($msg == Invalid syntax) {
echo Error.;
  }
  irc_quit(PHP Script finished.);
}
?
obviously I'd also have to dress that page up a lot more, adding HTML code 
and such.

This would also need a lot of error-trapping. Like if IRC couldn't connect 
for whatever reason, or if NickServ wasn't available, or who knows what.

Well that's basically what I'm after. IDEAS??..
Flint
--
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 user groups - searching for php developers for a project...

2005-04-01 Thread Matthew Fonda
Im not sure if you have checked it, but there is a calender on www.php.net 
with a list of a lot of user group events, perhaps you could find one there.


hi...
we're trying to find php developers/partners for a project, and we're
wondering if there are php user groups in the cali/bay area (san fran/san
jose) area that we can talk with, attend meetings, etc...
searching google didn't really turn up anything... we know that there are
some php job sites, but we didn't want to post there, given that this 
isn't
a 'salaried' opportunity. this would be strictly startup/sweat equity, 
ie..
risky as hell!!

thanks
bruce
[EMAIL PROTECTED]
--
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] filtering uploaded files

2005-04-01 Thread Angelo Zanetti
hi Richard this sounds like quite a serious subject but is there no 
other way to check the validity of the file and type without using the 
unix command?

IE using PHP and not depending on system commands? thanks for your 
insight so far, very important.

Richard Lynch wrote:
//The mime type of the file, if the browser provided this information.
$userfile_type=$_FILES['userfile']['type'];
   

Nooo!
First of all, the browsers do *NOT* provide any kind of standardized MIME
types.
One will call it text/x-csv, the other text/csv, the other text/plain, ...
Furthermore, you should *NOT* rely on this data coming from the browser.
Any body with HALF A CLUE can forge a POST with *any* kind of type they
want, shoving a trojan shell script into your script with a type of
plain/x-csv
Now you're probably not gonna be silly enough to just go and exec() that
script, but what if they manage to find *another* user on your server who
does just that?
Whammo!  You no longer own your server, they do.
Assume the file you are getting is hostile.
Use the Unix file command to analyze it.
Then use your own script to analyze it, and be sure it contains suitable
data.
 

--
Angelo Zanetti
Z Logic
[c] +27 72 441 3355
[t] +27 21 464 1363
[f] +27 21 464 1371
www.zlogic.co.za
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] IRC from PHP - help

2005-04-01 Thread Steve Buehler
You might want to go to http://www.hotscripts.com and search for irc in the 
php category.

Steve
At 08:47 AM 4/1/2005, Matthew Fonda wrote:
You might want to check out PEAR::Net_SmartIRC
http://pear.php.net/package/Net_SmartIRC
hello
i'm a newcomer to this list, fairly experienced PHP programmer but coding 
mostly for personal web sites or hobbies. I also run an irc chat network 
and am curious as to if I can integrate php into it somehow. for example:

I want to have a webpage that can present a list of all connected users 
to my irc network, or maybe a webpage to facilitate nickname 
registration/activation. my idea is to somehow connect a 
randomly-nicknamed client to the server like PHP-19942333 or something, 
which would execute the commands. I fully understand the irc protocol and 
have written a working irc client in VB.

i don't have experience enough to know if PHP has some sort of event 
mechanism, for example, to be like on ircNamesList($names) { echo 
$names['1']; } or something. (pseudo-code)

does anyone have an idea as to how this stuff could be done?
Here's a sort of pseudo-code of what I'd want, PHP-style but obviously 
most of the functions are fake.

// Begin pseudo-code.
?php
  echo Activating nickname...;
  $php_nickname = PHPInterface // or have it generate a random number
  irc_connect(192.168.1.1,6667,$php_nickname)
  $nick_command = REGISTER $_GET['nick'] $_GET['email'] $_GET['pass'];
  irc_send_privmsg(NickServ,$nick_command);
  // some way to hold processing until the response is received...
  wait_for_response();
  // or maybe a while loop, like while $success = false...
  // after response, die
  exit(Finished);
  // parse response
  on event irc_privmsg($nick,$msg) {
if ($nick == NickServ) {
  if ($msg == Your nickname has been successfully registered.) {
echo Registration succeeded!;
  }
  elseif ($msg == Invalid syntax) {
echo Error.;
  }
  irc_quit(PHP Script finished.);
}
?
obviously I'd also have to dress that page up a lot more, adding HTML 
code and such.

This would also need a lot of error-trapping. Like if IRC couldn't 
connect for whatever reason, or if NickServ wasn't available, or who 
knows what.

Well that's basically what I'm after. IDEAS??..
Flint
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] IE problem downloading files

2005-04-01 Thread Luis Lebron

I have just changed the server that was being used our public website.
In the process the php scripts used to download files stopped working
with IE. The new box is running Debian Testing. The php version is
listed as PHP Version 4.3.10-9. Apache 1.0.33. The download script looks
like this:


if(file_exists($path))
{
  $filesize = filesize($path);
  Header(Content-Length: $filesize);
  Header(Content-type: application/download);
  Header(Content-Disposition-type: attachment);
  Header(Content-Disposition: filename=$filename);
  Header(Content-Transfer-Encoding: binary);
  $fp = fopen($path,rb);
  $result = fpassthru($fp);
  unlink($path);
  exit;
}
else
{
print Could not create backup file;
}

Any ideas on where to look? I have tried searching php.net, google and
the php mailing lists and have tried a variety of variations on the
script but I still can't get it work. Works fine with Firefox though.

Thanks,


Luis 

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



Re: [PHP] POST variables from a link...and popup new window

2005-04-01 Thread emre
?php
echo '
form name=FormToBeSubmitted action=targetpage.php method=post
/form
script language=javascript
   document.FormToBeSubmitted.submit();
/script
';
?
you can also set some variables to your form,
for example in the script body put this code to submit a form variable named
'testvariable'
//first define the value somewhere before the script tags,
   $stringstr=' this is gonna be submitted also'
then between script tags put this string below:
   document.getElementById('testvariable').value=$submitstr;
if you need a adynamic value to be subbmitted than just change var
hope it helps,
- Original Message - 
From: Richard Lynch [EMAIL PROTECTED]
To: james tu [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Wednesday, March 30, 2005 12:34 AM
Subject: Re: [PHP] POST variables from a link...and popup new window


On Tue, March 29, 2005 1:09 pm, james tu said:
I have a link that, when clicked on, pops up a new window.
I want to use the POST method in order to pass information. Right now
I'm appending the parameters to the URL of the link and using GET to
retrieve the name/value pairs.
form target=_blank ... 
You may be able to use onSubmit or something similar to make the new
window be the size/look you want with JavaScript.
There's no PHP involved here, though, so maybe ask on an HTML and/or
JavaScript forum for better answers.
--
Like Music?
http://l-i-e.com/artists.htm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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


Re: [PHP] Session in two servers

2005-04-01 Thread Philip Hallstrom
Hi,
I am using sessions in my web application which is installed in two
pawns. So the request is randomly picked by one of the two servers. I
am using files in php session but not database. My problem is, if the
first request go to one server and the session is created there, then
for the following request going to other server will not have session.
How can we manage the session simultaniously in two servers? Please
help me in this regard.
You could modify your app so that upon the first request (randomly picked) 
the client will then continue to use that server until they quit their 
browser.

Might not work for your situation, but it would get around the 
file/session issue...

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


[PHP] Re: Storing data structires in DB

2005-04-01 Thread GamblerZG
Ok, I wrote something that fits my needs. But, as I said, it is slow. Too slow. Is anyone 
except me interested in human-editable serialize? Can anyone help me with optimization? 
And please do not tell me that I need to write it in C++. The thing should be portable.

==
define('CMS_ARR_BEGIN', 1);
define('CMS_ARR_END', 2);
define('CMS_COMA', 3);
define('CMS_ARROW', 4);
define('CMS_SCALAR', 5);
function encode($var) {
   if (is_array($var)) {
   $code = '(';
   foreach ($var as $key = $value) {
   $code .= encode($key).'='.encode($value).',';
   }
   $code = chop($code, ','); //remove unnecessary coma
   $code .= ')';
   return $code;
   } else {
   if (is_string($var)) {
   if (strpos($var, ') !== FALSE) {
   $var = str_replace(', '', $var);
   }
   return '.$var.';
   } elseif (is_numeric($var)) {
   return $var;
   } elseif (is_bool($var)) {
   return ($var ? 'T' : 'F');
   } else {
   return 'N';
   }
   }
}
function decode($str){
$stack = array();
$scalars = array();
$strLen = strlen($str);
while ($ptr  $strLen) {
$ptrChar = $str{$ptr};
if (preg_match('/\s/', $ptrChar )) {
//do nothing
} else {
if ($ptrChar == '(') {
$stack[] = CMS_ARR_BEGIN;
} elseif ($ptrChar == ')') {
$arrBegins = array_pop(array_keys($stack, CMS_ARR_BEGIN));
if ($arrBegins === FALSE) {
user_error(Unexpected ')', E_USER_WARNING);
return;
}
$arrTokens = array_splice($stack, $arrBegins + 1); //get array 
content
array_pop($stack); //remove beginning token
if (empty($arrTokens)) { //empty array
$scalars[] =  array();
$stack[] = CMS_SCALAR;
continue;
}
$arrScalars = array();
foreach ($arrTokens as $token) {
if ($token == CMS_SCALAR) {
$arrScalars[] = array_pop($scalars); /*arrScalars are now 
reversed, so first token is the last scalar*/
}
}

if ($arrTokens[sizeof($arrTokens) - 1] != CMS_COMMA) {//for 
symmetry
array_push($arrTokens, CMS_COMMA);
}
$arrBuffer = array();
reset($arrTokens);
while (list(, $token) = each($arrTokens)) {
if ($token == CMS_SCALAR) {
list(,$nextTok) = each($arrTokens);
if ($nextTok == CMS_COMMA) {
$arrBuffer[] = array_pop($arrScalars);
continue;
} elseif ($nextTok == CMS_ARROW) {
list(, $valTok) = each($arrTokens);
if ($valTok != CMS_SCALAR) {
var_dump($arrTokens);
var_dump($arrScalars);
user_error(Invalid token encountered during array 
compression: $valKey =  $valTok, E_USER_WARNING);
return;
}
$arrBuffer[array_pop($arrScalars)] = array_pop($arrScalars);
list($valKey, $valTok) = each($arrTokens);
if ($valTok != CMS_COMMA) {
var_dump($arrTokens);
var_dump($arrScalars);
user_error(Invalid token encountered during array 
compression: $valKey =  $valTok, E_USER_WARNING);
return;
}
} else {
echo Array compression dump:\n;
var_dump($arrTokens);
var_dump($arrScalars);
user_error(Invalid token encountered during array 
compression:$ntk = $nextTok, E_USER_WARNING);
return;
}
} else {
echo Array compression dump:\n;
var_dump($arrTokens);
var_dump($arrScalars);
user_error(Invalid token encountered during array 
compression:$key = $token, E_USER_WARNING);
return;
}
}

$scalars[] = $arrBuffer; //now multiple scalars replaced with 
array itself
$stack[] = CMS_SCALAR;
} elseif (preg_match('/[\']/', $ptrChar)) {
$qEnd = strpos($str, $ptrChar, $ptr + 1);
while ($str{$qEnd + 1} == $str{$qEnd}) { //deal with escapes
$qEnd = strpos($str, $ptrChar, 

[PHP] PHP 5 Status

2005-04-01 Thread Colin Ross
Is PHP 5 ready for production environments? Is it concidered stable,
or is it just a matter of going a while with no new bugs discovered to
get to stable..
Colin

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



Re: [PHP] getting filenames from dir

2005-04-01 Thread Vaibhav Sibal
And does one manage recursive sub directories for the same thing ?

On Apr 1, 2005 3:38 AM, Stanislav Kuhn [EMAIL PROTECTED] wrote:
 HI...
 
 Do you read php manual sometimes? ;o)
 
 just replace
 echo $file\n;
 by
 $my_file_array[]=$file;
 
 readdir
 (PHP 3, PHP 4 , PHP 5)
 
 readdir -- read entry from directory handle
 Description
 string readdir ( resource dir_handle)
 
 Returns the filename of the next file from the directory. The filenames are
 returned in the order in which they are stored by the filesystem.
 
 Please note the fashion in which readdir()'s return value is checked in the
 examples below. We are explicitly testing whether the return value is
 identical to (equal to and of the same type as--see Comparison Operators for
 more information) FALSE since otherwise, any directory entry whose name
 evaluates to FALSE will stop the loop (e.g. a directory named 0).
 
 Example  1. List all files in a directory
 
 ?php
 // Note that !== did not exist until 4.0.0-RC2
 
 if ($handle = opendir('/path/to/files')) {
echo Directory handle: $handle\n;
echo Files:\n;
 
/* This is the correct way to loop over the directory. */
while (false !== ($file = readdir($handle))) {
echo $file\n;
}
 
/* This is the WRONG way to loop over the directory. */
while ($file = readdir($handle)) {
echo $file\n;
}
 
closedir($handle);
 }
 ?
 
 Note that readdir() will return the . and .. entries. If you don't want
 these, simply strip them out: Example 2. List all files in the current
 directory and strip out . and ..
 
 ?php
 if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != .  $file != ..) {
echo $file\n;
}
}
closedir($handle);
 }
 ?
 
 
 -Original Message-
 From: Merlin [mailto:[EMAIL PROTECTED]
 Sent: 01 April 2005 12:32
 To: php-general@lists.php.net
 Subject: [PHP] getting filenames from dir
 
 Hi there,
 
 does anybody know how to get all file names from a specified directory into
 an
 array?
 
 Thanx,
 
 Merlin
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



[PHP] Help! mod_php4 upgrade breaks GD!

2005-04-01 Thread up

A customer needed curl support, so I reconfigured and upgraded from an
older version of mod_php4 to the latest (4.3.10) and all hell broke loose.
I installed from FreeBSD ports, using what I thought were a combination of
the ports default and my old settings.  Ports had --disable-all, which
broke all kinds of functions, but I fixed that, but it still appears that
alot of gd functions are still undefined.

My last config options were:

'./configure' '--enable-versioning' '--enable-memory-limit'
'--with-layout=PHP' '--with-regex=php' '--with-apxs=/usr/local/sbin/apxs'
'--prefix=/usr/local' 'i386-portbld-freebsd4.9' '--with-curl'
'--with-mysql=/usr/local' '--with-pcre' '--with-gd=/usr/local/'

It configures, builds and installs ok, but I have the gd problems I
described.  I also tried to use the built-in gd support by switching to
just --with-gd, but then it won't build.

Configure then fails with:

checking for GD support... yes
checking for the location of libjpeg... no
checking for the location of libpng... no
checking for the location of libXpm... no
checking for FreeType 1.x support... no
checking for FreeType 2... no
checking for T1lib support... no
checking whether to enable truetype string function in GD... no
checking whether to enable JIS-mapped Japanese font support in GD... no
checking for fabsf... (cached) yes
checking for floorf... (cached) yes
If configure fails try --with-jpeg-dir=DIR
configure: error: PNG support requires ZLIB. Use --with-zlib-dir=DIR

No clue why it couldn't find libjpeg, but I then tried adding:
--with-zlib-dir=/usr/include (AND) --with-jpeg-dir=/usr/local/include/
(the header files are there)

the configure script then runs through fine, but when I try to run make, I
get:

eg -lcurl -lz -lm -lcurl -lssl -lcrypto -lz -lcrypt -lcrypt  -o
sapi/cli/php
ext/gd/gd.lo: In function `zif_imagecreatefromstring':
/usr/ports/www/mod_php4/work/php-4.3.10/ext/gd/gd.c:1328: undefined
reference to `gdImageCreateFromJpegCtx'
ext/gd/gd.lo: In function `zif_imagecreatefromjpeg':
/usr/ports/www/mod_php4/work/php-4.3.10/ext/gd/gd.c:1507: undefined
reference to `gdImageCreateFromJpegCtx'
/usr/ports/www/mod_php4/work/php-4.3.10/ext/gd/gd.c:1507: undefined
reference to `gdImageCreateFromJpeg'
ext/gd/gd.lo: In function `zif_imagejpeg':
/usr/ports/www/mod_php4/work/php-4.3.10/ext/gd/gd.c:1762: undefined
reference to `gdImageJpegCtx'
ext/gd/gd.lo: In function `zif_imagecolorat':
/usr/ports/www/mod_php4/work/php-4.3.10/ext/gd/gd.c:1891: undefined
reference to `gdImageBoundsSafe'
ext/gd/gd.lo: In function `_php_image_convert':
/usr/ports/www/mod_php4/work/php-4.3.10/ext/gd/gd.c:3759: undefined
reference to `gdImageCreateFromJpeg'
*** Error code 1

Stop in /usr/ports/www/mod_php4/work/php-4.3.10.

These are all the functions that are breaking.  Any help greatly
appreciated!


James Smallacombe PlantageNet, Inc. CEO and Janitor
[EMAIL PROTECTED]   
http://3.am
=

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



Re: [PHP] hotlinking images

2005-04-01 Thread Jochem Maas
Sebastian wrote:
i have an issue with site linking directly to my images.
the problem is these images are generated on the fly with php/gd -- they're
generated each time its viewed because i have done some watermarking
manipulation and didnt want to watermaker them in a static way. they're
including the images like this:
img src=http://mydomain.com/script.php?pic=232;
not only is bandwidth usage increase but so does cpu because php/gd has to
process them as well.. if they're including 5 or 6 of these images on a
single page i can imagin how much cpu is being used.
how can i work around this, if at all possible?
you already got 2 answers covering the issues of direct linking to your 
images,
I would just like to add that you should also consider caching, you could
roll your own by saving the manipulated images on disk and checking to see 
whether
a cached image already exists before processing (and if it does just output 
that instead)
... on the other end of the scale you could try Squid (which can also act as a 
reverse-proxy)
rgds,
Jochem

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


[PHP] SSL XML File Download Problem

2005-04-01 Thread Shaun
Hi,

I have a site that allows users to download xml files. I have the following 
php script which prints the results of the query to the browser. As the 
header is chaged to XML it forces the browser to ask the user if they want 
to download the file rather than outputting the results straight to the 
browser:

?php
header('Content-type: text/xml');
header('Content-Disposition: attachment; filename=test.xml');

// doquery
$xml = ?xml version=\1.0\ ?\r\n;
// add query results to $xml
echo $xml;
?

This was working fine until i added an SSL certificate to my site, now I get
the following error message:

Internet Explorer cannot download ..._download.php?id=4723 from www... .com

Internet Explorer was not able to open this Internet site. The requested 
site is either unavailable or cannot be found...

Any ideas?

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



Re: [PHP] IE problem downloading files

2005-04-01 Thread kjohnson
Luis Lebron [EMAIL PROTECTED] wrote on 04/01/2005 09:42:32 AM:

 
 I have just changed the server that was being used our public website.
 In the process the php scripts used to download files stopped working
 with IE. The new box is running Debian Testing. The php version is
 listed as PHP Version 4.3.10-9. Apache 1.0.33. The download script looks
 like this:
 
 
 if(file_exists($path))
 {
   $filesize = filesize($path);
   Header(Content-Length: $filesize);
   Header(Content-type: application/download);
   Header(Content-Disposition-type: attachment);
   Header(Content-Disposition: filename=$filename);
   Header(Content-Transfer-Encoding: binary);
   $fp = fopen($path,rb);
   $result = fpassthru($fp);
   unlink($path);
   exit;
 }
 else
 {
print Could not create backup file;
 }

I am not exactly sure what the goal is here, so I don't have an exact 
solution. However, below are some links and code that helped us solve an 
IE and pdf download problem.

Good luck!

Kirk

Straight from somewhere in the horse's anatomy:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q293792

In short - ie will send 2-3 requests to the server per document, most 
servers/code are not prepared for what ie is sending.

Some general info and a way to trick IE:

http://us2.php.net/manual/en/function.session-cache-limiter.php
http://pgsql.designmagick.com/include/fpdf/FAQ.htm#5

Some working code to download a pdf and open it in an acrobat window:

?
session_cache_limiter('none');
session_start();

// generate the file. . .

// now send it
header('Content-Length: ' . strlen($pdfFileData));
header('Content-Disposition: inline; filename=' . $pdfFileName . '');
header('Content-Type: application/pdf');
echo $pdfFileData;
?

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



RE: [PHP] SSL XML File Download Problem

2005-04-01 Thread Chris W. Parker
Shaun mailto:[EMAIL PROTECTED]
on Friday, April 01, 2005 11:20 AM said:

 This was working fine until i added an SSL certificate to my site,
 now I get the following error message:
 
 Internet Explorer cannot download ..._download.php?id=4723 from
 www... .com 
 
 Internet Explorer was not able to open this Internet site. The
 requested site is either unavailable or cannot be found...
 
 Any ideas?

IIRC you've got friendly error messages turned on. Turn it off to see
what's really happening.


Chris.

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



[PHP] Accessing env variables

2005-04-01 Thread Ravi Natarajan
Hi,

 

I have defined couple of environment variables in one of my apache
module using setenv() at fixups and handler function calls.

 

I have another php module, where I need to access these variables. So I
have defined these variables as global $var1, $var2 ..etc;

 

When I try to access these variables as $var1 and $var2 , they don't
seem to be set, so I am not getting correct values, but they give
correct values when I acess them using getenv() call.

 

I thought that the global command would make the global environment
variables available in the local php code.

 

How to access these environment variables in my php code without using
getenv() call.

 

Thanks

 

Ravi Natarajan

 

 



Re: [PHP] PHP 5 Status

2005-04-01 Thread Matthew Fonda
Yes, PHP5 is ready for production environments. It is stable, and has been 
stable for almost an entire year.


Is PHP 5 ready for production environments? Is it concidered stable,
or is it just a matter of going a while with no new bugs discovered to
get to stable..
Colin
--
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] Accessing env variables

2005-04-01 Thread Philip Hallstrom
On Fri, 1 Apr 2005, Ravi Natarajan wrote:
I have defined couple of environment variables in one of my apache
module using setenv() at fixups and handler function calls.
I have another php module, where I need to access these variables. So I
have defined these variables as global $var1, $var2 ..etc;
When I try to access these variables as $var1 and $var2 , they don't
seem to be set, so I am not getting correct values, but they give
correct values when I acess them using getenv() call.
How to access these environment variables in my php code without using
getenv() call.
Try using $_SERVER and $_ENV...
See here for more info...
http://us3.php.net/reserved.variables
-philip
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Easy way to grab a value out of XML?

2005-04-01 Thread Brian Dunning
I've been looking at the XML commands and am feeling a bit overwhelmed. 
My needs are simple and I'm hoping there's an easy solution that I'm 
just missing. I have a hunk of well-formed XML in a variable, $xml, and 
it contains only one instance of pricex.xx/price. I just want to 
get the $price out of $xml. What's the simplest way?

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


Re: [PHP] Easy way to grab a value out of XML?

2005-04-01 Thread Franklin van de Meent
If you are using PHP5 check out SimpleXML (http://php.net/simplexml)



On Apr 1, 2005 10:53 PM, Brian Dunning [EMAIL PROTECTED] wrote:
 I've been looking at the XML commands and am feeling a bit overwhelmed.
 My needs are simple and I'm hoping there's an easy solution that I'm
 just missing. I have a hunk of well-formed XML in a variable, $xml, and
 it contains only one instance of pricex.xx/price. I just want to
 get the $price out of $xml. What's the simplest way?
 
 - Brian
 
 --
 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 5 Status

2005-04-01 Thread Jordi Canals
On Apr 1, 2005 8:30 PM, Colin Ross [EMAIL PROTECTED] wrote:

 Is PHP 5 ready for production environments? Is it concidered stable,
 or is it just a matter of going a while with no new bugs discovered to
 get to stable..

Yes, it is ready. I've been using on my production servers since
version 5.0.1 without any problem. Now I'm running 5.0.3 and this
weekend will update to 5.0.4. I'm really happy with PHP-5 and
specially with all his new features. Now the majority of my scripts
require PHP-5 (And don't wok with previous versions).

Also I run PHP-5 in some hosting server for my customers, some of them
running old scripts, and everything runs really well.

I would recommend it to anybody who starts a new development do it
with PHP-5 in mind. To all those people who has PHP-4 running, I would
recommend to test PHP-5 and start deploying it.

Regards,
Jordi.

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



Re: [PHP] Easy way to grab a value out of XML?

2005-04-01 Thread emre
you can handle xml output as if a string file, then easily parse xml file 
with preg_match / preg_match_all,

smt like this can do the job:
?php
$str=xml version bla 
blapricesomevaluehere/pricepricesomevaluehere2/pricepricesomevaluehere2/priceetc;

preg_match_all(/price([^])*\/price/i, $str, $matches);
echo count($matches[0]);
for ($i=0; $i count($matches[0]); $i++) {
echo 'br + '.$matches[0][$i];
}
?
but you'd better learn to handle xml files via xml parsers.





- Original Message - 
From: Brian Dunning [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Friday, April 01, 2005 11:53 PM
Subject: [PHP] Easy way to grab a value out of XML?


I've been looking at the XML commands and am feeling a bit overwhelmed. My 
needs are simple and I'm hoping there's an easy solution that I'm just 
missing. I have a hunk of well-formed XML in a variable, $xml, and it 
contains only one instance of pricex.xx/price. I just want to get the 
$price out of $xml. What's the simplest way?

- Brian
--
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] can I limit DB access

2005-04-01 Thread Dave Reinhardt
How can I limit access to my database to one computer or one domain?

I do not want it accessable from just any place on the web.

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



[PHP] FW: php pages

2005-04-01 Thread bruce
hey guys

can someone tell me why this seems to work.. is it because a security
attribute hasn't been correctly set?

 Add this to any php page ?=PHPE9568F36-D428-11d2-A769-00AA001ACF42
 Ex. http://www.fedoraforum.org/?=PHPE9568F36-D428-11d2-A769-00AA001ACF42

thanks..


-Original Message-
From: jim lawrence [mailto:[EMAIL PROTECTED]
Sent: Friday, April 01, 2005 1:05 PM
To: [EMAIL PROTECTED]
Subject: Re: php pages


On Apr 1, 2005 3:59 PM, bruce [EMAIL PROTECTED] wrote:
 the question i have is why this does this..???

 i was under the impression that php/webservers shouldn't return results
for
 query vars that aren't defined...

 clarification...??
Found it at fedoraforums.org


 Add this to any php page ?=PHPE9568F36-D428-11d2-A769-00AA001ACF42
 Ex. http://www.fedoraforum.org/?=PHPE9568F36-D428-11d2-A769-00AA001ACF42



--

Jim Lawrence
Registered Linux User: #376813

When I'm feeling down, I like to whistle.
It makes the neighbor's dog run to the end of his chain and gag himself.


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



Re: [PHP] can I limit DB access

2005-04-01 Thread emre
mysql comes with 2 predefined databases,  their names are
show databases;
1. mysql
2. test
open mysql database
 use mysql;
find the table named as 'user' , there mysql users and their access 
privileges are stored.
   select Host, User, Password  from user
modify Host column as you wish to limit access to your database. also you'd 
better check other columns to understand how to grant priviliges to mysql 
users.

btw dont forget to flush privileges after you are done with the 
modification.
flush privileges;

hope this helps.
- Original Message - 
From: Dave Reinhardt [EMAIL PROTECTED]
To: PHP General-List php-general@lists.php.net
Sent: Friday, April 01, 2005 11:22 PM
Subject: [PHP] can I limit DB access


How can I limit access to my database to one computer or one domain?
I do not want it accessable from just any place on the web.
--
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] can I limit DB access

2005-04-01 Thread Martín Marqués
El Vie 01 Abr 2005 17:22, Dave Reinhardt escribió:
 How can I limit access to my database to one computer or one domain?
 
 I do not want it accessable from just any place on the web.

This is DataBase related. PHP has nothing to do with it. And anyway, you are 
not saying which database you are using.

-- 
 19:16:57 up  3:45,  3 users,  load average: 0.83, 1.04, 0.89
-
Martín Marqués| select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica  |  DBA, Programador, Administrador
 Universidad Nacional
  del Litoral
-

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



[PHP] pass variable from vbscript to php

2005-04-01 Thread Ashley
I have a unique problem that may be able to be solved another way, but I 
don't know how.

What I need to do is pass a variable from a vbscript into php for use.
I am using vbscript to access an activeX control on the computer that 
grabs the currently logged in user.  This works fine, but I cannot 
determine how I can get that value into php so that I can use it.

This is for an Intranet app.  Basically I want to use the currently 
logged in user so that they don't have to log into the Intranet app.

I am running this on a Netware 6.5 server running Apache 2.5.
This may not be the best way to go about this, but it is the only thing 
that I have been able to find so I am open to suggestions.

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


Re: [PHP] FW: php pages

2005-04-01 Thread Alan Milnes
bruce wrote:
hey guys
can someone tell me why this seems to work.. is it because a security
attribute hasn't been correctly set?
 

It's called an easter egg - check out your phpinfo on April 1st ...
http://www.phpfreaks.com/articles/229/0.php
Alan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] pass variable from vbscript to php

2005-04-01 Thread Chris W. Parker
Ashley mailto:[EMAIL PROTECTED]
on Friday, April 01, 2005 2:32 PM said:

 I have a unique problem that may be able to be solved another way,
 but I don't know how.

Another way? What's the first way? :|

 What I need to do is pass a variable from a vbscript into php for use.
 
 I am using vbscript to access an activeX control on the computer that
 grabs the currently logged in user.  This works fine, but I cannot
 determine how I can get that value into php so that I can use it.

[snip /]

 This may not be the best way to go about this, but it is the only
 thing that I have been able to find so I am open to suggestions.

I must be missing something. Where is the first way?

In any case, here is another way:

You need to pass the variable through the querystring:

http://intranet/page.php?yourvariable=yourvalue


HTH,
Chris.

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



Re: [PHP] Easy way to grab a value out of XML?

2005-04-01 Thread Rasmus Lerdorf
The XML functions really aren't that hard to use.  If you just want a 
simple parse to pick out something have a look at:

for PHP4: http://php.net/xml_parse_into_struct
for PHP5: http://php.net/simplexml_load_file
-Rasmus
[EMAIL PROTECTED] wrote:
you can handle xml output as if a string file, then easily parse xml 
file with preg_match / preg_match_all,

smt like this can do the job:
?php
$str=xml version bla 
blapricesomevaluehere/pricepricesomevaluehere2/pricepricesomevaluehere2/priceetc; 

preg_match_all(/price([^])*\/price/i, $str, $matches);
echo count($matches[0]);
for ($i=0; $i count($matches[0]); $i++) {
echo 'br + '.$matches[0][$i];
}
?
but you'd better learn to handle xml files via xml parsers.





- Original Message - From: Brian Dunning [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Friday, April 01, 2005 11:53 PM
Subject: [PHP] Easy way to grab a value out of XML?

I've been looking at the XML commands and am feeling a bit 
overwhelmed. My needs are simple and I'm hoping there's an easy 
solution that I'm just missing. I have a hunk of well-formed XML in a 
variable, $xml, and it contains only one instance of 
pricex.xx/price. I just want to get the $price out of $xml. What's 
the simplest way?

- Brian
--
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] Recommendation for a MySql wrapper class

2005-04-01 Thread Ryan A
Hi,
After spending a long time reading about SQL injection on the Google,PHP.net
site and on Shifflet.org (very good article, links, feedback - and I'm
really happy that knowledgeable people like Chris take the time to help
actively on the list) I have some mixed views on how easy it is to actually
inject something into some of my sites, and I have also corrected some
mistakes which would have gone unnoticed if I didnt read the above.

Anyway, I have decided to start using a database wrapper from now on,
visiting the php classes site and searching sites/google I have found a
*LOT* of classes to do the job.

BUT, few promise to take care of any SQL injection without the programmer
first cleaning out the variables/strings,
so although this is new to me, I know there are a lot of PHP gurus on the
list and i'm sure this is not new to themI was hopeing someone could
recommend a class they are using as I am starting a new project on monday
and dont have the time to test each class before picking one (honest guys,
there are a lot, you gotto browse them to belive it)
I dont need anything fancy just something that gets the job donesafely
and effectivly.

Note: This address accepts attachements if it has [PHP] somewhere in the
subject line so if you want, zip it up and mail it to me.

Thanks in advance,
Ryan



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.0 - Release Date: 3/31/2005

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



[PHP] Retrieve URL of website

2005-04-01 Thread HarryG
Hi,

I want to retrieve the complete url in my php script. How can I do this?

eg. www.mysite.com/mydirectory/mypage.php

Result should either be www.mysite.com/mydirectory/mypage.php or 
/mydirectory/mypage.php

Thanks in advance
HarryG

Re: [PHP] Retrieve URL of website

2005-04-01 Thread Zareef Ahmed
HI, 

 Look for $_SERVER['REQUEST_URI'];

?php 

print $_SERVER['REQUEST_URI'];

?

But Dear first you should search the documentation , it is very easy
to notice if you can use phpinfo();


zareef ahmed 


On Apr 2, 2005 8:12 AM, HarryG [EMAIL PROTECTED] wrote:
 Hi,
 
 I want to retrieve the complete url in my php script. How can I do this?
 
 eg. www.mysite.com/mydirectory/mypage.php
 
 Result should either be www.mysite.com/mydirectory/mypage.php or 
 /mydirectory/mypage.php
 
 Thanks in advance
 HarryG
 


-- 
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

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



Re: [PHP] Retrieve URL of website

2005-04-01 Thread Leif Gregory
Hello HarryG,

Friday, April 1, 2005, 7:42:25 PM, you wrote:
H I want to retrieve the complete url in my php script. How can I do this?
H eg. www.mysite.com/mydirectory/mypage.php
H Result should either be www.mysite.com/mydirectory/mypage.php or 
/mydirectory/mypage.php

If you mean on your own site, use $_SERVER['PHP_SELF']


Cheers,
Leif Gregory 

-- 
TB Lists Moderator (and fellow registered end-user)
PCWize Editor  /  ICQ 216395  /  PGP Key ID 0x7CD4926F
Web Site http://www.PCWize.com

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



[PHP] Connection to Two databases simultaneously

2005-04-01 Thread HarryG
Hi,

I am connecting to two database in my index.php.

Here is how:
@ $db = mysql_connect(localhost, USERLOGIN, USERDBPASS);
 if (!$db)
 {  print Error: Could not connect to database. Please try again later.;  
exit; }
mysql_select_db(DATABASE);

@ $userdb = mysql_connect(localhost, USERLOGIN, USERDBPASS);
 if (!$userdb)
 {  print Error: Could not connect to database. Please try again later.;  
exit; }
mysql_select_db(USERDB);

$getaccount = SELECT * FROM account WHERE visible=1;  //Account table is 
present in USERDB.
$result = mysql_query($getaccount);

$get = SELECT * FROM useraccount;  //UserAccount table is present in DATABASE.
$result = mysql_query($get);

There is no problem with the connection. but I need to query tables in both 
databases. I know you need to use link identifiers, but have had no luck in 
getting it to work. Appreciate your help.

Thanks.
HarryG


Re: [PHP] getting filenames from dir

2005-04-01 Thread Mario St-Gelais
That should get you started :
$dirname='/var';
$dh=opendir($dirname) or die('could not open directory');
while (!(($file=readdir($dh))===false)){
   if (is_dir('$dirname/$file')){
   $myarray[]=$file;
   }
   echo $filebr;
   $myarray[]=$file;
}
Mario
Merlin wrote:
Hi there,
does anybody know how to get all file names from a specified directory 
into an array?

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


[PHP] Re: Retrieve URL of website

2005-04-01 Thread HarryG
Thanks guys.

HarryG [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi,

I want to retrieve the complete url in my php script. How can I do this?

eg. www.mysite.com/mydirectory/mypage.php

Result should either be www.mysite.com/mydirectory/mypage.php or
/mydirectory/mypage.php

Thanks in advance
HarryG

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



Re: [PHP] Recommendation for a MySql wrapper class

2005-04-01 Thread Dan Rossi
I have nothing to do with these but I would check out PEAR DB, MDB,MDB2 
and ADODB.

On 02/04/2005, at 10:41 PM, Ryan A wrote:
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php