[PHP] Adding to md5 checksums.

2003-04-02 Thread William Bailey
Hi all,

Just wondering if it is possiable to add or combine 2 or more md5 checksums 
togeather?

Basically i've got a value/file that i can get the md5 checksum for but want 
to be able to padd the input value/file with nulls to a specific length 
example:

value is   : abcdef
block size : 4 chars

Therefore i want to get the md5 value of abcdef\x00\x00.

The above example is very small and i could just recreate the string in 
memmory but i will need to do this with much bigger values/files and don't 
want to have to use silly amounts of memmory.

Maybe it would be an idea to add another parameter to the built in md5() 
function that specifies the starting md5 example:

$checksum=md5(\x00\x00, md5(adcdef));

would return the same checksum as:

$checksum=md5(abcdef\x00\x00);

-- 
Regards,
William Bailey.
Pro-Net Internet Services Ltd.
http://www.pro-net.co.uk
http://wb.pro-net.co.uk


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



[PHP] Re: Returning a variable from a function problem

2003-04-02 Thread Nicole
Hello,

Where is $duplicate originally being set? Are you using global variables? is
$duplicate being POST'd or GET'd or what?

If it is only gaining it's value from the duplicate_name() function, is that
function returning those possible values (1,2) based on whatever the result
of the action taken in that fuction is?

Maybe try this:

if (empty($form[name])) {
 $error[name] = *; $message[name] = Required field!;
}
else
{
 $duplicate = duplicate_name($form[name]);

 if ( $duplicate == 0 ) {
  $error[name] = *; $message[name] = Screen name already used!;
 }
 else if ($duplicate == 1) {
  $error[name] = *; $message[name] = Database error - Please try
again in a few moments!;
 }
 elseif ($duplicate == 2) {
  $error[name] = *; $message[name] = Server error - Please tryagain
in a few moments!;
 }
 else {
  // not a dup, do whatever
 }
}



Nicole

@rogers.com wrote in message news:[EMAIL PROTECTED]
 I have a form where the user inputs information - the code below is the
 error checking for one of the fields. The first IF statement just checks
 that the filed is not empty and works fine.

 Then I  check a function I made to see if the user is already in a mysql
 database and the function returns  0, 1, or 2 depending on the various
 conditions. The first elseif works as I would expect - but it seems that
the
 next two elseif's are just being ignored.

 Could someone possibly explain what I have wrong here.  Thanks

 if (empty($form[name])) { $error[name] = *; $message[name] =
 Required field!;
 }
 elseif($duplicate = duplicate_name($form[name]) == 0) {
  $error[name] = *; $message[name] = Screen name already used!;
 .
 }
 elseif ($duplicate == 1) {
  $error[name] = *; $message[name] = Database error - Please try
 again in a few moments!;
 }
 elseif ($duplicate == 2) {
 $error[name] = *; $message[name] = Server error - Please try
 again in a few moments!;
 }


 function duplicate_name($name) {

 if (!($connect = @mysql_connect($serverhost,$serveruser,$serverpass))) {
  These are all defined above but not included here.
  $server_error = 2;
 }
 if ([EMAIL PROTECTED]($databasename)) {
 $server_error = 1;
 }

 if($server_error) { $duplicate = $server_error;
 }
 else
 {
 $query = SELECT name FROM $tablename WHERE name = '$name';

 if(!$query) { $duplicate = 1}

 else {
 $result = mysql_query($query);
 $line = mysql_fetch_array($result);

 if($line['name'] == $name) { $duplicate = 0; }

 mysql_free_result($result);
 mysql_close($connect);

 }
 }

 echo $duplicate;   *  This shows that the variable $duplicate is
 assigned 0, 1, or 2 depending on the what conditions were met.

 return($duplicate);
 }





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



[PHP] Newbie

2003-04-02 Thread Ilyas
Hi all

I downloaded the oscommerce online shop. I have no experience with php. I 
installed yesterday php 4.3.

Just my question: I get this error if I call the startpage of this shop:

Warning: Unknown(): Your script possibly relies on a session side-effect 
which existed until PHP 4.2.3. Please be advised that the session extension 
does not consider global variables as a source of data, unless 
register_globals is enabled. You can disable this functionality and this 
warning by setting session.bug_compat_42 or session.bug_compat_warn to off, 
respectively. in Unknown on line 0

Thanks for any information

Ilyas 

[PHP] Re: $_SERVER[REMOTE_ADDR]

2003-04-02 Thread Nicole
Try these:

function getIP()
{
 if (getenv('HTTP_CLIENT_IP'))
  $ip=getenv('HTTP_CLIENT_IP');
 else if ( getenv('REMOTE_ADDR') )
  $ip=getenv('REMOTE_ADDR');
 else
  $ip = 'unknown';

 return trim($ip);
}

function getISP($addr,$byIP=true)
{
/*
Can pass in an ip, like 64.xxx.xxx.xx or a domain, like www.aeontrek.com;
true if it is an IP; else false
*/
 if ( $byIP )
  return trim(gethostbyaddr( trim($addr) ));
 else
  return trim(gethostbyname ( trim($addr) ));
}



--
Nicole


John [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Makes me think.. what exactly the $_SERVER[REMOTE_ADDR] is
doing

 Cause it does not really show the actual IP address instead IP address
 within its range

 e.g. 66.87.25.122
 output 66.87.25.2

 any idea how to get their actual IP add and if possible the name of their
 computer

 Also, is it also possible to get or trace the IP add?

 many thanks,
 John





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



Re: [PHP] checkdate function

2003-04-02 Thread tech
On Tuesday 01 April 2003 02:47 pm, Jon Haworth wrote:
 Hi Siva,

  checkdate function verifies whether the date is valid or
  not by taking month, day and year as arguments.
  The problem is when someone enters a three digit year by
  mistake (200 instead of 2003), this function does not catch it.

 Yes, I've been bitten by this as well :-)

Thanks Jon. Infact, we caught it when one of our guys were testing the 
application internally. Thankfully no serious problem :-)


  We are separating the year part from the string and validating
  separately to solve this problem. Is there a better way to do it?

 I think you're stuck with the extra validation step, but you can do it
 quite neatly with a replacement function that looks something like this:

 function myCheckdate ($m, $d, $y, $min = 1900, $max = 2100)
 {

   // check whether $y is within allowable range
   if ($y = $min || $y = $max)
 return false;

   // the year is OK: checkdate can do its stuff
   return (checkdate($m, $d, $y))

 }

Your suggestions looks very neat, we will use that. Thanks once again. 


 You can adjust the default allowable years to match what you usually need,
 and then override them as necessary.


 Personally I'd like to see PHP's checkdate() work a bit like the one above,
 or maybe have checkReasonableDate() and checkImprobableDate(): I'm prepared
 to believe that some PHP developers need to validate three- and five- digit
 years, but I can't believe that it's *that* common :-)

I too feel taht it will be nice to have another PHP function which does this 
work. I assume that the current function is needed by some applications 
(historical, archeoligacal etc) which account very early years and possibly 
years far into the future.

Siva





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



Re: [PHP] Newbie

2003-04-02 Thread Burhan Khalid
Ilyas wrote:
Hi all

I downloaded the oscommerce online shop. I have no experience with php. 
I installed yesterday php 4.3.

Just my question: I get this error if I call the startpage of this shop:

Warning: Unknown(): Your script possibly relies on a session side-effect 
which existed until PHP 4.2.3. Please be advised that the session 
extension does not consider global variables as a source of data, unless 
register_globals is enabled. You can disable this functionality and this 
warning by setting session.bug_compat_42 or session.bug_compat_warn to 
off, respectively. in Unknown on line 0
You have two options :

1. turn off warnings
2. edit the php.ini settings as it states by setting ...
--
Burhan Khalid
phplist[at]meidomus[dot]com


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


[PHP] timestamp from uniqid()

2003-04-02 Thread nooper
Would there be a way to extract a timestamp from uniqid(), since the
function is based on the microsecond, and its purpose is not to be random in
anyway, simply unique. I understand that it is not supposed to act as a
timestamp, just wondering if anyone has a method of extracting a date or
time from a uniqid.
Thanks,
nooper




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



Re: [PHP] timestamp from uniqid()

2003-04-02 Thread Sebastian
may i ask what is it that your trying to do? Why not use time(); ?

cheers,
Sebastian

- Original Message -
From: nooper [EMAIL PROTECTED]


| Would there be a way to extract a timestamp from uniqid(), since the
| function is based on the microsecond, and its purpose is not to be random
in
| anyway, simply unique. I understand that it is not supposed to act as a
| timestamp, just wondering if anyone has a method of extracting a date or
| time from a uniqid.
| Thanks,
| nooper
|
|
|
|
| --
| PHP General Mailing List (http://www.php.net/)
| To unsubscribe, visit: http://www.php.net/unsub.php
|


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



Re: [PHP] Newbie

2003-04-02 Thread skate
could this not also be solved by switching register_globals as on? reading
through the error, it looks like that's what it's complaining about. there
is security risks to turning this on, which is probably why it doesn't
suggest doing it, but depends how secure you need your site to be? and also
how much you want to check the security and patch it up if necessary?

- Original Message -
From: Burhan Khalid [EMAIL PROTECTED]
To: Ilyas [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 10:04 AM
Subject: Re: [PHP] Newbie


 Ilyas wrote:
  Hi all
 
  I downloaded the oscommerce online shop. I have no experience with php.
  I installed yesterday php 4.3.
 
  Just my question: I get this error if I call the startpage of this shop:
 
  Warning: Unknown(): Your script possibly relies on a session side-effect
  which existed until PHP 4.2.3. Please be advised that the session
  extension does not consider global variables as a source of data, unless
  register_globals is enabled. You can disable this functionality and this
  warning by setting session.bug_compat_42 or session.bug_compat_warn to
  off, respectively. in Unknown on line 0

 You have two options :

 1. turn off warnings
 2. edit the php.ini settings as it states by setting ...

 --
 Burhan Khalid
 phplist[at]meidomus[dot]com



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





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



[PHP] Email advice

2003-04-02 Thread Tony Burgess
Hi everyone!

Just wanted to know what the best way to deal with a system that makes use
of lots of emails.
The application itself creates emails using php mail() function, but I
recall reading that this was not necessarily the best way to do this if
sending lots of emails.

Any suggestions or thoughts are appreciated.

Thanks

--
Tony Burgess



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



Re: [PHP] timestamp from uniqid()

2003-04-02 Thread Justin French
If you want the microsecond use microtime().

Justin

on 02/04/03 8:44 PM, Sebastian ([EMAIL PROTECTED]) wrote:

 may i ask what is it that your trying to do? Why not use time(); ?
 
 cheers,
 Sebastian
 
 - Original Message -
 From: nooper [EMAIL PROTECTED]
 
 
 | Would there be a way to extract a timestamp from uniqid(), since the
 | function is based on the microsecond, and its purpose is not to be random
 in
 | anyway, simply unique. I understand that it is not supposed to act as a
 | timestamp, just wondering if anyone has a method of extracting a date or
 | time from a uniqid.
 | Thanks,
 | nooper
 |
 |
 |
 |
 | --
 | 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] Php.ini doesn't exit

2003-04-02 Thread Javier Carreras
Hi all,

Where does PHP get its settings if php.ini file doesn't exist?

BTW- I want to enable sockets that are not enabled. Could I do that without
creating a php.ini file?

Regards,
Javi.


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



Re: [PHP] Email advice

2003-04-02 Thread Burhan Khalid
Tony Burgess wrote:

Just wanted to know what the best way to deal with a system that makes use
of lots of emails.
The application itself creates emails using php mail() function, but I
recall reading that this was not necessarily the best way to do this if
sending lots of emails.
Any suggestions or thoughts are appreciated.


Depending on how many emails you are talking about, there are a few 
suggestions.

If your emails aren't time sensitive, you should queue them for a time 
when system resources aren't taxed as much. Say around midnight, or from 
3-4 in the morning depending on what kind of load your system experiences.

Also, pausing the email sending process after each email is a good idea 
also. In addition, getting your own SMTP server so you can further 
customize delivery should also be a consideration.

I run the free postcast server (Windows platforms) on my system so I can 
control the delivery of email for my entire network. Works wonders, and 
you don't have to worry about your ISP SMTP service choking on multiple 
emails.

Hoping this helps,
--
Burhan Khalid
phplist[at]meidomus[dot]com


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


Re: [PHP] Php.ini doesn't exit

2003-04-02 Thread Awlad Hussain
I think php.ini file must exist.. otherwise php will not work.

- Original Message -
From: Javier Carreras [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 11:01 AM
Subject: [PHP] Php.ini doesn't exit


 Hi all,

 Where does PHP get its settings if php.ini file doesn't exist?

 BTW- I want to enable sockets that are not enabled. Could I do that
without
 creating a php.ini file?

 Regards,
 Javi.


 --
 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.ini doesn't exit

2003-04-02 Thread skate
you can set _some_ directives directly in php

check the manual for the set ini options, can't remember the exact
function...

php will work without an .ini file, but will have all defaults set. again,
check thru the manual to see what the defaults are.

- Original Message -
From: Javier Carreras [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 11:01 AM
Subject: [PHP] Php.ini doesn't exit


 Hi all,

 Where does PHP get its settings if php.ini file doesn't exist?

 BTW- I want to enable sockets that are not enabled. Could I do that
without
 creating a php.ini file?

 Regards,
 Javi.


 --
 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] Sending messages with HL7

2003-04-02 Thread Miguel González Castaños
Dear all,

 A friend of mine has told me that his group is trying to build a php
interface to HL7 messages.

 Their spec is: They need to send through PHP (from a browser) a HL7
message with a query, interpret that HL7 message, make the request with
the information inside the HL7 message to an Informix database and then
send it back to the browser.

 Any suggestions of how to accomplish this?

 Many thanks

 Miguel



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



[PHP] QUESTION - user management

2003-04-02 Thread [EMAIL PROTECTED]

How do applications know how many users are logged into the system? For
example postnuke will tell you '3 users online, 2 members'. Im gussing it
uses sessions, but how?



Edd Barrett
(http://www.filibusta.net)

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



Re: [PHP] Another Problem installing PHP 4.3.1 - won't compile dueto error.

2003-04-02 Thread Marek Kilimajer
My guess you have a mess in your curl library installation. For example 
you use header from version 7.9.5 and specify that you have version 
7.10.3. Find all libcurl.so and curl.h files on your system and check if 
they are really the version you think they are. You may try running rpm 
-V libcurl(-devel), this verifys if any file has changed

Don wrote:

Ok, that problem solved but now another one pops up when I run 'make'.
Please note that it is complaining about code that came with the PHP tarball
and I haven't changed anything.  Below are the errors for your viewing
(dis)pleasure.  Any guidance would be appreciated.  This isn't supposed to
be so hard.
 



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


Re: [PHP] PHP and Front Page XP

2003-04-02 Thread Marek Kilimajer
No, this information is not provided by the browsers.

Tomás Liendo wrote:

Thanks! Your help solved my problems!
Is there some form of obtaining the complete path??? I tried $f1_path, but
don't work... :-)
Thank you very much,

 



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


[PHP] newbie2

2003-04-02 Thread Ilyas
FATAL ERROR: register_globals is disabled in php.ini, please enable it!

How can I make this?

Thanks...

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


[PHP] Menu from Directory

2003-04-02 Thread Ben Whitehead
I am trying to sort an image menu system which is passed a directory name,
and can count and name the files in a menu from simply seeing which files
are in this directory. It would be ideal if it can just do this just by
looking at the files in the directory, and their file names, but if that is
not possible, could it us the information in a text file I have created and
placed in this directory?

Anyway help would be greatly received! (I'm new to PHP, so simple help would
be even more appreciated!) :S

Ben

--
Ben Whitehead

[EMAIL PROTECTED]



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



Re: [PHP] security flaw?

2003-04-02 Thread Marek Kilimajer
It should not be too difficult to change the delphi utility to post a 
sql or csv file to a php script, in the script you can check the sql 
commands and then execute them or parse the csv file respectively. The 
password is not really hidden, maybe it is not even scrambled in the 
binary, and can be seen by sniffing the connection anyway.

Edward Peloke wrote:

Hello all,

As part of my website, I need to allow the users to upload data from an
access db to my mysql db.  This is all done with a small delphi utility by
way of odbc.  The problem is, my webhost will only allow me to have one user
set up for the db so when I set up the odbc connection for the client (by
way of an install), I have to set up the main username to the db and the
main password.  When I go back into odbc, the password appears to be hidden
from the user but is it really?  How can I give them access into this table
without such a security risk?
Thanks,
Eddie
 



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


Re: [PHP] newbie2 php.ini

2003-04-02 Thread Chris Hayes
At 13:32 2-4-03, you wrote:
FATAL ERROR: register_globals is disabled in php.ini, please enable it!

How can I make this?
First question would be: do i want this? Since PHP 4.10 the 
register_globals is turned off by default, see the release notes at 
http://www.php.net/release_4_1_0.php .

Second question: do you have access to php.ini? If not, ask your host to 
set it.

If you do have your own server, find php.ini, it is typically on the 
location you specified on installation (if you read the instructions), or 
else in
WINDOWS: c:/windows/php.ini  or do a search for file php.ini
LINUX: /etc/ (something)/php.ini with (something) depending on your 
unix/linux type.  try typing: where php.ini

In php.ini find the line that says register_globals=Off
and now change Off to ON.
Have a carefull look at the other options too. Change what you want to change.
Now, unless you know PHP runs as a CGI script, restart your server to make 
the changes have effect. 

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


Re: [PHP] newbie2

2003-04-02 Thread Sebastian
fatal error? What gave you this? Enabling it might not be a good idea, for
security.
.. but if you want to enable it you have to editing the php.ini and set
register_globals to ON.

cheers,
- Sebastian

- Original Message -
From: Ilyas [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 6:32 AM
Subject: [PHP] newbie2


| FATAL ERROR: register_globals is disabled in php.ini, please enable it!
|
| How can I make this?
|
| 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] UTF-8 encoding/decoding

2003-04-02 Thread Marek Kilimajer
There are 2 separate extenssions - iconv and recode

Michael Mulligan wrote:

Hi

So say I have some UTF-8 (not certain, but probably in UTF-8 format, I need
to check some more) encoded text. The text comes in encoded already, so it's
not an htmlspecialchars kind of quick fix. For instance, I get 'ê' and I
want to output 'ê'--how do I convert from the two high ASCII characters to
the one special character? Are their built-in functions for this?
Thanks in advance 

   -m^2

__
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me
spread!
__ 



 



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


RE: [PHP] Menu from Directory

2003-04-02 Thread Niklas Lampén
You might want to start with searching the manual for opendir()
function. There is a sample code listing all files from a directory. :)


Niklas


-Original Message-
From: Ben Whitehead [mailto:[EMAIL PROTECTED] 
Sent: 2. huhtikuuta 2003 1:05
To: [EMAIL PROTECTED]
Subject: [PHP] Menu from Directory


I am trying to sort an image menu system which is passed a directory
name,
and can count and name the files in a menu from simply seeing which
files
are in this directory. It would be ideal if it can just do this just by
looking at the files in the directory, and their file names, but if that
is
not possible, could it us the information in a text file I have created
and
placed in this directory?

Anyway help would be greatly received! (I'm new to PHP, so simple help
would
be even more appreciated!) :S

Ben

--
Ben Whitehead

[EMAIL PROTECTED]



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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



[PHP] Zip to postcode

2003-04-02 Thread Andy
Can someone please tell me how i change the following code:
if (!ereg(^[0-9]{5,5}(\-[0-9]{4,4})?$,$postcode))

to a UK postcode QQ1 1QQ
When i fill out the form it tells me that the postcode is not valid and i
think it is because it is in zip code format.

Thank you

Andy



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



RE: [PHP] Zip to postcode[Scanned]

2003-04-02 Thread Michael Egan
Andy,

There are some ready made scripts for dealing with UK post codes on the relevant page 
on the PHP site:

http://www.php.net/manual/en/function.ereg.php


HTH,

Michael Egan

-Original Message-
From: Andy [mailto:[EMAIL PROTECTED]
Sent: 02 April 2003 12:54
To: [EMAIL PROTECTED]
Subject: [PHP] Zip to postcode[Scanned]


Can someone please tell me how i change the following code:
if (!ereg(^[0-9]{5,5}(\-[0-9]{4,4})?$,$postcode))

to a UK postcode QQ1 1QQ
When i fill out the form it tells me that the postcode is not valid and i
think it is because it is in zip code format.

Thank you

Andy



-- 
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] trigger error and set error handling in an object

2003-04-02 Thread Dan Rossi
hi guys i am having an issue getting a set error handler to get a function
within a class, i am also having problems trying to trigger the error, i
dont want fatals or the error handler wont catch it anyway , but user or
message picks up annoying messages like undefined index on variable , how
can i achieve this properly

this seems to work within the constructor
set_error_handler(array($this, 'myErrorHandler'));

but this way only works in 4.3 ? i need it backwards compatible

trigger_error (Cannot divide by zero, E_USER_WARNING);

this is the trigger

function myErrorHandler ($errno, $errstr, $errfile, $errline, $context) {
plus this , is errrno supposed to return the error type or a code

sorry to e vague its late



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



[PHP] file upload

2003-04-02 Thread anders thoresson
Am I making any obvious mistakes here, in my upload script? I want to 
upload text-files only, they should end up in the directory from which the 
script is executed and be names __traningsmatcher.txt.

HTML-form:

FORM ENCTYPE=multipart/form-data METHOD=POST ACTION=store.php
TABLE
INPUT NAME=max_file_size TYPE=hidden VALUE=300
TR
TDFil: /TD
TDINPUT NAME=userfile TYPE=file/TD
/TR
TR
TD/TD
TDINPUT TYPE=submit VALUE= skicka /TD
/TR
/TABLE
/FORM
And php, on the recieving end:
?php
	// check and validate uploaded file

if($_FILES['userfile'] == none) {
die(Problem: Ingen fil uppladdad.);
}


if($_FILES['userfile']['size'] == 0){
die(Problem: Filen är tom.);
}

if($_FILES['userfile']['type'] != text/plain)   {
die(Problem: Filen är inte en textfil.);
}

if(!is_uploaded_file($_FILES['userfile']['tmp_name']))  {
die(Problem: Filen är inte uppladdad);
}
	$upfile = __traningsmatcher.txt;

if(!copy($_FILES['userfile']['tmp_name'], $upfile)) {
die(Kunde inte spara filen);
}
	echo(Filen är sparad!);

?

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


RE: [PHP] $_SERVER[REMOTE_ADDR]

2003-04-02 Thread Mark Charette
 -Original Message-
 From: thomas [mailto:[EMAIL PROTECTED]

 $_SERVER[REMOTE_ADDR]

 If the user have a proxy the real IP is:
 $_SERVER[HTTP_X_FORWARDED_FOR]

Maybe. If it's set and is set correctly. Even then:

How are 127.0.0.1 or 192.168.1.1 going to help you, supposing that those
values or other address are returned?

Mark C.



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



re: [PHP] Zip to postcode

2003-04-02 Thread skate
sorry, don't have anything to add for code, but just a note to remember that UK post 
codes can also be in the form...

QQ11 1QQ
Q1 1QQ
Q11 1QQ
QQ1 1QQ

so it's a real pain to write an expression for this...

-skate-




Can someone please tell me how i change the following code:
if (!ereg(^[0-9]{5,5}(\-[0-9]{4,4})?$,$postcode))

to a UK postcode QQ1 1QQ
When i fill out the form it tells me that the postcode is not valid and i
think it is because it is in zip code format.

Thank you

Andy



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



re: [PHP] Zip to postcode

2003-04-02 Thread Peter Hicks

Don't forget some London postcodes are Q1Q QQQ!


Peter.


On Wed, 2 Apr 2003, skate wrote:

 sorry, don't have anything to add for code, but just a note to remember that UK post 
 codes can also be in the form...

 QQ11 1QQ
 Q1 1QQ
 Q11 1QQ
 QQ1 1QQ

 so it's a real pain to write an expression for this...

 -skate-




 Can someone please tell me how i change the following code:
 if (!ereg(^[0-9]{5,5}(\-[0-9]{4,4})?$,$postcode))

 to a UK postcode QQ1 1QQ
 When i fill out the form it tells me that the postcode is not valid and i
 think it is because it is in zip code format.

 Thank you

 Andy






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



Re: [PHP] Zip to postcode

2003-04-02 Thread William Bailey
Hi Andy,

The following function seems to work for me:

function split_postcode ($postcode) {
if(eregi('(^[A-Z]{1,2})([0-9|A-Z]{1,2}).*([0-9][A-Z]{2}$)', str_replace(' 
', '', $postcode), $parts)){
$outcode=strtoupper(sprintf('%s%s%s', $parts[1], @str_repeat(' ', 
4-strlen($parts[1])-strlen($parts[2])), $parts[2]));
$incode=strtoupper($parts[3]);
return array($outcode, $incode);
}else{
return False;
}
}

On Wednesday 02 April 2003 12:54, Andy wrote:
 Can someone please tell me how i change the following code:
 if (!ereg(^[0-9]{5,5}(\-[0-9]{4,4})?$,$postcode))

 to a UK postcode QQ1 1QQ
 When i fill out the form it tells me that the postcode is not valid and i
 think it is because it is in zip code format.

 Thank you

 Andy

-- 
Regards,
William Bailey.
Pro-Net Internet Services Ltd.
http://www.pro-net.co.uk
http://wb.pro-net.co.uk


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



[PHP] database question

2003-04-02 Thread José Pereira
Hi all,

I'm trying to grab information from two DBs one being a mamber db and the
other a report DB

I want to print a list of users(pilots for a Virtual Airline) from the Pilot
db and then next to them the nº of reports and total hours they have so far
from the REPORT DB.  The Pilot ID on this list must be a link so that when
clicked it will show the details of the reports.

I got this to but in a general for using a variable $login

so when the pilot/member logins it stores his ID in the $login and then I
use the SELECT * FROM table WHERE column = $login

to be more specific using this code:

?
require(require/config.php);
require(require/authentication.php);
$auth=authenticate($login, $password);

$link = mysql_connect(localhost, user, password)
or die(Could not connect);
   mysql_select_db(databse) or die(Could not select database);
$query = SELECT flight_hhmm FROM pirep WHERE pilot_id='$login';
$result = mysql_query($query) or die(Query failed);
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
 $hhmm=explode(':',$line['flight_hhmm']);
 $totalm+=$hhmm[0]*60+$hhmm[1];
}

mysql_free_result($result);

?

then to print out the number of hours I use this:

?
echo $auth[login]. '. You have ';
echo floor($totalm / 60).':'.($totalm % 60). ' total hours.';
?

this show the total hours for $login which is the pilot id in the report DB.

now I have this code to produce TOTAL reports for the site:

$link = mysql_connect(localhost, user, password)
or die(Could not connect);
   mysql_select_db(database) or die(Could not select database);
$query = SELECT * FROM pirep ;
$result = mysql_query($query) or die(Query failed);


$nb1 = mysql_numrows($result);


This gets me the nº of rows for all pilots the using echo $nb1 will print
the total reports.

Now I tried alot but no luck.  I wanted to get a list like so:

MVC103  -  100 reports Filed - 130 Hours Total
MVC104  -  10 report filed  -  50 hours total
etc,

having the ID (MVCxxx) being a link so when clicked it will show the
datails.  I tried the count() statement but like I said I new to PHP.

If anyone can help PLS.. take a look at the site, mind you it is in
portuguese http://novo.cdmvirtual.com



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



[PHP] use of sessions compared to global scope

2003-04-02 Thread Dan Rossi
hi guys , as per my previous email i am trying to sort out a similar error
handling as c or java exception, although in the error handler i am sending
an error code to it and then return to the previous page with the error on
it , the only way i can do this is to store the code in a session variable ,
i have just realised i can also do this by $_GLOBALS['error_code'] , which
is a more efficient way to do this


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



RE: [PHP] Zip to postcode[Scanned]

2003-04-02 Thread Ford, Mike [LSS]
 -Original Message-
 From: Michael Egan [mailto:[EMAIL PROTECTED]
 Sent: 02 April 2003 13:05
 
 There are some ready made scripts for dealing with UK post 
 codes on the relevant page on the PHP site:
 
 http://www.php.net/manual/en/function.ereg.php

And not one of them is 100% correct!!  This would be my stab:

preg_match('/^([A-Z]{1,2}([0-9]{1,2})|[0-9][A-Z])|GIR)'
   . ' ?[0-9][A-Z]{2}$/i', $postcode)

(I've divided the pattern in two here simply to avoid strange line wrapping!)

One of the user notes referred to says that postcodes are sometimes written with a 
space after the initial letters; although technically this is incorrect, adjusting to 
allow it would give:

preg_match('/^([A-Z]{1,2} ?([0-9]{1,2})|[0-9][A-Z])|GIR)'
   . ' ?[0-9][A-Z]{2}$/i', $postcode)

Another states that the set of letters in the last two positions is restricted -- I 
can't vouch for the accuracy of this, but if it's the case the match would become:

preg_match('/^([A-Z]{1,2} ?([0-9]{1,2})|[0-9][A-Z])|GIR)'
   . ' ?[0-9]}[ABD-HJLNP-UW-Z]{2}$/i', $postcode)

Finally, if you really, really want to accept only completely valid postcodes (not 
just validly formatted ones), you should get the full list of postcode area 
identifiers (the initial letter or two) and validate against those -- plus any local 
peculiarities that occur (for example, in my local postcode area, the final digit is 2 
in *all* cases).  (Well, I guess here we're getting into the realms of paying for the 
Royal Mail's postcode database!!)

Cheers!

Mike

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

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



RE: [PHP] getting values from objects

2003-04-02 Thread Ford, Mike [LSS]
 -Original Message-
 From: Charles Kline [mailto:[EMAIL PROTECTED]
 Sent: 01 April 2003 21:21
 To: Dan Joseph
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] getting values from objects
 
 
 My objective was to try and NOT use a temporary variable.
 
 for example I can do this:
 
 foreach ($res_pform-getSubmitValue(investigator5) AS $k=$v){
   echo $k . br;
 }
 
 I was just wondering in other circumstances, how I can maybe just get 
 to the value of one of the keys without setting it first to a 
 variable 

Sorry, but you can't -- the intermediate variable is the only way (because you can 
only apply [] to variables!).

Cheers!

Mike

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

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



RE: [PHP] Returning a variable from a function problem

2003-04-02 Thread Ford, Mike [LSS]
 -Original Message-
 From: ODCS [mailto:[EMAIL PROTECTED]
 Sent: 02 April 2003 08:10
 
 I have a form where the user inputs information - the code 
 below is the
 error checking for one of the fields. The first IF statement 
 just checks
 that the filed is not empty and works fine.
 
 Then I  check a function I made to see if the user is already 
 in a mysql
 database and the function returns  0, 1, or 2 depending on the various
 conditions. The first elseif works as I would expect - but it 
 seems that the
 next two elseif's are just being ignored.
 
 Could someone possibly explain what I have wrong here.  Thanks
 
 if (empty($form[name])) { $error[name] = *; $message[name] =
 Required field!;
 }
 elseif($duplicate = duplicate_name($form[name]) == 0) {

This statement assigns the result of the comparison duplicate_name($form[name]) == 0 
to $duplicate (giving FALSE if this branch isn't executed, and so never satisfying the 
tests for 1 or 2 below).  I suspect that what you mean is:

   elseif(($duplicate = duplicate_name($form[name])) == 0) {

  $error[name] = *; $message[name] = Screen name 
 already used!;
 .
 }
 elseif ($duplicate == 1) {
  $error[name] = *; $message[name] = Database error 
 - Please try
 again in a few moments!;
 }
 elseif ($duplicate == 2) {
 $error[name] = *; $message[name] = Server error - 
 Please try
 again in a few moments!;
 }


Cheers!

Mike

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

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



[PHP] Re: Zip to postcode

2003-04-02 Thread Andy
Looks like i have it sussed thank you to all.
HOWEVER :o(
I have two small problems that i cannot solve, and seeing as you are all
gods in my opinion maybe you can help me further before i throw myself out
the window.

I am getting this error when i am taken to the member page after correctly
fill out the form:
Warning: extract() expects first argument to be an array in
/home/.sites/112//New_member.php on line 23

Also even though i am taken into the members area the mysql database is not
updating itself.  Why?

Here is the code for the error message:

$sql = SELECT name FROM members
 WHERE username='$logname';
  $result = mysql_query($sql)
   or die(Couldn't execute query 1.);
  $row = mysql_fetch_array($result,MYSQL_ASSOC);
  extract($row);
  echo html

Thank you for your help i take my hat off to all of you, how you understand
all this is byond me!

Andy


Andy [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Can someone please tell me how i change the following code:
 if (!ereg(^[0-9]{5,5}(\-[0-9]{4,4})?$,$postcode))

 to a UK postcode QQ1 1QQ
 When i fill out the form it tells me that the postcode is not valid and i
 think it is because it is in zip code format.

 Thank you

 Andy





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



[PHP] Help in sorting

2003-04-02 Thread Haseeb Iqbal
hi,
i want to sort messages in a sequence
the sequence is 23,12,25 (these are message nos)
now when i call  like this

$nMsgSeq=23,12,25;
imap_fetch_overview($pIMAP,$nMsgSeq,0);
i get an array sorted like

Array
(
[0] = stdClass Object
(
[uid] = 21
[msgno] = 12
[recent] = 0
[flagged] = 0
[answered] = 0
[deleted] = 0
[seen] = 1
[draft] = 0
)

[1] = stdClass Object
(
[uid] = 34
[msgno] = 23
[recent] = 0
[flagged] = 0
[answered] = 0
[deleted] = 1
[seen] = 1
[draft] = 0
)

[2] = stdClass Object
(
[uid] = 36
[msgno] = 25
[recent] = 0
[flagged] = 0
[answered] = 0
[deleted] = 1
[seen] = 1
[draft] = 0
)

)

i want the array just like the sequence what should i do?

Friendship is always a sweet responsibility, never an opportunity.
HaSeEb IqBaL.


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



[PHP] uploading entire directory, with or without compression ...

2003-04-02 Thread Kenn Murrah
Greetings.

I have a web site which permits my clients to upload a file via php4, and it
works great ... however, some clients have requested that they be able to
upload entire directories from their windows or macintosh computers ... that
is, to select the entire folder rather than doing one file at a time.

Is this possible?

And perhaps related: could a script be contructed to create an archive file
on the client side which, in turn, could be uploaded?  That would achieve
the same effect by allowing the client to create an archive with multiple
files.

I can't really see how that would be possible in PHP, but I'm hoping one of
you much more experienced folks could see a solution.

Thanks in advance.




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



Re: [PHP] newbie2

2003-04-02 Thread Ilyas
It is an online shop : oscommerce

How can I restart Php? Any ideas???

Ilyas
At 06:42 02.04.2003 -0500, you wrote:
fatal error? What gave you this? Enabling it might not be a good idea, for
security.
.. but if you want to enable it you have to editing the php.ini and set
register_globals to ON.
cheers,
- Sebastian
- Original Message -
From: Ilyas [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 6:32 AM
Subject: [PHP] newbie2
| FATAL ERROR: register_globals is disabled in php.ini, please enable it!
|
| How can I make this?
|
| 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


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


Re: [PHP] uploading entire directory, with or without compression...

2003-04-02 Thread Marek Kilimajer
Your clients can zip the folder, upload the zip file, and then you can 
on the server side use PclZip class to read the content

Kenn Murrah wrote:

Greetings.

I have a web site which permits my clients to upload a file via php4, and it
works great ... however, some clients have requested that they be able to
upload entire directories from their windows or macintosh computers ... that
is, to select the entire folder rather than doing one file at a time.
Is this possible?

And perhaps related: could a script be contructed to create an archive file
on the client side which, in turn, could be uploaded?  That would achieve
the same effect by allowing the client to create an archive with multiple
files.
I can't really see how that would be possible in PHP, but I'm hoping one of
you much more experienced folks could see a solution.
Thanks in advance.



 



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


Re: [PHP] accessing protected remote files

2003-04-02 Thread David Feldman
How would that work?

--Dave

On Monday, March 31, 2003, at 09:27 AM, Marek Kilimajer wrote:

You need to use socket functions and check the response headers

David Feldman wrote:

I have a script that needs to open a remote file on another Web 
server, which may or may not be protected (for example, by an 
htaccess file). What would be the best way to check if it's 
protected, and if so, prompt the user for username and password to 
open it?

Thanks.

--Dave




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




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


Re: [PHP] QUESTION - user management

2003-04-02 Thread Marek Kilimajer
Check the archives, this has been discused many times before

[EMAIL PROTECTED] wrote:

How do applications know how many users are logged into the system? For
example postnuke will tell you '3 users online, 2 members'. Im gussing it
uses sessions, but how?


Edd Barrett
(http://www.filibusta.net)
 



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


[PHP] Database Question

2003-04-02 Thread José Pereira
Hi all,

I'm trying to grab information from two DBs one being a mamber db and the
other a report DB

I want to print a list of users(pilots for a Virtual Airline) from the Pilot
db and then next to them the nº of reports and total hours they have so far
from the REPORT DB.  The Pilot ID on this list must be a link so that when
clicked it will show the details of the reports.

I got this to but in a general for using a variable $login

so when the pilot/member logins it stores his ID in the $login and then I
use the SELECT * FROM table WHERE column = $login

to be more specific using this code:

?
require(require/config.php);
require(require/authentication.php);
$auth=authenticate($login, $password);

$link = mysql_connect(localhost, user, password)
or die(Could not connect);
   mysql_select_db(databse) or die(Could not select database);
$query = SELECT flight_hhmm FROM pirep WHERE pilot_id='$login';
$result = mysql_query($query) or die(Query failed);
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
 $hhmm=explode(':',$line['flight_hhmm']);
 $totalm+=$hhmm[0]*60+$hhmm[1];
}

mysql_free_result($result);

?

then to print out the number of hours I use this:

?
echo $auth[login]. '. You have ';
echo floor($totalm / 60).':'.($totalm % 60). ' total hours.';
?

this show the total hours for $login which is the pilot id in the report DB.

now I have this code to produce TOTAL reports for the site:

$link = mysql_connect(localhost, user, password)
or die(Could not connect);
   mysql_select_db(database) or die(Could not select database);
$query = SELECT * FROM pirep ;
$result = mysql_query($query) or die(Query failed);


$nb1 = mysql_numrows($result);


This gets me the nº of rows for all pilots the using echo $nb1 will print
the total reports.

Now I tried alot but no luck.  I wanted to get a list like so:

MVC103  -  100 reports Filed - 130 Hours Total
MVC104  -  10 report filed  -  50 hours total
etc,

having the ID (MVCxxx) being a link so when clicked it will show the
datails.  I tried the count() statement but like I said I new to PHP.

If anyone can help PLS.. take a look at the site, mind you it is in
portuguese http://novo.cdmvirtual.com





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



Re: [PHP] uploading entire directory, with or without compression ...

2003-04-02 Thread Kenn Murrah
yes, of course they can ... but i'm looking for a way to automate the
process for them (a method which may not exist) .. i suppose i can give them
the option to upload multiple files using multiple input fields, but I'd
really like to find a way to select an entire folder instead ...


- Original Message -
From: Marek Kilimajer [EMAIL PROTECTED]
To: Kenn Murrah [EMAIL PROTECTED]
Cc: php list [EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 7:47 AM
Subject: Re: [PHP] uploading entire directory, with or without compression
...


 Your clients can zip the folder, upload the zip file, and then you can
 on the server side use PclZip class to read the content

 Kenn Murrah wrote:

 Greetings.
 
 I have a web site which permits my clients to upload a file via php4, and
it
 works great ... however, some clients have requested that they be able to
 upload entire directories from their windows or macintosh computers ...
that
 is, to select the entire folder rather than doing one file at a time.
 
 Is this possible?
 
 And perhaps related: could a script be contructed to create an archive
file
 on the client side which, in turn, could be uploaded?  That would achieve
 the same effect by allowing the client to create an archive with multiple
 files.
 
 I can't really see how that would be possible in PHP, but I'm hoping one
of
 you much more experienced folks could see a solution.
 
 Thanks in advance.
 
 
 
 
 
 


 --
 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] uploading entire directory, with or without compression ...

2003-04-02 Thread Jason Wong
On Wednesday 02 April 2003 22:08, Kenn Murrah wrote:
 yes, of course they can ... but i'm looking for a way to automate the
 process for them (a method which may not exist) .. i suppose i can give
 them the option to upload multiple files using multiple input fields, but
 I'd really like to find a way to select an entire folder instead ...

Can't be done. 

You can investigate the use of client-side scripting.

-- 
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
--
/*
Revolution, n.:
A form of government abroad.
*/


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



Re: [PHP] accessing protected remote files

2003-04-02 Thread Marek Kilimajer
Check examples and user notes in the manual:
http://www.php.net/manual/en/function.fsockopen.php
David Feldman wrote:

How would that work?

--Dave

On Monday, March 31, 2003, at 09:27 AM, Marek Kilimajer wrote:

You need to use socket functions and check the response headers

David Feldman wrote:

I have a script that needs to open a remote file on another Web 
server, which may or may not be protected (for example, by an 
htaccess file). What would be the best way to check if it's 
protected, and if so, prompt the user for username and password to 
open it?

Thanks.

--Dave




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






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


Re: [PHP] uploading entire directory, with or without compression ...

2003-04-02 Thread Chris Hayes
At 16:15 2-4-03, you wrote:

Um, i had a look at the FTP options, (I honestly have no idea about the 
security implications) but i saw only directory functions for the server.

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

but maybe one of the finished applications: 
http://nanoftpd.sourceforge.net/ (i never tried it) found a solution.



Or maybe, i am just thinking aloud,  you need to write some javascript that 
explores the directory on the local PC (can javascript see them?) and sends 
the list of names in a hidden formfield, with that you could try to make a 
form page that you send to them, with the file fields already filled out, 
and that is then automagically submitted immediately.



At 16:08 2-4-03, you wrote:
yes, of course they can ... but i'm looking for a way to automate the
process for them (a method which may not exist) .. i suppose i can give them
the option to upload multiple files using multiple input fields, but I'd
really like to find a way to select an entire folder instead ...
- Original Message -
From: Marek Kilimajer [EMAIL PROTECTED]
To: Kenn Murrah [EMAIL PROTECTED]
Cc: php list [EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 7:47 AM
Subject: Re: [PHP] uploading entire directory, with or without compression
...
 Your clients can zip the folder, upload the zip file, and then you can
 on the server side use PclZip class to read the content

 Kenn Murrah wrote:

 Greetings.
 
 I have a web site which permits my clients to upload a file via php4, and
it
 works great ... however, some clients have requested that they be able to
 upload entire directories from their windows or macintosh computers ...
that
 is, to select the entire folder rather than doing one file at a time.
 
 Is this possible?
 
 And perhaps related: could a script be contructed to create an archive
file
 on the client side which, in turn, could be uploaded?  That would achieve
 the same effect by allowing the client to create an archive with multiple
 files.
 
 I can't really see how that would be possible in PHP, but I'm hoping one
of
 you much more experienced folks could see a solution.
 
 Thanks in advance.
 
 
 
 
 
 


 --
 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-GTK General Mailing List (http://gtk.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] $_SERVER[REMOTE_ADDR]

2003-04-02 Thread Jason Sheets
It isn't always possible to get the visitor's real IP address, if the 
user's traffic is proxied the REMOTE_ADDR will be the proxy IP address, 
some proxies set the forwarded for header but for security and privacy 
some do not.

If you are not being directed through a proxy REMOTE_ADDR does show the 
real user IP address.

Also be aware dns lookups are expensive, rather than resolving their ip 
address when they visit you should consider resolving them when you need 
them in host format.

Jason

John wrote:

Makes me think.. what exactly the $_SERVER[REMOTE_ADDR] is doing

Cause it does not really show the actual IP address instead IP address
within its range
e.g. 66.87.25.122
output 66.87.25.2
any idea how to get their actual IP add and if possible the name of their
computer
Also, is it also possible to get or trace the IP add?

many thanks,
John


 



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


[PHP] OCINewcollection fails after being used more then once

2003-04-02 Thread Andries J. Algera

I am trying to use the ocicollection functions. Initially everything
works fine, but after reloading the page for the second time 
I get the following error: 

OCITypeByName: OCI-22303: type SISTRUT.MENSERRO not found

When I try half a minute later, I do manage reload the page without any
error. I'm using php-4.2.2 on solaris 2.6 as a module of apache_1.3.26. 

The php-code I used for this test follows:

?
$conn = OCILogon(scott,tiger,db);

$sql = BEGIN :SAIDA := SISTRUT.PK_UF.SEL(:CURSOR,:COD_UF); END;;
$stmt = OCIParse($conn, $sql);

OCIBindByName($stmt,':COD_UF',$cod_uf,32);

$saidacoll = OCINewCollection($conn,MENSERRO,SISTRUT);

OCIBindByName($stmt,':SAIDA',$saidacoll,-1,OCI_B_SQLT_NTY);

$curs = OCINewCursor($conn);
OCIBindByName($stmt,:CURSOR,$curs,-1,OCI_B_CURSOR);
OCIExecute($stmt);

$nmenserro = ocicollsize($saidacoll);
for ($i = 0; $i  $nmenserro; $i++)
$saida[]= $ocicollgetelem($saidacoll,$i);
ocifreecollection($saidacol);

if ( !$nmenserro ) {
OCIExecute($curs);
while (OCIFetchinto($curs,$r,OCI_ASSOC+OCI_RETURN_NULLS)) {
foreach ( $r as $k=$v )
print $v ;
print br\n;
}
}
ocifreecursor($curs);
?

the PL/SQL code for the function:

create or replace type menserro is varray(20) of varchar2(100);

function sel(p_cursor out ufcurtyp, p_cod_uf in uf.cod_uf%type
   ) return menserro is
  v_sql varchar2(200);
  v_menserro menserro := menserro();
begin
v_sql := 'select * from uf';
if p_cod_uf is not null then
  v_sql := v_sql || ' where cod_uf='''|| p_cod_uf || ;
end if;
v_sql := v_sql || ' order by nom_uf';
open p_cursor for v_sql;
return null;
  
  exception
when others then
  begin
  v_menserro.extend;
  v_menserro(v_menserro.count) := 'Erro na execução do select';
  return v_menserro;
  end;
end sel;




Andries Algera
CSR - IBAMA
SAIN L4, Lote 4, Ed. IBAMA Sede
70800.200  Brasilia / DF
BRASIL
ph: +5561 316-1326
  316-1453
fax:+5561 223-7108



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



[PHP] Check For Space

2003-04-02 Thread shaun
Hi,

How can i make sure a value sent from a form has no spaces in it?



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



Re: [PHP] Another Problem installing PHP 4.3.1 - won't compile due to error.

2003-04-02 Thread Don
Yup, you were correct. the 7.10.3 rpm was installed but I forgot to install
the 7.10.3 development rpm.  I did so and all compiles fine now.

Thanks,
Don

 My guess you have a mess in your curl library installation. For example
 you use header from version 7.9.5 and specify that you have version
 7.10.3. Find all libcurl.so and curl.h files on your system and check if
 they are really the version you think they are. You may try running rpm
 -V libcurl(-devel), this verifys if any file has changed

 Don wrote:

 Ok, that problem solved but now another one pops up when I run 'make'.
 Please note that it is complaining about code that came with the PHP
tarball
 and I haven't changed anything.  Below are the errors for your viewing
 (dis)pleasure.  Any guidance would be appreciated.  This isn't supposed
to
 be so hard.
 
 
 



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.465 / Virus Database: 263 - Release Date: 3/25/2003


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



Re: [PHP] FTP

2003-04-02 Thread Tomás Liendo
You are right! :-)

Other question: When I try to put a file as an anonymous user, I always
receipt this error: Permission denied on server. (Upload).  Does some form
exists of allowing to anonymous users upload files or it is impossible?

Thank you very much,

Tom.




Jon Haworth [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
 Hi Tomás,

  What's the meaning of this error?: FTP_PUT: Could not
  determine CWdir: No such directory.
^
 Are you trying to save a file in a directory that doesn't exist?

 Cheers
 Jon




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



Re: [PHP] Check For Space

2003-04-02 Thread Chris Hayes
At 17:16 2-4-03, you wrote:
Hi,

How can i make sure a value sent from a form has no spaces in it?
Before sending: javascript that prevents this on sending or even while 
typing.  Check the javascript form faqs on www.irt.org for this.

After sending:

Detect spaces with
if (!(strpos(' ', $string)===false) {ECHO bloody idiot, i told you not to 
do that. Stupid User!;}

In PHP you can remove spaces at start and end of the entry with trim(...).

Remove all spaces in a string with $string=str_replace(...) (replace   
with ).

 (see manual www.php.net/manual  for proper use of these functions.) 

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


Re: [PHP] Check For Space

2003-04-02 Thread Marek Kilimajer
if(strpos($string, ' ') === false) {
   //space found
}
if you don't want any white character:
if(ereg('\s',$string)) {
   //white character found
}
shaun wrote:

Hi,

How can i make sure a value sent from a form has no spaces in it?



 



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


[PHP] Warning Extract

2003-04-02 Thread Andy
Help AGAIN!!!

Thank you for all the help so far, i am close to getting this members
section working correctly now i think!
I think i would have given up by now if it were not for the help i get from
you all, thank you.

I have a warning that i don't understand:
Warning: extract() expects first argument to be an array in
/home/.sites//New_member.php on line 23

I also find that although i get through to the new members page OK when
filling in the form it does not write to the mysql database with the new
details, yet if i enter a username that already exists it tells me, so the
php and mysql must be interacting.

Here is the code for the warning message, hope it helps:

$connection = mysql_connect($host, $user,$password)
   or die (Couldn't connect to server.);
$db = mysql_select_db($database, $connection)
   or die (Couldn't select database.);
$sql = SELECT name FROM members
   WHERE username='$logname';
$result = mysql_query($sql)
   or die(Couldn't execute query 1.);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
  extract($row);
  echo html
headtitleNew Member Welcome/title/head etc

Thank you all again

Andy



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



FW: [PHP] Html forms to php scripts

2003-04-02 Thread VanZee, Timothy
Repost because no one replied originally.  Are there any other lists
that anyone knows of for php that could be more helpful?  I'm quite
disappointed in this one because I thought this was a fairly easy
question for those who have been working with php for a while.




I have the following issue between my html forms and php scripts.

Html file (input.html) looks like this:
form action=input.php method=post
  input type=text name=ttt
  pinput type=submit name=submit value=Submit/p
/form

Php file (input.php) looks like this:
?
echo $ttt;
?

I can input text (i.e. superman) and then click submit.  The resulting
php page returns:

supermanttt=superman

It seems to me that it must be something in the php.ini file that needs
to be changed, but I can't identify what exactly.  Any help would be
appreciated.

php 4.2.2


Tim Van Zee
ITS Network Specialist
Governors State University



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



Re: [PHP] Warning Extract

2003-04-02 Thread Marek Kilimajer


Andy wrote: (and Marek fixed)

$connection = mysql_connect($host, $user,$password)
  or die (Couldn't connect to server.);
$db = mysql_select_db($database, $connection)
  or die (Couldn't select database.);
$sql = SELECT name FROM members
  WHERE username='$logname';
$result = mysql_query($sql)
  or die(Couldn't execute query 1.);
if($row = mysql_fetch_array($result,MYSQL_ASSOC))  extract($row);
if $logname is not in members table, then your query returns zero rows 
and mysql_fetch_array returns false. First argument to extract (see 
manual) must be an array, but is false in your case, and php warns you 
about that.

 echo html
   headtitleNew Member Welcome/title/head etc
Thank you all again

Andy



 



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


[PHP] Can php run as a script?

2003-04-02 Thread Poon, Kelvin (Infomart)
Hi,

This might be a newbie question but I can't find an answer anywhere I
search.  I know php can be excuted by a web browser, but can it run as a
script like Perl?

The reason i ask is, I need to write a php script that updates a database in
a server.  And this script needs to be running in the background as a
service, that's why i was wondering if I can excute it like a perl script.

If it can't, do you guys know if I can use perl to call up a php script?

Please advise.

Thanks,
Kelvin

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



Re: FW: [PHP] Html forms to php scripts

2003-04-02 Thread Marek Kilimajer
VanZee, Timothy wrote:

Repost because no one replied originally.  Are there any other lists
that anyone knows of for php that could be more helpful?  I'm quite
disappointed in this one because I thought this was a fairly easy
question for those who have been working with php for a while.
 

Sorry, but this is not an easy question. I have been working with php 
for a while and I don't have any answer for you. Your example works for 
me so the only thing that comes to my mind is try echo $_POST['ttt'] or 
print_r($GLOBALS). I hope this will help you somehow.



I have the following issue between my html forms and php scripts.

Html file (input.html) looks like this:
form action=input.php method=post
 input type=text name=ttt
 pinput type=submit name=submit value=Submit/p
/form
Php file (input.php) looks like this:
?
echo $ttt;
?
I can input text (i.e. superman) and then click submit.  The resulting
php page returns:
supermanttt=superman

It seems to me that it must be something in the php.ini file that needs
to be changed, but I can't identify what exactly.  Any help would be
appreciated.
php 4.2.2

Tim Van Zee
ITS Network Specialist
Governors State University


 



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


RE: [PHP] Html forms to php scripts

2003-04-02 Thread Ford, Mike [LSS]
 -Original Message-
 From: VanZee, Timothy [mailto:[EMAIL PROTECTED]
 Sent: 02 April 2003 17:31
 
 Repost because no one replied originally.  Are there any other lists
 that anyone knows of for php that could be more helpful?  I'm quite
 disappointed in this one because I thought this was a fairly easy
 question for those who have been working with php for a while.
 
 I have the following issue between my html forms and php scripts.
 
 Html file (input.html) looks like this:
 form action=input.php method=post
   input type=text name=ttt
   pinput type=submit name=submit value=Submit/p
 /form
 
 Php file (input.php) looks like this:
 ?
 echo $ttt;
 ?
 
 I can input text (i.e. superman) and then click submit.  The resulting
 php page returns:
 
 supermanttt=superman
 
 It seems to me that it must be something in the php.ini file 
 that needs
 to be changed, but I can't identify what exactly.  Any help would be
 appreciated.
 
 php 4.2.2

I'm pretty sure that this is an Apache 2 problem that's fixed in a later version of 
PHP and/or Apache.  Try searching the bug database for more details.

Cheers!

Mike

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

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



Re: [PHP] Can php run as a script?

2003-04-02 Thread Aaron Gould
Yes, you definitely can...

http://www.php.net/manual/en/features.commandline.php

--
Aaron Gould
Web Developer
Parts Canada


- Original Message -
From: Poon, Kelvin (Infomart) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 11:43 AM
Subject: [PHP] Can php run as a script?


 Hi,

 This might be a newbie question but I can't find an answer anywhere I
 search.  I know php can be excuted by a web browser, but can it run as a
 script like Perl?

 The reason i ask is, I need to write a php script that updates a database
in
 a server.  And this script needs to be running in the background as a
 service, that's why i was wondering if I can excute it like a perl script.

 If it can't, do you guys know if I can use perl to call up a php script?

 Please advise.

 Thanks,
 Kelvin

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


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



[PHP] Re: Can php run as a script?

2003-04-02 Thread Tim Burden
Look for PHP CLI in google.

Recent versions of PHP install at CLI PHP executable by default.
e.g I ended up with one in:

 /usr/local/apache/bin/php

[EMAIL PROTECTED] root]# /usr/local/apache/bin/php -v
PHP 4.3.1 (cli) (built: Feb 20 2003 14:09:35)
Copyright (c) 1997-2002 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies


- Original Message -
From: Kelvin Poon [EMAIL PROTECTED]
Newsgroups: php.general
To: [EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 11:43 AM
Subject: Can php run as a script?


 Hi,

 This might be a newbie question but I can't find an answer anywhere I
 search.  I know php can be excuted by a web browser, but can it run as a
 script like Perl?

 The reason i ask is, I need to write a php script that updates a database
in
 a server.  And this script needs to be running in the background as a
 service, that's why i was wondering if I can excute it like a perl script.

 If it can't, do you guys know if I can use perl to call up a php script?

 Please advise.

 Thanks,
 Kelvin


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



Re: [PHP] Warning Extract

2003-04-02 Thread Andy
logname is not in my database.
It is a session variable used to hold the members login name.
In the form it is session_register('logname'); which is then set to a
variable with this code:
if ($num2  0) { // password is correct
   $auth=yes;
   $logname=$fusername;
   $today = date(Y-m-d h:m:s);
   $sql = INSERT INTO login (username,loginTime)
   VALUES ('$logname','$today');

does that make any sense?

Andy

Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]


 Andy wrote: (and Marek fixed)

 $connection = mysql_connect($host, $user,$password)
or die (Couldn't connect to server.);
 $db = mysql_select_db($database, $connection)
or die (Couldn't select database.);
 $sql = SELECT name FROM members
WHERE username='$logname';
 $result = mysql_query($sql)
or die(Couldn't execute query 1.);
 if($row = mysql_fetch_array($result,MYSQL_ASSOC))  extract($row);
 
 if $logname is not in members table, then your query returns zero rows
 and mysql_fetch_array returns false. First argument to extract (see
 manual) must be an array, but is false in your case, and php warns you
 about that.

   echo html
 headtitleNew Member Welcome/title/head etc
 
 Thank you all again
 
 Andy
 
 
 
 
 




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



Re: [PHP] Html forms to php scripts

2003-04-02 Thread Tim Burden
What version of Apache are you using? Can you point us to a phpinfo() file?

- Original Message - 
From: Timothy Vanzee [EMAIL PROTECTED]
Newsgroups: php.general
To: [EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 11:31 AM
Subject: FW: [PHP] Html forms to php scripts


Repost because no one replied originally.  Are there any other lists
that anyone knows of for php that could be more helpful?  I'm quite
disappointed in this one because I thought this was a fairly easy
question for those who have been working with php for a while.




I have the following issue between my html forms and php scripts.

Html file (input.html) looks like this:
form action=input.php method=post
  input type=text name=ttt
  pinput type=submit name=submit value=Submit/p
/form

Php file (input.php) looks like this:
?
echo $ttt;
?

I can input text (i.e. superman) and then click submit.  The resulting
php page returns:

supermanttt=superman

It seems to me that it must be something in the php.ini file that needs
to be changed, but I can't identify what exactly.  Any help would be
appreciated.

php 4.2.2


Tim Van Zee
ITS Network Specialist
Governors State University



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



Re: [PHP] Html forms to php scripts

2003-04-02 Thread CPT John W. Holmes
It's an Apache 2 / PHP bug. I think if you use $_POST['ttt'], you'll get the
correct value, but I'm not sure. Try turning register globals off or using a
stable version of Apache that works with PHP (the 1.3 series).

---John Holmes...

- Original Message -
From: VanZee, Timothy [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 11:31 AM
Subject: FW: [PHP] Html forms to php scripts


Repost because no one replied originally.  Are there any other lists
that anyone knows of for php that could be more helpful?  I'm quite
disappointed in this one because I thought this was a fairly easy
question for those who have been working with php for a while.




I have the following issue between my html forms and php scripts.

Html file (input.html) looks like this:
form action=input.php method=post
  input type=text name=ttt
  pinput type=submit name=submit value=Submit/p
/form

Php file (input.php) looks like this:
?
echo $ttt;
?

I can input text (i.e. superman) and then click submit.  The resulting
php page returns:

supermanttt=superman

It seems to me that it must be something in the php.ini file that needs
to be changed, but I can't identify what exactly.  Any help would be
appreciated.

php 4.2.2


Tim Van Zee
ITS Network Specialist
Governors State University



--
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] Email Attachment Problem....

2003-04-02 Thread Mike
Hello,
I want to send an email attachment using PHP and the below code works
locally but when i upload to my RAQ Cobalt server it doesn't send the
attachment and i can't figure out why. If you can offer me any guidance as
to why this is happening it is greatly appreciated.
**The sendmail is a custom function listed below also, not the one inherent
to PHP.**

Thanks,
Mike

-Begin Code--

case(send_message):

// Obtain file upload vars
$fileatt  = $_FILES['fileatt']['tmp_name'];
$fileatt_type = $_FILES['fileatt']['type'];
$fileatt_name = $_FILES['fileatt']['name'];
$from = [EMAIL PROTECTED];

if (is_uploaded_file($fileatt)) {
  // Read the file to be attached ('rb' = read binary)
  $file = fopen($fileatt,'rb');
  $data = fread($file,filesize($fileatt));
  fclose($file);

  // Generate a boundary string
  $semi_rand = md5(time());
  $mime_boundary = ==Multipart_Boundary_x{$semi_rand}x;

  // Add the headers for a file attachment
  $messaggio = \nMIME-Version: 1.0\n .
  Content-Type: multipart/mixed;\n .
   boundary=\{$mime_boundary}\;

  // Add a multipart boundary above the plain message
  $messaggio .= This is a multi-part message in MIME format.\n\n .
 --{$mime_boundary}\n .
 Content-Type: text/plain; charset=\iso-8859-1\\n .
 Content-Transfer-Encoding: 7bit\n\n .
 $messaggio . \n\n;

  // Base64 encode the file data
  $data = chunk_split(base64_encode($data));

  // Add file attachment to the message
  $messaggio .= --{$mime_boundary}\n .
  Content-Type: {$fileatt_type};\n .
   name=\{$fileatt_name}\\n .
  //Content-Disposition: attachment;\n .
  // filename=\{$fileatt_name}\\n .
  Content-Transfer-Encoding: base64\n\n .
  $data . \n\n .
  --{$mime_boundary}--\n;
}

// Send the message
include(header.php);
SendMail($ml, $member_mail, $oggetto, $messaggio, $linkpage);
echoh2brbrbrbr$message_success/h2brbrbrbr\n;
break;

---Sendmail Function-
function SendMail($from_address, $to_address, $subject_mail, $message_mail,
$site_address){
$from=$from_address;
$to =$to_address;
$subject=$subject_mail;
$message=$message_mail;


// removes html tags and whitespace from input data
$to =strip_tags(trim($to));
$subject =strip_tags(trim($subject));
$from =strip_tags(trim($from));

$message .=\n\n;
$message .=\n-\n;
$message .= $site_address\n;
$message .= $headers\n;
$from_address=[EMAIL PROTECTED];
@$send=mail($to,$subject,$message,From: $from_address\r\nReply-To:
$from_address\r\nX-Mailer: ADP_FormMail);
}
---End Sendmail function

---End Code





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



Re: [PHP] Warning Extract

2003-04-02 Thread Marek Kilimajer
I meant there is no row in table members where username='$logname', 
whatever value $logname contains.

Don't forget to run session_start() at the begining of every script.

Andy wrote:

logname is not in my database.
It is a session variable used to hold the members login name.
In the form it is session_register('logname'); which is then set to a
variable with this code:
if ($num2  0) { // password is correct
  $auth=yes;
  $logname=$fusername;
  $today = date(Y-m-d h:m:s);
  $sql = INSERT INTO login (username,loginTime)
  VALUES ('$logname','$today');
does that make any sense?

Andy

Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 

Andy wrote: (and Marek fixed)

   

$connection = mysql_connect($host, $user,$password)
 or die (Couldn't connect to server.);
$db = mysql_select_db($database, $connection)
 or die (Couldn't select database.);
$sql = SELECT name FROM members
 WHERE username='$logname';
$result = mysql_query($sql)
 or die(Couldn't execute query 1.);
if($row = mysql_fetch_array($result,MYSQL_ASSOC))  extract($row);
 

if $logname is not in members table, then your query returns zero rows
and mysql_fetch_array returns false. First argument to extract (see
manual) must be an array, but is false in your case, and php warns you
about that.
   

echo html
  headtitleNew Member Welcome/title/head etc
Thank you all again

Andy





 



 



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


[PHP] RE: Can php run as a script?

2003-04-02 Thread Poon, Kelvin (Infomart)
Thanks!

but the thing is I have php 4.2.2 version installed in that server.  And
since it is not 4.3.0 therefore CLI isn't on by default.  How can I check if
CLI is on or not?  If it is not on, I won't be able to excute the php as a
script in another other way?

THnaks@

-Original Message-
From: Tim Burden [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 12:02 PM
To: Kelvin Poon
Cc: [EMAIL PROTECTED]
Subject: Re: Can php run as a script?


Look for PHP CLI in google.

Recent versions of PHP install at CLI PHP executable by default.
e.g I ended up with one in:

 /usr/local/apache/bin/php

[EMAIL PROTECTED] root]# /usr/local/apache/bin/php -v
PHP 4.3.1 (cli) (built: Feb 20 2003 14:09:35)
Copyright (c) 1997-2002 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies


- Original Message -
From: Kelvin Poon [EMAIL PROTECTED]
Newsgroups: php.general
To: [EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 11:43 AM
Subject: Can php run as a script?


 Hi,

 This might be a newbie question but I can't find an answer anywhere I
 search.  I know php can be excuted by a web browser, but can it run as a
 script like Perl?

 The reason i ask is, I need to write a php script that updates a database
in
 a server.  And this script needs to be running in the background as a
 service, that's why i was wondering if I can excute it like a perl script.

 If it can't, do you guys know if I can use perl to call up a php script?

 Please advise.

 Thanks,
 Kelvin

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



[PHP] Re: Can php run as a script?

2003-04-02 Thread Tim Burden
find / -name php -print

- Original Message -
From: Poon, Kelvin (Infomart) [EMAIL PROTECTED]
To: 'Tim Burden' [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 12:35 PM
Subject: RE: Can php run as a script?


 Thanks!

 but the thing is I have php 4.2.2 version installed in that server.  And
 since it is not 4.3.0 therefore CLI isn't on by default.  How can I check
if
 CLI is on or not?  If it is not on, I won't be able to excute the php as a
 script in another other way?

 THnaks@

 -Original Message-
 From: Tim Burden [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, April 02, 2003 12:02 PM
 To: Kelvin Poon
 Cc: [EMAIL PROTECTED]
 Subject: Re: Can php run as a script?


 Look for PHP CLI in google.

 Recent versions of PHP install at CLI PHP executable by default.
 e.g I ended up with one in:

  /usr/local/apache/bin/php

 [EMAIL PROTECTED] root]# /usr/local/apache/bin/php -v
 PHP 4.3.1 (cli) (built: Feb 20 2003 14:09:35)
 Copyright (c) 1997-2002 The PHP Group
 Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies


 - Original Message -
 From: Kelvin Poon [EMAIL PROTECTED]
 Newsgroups: php.general
 To: [EMAIL PROTECTED]
 Sent: Wednesday, April 02, 2003 11:43 AM
 Subject: Can php run as a script?


  Hi,
 
  This might be a newbie question but I can't find an answer anywhere I
  search.  I know php can be excuted by a web browser, but can it run as a
  script like Perl?
 
  The reason i ask is, I need to write a php script that updates a
database
 in
  a server.  And this script needs to be running in the background as a
  service, that's why i was wondering if I can excute it like a perl
script.
 
  If it can't, do you guys know if I can use perl to call up a php script?
 
  Please advise.
 
  Thanks,
  Kelvin


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



[PHP] Re: Can php run as a script?

2003-04-02 Thread Tim Burden
I used to use wget and run cleanup scripts from cron in the usual way.

Some people also used to use lynx to do it, I believe.

But the best way would be to install latest version of PHP, IMHO.

- Original Message -
From: Poon, Kelvin (Infomart) [EMAIL PROTECTED]
To: 'Tim Burden' [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 12:35 PM
Subject: RE: Can php run as a script?


 Thanks!

 but the thing is I have php 4.2.2 version installed in that server.  And
 since it is not 4.3.0 therefore CLI isn't on by default.  How can I check
if
 CLI is on or not?  If it is not on, I won't be able to excute the php as a
 script in another other way?

 THnaks@

 -Original Message-
 From: Tim Burden [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, April 02, 2003 12:02 PM
 To: Kelvin Poon
 Cc: [EMAIL PROTECTED]
 Subject: Re: Can php run as a script?


 Look for PHP CLI in google.

 Recent versions of PHP install at CLI PHP executable by default.
 e.g I ended up with one in:

  /usr/local/apache/bin/php

 [EMAIL PROTECTED] root]# /usr/local/apache/bin/php -v
 PHP 4.3.1 (cli) (built: Feb 20 2003 14:09:35)
 Copyright (c) 1997-2002 The PHP Group
 Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies


 - Original Message -
 From: Kelvin Poon [EMAIL PROTECTED]
 Newsgroups: php.general
 To: [EMAIL PROTECTED]
 Sent: Wednesday, April 02, 2003 11:43 AM
 Subject: Can php run as a script?


  Hi,
 
  This might be a newbie question but I can't find an answer anywhere I
  search.  I know php can be excuted by a web browser, but can it run as a
  script like Perl?
 
  The reason i ask is, I need to write a php script that updates a
database
 in
  a server.  And this script needs to be running in the background as a
  service, that's why i was wondering if I can excute it like a perl
script.
 
  If it can't, do you guys know if I can use perl to call up a php script?
 
  Please advise.
 
  Thanks,
  Kelvin


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



[PHP] Problem with PHP and MySQl after install

2003-04-02 Thread Don
1) Installed MySQL 4.0.12

2) Installed PHP 4.3.1
One of my config options was --with-mysql=shared,/usr

3) added the following to /etc/ld.so.conf and ran ldconfig:
/usr/lib/libmysqlclient.so
/usr/lib/mysql

4) When I try to run phpmyadmin, I get the following error:
cannot load MySQL extension,
please check PHP Configuration.


5) Looking at the explanation of the errro still leaves me baffled on how to
proceed:
[1.20] I receive the error cannot load MySQL extension, please check PHP
Configuration.
To connect to a MySQL server, PHP needs a set of MySQL functions called
MySQL extension. This extension may be part of the PHP server
(compiled-in), otherwise it needs to be loaded dynamically. Its name is
probably mysql.so or mysql.dll. phpMyAdmin tried to load the extension but
failed.

What was I missing fom my install that is causing my problem?

Thanks,
Don


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.465 / Virus Database: 263 - Release Date: 3/25/2003


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



Re: [PHP] Theme selector?

2003-04-02 Thread Steve Keller
At 4/1/2003 08:49 PM, [EMAIL PROTECTED] wrote:

 Also, I've not convinced anyone where I'm at now to use smarty. In my
 mind they are penny-wise and pound foolish. The real little extra
 time you might need to use a template system is richly rewarded in
 code re-use and  future changes to the site not to mention, imho,
 thinking better about what one is doing.
You haven't convinced me either. Changing the included CSS file, if you're 
using CSS-P for your layouts, lets you re-use *all* of your PHP code. 
Including extra files for templates in sub-directories sounds like a 
terrible waste of server space to me. Plus, once you've created the CSS 
files, the rendering overhead is shifted to the client, saving your server 
the extra processing for a template. And as for better thinking, CSS-P lets 
me debug a lot faster because the individual sections are truly modular in 
both the PHP code and the finished output.

I was hoping for some convincing reasoning for using Smarty templates over 
CSS, but code re-use and future changes aren't doing it for me since I 
get both of those in spades with CSS-P.

--
S. Keller
UI Engineer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Pkwy.
Anchorage, AK 99508
907.770.6200 ext.220
907.336.6205 (fax)
Email: [EMAIL PROTECTED]
Web: www.healthtvchannel.org
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] mailing forms and input into MySQL

2003-04-02 Thread Scott Miller
Hi all,

   I have a current php script that allows me to add/remove customer information from 
a particular MySQL Database.  What I would like to do, is when an employee adds a 
customer, have some (if not all) of that information e-mailed to a particular e-mail 
address.

   I've created scripts that e-mail info, and ones that just enter info into a 
database, but have not attempted combining them.

   Anyone have any ideas, or is anyone doing this?  If so, could you give me a quick 
how-to or point me in the direction of some online documentation?

Thanks,
Scott Miller

Re: [PHP] Php.ini doesn't exit

2003-04-02 Thread Leif K-Brooks
If it doesn't exist, it will use default settings.  To see where it's 
looking for php.ini, use phpinfo().

Javier Carreras wrote:

Hi all,

Where does PHP get its settings if php.ini file doesn't exist?

BTW- I want to enable sockets that are not enabled. Could I do that without
creating a php.ini file?
Regards,
Javi.
 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP] mailing forms and input into MySQL

2003-04-02 Thread Kevin Stone
There is no trick to it.  Query the database, build a string, send it off.

?
$query = SELECT * FROM mytable;
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result))
{
foreach ($row as $column = $value)
   {
$body .= $column : $value\n;
   }
$body .= \n;
}

mail($to, $subject, $body, $headers);
?

HTH,
Kevin

- Original Message -
From: Scott Miller [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 12:05 PM
Subject: [PHP] mailing forms and input into MySQL


Hi all,

   I have a current php script that allows me to add/remove customer
information from a particular MySQL Database.  What I would like to do, is
when an employee adds a customer, have some (if not all) of that information
e-mailed to a particular e-mail address.

   I've created scripts that e-mail info, and ones that just enter info into
a database, but have not attempted combining them.

   Anyone have any ideas, or is anyone doing this?  If so, could you give me
a quick how-to or point me in the direction of some online documentation?

Thanks,
Scott Miller



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



[PHP] So many functions!

2003-04-02 Thread Vincent M.
Hello,

There so many functions in php that I can't find the one I need. I have 
a table like that:

$lang[english][category]= Category ;
$lang[english][backpage]= Go to the back page ;
$lang[english][nextpage]= Go to the next page ;
...
$lang[francais][category]= Catégorie ;
$lang[francais][backpage]= Aller à la page précédente ;
$lang[francais][nextpage]= Aller à la page suivante ;
...
And I need to extract english and francais.
As it, when I will add another language such as espanol, it will be
automatic...
Any idea ?
Thanks,
Vincent.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] xml parse error?

2003-04-02 Thread Jon King
I'm trying to parse a simple xml file, but I keep getting a strange error at
$node-name which returns #text.  Is this normal or am I doing something
wrong?

From what I understand, the $node-name should return branch but it
returns #text.

TIA

Jon

--- PHP Code -

?php
$xmlDoc = xmldocfile(xml_navigation.xml);
$root = $xmlDoc-root();
$node = array_shift($root-children());
print $node-name;

?

--- xml_navigation.xml File -


branch title=Home href=/
branch title=News href=news//branch
branch title=dotPlan href=dotplan//branch
branch title=Projects href=projects/
branch title=Accessibility href=gap//branch
branch title=Documentation href=gdp/
branch title=News href=news//branch
branch title=Status Reports href=status//branch
branch title=Joining href=joining//branch
branch title=Tasks href=tasks//branch
branch title=Resources href=resources//branch
/branch
branch title=Packaging href=gpp//branch
branch title=Translation href=gtp//branch
branch title=Usability href=gup//branch
branch title=Webhackers href=gwh//branch
/branch
branch title=Sitemap href=sitemap//branch
/branch



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



[PHP] question: installing PHP with mysql isn't working?

2003-04-02 Thread Don
Hi,

Trying to install PHP with the ability to interact with MySQL.  In my
configuration, I've included the option:

--with-mysql=shared,/usr

There are no compile errors.  Any idea why PHP is not recognizing any MySQL
functions?

Thanks,
Don


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.465 / Virus Database: 263 - Release Date: 3/25/2003


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



Re: [PHP] So many functions!

2003-04-02 Thread Richard Baskett
What I would do is first read a cookie that you set on the clients machine
that follows the accept language guidelines.. so just the first two letters
then if that is not set, then take the browsers languages
$HTTP_ACCEPT_LANGUAGE and use them.

So instead of english you would have 'en', espanol = 'es', german = 'de'

$lang[en][category]

So you just take that one variable and it will know which array to use..

Cheers!

Rick

He who draws noble delights from the sentiments of poetry is a true poet,
though he has never written a line in all his life. - George Sand

 From: Vincent M. [EMAIL PROTECTED]
 Date: Wed, 02 Apr 2003 16:58:06 -0500
 To: [EMAIL PROTECTED]
 Subject: [PHP] So many functions!
 
 Hello,
 
 There so many functions in php that I can't find the one I need. I have
 a table like that:
 
 $lang[english][category]= Category ;
 $lang[english][backpage]= Go to the back page ;
 $lang[english][nextpage]= Go to the next page ;
 ...
 $lang[francais][category]= Catégorie ;
 $lang[francais][backpage]= Aller à la page précédente ;
 $lang[francais][nextpage]= Aller à la page suivante ;
 ...
 
 And I need to extract english and francais.
 As it, when I will add another language such as espanol, it will be
 automatic...
 Any idea ?
 
 Thanks,
 Vincent.
 
 
 -- 
 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] Ok, problem found, but that makes way for another...

2003-04-02 Thread Ryan Vennell
ok, my last post stated that i've tried reconfigureing.making/makeinstalling php 4.3.1 
a tons of times.  well, today when i typed php -v it told me that version 4.2.2 was 
the one that was installed.  so apparently my installing has not been taking the place 
of the old one.  

The original root is that the original compile of php (not done by me) was installed 
w/out mysql and i need mysql for what i'm working on.

now that i know the problem here, any suggestions?

I'm running apache for what i'm working on, tomcat for other things that this server 
does, and the latest version of mysql

now how do i get rid of hte old php and make sure this new one goes into its place?

P.S.- i'm not a total linux newb but i'm not, NOT a newb either.

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



[PHP] Re: question: installing PHP with mysql isn't working?

2003-04-02 Thread Ryan Vennell
you can try just straight --with-mysql without the = and it may be in the default 
path...

 Don[EMAIL PROTECTED] 04/02/03 03:18PM 
Hi,

Trying to install PHP with the ability to interact with MySQL.  In my
configuration, I've included the option:

--with-mysql=shared,/usr

There are no compile errors.  Any idea why PHP is not recognizing any MySQL
functions?

Thanks,
Don


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.465 / Virus Database: 263 - Release Date: 3/25/2003




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



Re: [PHP] uploading entire directory, with or without compression...

2003-04-02 Thread Burhan Khalid
Jason Wong wrote:
On Wednesday 02 April 2003 22:08, Kenn Murrah wrote:

yes, of course they can ... but i'm looking for a way to automate the
process for them (a method which may not exist) .. i suppose i can give
them the option to upload multiple files using multiple input fields, but
I'd really like to find a way to select an entire folder instead ...


Can't be done. 

You can investigate the use of client-side scripting.

*can't* do it with PHP, but ...

If this is a real priority, you can write some sort of ActiveX component 
that you can use to upload. However, you will have to ask the client for 
security permissions, since client apps do not have access to the remote 
file system (for good reason).

Either that, or you can write a Java applet to do it.

Bottom line, no way to do it with PHP, but if you really want it done, 
look to other languages.

--
Burhan Khalid
phplist[at]meidomus[dot]com




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


Re: [PHP] Menu from Directory

2003-04-02 Thread Burhan Khalid
Ben Whitehead wrote:
I am trying to sort an image menu system which is passed a directory name,
and can count and name the files in a menu from simply seeing which files
are in this directory. It would be ideal if it can just do this just by
looking at the files in the directory, and their file names, but if that is
not possible, could it us the information in a text file I have created and
placed in this directory?
Anyway help would be greatly received! (I'm new to PHP, so simple help would
be even more appreciated!) :S
I wrote some code that might be what you want. It was for a reference 
download system. Here is what it does :

1. Scans a directory for all sub-directories
2. Scans those subdirectoties for files
3. Creates a drop down box with the appropriate categories (sub dir name 
), and file listing.

You can see it in action at http://www.meidomus.com

(top left, marked REFERENCE DOWNLOAD)

Let me know if this is what you were after and I will post the code. Its 
just two functions.

--
Burhan Khalid
phplist[at]meidomus[dot]com


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


Re: [PHP] mailing forms and input into MySQL

2003-04-02 Thread Lowell Allen
 From: Scott Miller [EMAIL PROTECTED]
 
 I have a current php script that allows me to add/remove customer information
 from a particular MySQL Database.  What I would like to do, is when an
 employee adds a customer, have some (if not all) of that information e-mailed
 to a particular e-mail address.
 
 I've created scripts that e-mail info, and ones that just enter info into a
 database, but have not attempted combining them.
 
 Anyone have any ideas, or is anyone doing this?  If so, could you give me a
 quick how-to or point me in the direction of some online documentation?
 

There's nothing tricky about it. Just do the database insert and then send
the email. I suggest returning a simple success/failure from the database
insert so that if it fails you can note that in the email (probably going to
a site administrator). I build strings for $subject, $headers and $message
(from the values that were used in the insert) like so:

$message = SUBMITTED:\n\n;
$message .= First name: $first\n;
$message .= Last name: $last\n\n;
$message .= Address: $address1\n;
if ($address2 != ) {
$message .= Address: $address2\n;
}
etc.

Then send it and report failure or success to the user like so:

if ([EMAIL PROTECTED]($send_to_name$sendto, $subject, $message, $headers)) {
// report failure to send confirming email
} else {
// thanks for submitting
}

HTH

--
Lowell Allen



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



Re: [PHP] Html forms to php scripts

2003-04-02 Thread Burhan Khalid
Ford, Mike [LSS] wrote:
-Original Message-
From: VanZee, Timothy [mailto:[EMAIL PROTECTED]
Sent: 02 April 2003 17:31
Repost because no one replied originally.  Are there any other lists
that anyone knows of for php that could be more helpful?  I'm quite
disappointed in this one because I thought this was a fairly easy
question for those who have been working with php for a while.
I have the following issue between my html forms and php scripts.

Html file (input.html) looks like this:
form action=input.php method=post
 input type=text name=ttt
 pinput type=submit name=submit value=Submit/p
/form
Php file (input.php) looks like this:
?
echo $ttt;
?
I can input text (i.e. superman) and then click submit.  The resulting
php page returns:
supermanttt=superman

It seems to me that it must be something in the php.ini file 
that needs
to be changed, but I can't identify what exactly.  Any help would be
appreciated.

php 4.2.2

registered_globals is off by default in your version of PHP (its in the 
release notes)

so, try replacing your echo statement with

echo $_POST['ttt'];

and see if that helps.

--
Burhan Khalid
phplist[at]meidomus[dot]com


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


Re: [PHP] So many functions!

2003-04-02 Thread Burhan Khalid
Vincent M. wrote:
Hello,

There so many functions in php that I can't find the one I need. I have 
a table like that:

$lang[english][category]= Category ;
$lang[english][backpage]= Go to the back page ;
$lang[english][nextpage]= Go to the next page ;
...
$lang[francais][category]= Catégorie ;
$lang[francais][backpage]= Aller à la page précédente ;
$lang[francais][nextpage]= Aller à la page suivante ;
...
And I need to extract english and francais.
As it, when I will add another language such as espanol, it will be
automatic...
Any idea ?
Try while(list($key, $val) = each($lang)) { echo $key. : .$val; }

--
Burhan Khalid
phplist[at]meidomus[dot]com


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


Re: [PHP] So many functions!

2003-04-02 Thread Matt Vos
Try $languages = array_keys($lang);

This will create an array $languages = array(english,francais);

Matt
- Original Message -
From: Vincent M. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 4:58 PM
Subject: [PHP] So many functions!


 Hello,

 There so many functions in php that I can't find the one I need. I have
 a table like that:

 $lang[english][category]= Category ;
 $lang[english][backpage]= Go to the back page ;
 $lang[english][nextpage]= Go to the next page ;
 ...
 $lang[francais][category]= Catégorie ;
 $lang[francais][backpage]= Aller à la page précédente ;
 $lang[francais][nextpage]= Aller à la page suivante ;
 ...

 And I need to extract english and francais.
 As it, when I will add another language such as espanol, it will be
 automatic...
 Any idea ?

 Thanks,
 Vincent.


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



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



[PHP] Re: parse_str()

2003-04-02 Thread Ron Rudman
I think you mean:

$example_string = '?action=kickitem=me';

Jose [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I might be wrong here, but with the code below I would expect $_GET to be
filled and the script to output the next line:

   ?php
   $example_string = 'action=kickitem=me';
   parse_str($example_string);
   var_dump($_GET);
   ?

// expected output:
//
// array(2) { [action]=  string(4) kick [item]=  string(2) me }
//

Is my assumption wrong? What would be the workaround?

Thanks,

Jose







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



Re: [PHP] Re: parse_str()

2003-04-02 Thread Rasmus Lerdorf
 Jose [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 I might be wrong here, but with the code below I would expect $_GET to be
 filled and the script to output the next line:
 
?php
$example_string = 'action=kickitem=me';
parse_str($example_string);
var_dump($_GET);
?
 
 // expected output:
 //
 // array(2) { [action]=  string(4) kick [item]=  string(2) me }
 //
 
 Is my assumption wrong? What would be the workaround?

Your assumption is way wrong.  $_GET will only contain data that actually 
passed through a GET-method request.  Decoding a URL-encoded string 
doesn't suddenly make it GET data.  It will simply create entries in your 
global symbol table, or alternatively you can pass a second argument which 
is an array it will put the data into.  As per the docs.

-Rasmus


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



[PHP] One form - two db's?

2003-04-02 Thread Scott Miller
Is it feasible to have a php form update two different MySQL DB's at the
same time, with all info going to one DB, and just certain info going to the
second?

Just dreaming of ways to make my life easier.

Scott


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



[PHP] Nested select options from database.

2003-04-02 Thread Krista
Hi everyone,

Is it possible, using just PHP, to pull a select menu from a DB, then when
the person makes a selection have it populate a second drop down select
menu, and again for a third one?  Would javascript need to be involved here
to keep it all on the same page?

I'm in pretty desperate need of some code that can do this to select
categories for products to go into, and I'm not sure how to make it work.
There are way too many categories to have top level, second and third in the
same drop down anymore - we only want people to be able to add the products
to the third level.

Krista




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



[PHP] Making it so the .php isn't needed

2003-04-02 Thread Teren Sapp
Hi, I had it setup on my server before i reloaded it, but what i need to have happen 
is so that when i'm passing variables to a php file, I don't have to include the .php 
in the link...so i can have 

http://www.my-domain.com/page1?var1=3var2=4
instead of 
http://www.my-domain.com/page1.php?var1=3var2=4

Anybody know how i can make this work? THanks

Teren



Re: [PHP] Nested select options from database.

2003-04-02 Thread olinux
--- Krista [EMAIL PROTECTED] wrote:
 Hi everyone,
 
 Is it possible, using just PHP, to pull a select
 menu from a DB, then when
 the person makes a selection have it populate a
 second drop down select
 menu, and again for a third one?  Would javascript
 need to be involved here
 to keep it all on the same page?
 

No but you could retrieve all of this information at
once and use it in your javascript

 I'm in pretty desperate need of some code that can
 do this to select
 categories for products to go into, and I'm not sure
 how to make it work.
 There are way too many categories to have top level,
 second and third in the
 same drop down anymore - we only want people to be
 able to add the products
 to the third level.
 

here are a several options

http://www.jsexamples.com/example/?ex=290mode=2
http://www.jsexamples.com/example/?ex=728mode=2
http://www.jsexamples.com/example/?ex=536mode=2
http://www.jsexamples.com/example/?ex=458mode=2

olinux

__
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com

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



RE: [PHP] Making it so the .php isn't needed

2003-04-02 Thread Jennifer Goodie
You can accomplish this by enabling multiviews in your httpd.conf

 -Original Message-
 From: Teren Sapp [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, April 02, 2003 3:18 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Making it so the .php isn't needed
 
 
 Hi, I had it setup on my server before i reloaded it, but what i 
 need to have happen is so that when i'm passing variables to a 
 php file, I don't have to include the .php in the link...so i can have 
 
 http://www.my-domain.com/page1?var1=3var2=4
 instead of 
 http://www.my-domain.com/page1.php?var1=3var2=4
 
 Anybody know how i can make this work? THanks
 
 Teren
 
 

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



Re: [PHP] Making it so the .php isn't needed

2003-04-02 Thread Peter Houchin
at a guess would say have something to do with the line in ur server 
config ... eg in apache the httpd.conf file ... and where you tell it 
what to run thru the php engine

Teren Sapp wrote:
Hi, I had it setup on my server before i reloaded it, but what i need to have happen is so that when i'm passing variables to a php file, I don't have to include the .php in the link...so i can have 

http://www.my-domain.com/page1?var1=3var2=4
instead of 
http://www.my-domain.com/page1.php?var1=3var2=4

Anybody know how i can make this work? THanks

Teren




--

Peter Houchin
Sun Rentals STR Manager
Phone: 03 9869 6452
Fax:   03 9866 2511
Mobile:0438 789 220
[EMAIL PROTECTED]
http://www.sunrentals.com.au/


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


RE: [PHP] One form - two db's?

2003-04-02 Thread John W. Holmes
 Is it feasible to have a php form update two different MySQL DB's at
the
 same time, with all info going to one DB, and just certain info going
to
 the second?

Yes... make your connection, select the first database, do your insert,
select the second database, and do your final insert. Isn't rocket
science, eh? Use mysql_select_db() to change databases...

---John W. Holmes...

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



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



  1   2   >