Re: [PHP] Oracle to MySQL

2003-02-20 Thread Philippe Saladin
 I'm recalling this from memory, and I may not be 100% right, but it
 should put you on the right path.  You will need to install the Oracle
 client libraries on the box with php (you can find these on the Oracle
 discs used to install the actual database).
Yes

 correctly, the Oracle discs will be for a specific OS, so if the db
 isn't on OS X, the client libraries for OS X won't be on there.  If you
 can find the libraries for OS X, and get them installed,
www.otn.oracle.com ?

 to recompile php with Oracle support--with-oci8, or the other
 option (I can't remember what it is ( --with-oracle?, and this depends
 on the version of the Oracle DB you have).
--with-oci8 is the good one. used for both oracle 7 and oracle 8 (and oracle
9?). With that, you will use the php oci* functions (ocilogon, etc. See
http://www.php.net/manual/en/ref.oci8.php)
--with-oracle is older, and only for oracle 7. this is for php ora*
functions (ora_logon, etc.). IMHO, you can forget them.


Regards,
Philippe



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




Re: [PHP] new to php, need help..

2003-02-20 Thread Chris Cook
Try naming the file with a .php extension. It is also possible your server 
does not support php.

Good luck,
Chris

From: Jonathan [EMAIL PROTECTED]
Reply-To: Jonathan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP] new to php, need help..
Date: Thu, 20 Feb 2003 01:34:12 -0600

hi all, i've only begun learning php around 1 week ago, i'm having trouble
with this code,

html
head
titleUntitled Document/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head

body
?
if (isset($subject)) { echo $subject[0]br /;
echo $subject[1]p /; }
else { $subject[0] = Enter Subject A;
$subject[1] = Enter Subject B; } ?
FORM ACTION=? echo $PHP_SELF; ?
input type=text NAME=subject[0] value=? echo $subject[0]; ? /
input type=text NAME=subject[1] value=? echo $subject[1]; ? /
input type=submit value=Submit! /
input type=reset value=Reset /
/FORM

/body
/html

i got the body code from www.linuxguruz.org

but i can't seem to get my input value correct,

rather then parsing the variable subject[0]

it passes the words ? echo $subject[0]; ?  as the value instead,


i'm using macromedia dreamweaver MX as my html text editor

pls help... thanks!

Jonathan




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



_
The new MSN 8: advanced junk mail protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail


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



[PHP] Can I do this? header(Content-type: text/rtf);

2003-02-20 Thread John Taylor-Johnston
Hey,

I'm using PHP  MySQL to generate a RTF document. I use this header:

header(Content-type: text/rtf);

Of course, the header scares the poor browser. The browser bawks and says, unknown 
file type, and instructs the browser to save the file.

It tries to save a file called export_to_rtf_text_format.php

The folks I work with are technologically challenged. Asking them to save that 
document and rename it to *.rtf may be disasterous.

Come on, we all work with a couple technologically challenged people :) I like mine so 
I try to make their life easier!

Sooo ... can I change the header somehow to instruct it to save a file called 
export_to_rtf_text_format.rtf instead?

John


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




[PHP] is there php debuggers or IDE under Linux?

2003-02-20 Thread Andrey Ivanov
 Hi, people.


I've been trying setup dbg-2.11.5 under RedHat-7.3, but can't find
dbg-client for this OS.
Which php-debugger do you use under Linux?


Thank you.


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




[PHP] is there php debuggers or IDE under Linux?

2003-02-20 Thread Andrey Ivanov
 Hi, people.

I've been trying setup dbg-2.11.5 under RedHat-7.3, but can't find 
dbg-client for this OS.
Which php-debugger do you use under Linux?

Thank you.


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



[PHP] Re: new to php, need help..

2003-02-20 Thread John Taylor-Johnston
Just a hunch:

? echo $subject[0]; ?

Try using ?php instead, as in:

?php echo $subject[0]; ?

Do you have a URL to show us what your page does and doesn't do?


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




[PHP] Re: is there php debuggers or IDE under Linux?

2003-02-20 Thread John Taylor-Johnston
I didn't know a debugger was available? Then again, I'm no expert. However, as an 
aside note, rename your file to *.PHPS
This will display your code in a readable, color-coded fashion, allowing you to 
decipher possible problems yourself.
Newbie advice, but helps some.


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




Re: [PHP] php ecommers site

2003-02-20 Thread Awlad Hussain
try this site http://www.oscommerce.com/

you might have to add additional functions to customize it.

- Original Message -
From: Chris Knipe [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, February 20, 2003 2:06 AM
Subject: [PHP] php ecommers site


 Lo all,

 Is there any good already developed PHP based commerce solutions out
there?
 I'm preferably looking for something with catalogues (product pics,
 descriptions, ratings, buyer comments, etc), online payment options, xml
 support (to sell via partners for example), etc etc etc.

 Thanks,

 --
 me


 --
 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] is there php debuggers or IDE under Linux?

2003-02-20 Thread Richard Whitney
I use a hardened release of Redhat called SME Server ( http://e-smith.org ) that
works very nicely as a development environment.  I also use it for my production
server (40+ domains).  The 5.5 release comes packaged with PHP v4.1.2 . The
newest release 5.6 I am not sure what version of PHP it comes with but it's very
easy to turn error reporting on and I use it a lot just for that.

Forgive me if this is irrelevant - I am quite drunk!

Quoting Andrey Ivanov [EMAIL PROTECTED]:

###   Hi, people.
### 
### I've been trying setup dbg-2.11.5 under RedHat-7.3, but can't find 
### dbg-client for this OS.
### Which php-debugger do you use under Linux?
### 
### Thank you.
### 
### 
### -- 
### PHP General Mailing List (http://www.php.net/)
### To unsubscribe, visit: http://www.php.net/unsub.php
### 
### 


-- 
Richard Whitney   *
Transcend Development
Producing the next phase of your internet presence.
[EMAIL PROTECTED]   *
http://xend.net*
602-971-2791
  * *   *
*  *  *__**
 _/  \___  *
 *  /   *\**
  */ * *  \
**/\_ |\
 /   \_  /  \
/  \/\
   /  \ 
  /\
 /  \


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




Re: [PHP] is there php debuggers or IDE under Linux?

2003-02-20 Thread Richard Whitney
Of course, you'll need a separate box for SME Server!

Quoting Andrey Ivanov [EMAIL PROTECTED]:

###   Hi, people.
### 
### 
### I've been trying setup dbg-2.11.5 under RedHat-7.3, but can't find
### dbg-client for this OS.
### Which php-debugger do you use under Linux?
### 
### 
### Thank you.
### 
### 
### -- 
### PHP General Mailing List (http://www.php.net/)
### To unsubscribe, visit: http://www.php.net/unsub.php
### 
### 


-- 
Richard Whitney   *
Transcend Development
Producing the next phase of your internet presence.
[EMAIL PROTECTED]   *
http://xend.net*
602-971-2791
  * *   *
*  *  *__**
 _/  \___  *
 *  /   *\**
  */ * *  \
**/\_ |\
 /   \_  /  \
/  \/\
   /  \ 
  /\
 /  \


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




[PHP] AUTH (.htaccess style)

2003-02-20 Thread Sebastian
Greetings.

I have a member system which each user has a unique ID, username and password.

I want to secure some of my scripts with .htaccess style login, Basically I would like 
to fetch the username and password from mysql database, the password is encrypt using 
md5 hash.

I would like to the ability to include the file into any script I would like to 
protect and validate the user based on the information that is stored on the mysql 
database.

Conclusion: Does anyone know of a handy script that I could use?

Thanks in advanced.

Sebastian - [BBR] Gaming Clan
http://www.BroadBandReports.com



[PHP] Failed to initialize session module

2003-02-20 Thread news.php.net
Hi guys, having trouble with my win2k install of php 4.3.0 - can't run
sessions! I have some test code:

?php
/*
  SM 2/20/2003 9:21AM
  Basic session test
*/
session_start();
echo(pwhadda!)
?

And it results in

Fatal error: session_start() [function.session-start]: Failed to initialize
session module in ... on line 6

My php.ini has the following set (I've tried with both settings) :

;session.save_path = C:/TEMP/phpsessions
session.save_path = D:\temp\php

Any thoughts?

thanks,
neko



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




[PHP] Re: new to php, need help..

2003-02-20 Thread Jonathan
thanks for helping guys :)

sorry i don't have a url that i can upload my files too.. all i can show is
my code.. :(

the original code that i got from is from :
http://www.linuxguruz.org/z.php?id=33

example 5:

examples 1-4 seems to work, but other examples with this line doesn't,
input type=text NAME=subject[0] value=? echo $subject[0]; ? /

if you click on the demo button, that's what it's suppose to show, but for
my case, in example 5,
instead of showing Enter Subject A ,Enter Subject B in both input text
fields,
it shows ? echo $subject[0]; ? , ? echo $subject[1]; ? , without the
s
everything else is the same

all the suggestions didn't work though, could it be as what chris said, my
IE doesn't support php?

is there anyway to find out?

Thanks again for helping :)

jon


John Taylor-Johnston [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Just a hunch:

 ? echo $subject[0]; ?

 Try using ?php instead, as in:

 ?php echo $subject[0]; ?

 Do you have a URL to show us what your page does and doesn't do?




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




[PHP] Re: Failed to initialize session module

2003-02-20 Thread neko
got it, had to change

session.save_handler = files
;session.save_handler = user

to files - my bad!

neko



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




Re: [PHP] RSA implementation

2003-02-20 Thread José León Serna
El lun, 17-02-2003 a las 19:17, Matt Vos escribió:
 I don't care what you say, all you need is Secure-Socket-Layer
I know, but I cannot use SSL
 contrary to what you may believe, you don't need a beefy server to implement
 it. I had apache+ssl+php+mysql running quite well on a 486 DX4/100 with 64MB
 ram.
The device running the web server is a firewall, not normal a pc. When I
said, I cannot use SSL meant I cannot use SSL ;-)

Regards and thanks for your help.


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




[PHP] PHP as Shell script...

2003-02-20 Thread Brian McGarvie
I am having trouble using php as a script.

#!/usr/local/bin/php
?php
... stuff ...
?

using the above form creates the following cron error:

/bin/sh: /usr/local/apache/sites/domain.com/tasks/autoreport/test.php: bad
interpreter: No such file or directory

Any ideas?

Thanks in advance...


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.445 / Virus Database: 250 - Release Date: 21/01/03



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




[PHP] Encrypted URL links?

2003-02-20 Thread MIKE YRABEDRA


I have a site that sells software and wants to have downloadable purchases.

Is there a way to encrypt a URL that will still work when clicked on, BUT
not show the customer where the file actually resides? Is it also possible
to have it expire after a given amount of time?

TIA



-- 
Mike Yrabedra
President

 323, Inc.
 Home of The MacDock and The MacSurfshop
 [http://macdock.com] : [http://macsurfshop.com]
 VOICE: 770.382.1195
 iChat/AIM: ichatmacdock
___
Whatever you do, work at it with all your heart,
as working for the Lord, not for men.
~Colossians 3:23 {{{
--



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




[PHP] Display strings with single quotes

2003-02-20 Thread Rea_David
Hi all, 

Have simple but annoying issue, I want to display a string within an
input field. This string contains '  so when it's being display the,
anything after the ' is being left out. Here is the code I'm using:

$string = str_replace(', '', $string);
$string = stripslashes($string);
echo input type=text name='value' size=20 value = '$string';

Thanks
Dave

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




Re: [PHP] PHP as Shell script...

2003-02-20 Thread Ernest E Vogelsinger
At 12:16 20.02.2003, Brian McGarvie said:
[snip]
I am having trouble using php as a script.

#!/usr/local/bin/php
?php
... stuff ...
?

using the above form creates the following cron error:

/bin/sh: /usr/local/apache/sites/domain.com/tasks/autoreport/test.php: bad
interpreter: No such file or directory
[snip] 

On the shell prompt, issue
which php
to check where your installation of php actually resides.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] Display strings with single quotes

2003-02-20 Thread Tom Rogers
Hi,

Thursday, February 20, 2003, 9:34:03 PM, you wrote:
Rec Hi all, 

Rec Have simple but annoying issue, I want to display a string within an
Rec input field. This string contains '  so when it's being display the,
Rec anything after the ' is being left out. Here is the code I'm using:

Rec $string = str_replace(', '', $string);
Rec $string = stripslashes($string);
Rec echo input type=text name='value' size=20 value = '$string';

Rec Thanks
Rec Dave


Pass the string through htmlentities(); before you echo it.

-- 
regards,
Tom


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




Re: [PHP] Display strings with single quotes

2003-02-20 Thread Ernest E Vogelsinger
At 13:16 20.02.2003, Tom Rogers said:
[snip]
Rec Have simple but annoying issue, I want to display a string 
within an
Rec input field. This string contains '  so when it's being display the,
Rec anything after the ' is being left out. Here is the code I'm using:

Rec $string = str_replace(', '', $string);
Rec $string = stripslashes($string);
Rec echo input type=text name='value' size=20 value = '$string';


Pass the string through htmlentities(); before you echo it.
[snip] 

htmlentities won't work with single quotes, use addslashes:

input type='text' name='value' size='20' value=' .
htmlentities(addslashes($string)) . ';


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] Display strings with single quotes

2003-02-20 Thread Jason Wong
On Thursday 20 February 2003 20:26, Ernest E Vogelsinger wrote:
 At 13:16 20.02.2003, Tom Rogers said:
 [snip]

 Rec Have simple but annoying issue, I want to display a string
 within an
 Rec input field. This string contains '  so when it's being display the,
 Rec anything after the ' is being left out. Here is the code I'm using:
 
 Rec $string = str_replace(', '', $string);
 Rec $string = stripslashes($string);
 Rec echo input type=text name='value' size=20 value =
  '$string';
 
 
 Pass the string through htmlentities(); before you echo it.

 [snip]

 htmlentities won't work with single quotes, use addslashes:

Actually just (only) htmlentities() will do. See manual for options regarding 
whether to encode single-quotes and double-quotes.

 input type='text' name='value' size='20' value=' .
 htmlentities(addslashes($string)) . ';

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
The only thing cheaper than hardware is talk.
*/


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




[PHP] Pass Array parameter by reference

2003-02-20 Thread Andrea
Hi!

How can I pass an array parameter by reference?
I tried something similar:

function my_function($argument) {
$argument[0]=test;
}

my_function($array);
echo $array[0];

but the echo function returns Array.

Can anybody help me?

Thanks!

Andrea



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




Re: [PHP] excluding same field values in mysql

2003-02-20 Thread Sunfire
i am selecting company because the company i am writing this for wanted me to print 
out on a web page all the company names that had gotten mail from the email system.. 
and i didnt know if i should do a different query for that or if i could leave it in 1 
query...

so could i do this:
select company, distinct email from members; 

wasnt sure if that would work right or not...

or would i need to do something else for the company print out
tnx


  - Original Message - 
  From: [EMAIL PROTECTED] 
  To: [EMAIL PROTECTED] 
  Sent: Wednesday, February 19, 2003 8:41 PM
  Subject: Re: [PHP] excluding same field values in mysql


  In a message dated 2/19/2003 5:22:19 PM Pacific Standard Time, [EMAIL PROTECTED] 
writes:



in the example above i want to only use one of those addresses since they
would end up getting 2 emails and that wouldnt look right..

code i have so far is:
?php
//connect to db stuff here
$query=mysql_query(select company, Email from members);
while($mail=mysql_fetch_array($query)){
mail($mail[Email], $subject, $message, from: $sender);
echo mail was sent to: $mail[company]
;
}
echo go back to main menu;
?

works fine except only using an email address 1 time if more than one of the
same email..


anybody have any ideas how to fix this?




  I don't know why you are selecting company, but it you didn't, you could use the 
following query.

  select DISTINCT Email from members

  That would eliminate duplicate email addresses.

  Janet



  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003


Re: [PHP] Pass Array parameter by reference

2003-02-20 Thread Tom Rogers
Hi,

Thursday, February 20, 2003, 10:52:11 PM, you wrote:
A Hi!

A How can I pass an array parameter by reference?
A I tried something similar:

A function my_function($argument) {
A $argument[0]=test;
A }

A my_function($array);
A echo $array[0];

A but the echo function returns Array.

A Can anybody help me?

A Thanks!

A Andrea

Try like this
my_function($argument){
  $argument[0] = 'test';
}
$array = array();
my_function($array);

echo $array[0];


The function declaration is what determins the reference passing.
-- 
regards,
Tom


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




Re: [PHP] Can I do this? header(Content-type: text/rtf);

2003-02-20 Thread David Otton
On Thu, 20 Feb 2003 03:42:14 -0500, you wrote:

I'm using PHP  MySQL to generate a RTF document. I use this header:

header(Content-type: text/rtf);

Of course, the header scares the poor browser. The browser bawks and says, unknown 
file type, and instructs the browser to save the file.

It tries to save a file called export_to_rtf_text_format.php

The folks I work with are technologically challenged. Asking them to save that 
document and rename it to *.rtf may be disasterous.

Come on, we all work with a couple technologically challenged people :) I like mine 
so I try to make their life easier!

Sooo ... can I change the header somehow to instruct it to save a file called 
export_to_rtf_text_format.rtf instead?

If this is an intranet (ie you know everyone's on the same platform),
then header(Content-type: application/msword); will encourage the file
to open in Word (which is where you probably wanted it anyway).

If this is the only rtf file on your webserver, you could set it up so
*.rtf files get run under PHP just as *.php files do, then rename your
file to *.rtf

Again on an intranet, fix everyone's browsers so they handle text/rtf
correctly.


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




Re: [PHP] Display strings with single quotes

2003-02-20 Thread 1LT John W. Holmes
 On Thursday 20 February 2003 20:26, Ernest E Vogelsinger wrote:
  At 13:16 20.02.2003, Tom Rogers said:
  [snip]
 
  Rec Have simple but annoying issue, I want to display a string
  within an
  Rec input field. This string contains '  so when it's being display
the,
  Rec anything after the ' is being left out. Here is the code I'm
using:
  
  Rec $string = str_replace(', '', $string);
  Rec $string = stripslashes($string);
  Rec echo input type=text name='value' size=20 value =
   '$string';
  
  
  Pass the string through htmlentities(); before you echo it.
 
  [snip]
 
  htmlentities won't work with single quotes, use addslashes:

Addslashes will have no effect. HTML does not recognize the \ character as
an escape character. That's a PHP concept.

 Actually just (only) htmlentities() will do. See manual for options
regarding
 whether to encode single-quotes and double-quotes.

  input type='text' name='value' size='20' value=' .
  htmlentities(addslashes($string)) . ';

But, you're right that this won't work. htmlentities() by itself will leave
single quotes alone. What you want to use is

htmlentities($string,ENT_QUOTES);

which will convert single and double quotes to entities.

---John Holmes...


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




[PHP] server side including

2003-02-20 Thread Hans Prins
Im have a script.php which needs to be able to tell if it has been
included in an .shtml file or not...

e.g. if included is true: do this, else: do something else

I could ofcourse do something like this:

!--#include
virtual=/packages/combo1/example_red/poll/poll.php?included=yes --

but it would be nice to totally let the php check if it has been
included

Anyone have any ideas?

hans



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




RE: [PHP] Display strings with single quotes

2003-02-20 Thread Rea_David
Thanks everyone!

-Original Message-
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: 20 February 2003 13:40
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Display strings with single quotes


 On Thursday 20 February 2003 20:26, Ernest E Vogelsinger wrote:
  At 13:16 20.02.2003, Tom Rogers said:
  [snip]
 
  Rec Have simple but annoying issue, I want to display a string
  within an
  Rec input field. This string contains '  so when it's being display
the,
  Rec anything after the ' is being left out. Here is the code I'm
using:
  
  Rec $string = str_replace(', '', $string);
  Rec $string = stripslashes($string);
  Rec echo input type=text name='value' size=20 value =
   '$string';
  
  
  Pass the string through htmlentities(); before you echo it.
 
  [snip]
 
  htmlentities won't work with single quotes, use addslashes:

Addslashes will have no effect. HTML does not recognize the \ character as
an escape character. That's a PHP concept.

 Actually just (only) htmlentities() will do. See manual for options
regarding
 whether to encode single-quotes and double-quotes.

  input type='text' name='value' size='20' value=' .
  htmlentities(addslashes($string)) . ';

But, you're right that this won't work. htmlentities() by itself will leave
single quotes alone. What you want to use is

htmlentities($string,ENT_QUOTES);

which will convert single and double quotes to entities.

---John Holmes...


-- 
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] Encrypted URL links?

2003-02-20 Thread 1LT John W. Holmes
 I have a site that sells software and wants to have downloadable
purchases.

 Is there a way to encrypt a URL that will still work when clicked on, BUT
 not show the customer where the file actually resides? Is it also possible
 to have it expire after a given amount of time?

Sure, just have a PHP script handle the downloads. Store the files you want
to protect outside of your web root, that way no one can ever get to them
directly.

Now, construct a PHP script that's going to control the download. It can
check to make sure the user is logged in if necessary among other things.
You can construct a URL such as the following

www.yourdomain.com/download.php?file_id=XXcode=YY

where XX would identify what file they are trying to download. the code
could be used to relate to a database or separate file that you can check to
see if X minutes have passed or not, so you know whether this link is
expired or not. If everything checks out fine, you just use a couple
header() calls to set the appropriate headers for the type of file you are
offering for download and then use readfile() to send the data. The end
result to the user will be a download box if everything validates.

---John Holmes...


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




[PHP] Correct number format (curency)

2003-02-20 Thread Robert Mena
Hi,

I have one application where the users enter a curency
value.

Unfortunately even tough I write the correct format
I keep receiving all kinds.

Example

1.000,00
1000.00
1,000.00

I would like to convert those to a single format
1000.00

Is there any function in php that already does that ? 
Or perhaps any code snippets ?

thanks.

__
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

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




Re: [PHP] Root Commands

2003-02-20 Thread Adam Voigt




Check out sudo, with man pages or what not, you use

the command visudo to define who can run what commands

as root. And then in your php, you just do:



exec(sudo adduser);



With whatever parameters you need to adduser.



On Wed, 2003-02-19 at 18:37, Patrick Armour wrote:

I am trying to use a form (password protected of course) that will allow an administrator to add POP accounts to a linux box.  The problem that I seem to have is that the form is trying to give the commands as user 'nobody' and they need to be given by either root or a superuser.



Is there any way to accomplish this?  If somebody were to point me in the direction of a tutorial on this subject I would really appreciate it.



Sincerely,

Patrick Armour

www.greatplainsinternet.com



-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








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


Re: [PHP] define(DOC_HOME_PATH, what goes here)

2003-02-20 Thread 1LT John W. Holmes
 define (DOC_HOME_PATH, http://localhost/killerspin/web/store/;);
 define (IMG_HOME_PATH, http://localhost/killerspin/web/images/;);
 define (CTL_HOME_PATH, http://localhost/killerspin/web/control/;);
 img src=? echo IMG_HOME_PATH ?stuff/image.jpg
 a href=? echo DOC_HOME_PATH ?stuff/index.jspClick Here/a
  form action=? echo CTL_HOME_PATH ?stuff/process_order.php

 doesn't work.

It should. The above code produces this when I try it:

img src=http://localhost/killerspin/web/images/stuff/image.jpg;
a href=http://localhost/killerspin/web/store/stuff/index.jsp;Click
Here/a
form
action=http://localhost/killerspin/web/control/stuff/process_order.php;

Isn't that what you want? Look at the HTML source of your page that's being
generated...

---John Holmes...


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




Re: [PHP] long running PHP application

2003-02-20 Thread Adam Voigt




PHP's max execution time has always over-ridden whatever Apache

wants for keep-alive time (in my experience anyway).



On Wed, 2003-02-19 at 22:50, Lord Loh. wrote:

Is there any conflict with the server Keep-Alice time ?

That is usually not more than a minute...



Thank You

Lord Loh







-- 

PHP General Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php






-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








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


Re: [PHP] Encrypted URL links?

2003-02-20 Thread David Otton
On Thu, 20 Feb 2003 06:20:26 -0500, you wrote:

Is there a way to encrypt a URL that will still work when clicked on, BUT
not show the customer where the file actually resides?

It's not possible to encrypt a URL  and leave it readable. URLs are
plaintext.

Is it also possible to have it expire after a given amount of time?

Ideally I would place the file to be downloaded in a directory protected
by Basic Authentication, then manage the .htpasswd file so logins
expire.

There are other ways, but I think this is the simplest/most secure.


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




[PHP] Bechmarks with Caching technics

2003-02-20 Thread Torsten Rosenberger
Hello

has someone done some benchmarks with Cache scripts?

I wrote a small and easy Script to cache some sites;

I have seen that the Cache needs more time to send the Data 
as php alone.

I also tried it with PEAR Cache but there was the same.
On small files PHP witout Caching is faster,
On larger files (600KB needs on the server around 3 sec) 
with and without Cache ??

BR/Torsten









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




Re: [PHP] Can I do this? header(Content-type: text/rtf);

2003-02-20 Thread David Otton
On Thu, 20 Feb 2003 03:42:14 -0500, you wrote:

I'm using PHP  MySQL to generate a RTF document. I use this header:

header(Content-type: text/rtf);

Sorry, I should have mentioned

header(Content-Disposition: attachment; filename=myfile.rtf);

as well. Rather easier :)


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




Re: [PHP] Root Commands

2003-02-20 Thread Jason Sheets
I would highly recommend against doing this, this would work but it
would open you up to allowing your webserver user/php to add any user to
your system.  This is beyond a bad idea.

Jason.
On Thu, 2003-02-20 at 06:46, Adam Voigt wrote:
 Check out sudo, with man pages or what not, you use
 the command visudo to define who can run what commands
 as root. And then in your php, you just do:
 
 exec(sudo adduser);
 
 With whatever parameters you need to adduser.
 
 On Wed, 2003-02-19 at 18:37, Patrick Armour wrote:
 
 I am trying to use a form (password protected of course) that will
 allow an administrator to add POP accounts to a linux box.  The
 problem that I seem to have is that the form is trying to give the
 commands as user 'nobody' and they need to be given by either root
 or a superuser.
 
 Is there any way to accomplish this?  If somebody were to point me
 in the direction of a tutorial on this subject I would really
 appreciate it.
 
 Sincerely,
 Patrick Armour
 
 www.greatplainsinternet.com
 -- 
 Adam Voigt ([EMAIL PROTECTED])
 The Cryptocomm Group
 My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc


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




RE: [PHP] Undefined offset notices

2003-02-20 Thread Ford, Mike [LSS]
 -Original Message-
 From: Shawn McKenzie [mailto:[EMAIL PROTECTED]]
 Sent: 20 February 2003 05:55
 
 While debugging my code, that seems to work fine, I see 
 hundreds of these
 notices, many different ones with different offset numbers 
 same line number.
 
 Notice: Undefined offset: 2 in
 D:\apps\www\test\themes\Family\includes\autotheme.inc.php on line 275
 
 I would like to know what the notice pertains to (offset?)  
 Here's the code:
 
 $commands is an associative array, $tmpparts and $tmpcmds are 
 integer index
 arrays.
 
 $i = 0;  // Line 270
 while($i != count($tmpparts)) {
 $content = ?.$tmpparts[$i];
 eval($content);
 foreach($command as $name = $cmds) {
 if($tmpcmds[$i] == $name) {

Here, the offset is $i -- it's telling you that there is no $i element in the array 
$tmpcmds.

 $docmd = $cmds;
 eval($docmd);
 }
 }
 $i++;
 } // Line 281

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] server side including

2003-02-20 Thread David Otton
On Thu, 20 Feb 2003 14:41:09 +0100, you wrote:

Im have a script.php which needs to be able to tell if it has been
included in an .shtml file or not...

e.g. if included is true: do this, else: do something else

I could ofcourse do something like this:

!--#include
virtual=/packages/combo1/example_red/poll/poll.php?included=yes --

but it would be nice to totally let the php check if it has been
included

Anyone have any ideas?

If you call phpinfo(), you'll see bunch of variables that are related to
the filename in some way (PHP_SELF, REQUEST_URI, etc.). One of these may
help you.


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




RE: [PHP] sorting multi-dimensional array

2003-02-20 Thread Ford, Mike [LSS]
 -Original Message-
 From: Steve Buehler [mailto:[EMAIL PROTECTED]]
 Sent: 20 February 2003 05:25
 
 Ahhhfinally did it with usort.  Thanks to those who gave me that 
 answer.  Now here is a question for that.  I would like to 
 re-use my cmp 
 function without having to rewrite it each time.  Can it be 
 written so that 
 instead of divname being hard coded, that I can pass the 
 sort field in 
 the usort call.  That way, I can either sort by divname and 
 do another 
 sort by divid for seperate results without having to have 
 multiple cmp 
 type functions.  I hope that made since.  Lack of sleep isn't 
 good when 
 programming.  Below is my sorting code.
 
 
 function cmp ($a, $b) {
  return strcmp($a[divname], $b[divname]);
 }
 
 usort($array, cmp);

Well, the only obvious way I can think of is to use a global variable to set the array 
index you want to sort by -- something like:

   function cmp ($a, $b) {

  global $field;

  return strcmp($a[$field], $b[$field]);
   }
 

   $field = divname;
   usort($array, cmp);


   $field = divid;
   usort($array, cmp);

I haven't tested this, but I think it should work...!

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] Root Commands

2003-02-20 Thread Adam Voigt




Yeah, it's a bad idea, but he wants to be able to add email accounts to the

system, and not have to use a database for his mail users. So there you go.



On Thu, 2003-02-20 at 09:30, Jason Sheets wrote:

I would highly recommend against doing this, this would work but it

would open you up to allowing your webserver user/php to add any user to

your system.  This is beyond a bad idea.



Jason.

On Thu, 2003-02-20 at 06:46, Adam Voigt wrote:

 Check out sudo, with man pages or what not, you use

 the command visudo to define who can run what commands

 as root. And then in your php, you just do:

 

 exec(sudo adduser);

 

 With whatever parameters you need to adduser.

 

 On Wed, 2003-02-19 at 18:37, Patrick Armour wrote:

 

 I am trying to use a form (password protected of course) that will

 allow an administrator to add POP accounts to a linux box.  The

 problem that I seem to have is that the form is trying to give the

 commands as user 'nobody' and they need to be given by either root

 or a superuser.

 

 Is there any way to accomplish this?  If somebody were to point me

 in the direction of a tutorial on this subject I would really

 appreciate it.

 

 Sincerely,

 Patrick Armour

 

 www.greatplainsinternet.com

 -- 

 Adam Voigt ([EMAIL PROTECTED])

 The Cryptocomm Group

 My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc






-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








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


Re: [PHP] Correct number format (curency)

2003-02-20 Thread Bas Jobsen
 Example

 1.000,00
 1000.00
 1,000.00

 I would like to convert those to a single format
 1000.00
?
function money($money)
{
/* written by [EMAIL PROTECTED] */
$money=str_replace(array(',','.'),'',$money);
$money=substr($money,0,strlen($money)-2).'.'.substr($money,-2);
}
$money='1.000,00';
money($money);
echo $money.\n;
$money='1000.00';
money($money);
echo $money.\n;
$money='1,000.00';
money($money);
echo $money.\n;
?

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




[PHP] Re: smarty vs. patTemplate vs. includes - newbie q

2003-02-20 Thread neko
A great article on PHP and template engines can be found here:

http://phppatterns.com/index.php/article/articleview/4/1/1/

The opinon of the author is that template engines might not be worth your
time, and I'm inclined to agree. I'd rather develop a more comprehensive CMF
which limits what the user can design in other ways, rather than use some
template engine like smarty or velocity. To me, templates just seem like a
dumbed-down language - not that useful in my opinion.

neko



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




Re: [PHP] Display strings with single quotes

2003-02-20 Thread Tom Rogers
Hi,

Thursday, February 20, 2003, 9:34:03 PM, you wrote:
Rec Hi all, 

Rec Have simple but annoying issue, I want to display a string within an
Rec input field. This string contains '  so when it's being display the,
Rec anything after the ' is being left out. Here is the code I'm using:

Rec $string = str_replace(', '', $string);
Rec $string = stripslashes($string);
Rec echo input type=text name='value' size=20 value = '$string';

Rec Thanks
Rec Dave


You could also try

echo 'input type=text name=value size=20 value='.$string.'';
which would be more politically correct :)

-- 
regards,
Tom


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




[PHP] Test

2003-02-20 Thread Robert E. Harvey, M.D.
This is a test message.  I sent a real message last night and apparently 
it didn't make it to the server.

Bob


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



Re: [PHP] Display strings with single quotes

2003-02-20 Thread Ernest E Vogelsinger
At 13:41 20.02.2003, Jason Wong spoke out and said:
[snip]
On Thursday 20 February 2003 20:26, Ernest E Vogelsinger wrote:

 htmlentities won't work with single quotes, use addslashes:

Actually just (only) htmlentities() will do. See manual for options regarding 
whether to encode single-quotes and double-quotes.
[snip] 

Mea culpa.

Of course you're right... you need to use
htmlentities($string, ENT_QUOTES);

My message was rubbish.


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/


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




Re: [PHP] Test

2003-02-20 Thread 1LT John W. Holmes
 This is a test message.  I sent a real message last night and apparently 
 it didn't make it to the server.

So this is not a real message? Do I exist?

---John Holmes...

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




Re: [PHP] Test

2003-02-20 Thread Ernest E Vogelsinger
At 16:07 20.02.2003, 1LT John W. Holmes spoke out and said:
[snip]
 This is a test message.  I sent a real message last night and apparently 
 it didn't make it to the server.

So this is not a real message? Do I exist?
[snip] 

Well, most certainly, as I see it.
Bots are still a bit faster in their response (not much, but...)

g


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/


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




[PHP] Re: server side including

2003-02-20 Thread Hans Prins
$HTTP_SERVER_VARS['REQUEST_URI'] did the trick

Hans Prins [EMAIL PROTECTED] schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Im have a script.php which needs to be able to tell if it has been
 included in an .shtml file or not...

 e.g. if included is true: do this, else: do something else

 I could ofcourse do something like this:

 !--#include
 virtual=/packages/combo1/example_red/poll/poll.php?included=yes --

 but it would be nice to totally let the php check if it has been
 included

 Anyone have any ideas?

 hans





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




[PHP] wfrite and chmod security stuff

2003-02-20 Thread Wilbert Enserink
hi all


I'm trying to do the following:
a user can log in on a site where he/she can change the contents of a css-stylesheet 
file with the aid of forms.
The results of the form input are used to wrie a css file on the webserver which later 
will be used in the HTML files of the website.

I know how to read/write to the server. But after the action I have to chmod the file 
which was created. I don't want users to input php code or perl code which can then be 
executed by calling the urlAnybody knows how to do this?

In the example file below I use the chmod function. I tried nearly every value (not 
only 0777), but still you are able to enter php code, goto the url and ...voila the 
script is executed.

Any ideas would be most welcome.

Wilbert

//start of 
fwrite.php--

?php
//this file is called write.php

global $filename,$filecontent;

if (!(isset($stage)))
{
if (file_exists($filename) and ($filename))
{
  $fd=fopen($filename, r);//open file read only
  $fstring=fread($fd,filesize($filename));
}
?

html

body
form action=fwrite.php method=post name=writefile id=writefile
input type=hidden name=stage value=1
input type=text name=filename value=?php echo $filename?file nameBR
textarea cols=20 rows=20 name=filecontent id=filecontent
?php echo $fstring?
/textarea
input type=submit name=submit value=save to file
/form

a href=?php echo $filename??php echo $filename?/a
/body
/html
?php
}
else
{
 $fd2=fopen($filename, w+);//open file 
 chmod($filename,0777);
 $fout=fwrite($fd2,$filecontent);
 
header(location:fwrite.php?filename=.$filename);
}
?
//end of fwrite.php

-
Pas de Deux
Van Mierisstraat 25
2526 NM Den Haag
tel 070 4450855
fax 070 4450852
http://www.pdd.nl
[EMAIL PROTECTED]
-


[PHP] Splitting Article Into Multiple Pages

2003-02-20 Thread Alan McCoy
Greetings!

I have a MySQL database of essays that contain some pretty long articles.
I'm using PHP and instead of throwing all the text up on one mile-long page,
I'd like to be able to automagically break up the article among multiple
pages.

I had thought about using multiple text areas for breaking up the story when
it is published, but fear it may be a bit cumbersome for the writers. They
might be able to handle putting in a tag (like pagebreak) to signify page
breaks in the text if it's possible that PHP could spot the tags and split
it into separate pages accordingly.

Any thoughts on this (or where to find sample code to get me started) would
be greatly appreciated!

Thanks!

Alan


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




Re: [PHP] TrueType + GD (ImageTTFBox)

2003-02-20 Thread Jesse Guardiani
I fixed this yesterday. I'm not sure what exactly fixed it,
but I can tell the list what I did:

1.) Removed distribution directory ENTIRELY. rm config.cache
just wasn't enough I think.

2.) Configured with the following:

./configure --with-mysql=/usr/local/mysql \
--with-apxs=/usr/local/apache/bin/apxs \
--enable-inline-optimization --disable-debug \
--with-mm=/usr/local/mm-1.2.2 \
--with-gd --with-zlib \
--with-zlib-dir=/usr/local --with-png-dir=/usr/local \
--with-freetype-dir=/usr/local/include/freetype2/freetype/

This is for PHP 4.3.1 with built-in GD with TrueType ( ttf ) running on
FreeBSD 4.7-RELEASE.

Typo3 now works great! Woo.

Jesse


On Wednesday 19 February 2003 15:45, Jesse Guardiani wrote:
 Howdy list,

 I'm trying to install a PHP CMS package that requires GD
 and TrueType.

 I installed the latest PHP production release (4.3.1) with
 the following configure line:

./configure --with-mysql=/usr/local/mysql \
 --with-apxs=/usr/local/apache/bin/apxs \
 --enable-inline-optimization --disable-debug \
 --with-mm=/usr/local/mm-1.2.2 \
 --with-gd --with-ttf --with-zlib

 Configure gave me no errors. Everything installed fine.

 However, I get errors like the following:

 Fatal error: Call to undefined function: imagettfbbox() in
 /usr/home/typo3test/public_html/typo3/t3lib/class.t3lib_stdgraphic.php on
 line 604

 It seems that PHP doesn't see imagettfbox(). I know it's in the GD code
 because I grep'ed for it.

 Does anyone know what I'm doing wrong?

 Thanks!!

-- 
Jesse Guardiani, Systems Administrator
WingNET Internet Services,
P.O. Box 2605 // Cleveland, TN 37320-2605
423-559-LINK (v)  423-559-5145 (f)
http://www.wingnet.net

We are actively looking for companies that do a lot of long
distance faxing and want to cut their long distance bill by
up to 50%.  Contact [EMAIL PROTECTED] for more info.



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




Re: [PHP] Display strings with single quotes

2003-02-20 Thread 1LT John W. Holmes
 Thursday, February 20, 2003, 9:34:03 PM, you wrote:
 Rec Hi all,

 Rec Have simple but annoying issue, I want to display a string
within an
 Rec input field. This string contains '  so when it's being display the,
 Rec anything after the ' is being left out. Here is the code I'm using:

 Rec $string = str_replace(', '', $string);
 Rec $string = stripslashes($string);
 Rec echo input type=text name='value' size=20 value =
'$string';

 Rec Thanks
 Rec Dave


 You could also try

 echo 'input type=text name=value size=20 value='.$string.'';
 which would be more politically correct :)

Good point. You'll still run into problems if $string has double quotes
within it, though. So the original suggestion of using htmlentities() still
applies.

---John Holmes...


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




[PHP] passing content of file as argument

2003-02-20 Thread William S.
I would like to pass the content of ./doc_test2.xml
as an argument. How would I alter the file below to
accomplish this? Do I need to change the stylesheet as
well?

begin *.php
?php
$xml = ./doc_test.xml;
$xsl = ./doc_test.xsl;
$mydata = ./doc_test2.xml;
$arguments = array();
$arguments['mydata'] = $mydata;
ob_start();

$_parser = xslt_create();

if( !$result = @xslt_process(  $_parser,// resource xh
   $xml,// string xsl
   $xsl,
   NULL,
   $arguments,
   array()
 ) ) {
printf( Sablotron Error (%s): br /strong%s/strong,
xslt_errno($_parser), xslt_error($_parser) );
}
ob_end_clean();
xslt_free($_parser);
echo $result;
?
end *.php

-- 
Bill
Amsterdam, NL

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




Re: [PHP] Splitting Article Into Multiple Pages

2003-02-20 Thread 1LT John W. Holmes
If you use the pagebreak method, you could use:

$part = explode(pagebreak,$text);

to break apart the essay. Then echo $part[0] for page 1, $part[1] for page
2, etc...

I'm sure there are other ways.

---John Holmes...

- Original Message -
From: Alan McCoy [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, February 20, 2003 10:11 AM
Subject: [PHP] Splitting Article Into Multiple Pages


Greetings!

I have a MySQL database of essays that contain some pretty long articles.
I'm using PHP and instead of throwing all the text up on one mile-long page,
I'd like to be able to automagically break up the article among multiple
pages.

I had thought about using multiple text areas for breaking up the story when
it is published, but fear it may be a bit cumbersome for the writers. They
might be able to handle putting in a tag (like pagebreak) to signify page
breaks in the text if it's possible that PHP could spot the tags and split
it into separate pages accordingly.

Any thoughts on this (or where to find sample code to get me started) would
be greatly appreciated!

Thanks!

Alan


--
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] Reading remote image into a file and displaying..

2003-02-20 Thread Chad Day
I'm trying to get weather channel information without using their form to
submit the zip code .. the url format is :

http://oap.weather.com/fcgi-bin/oap/generate_magnet?loc_id=$ZIPcode=689861;
destination=$ZIP

so I tried:

$weatherfile =
readfile(http://oap.weather.com/fcgi-bin/oap/generate_magnet?loc_id=$_SESSI
ON[ZIP]code=689861destination=$_SESSION[ZIP]);
echo $weatherfile;

but of course it just outputs the raw image data .. I tried echoing it out
in a img src tag, same result.  Is there some function I'm unaware of that
will help me out here?

Thanks,
Chad


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




Re: [PHP] Re: Redirect without header or javascipt

2003-02-20 Thread Chris Shiflett
--- Daniel Guerrier [EMAIL PROTECTED] wrote:
 Is there any to redirect in php with using header()
 and without the use of javascript?

Yes:

header('Location: http://www.php.net/');

If we are meant to answer your subject and not your message, then use a meta
HTML tag.

Chris

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




Re: [PHP] HTTP_RAW_POST_DATA

2003-02-20 Thread Chris Shiflett
--- Sam Minnee [EMAIL PROTECTED] wrote:
 I'm having a couple of problems getting PHP to accept my post data.
 Specifically, the data I am sending is not with POST, put with PUT and
 PROPFIND.  I'm implementing WebDAV within PHP.
 
 How to I get PHP to set $HTTP_RAW_POST_DATA for all methods where content is
 sent, not just post?

Sam,

You might want to look into the apache_hooks SAPI. It is experimental, but it
will give you more flexibility in terms of working with Apache (and interacting
with different phases).

Chris

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




[PHP] List folder contents with links?

2003-02-20 Thread MIKE YRABEDRA


Is it possible to display the contents of a given folder, list them , and
make them links?



-- 
Mike Yrabedra
President

 323, Inc.
 Home of The MacDock and The MacSurfshop
 [http://macdock.com] : [http://macsurfshop.com]
 VOICE: 770.382.1195
 iChat/AIM: ichatmacdock
___
Whatever you do, work at it with all your heart,
as working for the Lord, not for men.
~Colossians 3:23 {{{
--



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




RE: [PHP] Re: register_globals On

2003-02-20 Thread Johnson, Kirk

 -Original Message-
 An alternative...
 
 1. register_globals off
 
 use the command
 import_request_variables(PC,_p);
 now you can get the variables like user as $p_user.
 The get variables will be ignored!
 
 Still, If a user developes a special browser, exclusively to 
 hack, he may be
 able to send post variables...

Anybody, anywhere in the world, can send any data they want (POST, GET,
COOKIE) to your scripts. They key is to grab only the data you are expecting
to receive.

Kirk

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




Re: [PHP] List folder contents with links?

2003-02-20 Thread David Otton
On Thu, 20 Feb 2003 11:33:19 -0500, you wrote:

Is it possible to display the contents of a given folder, list them , and
make them links?

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


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




Re: [PHP] List folder contents with links?

2003-02-20 Thread 1LT John W. Holmes
 Is it possible to display the contents of a given folder, list them , and
 make them links?

Yes.

---John Holmes...

PS: www.php.net/readdir

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




Re: [PHP] passing content of file as argument-SOLVED-

2003-02-20 Thread William S.
Please disregard the previous post.
I figured it out.

On Thu, Feb 20, 2003 at 04:24:00PM +0100, William S. wrote:
 I would like to pass the content of ./doc_test2.xml
 as an argument. How would I alter the file below to
 accomplish this? Do I need to change the stylesheet as
 well?

-- 
Bill
Amsterdam, NL

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




Re: [PHP] List folder contents with links?

2003-02-20 Thread MIKE YRABEDRA
on 2/20/03 11:49 AM, David Otton at [EMAIL PROTECTED] wrote:

 Is it possible to display the contents of a given folder, list them , and
 make them links?
 
 http://www.php.net/manual/en/function.readdir.php

Thanks :-)



-- 
Mike Yrabedra
President

 323, Inc.
 Home of The MacDock and The MacSurfshop
 [http://macdock.com] : [http://macsurfshop.com]
 VOICE: 770.382.1195
 iChat/AIM: ichatmacdock
___
Whatever you do, work at it with all your heart,
as working for the Lord, not for men.
~Colossians 3:23 {{{
--



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




Re: [PHP] List folder contents with links?

2003-02-20 Thread CodersNightMare

You can also take a look at:

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

Hope this helps.

At 11:54 AM 2/20/2003 -0500, you wrote:

on 2/20/03 11:49 AM, David Otton at [EMAIL PROTECTED] wrote:

 Is it possible to display the contents of a given folder, list them , and
 make them links?

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

Thanks :-)



--
Mike Yrabedra
President

 323, Inc.
 Home of The MacDock and The MacSurfshop
 [http://macdock.com] : [http://macsurfshop.com]
 VOICE: 770.382.1195
 iChat/AIM: ichatmacdock
___
Whatever you do, work at it with all your heart,
as working for the Lord, not for men.
~Colossians 3:23 {{{
--



--
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] AUTH (.htaccess style)

2003-02-20 Thread Mark Cubitt
it will probely need abit of work to be used in your set up, for one i use
postgresql not mysql, but hopefully it will be a start

also if you or anybody else can suggest any improvements please say as they
will be a help

p.s. i'm not a security expert so this is probely not very secure

?php

// I have used * to hide certian detail

// web site script is used on
$site = ***;

// checks to see if id is pass to script
if (!isset($_GET['id']))
{
Header(Content-type: text/html);
Header(Status: 302 Moved);
Header(Location: $site/unauthorised.htm);
exit;
}

// checks if id is only made up of numbers
if (!ereg(^[0-9]{1,}$, $_GET['id']))
{
Header(Content-type: text/html);
Header(Status: 302 Moved);
Header(Location: $site/unauthorised.htm);
exit;
}

session_start();

// sets id var from what was sent to page
$id = $_GET['id'];

// checks if user has tried to logon before in the same session
if (!session_is_registered(authrealm))
{
// sets id in a session var
session_register(authrealm);
$authrealm = $_GET['id'];
}

// checks if user is trying to logon to a different company page
if ($authrealm != $_GET['id'])
{
// resets username and password to blank
$PHP_AUTH_USER = '';
unset($PHP_AUTH_USER);
$PHP_AUTH_PW = '';
unset($PHP_AUTH_PW);
$authrealm = $_GET['id'];
}

if (!IsSet($PHP_AUTH_USER))
{
// if username hasn't been set before for this realm, prompts user for
username/password
Header(WWW-Authenticate: Basic realm=\$id\);
Header('Status: 401 Unauthorized');
exit;
}

// opens database connection
$connstr = dbname= user=;
$dbh = pg_connect($connstr);

// sets the SQL statment to recive the user/password for that id
$sql = SELECT * FROM  WHERE  = '$authrealm';

// executes the SQL statment on the database
$passdb = pg_exec($dbh, $sql);

// if database connection failed send to unauthorised page
if (!$passdb)

{
Header(Content-type: text/html);
Header(Status: 302 Moved);
Header(Location: $site/unauthorised.htm);
exit;
}

// if there is no entry in the database for this id then redirect to
unauthorised page
if (pg_numrows($passdb) == '0')

{
Header(Content-type: text/html);
Header(Status: 302 Moved);
Header(Location: $site/unauthorised.htm);
exit;
}

$data = pg_fetch_row($passdb, 0);

// if there is no entry in the database for this id then redirect to
unauthorised page
if (!$data)

{
Header(Content-type: text/html);
Header(Status: 302 Moved);
Header(Location: $site/unauthorised.htm);
exit;
}

// sets username into var $login
$login = $data[1];

//sets a key for the md5 hash (replace stars with numbers execpt the first
one)
$key = (($id * ^*) / ^*);

// encrypts the password
$hash = md5($id.$PHP_AUTH_PW.$key);

// returns encrypted password from database
$pass = $data[2];

// checks username/password entered against the ones in the database
// if correct continues on, if wrong redirects you to the unauthorised page
if ((!$PHP_AUTH_USER == '$login') || (!$pass == '$hash'))

{
Header(Content-type: text/html);
Header(Status: 302 Moved);
Header(Location: $site/unauthorised.htm);
exit;
}

pg_close($dbh);

?

regards

Mark Cubitt

 -Original Message-
 From: Sebastian [mailto:[EMAIL PROTECTED]]
 Sent: 20 February 2003 09:35
 To: [EMAIL PROTECTED]
 Subject: [PHP] AUTH (.htaccess style)


 Greetings.

 I have a member system which each user has a unique ID, username
 and password.

 I want to secure some of my scripts with .htaccess style login,
 Basically I would like to fetch the username and password from
 mysql database, the password is encrypt using md5 hash.

 I would like to the ability to include the file into any script I
 would like to protect and validate the user based on the
 information that is stored on the mysql database.

 Conclusion: Does anyone know of a handy script that I could use?

 Thanks in advanced.

 Sebastian - [BBR] Gaming Clan
 http://www.BroadBandReports.com


 **
 
  This email has been virus checked by the Eclipse Internet
 MAILsafe service
 **
 
  www: http://www.eclipse.net.uk/email:
 [EMAIL PROTECTED]
 **
 



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




RE: [PHP] AUTH (.htaccess style)

2003-02-20 Thread Mark Cubitt
This mail doesn't seem to have gone through first time so here it is again,
sorry if the first mail does eventually turn up.

it will probely need abit of work to be used in your set up, for one i use
postgresql not mysql, but hopefully it will be a start

also if you or anybody else can suggest any improvements please say as they
will be a help

p.s. i'm not a security expert so this is probely not very secure

?php

// I have used * to hide certian detail

// web site script is used on
$site = ***;

// checks to see if id is pass to script
if (!isset($_GET['id']))
{
Header(Content-type: text/html);
Header(Status: 302 Moved);
Header(Location: $site/unauthorised.htm);
exit;
}

// checks if id is only made up of numbers
if (!ereg(^[0-9]{1,}$, $_GET['id']))
{
Header(Content-type: text/html);
Header(Status: 302 Moved);
Header(Location: $site/unauthorised.htm);
exit;
}

session_start();

// sets id var from what was sent to page
$id = $_GET['id'];

// checks if user has tried to logon before in the same session
if (!session_is_registered(authrealm))
{
// sets id in a session var
session_register(authrealm);
$authrealm = $_GET['id'];
}

// checks if user is trying to logon to a different company page
if ($authrealm != $_GET['id'])
{
// resets username and password to blank
$PHP_AUTH_USER = '';
unset($PHP_AUTH_USER);
$PHP_AUTH_PW = '';
unset($PHP_AUTH_PW);
$authrealm = $_GET['id'];
}

if (!IsSet($PHP_AUTH_USER))
{
// if username hasn't been set before for this realm, prompts user for
username/password
Header(WWW-Authenticate: Basic realm=\$id\);
Header('Status: 401 Unauthorized');
exit;
}

// opens database connection
$connstr = dbname= user=;
$dbh = pg_connect($connstr);

// sets the SQL statment to recive the user/password for that id
$sql = SELECT * FROM  WHERE  = '$authrealm';

// executes the SQL statment on the database
$passdb = pg_exec($dbh, $sql);

// if database connection failed send to unauthorised page
if (!$passdb)

{
Header(Content-type: text/html);
Header(Status: 302 Moved);
Header(Location: $site/unauthorised.htm);
exit;
}

// if there is no entry in the database for this id then redirect to
unauthorised page
if (pg_numrows($passdb) == '0')

{
Header(Content-type: text/html);
Header(Status: 302 Moved);
Header(Location: $site/unauthorised.htm);
exit;
}

$data = pg_fetch_row($passdb, 0);

// if there is no entry in the database for this id then redirect to
unauthorised page
if (!$data)

{
Header(Content-type: text/html);
Header(Status: 302 Moved);
Header(Location: $site/unauthorised.htm);
exit;
}

// sets username into var $login
$login = $data[1];

//sets a key for the md5 hash (replace stars with numbers execpt the first
one)
$key = (($id * ^*) / ^*);

// encrypts the password
$hash = md5($id.$PHP_AUTH_PW.$key);

// returns encrypted password from database
$pass = $data[2];

// checks username/password entered against the ones in the database
// if correct continues on, if wrong redirects you to the unauthorised page
if ((!$PHP_AUTH_USER == '$login') || (!$pass == '$hash'))

{
Header(Content-type: text/html);
Header(Status: 302 Moved);
Header(Location: $site/unauthorised.htm);
exit;
}

pg_close($dbh);

?

regards

Mark Cubitt

 -Original Message-
 From: Sebastian [mailto:[EMAIL PROTECTED]]
 Sent: 20 February 2003 09:35
 To: [EMAIL PROTECTED]
 Subject: [PHP] AUTH (.htaccess style)


 Greetings.

 I have a member system which each user has a unique ID, username
 and password.

 I want to secure some of my scripts with .htaccess style login,
 Basically I would like to fetch the username and password from
 mysql database, the password is encrypt using md5 hash.

 I would like to the ability to include the file into any script I
 would like to protect and validate the user based on the
 information that is stored on the mysql database.

 Conclusion: Does anyone know of a handy script that I could use?

 Thanks in advanced.

 Sebastian - [BBR] Gaming Clan
 http://www.BroadBandReports.com


 **
 
  This email has been virus checked by the Eclipse Internet
 MAILsafe service
 **
 
  www: http://www.eclipse.net.uk/email:
 [EMAIL PROTECTED]
 **
 



-- 
PHP General Mailing List (http://www.php.net/)
To 

[PHP] Smarty and FAI

2003-02-20 Thread user
Hi,

My provider is free.Fr
chmod is disabled

Is it possible to use Smarty on my web pages ?

thanks for your answer

Guillaume


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




[PHP] php and mysql

2003-02-20 Thread Tyler Durdin
When using a php script to pull recorda from a db how can I cut the records 
at 1/4 of the total and arrange them alaphabetically according to a certain 
field? Thanks in advance.





_
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus


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



Re: [PHP] Reading remote image into a file and displaying..

2003-02-20 Thread Mincu Alexandru
use header(Content-type: image/jpeg); and then you can echo it's
content.
On Thu, 2003-02-20 at 17:30, Chad Day wrote:
 I'm trying to get weather channel information without using their form to
 submit the zip code .. the url format is :
 
 http://oap.weather.com/fcgi-bin/oap/generate_magnet?loc_id=$ZIPcode=689861;
 destination=$ZIP
 
 so I tried:
 
 $weatherfile =
 readfile(http://oap.weather.com/fcgi-bin/oap/generate_magnet?loc_id=$_SESSI
 ON[ZIP]code=689861destination=$_SESSION[ZIP]);
 echo $weatherfile;
 
 but of course it just outputs the raw image data .. I tried echoing it out
 in a img src tag, same result.  Is there some function I'm unaware of that
 will help me out here?
 
 Thanks,
 Chad
-- 
Mincu Alexandru intelinet.ro
Tel:+4 0745 369719  +4 021 3140021
www.intelinet.ro[EMAIL PROTECTED]



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




Re: [PHP] RSA implementation

2003-02-20 Thread Matt Vos
So forward the ports (80,443) to a box that u can run a webserver on, then
you can user SSL.

Matt
- Original Message -
From: José León Serna [EMAIL PROTECTED]
To: Matt Vos [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, February 20, 2003 5:28 AM
Subject: Re: [PHP] RSA implementation


El lun, 17-02-2003 a las 19:17, Matt Vos escribió:
 I don't care what you say, all you need is Secure-Socket-Layer
I know, but I cannot use SSL
 contrary to what you may believe, you don't need a beefy server to
implement
 it. I had apache+ssl+php+mysql running quite well on a 486 DX4/100 with
64MB
 ram.
The device running the web server is a firewall, not normal a pc. When I
said, I cannot use SSL meant I cannot use SSL ;-)

Regards and thanks for your help.



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




Re: [PHP] Smarty and FAI

2003-02-20 Thread Ernest E Vogelsinger
At 18:27 20.02.2003, [EMAIL PROTECTED] spoke out and said:

Please use a real email address when posting to this list, thank you.


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/


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




Re: [PHP] php and mysql

2003-02-20 Thread David Otton
On Thu, 20 Feb 2003 17:44:51 +, you wrote:

When using a php script to pull recorda from a db how can I cut the records 
at 1/4 of the total and arrange them alaphabetically according to a certain 
field? Thanks in advance.

http://www.mysql.com/doc/en/SELECT.html

LIMIT and ORDER BY.

This is really a MySQL question, not PHP.


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




[PHP] sessions

2003-02-20 Thread Joseph Bannon
I'm starting to use sessions for my website and wanted
to know some things before I fully commit to use them.

1) How are sessions different from cookies other than
where the information is stored?

2) Does session data stored on the server
automatically delete after a certain time?

3) Is a session id created for each user per each
browser or just per each user?

Thanks,

Joe The Dev.



__
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

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




RE: [PHP] sorting multi-dimensional array

2003-02-20 Thread Steve Buehler
This would work (and might still if I changed things), but the part that 
calls it is in another function also.

Steve

At 02:35 PM 2/20/2003 +, you wrote:
 -Original Message-
 From: Steve Buehler [mailto:[EMAIL PROTECTED]]
 Sent: 20 February 2003 05:25

 Ahhhfinally did it with usort.  Thanks to those who gave me that
 answer.  Now here is a question for that.  I would like to
 re-use my cmp
 function without having to rewrite it each time.  Can it be
 written so that
 instead of divname being hard coded, that I can pass the
 sort field in
 the usort call.  That way, I can either sort by divname and
 do another
 sort by divid for seperate results without having to have
 multiple cmp
 type functions.  I hope that made since.  Lack of sleep isn't
 good when
 programming.  Below is my sorting code.


 function cmp ($a, $b) {
  return strcmp($a[divname], $b[divname]);
 }

 usort($array, cmp);

Well, the only obvious way I can think of is to use a global variable to 
set the array index you want to sort by -- something like:

   function cmp ($a, $b) {

  global $field;

  return strcmp($a[$field], $b[$field]);
   }


   $field = divname;
   usort($array, cmp);


   $field = divid;
   usort($array, cmp);

I haven't tested this, but I think it should work...!

Cheers!

Mike

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



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




RE: [PHP] php and mysql

2003-02-20 Thread Kelly Protsko
I'm not sure what you mean by cut the records at 1/4, if you mean only
bringing back 1/4 of the rows you could use the LIMIT clause in your sql
statement and give it a number of rows you want brought back.  

To sort alphabetically just use the order by command in SQL

So your query would look like this
SELECT * from Table order by column_name Limit 100

This will bring back 100 rows that are order by the column you specify.

Kelly

-Original Message-
From: Tyler Durdin [mailto:[EMAIL PROTECTED]] 
Sent: February 20, 2003 10:45 AM
To: [EMAIL PROTECTED]
Subject: [PHP] php and mysql

When using a php script to pull recorda from a db how can I cut the
records 
at 1/4 of the total and arrange them alaphabetically according to a
certain 
field? Thanks in advance.





_
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus


-- 
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] array values format

2003-02-20 Thread janet
In a message dated 2/19/2003 8:44:53 PM Pacific Standard Time,
[EMAIL PROTECTED] writes:

I have a problem here in array manipulations. I need an output like this
from the queried data :

data1,data2,data3

Any idea how? thanx in advance

$string = ''.implode(',',$testarray).'';


Janet

--
Janet Valade
Author, PHP  MySQL for Dummies

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




[PHP] simple ereg question

2003-02-20 Thread Robert E. Harvey, M.D.
Hello folks,

I'd like to verify input data transferred from a form and make sure it 
is numeric data or null before my program executes.  I am using this 
syntax, which doesn't work:

for ($i=1;$i=3;$i++)
{
 if (ereg('[0-9]+','$_POST[gamt_$i]'))
{
  continue;
}
 else
   {
 die(Non-numeric data entered in grass entry field(s).);
   }
}

No matter what I put in the fields, the program dies and I get the death 
message.  What can I do to fix this?

TIA

Bob Harvey


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



Re: [PHP] simple ereg question

2003-02-20 Thread Greg Donald
On Thu, 20 Feb 2003, Robert E. Harvey, M.D. wrote:

I'd like to verify input data transferred from a form and make sure it 
is numeric data or null before my program executes.  I am using this 
syntax, which doesn't work:

for ($i=1;$i=3;$i++)
{
  if (ereg('[0-9]+','$_POST[gamt_$i]'))
 {
   continue;
 }
  else
{
  die(Non-numeric data entered in grass entry field(s).);
}
}

Try changing '$_POST[gamt_$i]' to $_POST['gamt_$i']


-- 
Greg Donald
http://destiney.com


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




RE: [PHP] simple ereg question

2003-02-20 Thread Kelly Protsko
Did you try this syntax yet?
The  with the ^ and $search matching beginning and end
I tested out the code myself and it worked fine.
http://www.theoutersphere.com/testing/testnumbers.php  


//here is the exact code that I used

echo $_POST[vari] .br;
  if (eregi('^[0-9]+$',$_POST[vari]) || $_POST[vari] == null)
  {
   echo  continue This is a valid number;
  }
   else
 {
   die(Non-numeric data entered in grass entry field(s).);
 }


Kelly
-Original Message-
From: Robert E. Harvey, M.D. [mailto:[EMAIL PROTECTED]] 
Sent: February 20, 2003 12:34 PM
To: php; Robert Harvey
Subject: [PHP] simple ereg question

Hello folks,

I'd like to verify input data transferred from a form and make sure it 
is numeric data or null before my program executes.  I am using this 
syntax, which doesn't work:

for ($i=1;$i=3;$i++)
{
  if (ereg('[0-9]+','$_POST[gamt_$i]'))
 {
   continue;
 }
  else
{
  die(Non-numeric data entered in grass entry field(s).);
}
}

No matter what I put in the fields, the program dies and I get the death

message.  What can I do to fix this?

TIA

Bob Harvey


-- 
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] simple ereg question

2003-02-20 Thread Leif K-Brooks
  Change to:No, the double quotes are needed so that $i will be parsed. 
The problem is the single quotes around $_POST[gamt_$i].
if (ereg('[0-9]+',$_POST[gamt_$i])


Greg Donald wrote:

On Thu, 20 Feb 2003, Robert E. Harvey, M.D. wrote:

 

I'd like to verify input data transferred from a form and make sure it 
is numeric data or null before my program executes.  I am using this 
syntax, which doesn't work:

for ($i=1;$i=3;$i++)
{
if (ereg('[0-9]+','$_POST[gamt_$i]'))
{
 continue;
}
else
  {
die(Non-numeric data entered in grass entry field(s).);
  }
}
   


Try changing '$_POST[gamt_$i]' to $_POST['gamt_$i']


 


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





Re: [PHP] sessions

2003-02-20 Thread Chris Shiflett
--- Joseph Bannon [EMAIL PROTECTED] wrote:
 1) How are sessions different from cookies other than
 where the information is stored?

Cookies are a state management mechanism. PHP's session management (depending
on how it is configured, of course) uses either cookies or URL variables for
maintaining state, depending upon whether the Web client returns cookies.

 2) Does session data stored on the server
 automatically delete after a certain time?

Reading between the lines here, I would answer yes, though it is not
technically automatic. As with most things, it is event driven.

 3) Is a session id created for each user per each
 browser or just per each user?

For each user, because PHP scans their retina for user identification. Just
kidding, of course. A new session ID is created whenever the Web client dooes
not send one (via cookie or URL variable, as mentioned above).

Chris

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




Re: [PHP] Reading remote image into a file and displaying..

2003-02-20 Thread Michael Mulligan
More specifically (since I just dealt with this issue myself), use fpassthru
(and be sure not to fclose the file pointer as it's automatically done by
fpassthru)

On 02/20/03 12:47 PM, Mincu Alexandru [EMAIL PROTECTED] wrote:

 use header(Content-type: image/jpeg); and then you can echo it's
 content.
 On Thu, 2003-02-20 at 17:30, Chad Day wrote:
 I'm trying to get weather channel information without using their form to
 submit the zip code .. the url format is :
 
 http://oap.weather.com/fcgi-bin/oap/generate_magnet?loc_id=$ZIPcode=689861;
 destination=$ZIP
 
 so I tried:
 
 $weatherfile =
 readfile(http://oap.weather.com/fcgi-bin/oap/generate_magnet?loc_id=$_SESSI
 ON[ZIP]code=689861destination=$_SESSION[ZIP]);
 echo $weatherfile;
 
 but of course it just outputs the raw image data .. I tried echoing it out
 in a img src tag, same result.  Is there some function I'm unaware of that
 will help me out here?
 
 Thanks,
 Chad


-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




[PHP] sorting multi-dimensional array part 2

2003-02-20 Thread Steve Buehler
The following Seems to work.  But does anybody know how reliable this 
might be?  Baically, I have a multi-dimensional array and want to sort by 
one column first, than another than another.  Right now, I am using a 
temporary table in MySQL, but want to speed things up if possible.  The 
command there would be to ORDER BY column1,column3,column2 in my select 
statement.  If I kept it in a multi-dimensional array, would the following 
be reliable
1,b,a
2,a,c
1,e,b

function dostuff(){
	usort($array, column1);
	usort($array, column3);
	usort($array, column2);
// I would be doing any of my outputting here after the sorting.
}

function column1 ($a, $b) {
return strcmp($a[column1name], $b[column1name]);
}

function column2 ($a, $b) {
return strcmp($a[column2name], $b[column2name]);
}

function column3 ($a, $b) {
return strcmp($a[column3name], $b[column3name]);
}

output should be
1,b,a
1,e,b
2,a,c

Yes, this is only 3 rows in this array, but the live one would have 
hundreds or thousands in it.  I do hope that you experts understand what I 
am trying to do here.
The above problem is why I was wondering also if I could have the function 
collect one more variable so that I could call it with the column name that 
I want to sort by.  So that I don't have to have 3 different functions to 
do the job.  Anybody know who I could go about doing that?


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



RE: [PHP] Correct number format (curency)

2003-02-20 Thread Dennis Cole
This should also work, without any problems.

- Php Code --
?
$total = 1.000,00;
$total = str_replace(',','',$total);

echo number_format($total, 2, '.', '');
?
- End PHP Code --

- Original Message -
From: Bas Jobsen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 20, 2003 10:05 AM
To: Robert Mena; php mailing list
Subject: Re: [PHP] Correct number format (curency)


 Example

 1.000,00
 1000.00
 1,000.00

 I would like to convert those to a single format
 1000.00
?
function money($money)
{
/* written by [EMAIL PROTECTED] */
$money=str_replace(array(',','.'),'',$money);
$money=substr($money,0,strlen($money)-2).'.'.substr($money,-2);
}
$money='1.000,00';
money($money);
echo $money.\n;
$money='1000.00';
money($money);
echo $money.\n;
$money='1,000.00';
money($money);
echo $money.\n;
?

-- 
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] Derive bottom-most dir from string???

2003-02-20 Thread Shawn McKenzie
Is there an easy way to derive the bottom-most directory from a string
containing a path?

Example:  $somepath = html/testsite/templates/shopping;

Becomes:  shopping

TIA
-Shawn



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




[PHP] Opendir listing

2003-02-20 Thread MIKE YRABEDRA


How do I remove the '.' and '..' from displaying with the following script?
I want just the files, not the dots.

?php
if ($handle = opendir('graphics/')) {
echo Files:br\n;

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

closedir($handle);
}
?



-- 
Mike Yrabedra
President

 323, Inc.
 Home of The MacDock and The MacSurfshop
 [http://macdock.com] : [http://macsurfshop.com]
 VOICE: 770.382.1195
 iChat/AIM: ichatmacdock
___
Whatever you do, work at it with all your heart,
as working for the Lord, not for men.
~Colossians 3:23 {{{
--



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




[PHP] Re: Derive bottom-most dir from string???

2003-02-20 Thread Shawn McKenzie
Sorry...  Think I was over complicating it.

Seems the last element of $somearray from $somearray = explode(/,
$somepath);  will work well.

Thanks!
Shawn

Shawn McKenzie [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Is there an easy way to derive the bottom-most directory from a string
 containing a path?

 Example:  $somepath = html/testsite/templates/shopping;

 Becomes:  shopping

 TIA
 -Shawn





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




[PHP] Re: Derive bottom-most dir from string???

2003-02-20 Thread Philip Hallstrom
see the basename() function

On Thu, 20 Feb 2003, Shawn McKenzie wrote:

 Is there an easy way to derive the bottom-most directory from a string
 containing a path?

 Example:  $somepath = html/testsite/templates/shopping;

 Becomes:  shopping

 TIA
 -Shawn



 --
 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] end of the loop.

2003-02-20 Thread Didier McGillis
I have a question.  I need to setup something so it goes through a dynamic 
list, the length of the list changes, gets the contents of the list and 
seperate each element with a ^ (carot), except for the last one.  So it 
looks like this.  number=0^1^2^3

How do I make sure that it does append a ^ to the last item?

_
Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail


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



Re: [PHP] end of the loop.

2003-02-20 Thread Leif K-Brooks
If the list is an array, try implode()ing it.

Didier McGillis wrote:


I have a question.  I need to setup something so it goes through a 
dynamic list, the length of the list changes, gets the contents of the 
list and seperate each element with a ^ (carot), except for the last 
one.  So it looks like this.  number=0^1^2^3

How do I make sure that it does append a ^ to the last item?

_
Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail



--
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] Opendir listing

2003-02-20 Thread MIKE YRABEDRA
on 2/20/03 3:34 PM, MIKE YRABEDRA at [EMAIL PROTECTED] wrote:

 How do I remove the '.' and '..' from displaying with the following script?
 I want just the files, not the dots.
 
 ?php
 if ($handle = opendir('graphics/')) {
   echo Files:br\n;
 
   /* This is the correct way to loop over the directory. */
   while (false !== ($file = readdir($handle))) {
   echo a href=\$file\$file/abr\n;
   }
 
   closedir($handle);
 }
 ?


Nevermind, got it.



-- 
Mike Yrabedra
President

 323, Inc.
 Home of The MacDock and The MacSurfshop
 [http://macdock.com] : [http://macsurfshop.com]
 VOICE: 770.382.1195
 iChat/AIM: ichatmacdock
___
Whatever you do, work at it with all your heart,
as working for the Lord, not for men.
~Colossians 3:23 {{{
--



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




[PHP] missing simple php functionality

2003-02-20 Thread ML
Hello all. Im having a strange problem. My php outputs html correctly, and
Ive tried other builtin functions like date and that works too. But when I
try to do something as simple as passing a value from a form to a php file
and display that value, no go.

the HTML:
html
body
h1Enter Your Name/h1
form action=simplephp.php action=POST
input type=text size=20 maxlength=20 name=user_name
input type=submit value=Submit Your Name
/form
/body
/html

the PHP file:
?php
echo Your name is $name;
?

I fill in my name, I click submit, and where the name should be displayed it
shows nothing. I have gone over this again and again and I just don't know
whats wrong. I also noticed that register globals was OFF so I just turned
that on, but still I have the same problemany ideas? I really appreciate
any feedback. Thank you!

-Mike L



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




RE: [PHP] missing simple php functionality

2003-02-20 Thread Johnson, Kirk
The field name in the form is user_name, and the echo is for name. Are
you copying the value from $user_name to $name at some point?

Kirk

 -Original Message-
 From: ML [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, February 20, 2003 2:04 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] missing simple php functionality
 
 
 Hello all. Im having a strange problem. My php outputs html 
 correctly, and
 Ive tried other builtin functions like date and that works 
 too. But when I
 try to do something as simple as passing a value from a form 
 to a php file
 and display that value, no go.
 
 the HTML:
 html
 body
 h1Enter Your Name/h1
 form action=simplephp.php action=POST
 input type=text size=20 maxlength=20 name=user_name
 input type=submit value=Submit Your Name
 /form
 /body
 /html
 
 the PHP file:
 ?php
 echo Your name is $name;
 ?
 
 I fill in my name, I click submit, and where the name should 
 be displayed it
 shows nothing. I have gone over this again and again and I 
 just don't know
 whats wrong. I also noticed that register globals was OFF so 
 I just turned
 that on, but still I have the same problemany ideas? I 
 really appreciate
 any feedback. Thank you!
 
 -Mike L

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




[PHP] Rounding

2003-02-20 Thread Van Andel, Robbert
How do I round a number to the nearest 10 or even 5.  Say I have a
number like 12.  Is there an easy way to round that up to 15 or 20?

Robbert van Andel 



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




Re: [PHP] missing simple php functionality

2003-02-20 Thread Ernest E Vogelsinger
At 22:04 20.02.2003, ML spoke out and said:
[snip]
the HTML:
html
body
h1Enter Your Name/h1
form action=simplephp.php action=POST
input type=text size=20 maxlength=20 name=user_name
input type=submit value=Submit Your Name
/form
/body
/html

the PHP file:
?php
echo Your name is $name;
?

I fill in my name, I click submit, and where the name should be displayed it
shows nothing. I have gone over this again and again and I just don't know
whats wrong. I also noticed that register globals was OFF so I just turned
that on, but still I have the same problemany ideas? I really appreciate
any feedback. Thank you!
[snip] 

1) You shouldn't look for $name but rather for $user_name.
2) Most probably, register_globals is off at your host (see the online doc
for this). Thus, you need to echo $_REQUEST['user_name'].

HTH,

-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/


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




Re: [PHP] Rounding

2003-02-20 Thread Ernest E Vogelsinger
At 22:17 20.02.2003, Van Andel, Robbert spoke out and said:
[snip]
How do I round a number to the nearest 10 or even 5.  Say I have a
number like 12.  Is there an easy way to round that up to 15 or 20?
[snip] 

function round_to($number, $full, $isup=true)
{
$factor = $number % $full;
if ($isup) {
if ($factor) $factor = $full - $factor;
$result = $number + ($factor ? $factor : 0);
}
else
$result = $number - $factor;
return $result;
}

$x = 12;
$to = 5;
echo $x = , round_to($x, $to), \n, $x = , round_to($x, $to, false);


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/


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




Re: [PHP] Rounding

2003-02-20 Thread Jason Wong
On Friday 21 February 2003 05:17, Van Andel, Robbert wrote:
 How do I round a number to the nearest 10 or even 5.  Say I have a
 number like 12.  Is there an easy way to round that up to 15 or 20?

To round to the nearest 5:

  Divide by 5
  Round to the nearest integer
  Multiply by 5

I'll leave you to work out how to round to nearest 10.

-- 
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
--
/*
Man belongs wherever he wants to go.
-- Wernher von Braun
*/


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




Re: [PHP] Can I do this? header(Content-type: text/rtf);

2003-02-20 Thread John Taylor-Johnston
Works great. Thanks,
John


 I'm using PHP  MySQL to generate a RTF document. I use this header:
 header(Content-type: text/rtf);
 header(Content-Disposition: attachment; filename=myfile.rtf);

--
John Taylor-Johnston
-
If it's not open-source, it's Murphy's Law.

Université de Sherbrooke:
http://compcanlit.ca/


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




  1   2   >