[PHP] RE: Mysql Date got prob!

2003-03-01 Thread Uttam
try:

select
date_format(date_add(arrivaldate1, INTERVAL nights1 DAY), '%Y-%m-%d') as
dept_date1
from mytable
where
(date_add(arrivaldate1, INTERVAL nights1 DAY) BETWEEN '2003-02-01' AND
'2003-02-10')

regds,
-Original Message-
From: Dhaval Desai [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 15:48
To: [EMAIL PROTECTED]
Subject: Mysql Date got prob!


Hello,

As related to my earlier question


select  date_format(date_add(arrivaldate1, INTERVAL nights1 DAY), '%Y-
%m-%d') as dept_date1 from mytable where ('dept_date1' BETWEEN
'2003-02-01' AND '2003-02-10')

The above query is valid but returns 0 because 'dept_date1' is treated
as a
string. I want dept_date1 to be treated as  date so that it can be
compared.


I hope it is possible...


Thank you!

-Dhaval


_
Add photos to your messages 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



Fwd: Re[7]: [PHP] Help!! with array's Please

2003-03-01 Thread Tom Rogers
This is a forwarded message
From: Tom Rogers [EMAIL PROTECTED]
To: Richard Kurth [EMAIL PROTECTED]
Date: Saturday, March 1, 2003, 5:59:11 PM
Subject: [PHP] Help!! with array's Please

===8==Original message text===
Hi,

Saturday, March 1, 2003, 4:28:27 PM, you wrote:
RK Hello Tom,
RK I would love to see a basic class to do all of this. I took what you
RK showed me and turned it into a function that works perfect.
RK The one thing that I have had a lot of trouble with is manipulating
RK text based data. And out of all the books I have, none of them get
RK into doing this type of programing.

Here it is

class groupClass {
var $groups = array();
var $gid = 499; //if there are no groups, new ones start at this 
number +1
function groupClass($file){
$r = false;
if(file_exists($file)){
$in = file($file);
//build an array using names as keys so we can identify 
entries easier
while(list($key,$val) = each($in)){
$val = trim($val);  //get rid of newlines
list($name,$pass,$gid,$userlist) = split (:, $val);
if($gid  $this-gid){
$this-gid = $gid;  //keep track 
of the highest gid number
}
$this-groups[$name]['gid'] = $gid;
$this-groups[$name]['pass'] = $pass;
$users = explode(',',$userlist);//get an array 
of users
while(list($key2,$user) = each($users)){
// build an array using name as key
$this-groups[$name]['users'][$user] = 1;
}
}
$r = true;
//debug
//echo 'pre';
//print_r($this-groups);
//echo '/pre';
}
Return $r;
}
function addGroup($group,$gid = 0,$pass = 'x'){
$r = false;
if(!isset($this-groups[$group])){
$gid = ($gid  0)? $gid : $this-gid +1;// if no gid 
then generate the next highest
$this-groups[$group]['gid'] = $gid;
$this-groups[$group]['pass'] = $pass;
$r = true;
}
Return $r;
}
function delGroup($group){
$r = false;
if(isset($this-groups[$group])){
unset($this-groups[$group]);
$r = true;
}
Return $r;
}
function addUser($group,$user){
$r = false;
if(isset($this-groups[$group])){
$this-groups[$group]['users'][$user] = 1;
$r = true;
}
Return $r;
}
function delUser($group,$user){
$r = false;
if(isset($this-groups[$group]['users'][$user])){
unset($this-groups[$group]['users'][$user]);
$r = true;
}
Return $r;
}
function dump($file){
$r = false;
if($handle = fopen($file,'w')){
$groups = $this-groups;//get a copy of the groups 
array (saves typing :)
//debug
//echo 'pre';
//print_r($this-groups);
//echo '/pre';
while(list($key,$val) = each($groups)){ //go through the groups
$users = $groups[$key]['users'];   
 //get a copy of the users array
$x = 0;
$userlist = '';
while(list($key2,$val2) = each($users)){// add 
the users
$userlist .= ($x  0)? ','.$key2 : $key2; // 
don't need a comma for the first run
$x++;
}
$gid = $groups[$key]['gid'];
$pass = $groups[$key]['pass'];
$list = $key.':'.$pass.':'.$gid.':'.$userlist.\n; // 
make the entry
fputs($handle,$list);   //save it
}
$r = true;
fclose($handle);
}
Return $r;
}
}

//usage
$g = new groupClass('group');
$g -addGroup('site8');
$g -addUser('site8','fred');

[PHP] mysql replication + mysql_pconnect

2003-03-01 Thread electroteque
hi there i am setting up a test replication slave server as a mysql db
master backup if it fails , i would like to know how to dynamically connect
to the slave if the master fails , something really strange i have set the
host like localhost:3307 for the slave but is still connecting to the master
, and if i shut down the master it wont goto the slave :|



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



[PHP] mail function and Bcc restriction?

2003-03-01 Thread Mirza Muharemagic
Hi all,

   are there any restrictions for mail function, when I use Bcc? how
   many email adresses can i put in Bcc, are there any PHP
   restriction, or just memory restriction, or something else?

   Thanx a lot

   Mirza
   [EMAIL PROTECTED]


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



[PHP] V_OPEN() causes crash?

2003-03-01 Thread Niels Andersen
Hello,

I did my first PHP extension (a simple template engine), and I found out I
could not ude V_OPEN() - it simply crashed PHP.

I then searched the web and found somebody mentioning something about a
function called VCWD_OPEN(), which works perfectly, but is not
documented

Any idea why did V_OPEN() crashes PHP?



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



[PHP] Re: php.ini

2003-03-01 Thread Niels Andersen
Check that php_gd2.dll is in your C:\PHP\ folder.

Anthony Ritter [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I run the following script:

 ?
 phpinfo();
 ?

 // the page loads o.k. when the semi-colon remains as in:
 ;extension=php_gd2.dll

 but if I remove the semicolon as in:

 extension=php_gd2.dll

 the page won't load and the server hangs up.
 ..

 \\ this is my php.ini file on MS Win 98/ PHP/ Apache


 ; Directory in which the loadable extensions (modules) reside.
 extension_dir = C:\PHP\

 ; Whether or not to enable the dl() function.  The dl() function does NOT
 work
 ; properly in multithreaded servers, such as IIS or Zeus, and is
 automatically
 ; disabled on them.
 enable_dl = On

 extension=php_gd2.dll
 ...

 Any advice on how I can install GD libraries greatly appreciated.
 Thank you.
 Tony Ritter








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



[PHP] Re: session help

2003-03-01 Thread Niels Andersen

 i am having a terrible time killing the session
 someone please please help me...

This one works for me:
session_start();
$_SESSION = array();
session_destroy();

But I am surprised that there is no single command to kill the session.
The semantics of session_destroy() suggest that it does just that. But, as
you have found out, it does not...



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



[PHP] Re: testing for 0

2003-03-01 Thread Niels Andersen
Data from POST is a hash table of strings, so you should use this to check
for zero:

if ($_POST['field'] == 0)
 // Zero was entered



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



[PHP] authentication headers....

2003-03-01 Thread Sunfire
how would you show a header message or basically force apache to show an
error page of its own like 401 if someone hits cancle on the php auth header
function?

and i have a line like:
header(WWW-Authenticate: basic realm='a realm name');
//i know what that means look at next line...
header(HTTP/1.0 401 Unathorized);
//what does that line do since the first one is the login box
//dont know what the second one is for
//and third line:
echo stuff to print on screen if person hits cancle...

so was wondering how would i use a header on the cancle part and what does
the header with unathorized mean






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.458 / Virus Database: 257 - Release Date: 2/24/2003


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



Re: [PHP] Checking for HTTP:// at the start of a string and more ////

2003-03-01 Thread Ernest E Vogelsinger
At 05:09 01.03.2003, Philip J. Newman said:
[snip]
I would like to check for HTTP:// at the start of a string and for at least
1 . and a / at the end of a string.

I have tried ereg, but the documentation is not too clear how to format.
[snip] 

Untested:

if (preg_match('/^http:\/\/[^\.\s]+\.[^\s]+\/$/i', $string))
// valid string
else
// invalid string

Should match a string beginning with 'http://', followed by one or more
characters that are no dots or whitespace, followed by a dot, followed by
one or more characters that are not whitespace, and terminated with a
slash. The terminating 'i' makes the search case insensitive.


-- 
   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] IS there a way.

2003-03-01 Thread Ernest E Vogelsinger
At 05:40 01.03.2003, Philip J. Newman said:
[snip]
  Is there a way to PING a URL and check if it returns a valid code like 200
... ??
[snip] 

Ping doesn't return a 200 OK code... If you want to check for the
existence of a webserver at the given address you should try to read some
data from it. To check the return code you need a tool to return the HTTP
headers - check out cUrl (also supports SSL), or go on your own using
fsockopen().


-- 
   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] Get variable from PHP before submit

2003-03-01 Thread Chris Hayes
I am putting my gamma-epsilon-psycho telepathy beamer to the maximum but 
there are too many coders inbetween us, i cannot receive you.

Please give a little hint on what these functions are and what value comes 
from where and goes where.

At 04:00 1-3-2003, you wrote:
I'm trying to implement the following functionality into the file test.php:

When I scroll down the page and then hit a button, the page should remember
the scrolled position, refresh the page and then scroll down to the
remembered position. I've almost managed to make this work, but only almost.
The first time I click one of the buttons, the page won't scroll, but after
that it works fine. I think the reason for this is that the function
hentKoordinat() gets called before $teller is set. hentKoordinat() uses
$teller.
Anyone know a way to make this work?

Thanks alot!

Lars

File test.php:

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
http://www.w3.org/TR/html4/loose.dtd;
?php echo 
Ykoordinat:  . $yKoord . 

; echo Teller:  . $teller; for($i=0; $i150; $i++) { echo '
'; } for($teller=0; $teller2; $teller++) { ? ?php $teller++; ? ?php } 
//for($teller=0; $i2; $i++) { ?

--
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] addslashes(): Is it multi-byte safe?

2003-03-01 Thread Daniel Guerrier
why not try it and let us know.
--- Jean-Christian Imbeault [EMAIL PROTECTED]
wrote:
 Is addslashes() multi-byte safe?
 
 I will bu sing it to escape multi-byte input and
 wouldn't want it to 
 mangle anything...
 
 Thanks,
 
 Jc
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


__
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



[PHP] email pipe

2003-03-01 Thread qt
Dear Sirs,

I wa using

my @InBody = STDIN;

To get data from email after piping. I am not sure that what I should use to
have same result with php?

I just want to have email' s data into my php script to handle.

Best Regards



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



[PHP] Constants and Here Document Interpolation

2003-03-01 Thread Daniel R. Hansen
Can anyone tell me if it is possible (and how) to use defined constants
within here document content?  I've not been successful finding anything
on this in the online docs.

Thanks!

Dan

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

php-general Digest 1 Mar 2003 16:29:34 -0000 Issue 1912

2003-03-01 Thread php-general-digest-help

php-general Digest 1 Mar 2003 16:29:34 - Issue 1912

Topics (messages 137664 through 137694):

Checking for HTTP:// at the start of a string and more 
137664 by: Philip J. Newman
137665 by: Rasmus Lerdorf
137688 by: Ernest E Vogelsinger

IS there a way.
137666 by: Philip J. Newman
137667 by: Leif K-Brooks
137668 by: Rasmus Lerdorf
137689 by: Ernest E Vogelsinger

Re: Post method
137669 by: Alex Shi

Re: SORT_NUMERIC
137670 by: Jason Wong

Re: testing for  0
137671 by: Leo Spalteholz
137686 by: Niels Andersen

Re: IMAP error while compiling PHP-4.3.0
137672 by: Jason Wong

Re: JP Graph
137673 by: Uttam

Re: Mysql Date got prob!
137674 by: Uttam

Re: Help!! with array's Please
137675 by: Tom Rogers

mysql replication + mysql_pconnect
137676 by: electroteque

Re: Is it multi-byte safe?
137677 by: Jean-Christian Imbeault
137692 by: Daniel Guerrier

Random not working?
137678 by: Frank Keessen

mail function and Bcc restriction?
137679 by: Mirza Muharemagic

Re: [PHP-I18N] addslashes(): Is it multi-byte safe?
137680 by: Moriyoshi Koizumi
137681 by: Jean-Christian Imbeault
137682 by: Moriyoshi Koizumi

V_OPEN() causes crash?
137683 by: Niels Andersen

Re: php.ini
137684 by: Niels Andersen

Re: session help
137685 by: Niels Andersen

authentication headers
137687 by: Sunfire

Re: [PHP-DB] Random not working?
137690 by: Doug Thompson

Re: Get variable from PHP before submit
137691 by: Chris Hayes

email pipe
137693 by: qt

Constants and Here Document Interpolation
137694 by: Daniel R. Hansen

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---
I would like to check for HTTP:// at the start of a string and for at least
1 . and a / at the end of a string.

I have tried ereg, but the documentation is not too clear how to format.




--
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]

+64 (9) 576 9491
+64 021-048-3999

--
Friends are like stars
You can't allways see them,
but they are always there.

--
Websites:

PhilipNZ.com - Design.
http://www.philipnz.com/
[EMAIL PROTECTED]

Philip's Domain // Internet Project.
http://www.philipsdomain.com/
[EMAIL PROTECTED]

Vital Kiwi / NEWMAN.NET.NZ.
http://www.newman.net.nz/
[EMAIL PROTECTED]

--
Quote:

God gave men both a penis and a brain,
but unfortunately not enough blood supply
to run both at the same time.

- Robin Williams
(Commenting on the Clinton/Lewinsky affair).


---End Message---
---BeginMessage---
You don't need a regular expression.  Look at the substr() function.

-Rasmus

On Sat, 1 Mar 2003, Philip J. Newman wrote:

 I would like to check for HTTP:// at the start of a string and for at least
 1 . and a / at the end of a string.

 I have tried ereg, but the documentation is not too clear how to format.




 --
 Philip J. Newman.
 Head Developer
 [EMAIL PROTECTED]

 +64 (9) 576 9491
 +64 021-048-3999

 --
 Friends are like stars
 You can't allways see them,
 but they are always there.

 --
 Websites:

 PhilipNZ.com - Design.
 http://www.philipnz.com/
 [EMAIL PROTECTED]

 Philip's Domain // Internet Project.
 http://www.philipsdomain.com/
 [EMAIL PROTECTED]

 Vital Kiwi / NEWMAN.NET.NZ.
 http://www.newman.net.nz/
 [EMAIL PROTECTED]

 --
 Quote:

 God gave men both a penis and a brain,
 but unfortunately not enough blood supply
 to run both at the same time.

 - Robin Williams
 (Commenting on the Clinton/Lewinsky affair).



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

---End Message---
---BeginMessage---
At 05:09 01.03.2003, Philip J. Newman said:
[snip]
I would like to check for HTTP:// at the start of a string and for at least
1 . and a / at the end of a string.

I have tried ereg, but the documentation is not too clear how to format.
[snip] 

Untested:

if (preg_match('/^http:\/\/[^\.\s]+\.[^\s]+\/$/i', $string))
// valid string
else
// invalid string

Should match a string beginning with 'http://', followed by one or more
characters that are no dots or whitespace, followed by a dot, followed by
one or more characters that are not whitespace, and terminated with a
slash. The terminating 'i' makes the search case insensitive.


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


---End Message---
---BeginMessage---
  Is there a way to PING a URL and check if it returns a valid code like 200
... ??

--
Philip J. Newman.
Head Developer

RE: [PHP] Constants and Here Document Interpolation

2003-03-01 Thread Danny Shepherd
Hello,

It doesn't look like it - a note in the constants manual entry reads:

PHP has no way of recognizing the constant from any other string of
characters within the heredoc block

Danny.

-Original Message-
From: Daniel R. Hansen [mailto:[EMAIL PROTECTED] 
Sent: 01 March 2003 15:57
To: [EMAIL PROTECTED]

Can anyone tell me if it is possible (and how) to use defined constants
within here document content?  I've not been successful finding anything
on this in the online docs.

Thanks!

Dan




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



Re: [PHP] email pipe

2003-03-01 Thread Michael Sims
On Sat, 1 Mar 2003 17:26:37 +0300, you wrote:

Dear Sirs,

I wa using

my @InBody = STDIN;

To get data from email after piping. I am not sure that what I should use to
have same result with php?

Hi,

Read the section beginning with Table 23-2. CLI specific Constants
here:

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

You should find what you need...

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



RE: [PHP] Get variable from PHP before submit

2003-03-01 Thread Rich Gray
 I'm trying to implement the following functionality into the file 
 test.php:
 
 When I scroll down the page and then hit a button, the page 
 should remember
 the scrolled position, refresh the page and then scroll down to the
 remembered position. I've almost managed to make this work, but 
 only almost.
 
 The first time I click one of the buttons, the page won't scroll, 
 but after
 that it works fine. I think the reason for this is that the function
 hentKoordinat() gets called before $teller is set. hentKoordinat() uses
 $teller.
 
 Anyone know a way to make this work?
 
 Thanks alot!
 
 Lars

I've probably misunderstood but can you not use an HTML anchor...?
Rich


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



[PHP] Re: Creating MySQL Entry Forms

2003-03-01 Thread Bobby Patel
What I would recommend is PHPmyAdmin. I believe it's open source and written
in PHP specifically as a utility for mySQL.

I'm sure you can find it at sourceforge.net (or a similar site) .

Jeremy N.E. Proffitt [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I need to create some simple web forms for entering, changing, deleteing
information from a fairly simple MySQL database.  This is to be for internal
use, so doesn't have to be really fancy or have alot of error checking.
  I could make a form for each table myself, but I would think their is an
easier way...

Cheers
Jeremy



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



RE: [PHP] Parse exec output

2003-03-01 Thread Rich Gray
 
 If I exec a command like ifconfig, I'd like to be able to parse.  What is
 the best way to go about thihs?  An example output from ifconfig is:

Check http://www.php.net/manual/en/function.passthru.php

Rich

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



RE: [PHP] php.ini

2003-03-01 Thread Rich Gray
 I run the following script:
 
 ?
 phpinfo();
 ?
 
 // the page loads o.k. when the semi-colon remains as in:
 ;extension=php_gd2.dll
 
 but if I remove the semicolon as in:
 
 extension=php_gd2.dll
 
 the page won't load and the server hangs up.
 ..
 
 \\ this is my php.ini file on MS Win 98/ PHP/ Apache
 
 
 ; Directory in which the loadable extensions (modules) reside.
 extension_dir = C:\PHP\
 
 ; Whether or not to enable the dl() function.  The dl() function does NOT
 work
 ; properly in multithreaded servers, such as IIS or Zeus, and is
 automatically
 ; disabled on them.
 enable_dl = On
 
 extension=php_gd2.dll
 ...
 
 Any advice on how I can install GD libraries greatly appreciated.
 Thank you.
 Tony Ritter

Hi Tony

Still battling GD I see :)

Are there any errors in the Apache error.log?

What happens if you change your php.ini directive to ...

extension_dir = C:/php/extensions

HTH
Rich


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



RE: [PHP] mysql replication + mysql_pconnect

2003-03-01 Thread Rich Gray
 hi there i am setting up a test replication slave server as a mysql db
 master backup if it fails , i would like to know how to
 dynamically connect
 to the slave if the master fails , something really strange i have set the
 host like localhost:3307 for the slave but is still connecting to
 the master
 , and if i shut down the master it wont goto the slave :|



Not sure I understand ... are you saying that
mysql_connect('localhost:3307','user','password') connects to the master
server? Can you describe the problem in more detail?

Rich


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



Re: [PHP] Constants and Here Document Interpolation

2003-03-01 Thread Ernest E Vogelsinger
At 16:56 01.03.2003, Daniel R. Hansen said:
[snip]
Can anyone tell me if it is possible (and how) to use defined constants
within here document content?  I've not been successful finding anything
on this in the online docs.
[snip] 

You simply could have tried it - it's trivial.

The answer: no, you cannot have a constant within a string, be it heredoc
or quoted. A constant must always reside on native code level.

However you can easily concatenate strings and heredocs - both of the
examples below work correctly:

define('A_CONSTANT', 1);
$text1 = EOT
This heredoc text contains the constant A_CONSTANT (
EOT
. A_CONSTANT .  EOT
) outside the heredoc construct...
EOT;

$text2 = This quoted text contains the constant A_CONSTANT ( .
 A_CONSTANT .
 ) outside the string quotes...;
echo $text1br /$text2;

Output:
This heredoc text contains the constant A_CONSTANT (1) outside the heredoc
construct...
This quoted text contains the constant A_CONSTANT (1) outside the string
quotes...


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



FW: [PHP] Constants and Here Document Interpolation

2003-03-01 Thread Daniel R. Hansen
Actually I did try it and couldn't think of a way to work around the matter.
Thanks for the suggestion.

-Original Message-
From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 01, 2003 12:56 PM
To: Daniel R. Hansen
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Constants and Here Document Interpolation


At 16:56 01.03.2003, Daniel R. Hansen said:
[snip]
Can anyone tell me if it is possible (and how) to use defined constants
within here document content?  I've not been successful finding anything
on this in the online docs.
[snip]

You simply could have tried it - it's trivial.

The answer: no, you cannot have a constant within a string, be it heredoc
or quoted. A constant must always reside on native code level.

However you can easily concatenate strings and heredocs - both of the
examples below work correctly:

define('A_CONSTANT', 1);
$text1 = EOT
This heredoc text contains the constant A_CONSTANT (
EOT
. A_CONSTANT .  EOT
) outside the heredoc construct...
EOT;

$text2 = This quoted text contains the constant A_CONSTANT ( .
 A_CONSTANT .
 ) outside the string quotes...;
echo $text1br /$text2;

Output:
This heredoc text contains the constant A_CONSTANT (1) outside the heredoc
construct...
This quoted text contains the constant A_CONSTANT (1) outside the string
quotes...


--
   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: Mysql Date got prob!

2003-03-01 Thread Dhaval Desai
Hi,

Thanx for yor reply. Well It worked for me with the same query when I used 
HAVING instead of where. This is what I got from Mysql Database. However 
the solution that you have showed is reall good as well.

Thanx
-Dhaval





From: Uttam [EMAIL PROTECTED]
To: 'Dhaval Desai' [EMAIL PROTECTED],[EMAIL PROTECTED]
Subject: RE: Mysql Date got prob!
Date: Sat, 1 Mar 2003 13:45:53 +0530
try:

select
date_format(date_add(arrivaldate1, INTERVAL nights1 DAY), '%Y-%m-%d') as
dept_date1
from mytable
where
(date_add(arrivaldate1, INTERVAL nights1 DAY) BETWEEN '2003-02-01' AND
'2003-02-10')
regds,
-Original Message-
From: Dhaval Desai [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 15:48
To: [EMAIL PROTECTED]
Subject: Mysql Date got prob!
Hello,

As related to my earlier question

select  date_format(date_add(arrivaldate1, INTERVAL nights1 DAY), '%Y-
%m-%d') as dept_date1 from mytable where ('dept_date1' BETWEEN
'2003-02-01' AND '2003-02-10')
The above query is valid but returns 0 because 'dept_date1' is treated
as a
string. I want dept_date1 to be treated as  date so that it can be
compared.
I hope it is possible...

Thank you!

-Dhaval

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


_
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


[PHP] Checking Access to a directory Via a PHP/MYSQL Databace.

2003-03-01 Thread Philip J. Newman
Is there a way that i can restrict access to an entire directory using
PHP/MYSQL so only valid users in the Database can have access to a resource?

--
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]

+64 (9) 576 9491
+64 021-048-3999

--
Friends are like stars
You can't allways see them,
but they are always there.

--
Websites:

PhilipNZ.com - Design.
http://www.philipnz.com/
[EMAIL PROTECTED]

Philip's Domain // Internet Project.
http://www.philipsdomain.com/
[EMAIL PROTECTED]

Vital Kiwi / NEWMAN.NET.NZ.
http://www.newman.net.nz/
[EMAIL PROTECTED]



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



RE: [PHP] .htpasswd and PayPal generated passwords

2003-03-01 Thread Boaz Yahav
Check out :

Authenticating against .htpasswd style files.
http://www.weberdev.com/index.php3?GoTo=get_example.php3?count=109

Sincerely

berber

Visit http://www.weberdev.com/ Today!!!
To see where PHP might take you tomorrow.


-Original Message-
From: Rob Packer [mailto:[EMAIL PROTECTED] 
Sent: Saturday, February 15, 2003 6:06 PM
To: [EMAIL PROTECTED]
Subject: [PHP] .htpasswd and PayPal generated passwords


I use PayPal to generate a username and password and then write them
to the .htpasswd file. If I were to switch to using a database (because
.htaccess seems to always prompt twice!) how would I perform the
comparison for the passwords? It would seem that everytime you generate
an encrypted password it's different. So how would you compare them?
Also, does anyone know what the encryption method used by PayPal is?

Thanks for any help...

Robert Packer



-- 
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] Using PHP to convert to JPEG

2003-03-01 Thread Jason Paschal
I'm building a site that allows ppl to upload images.  PHP was compiled with 
the GD lib so I'm able to verify all sorts of info about the image for 
validation.  However, I was wondering if there is a way to convert a 
non-jpeg image to jpeg just by using the GD functions as opposed to using 
unix command line utilities and system/exec functions (the hosting company 
doesn't like that, and personally, i don't like the 'cross ur fingers' 
aspect of php/commandline stuff).
Some browsers don't like some image types and we're trying to make jpg the 
standard extension, though we allow ppl to upload BMP, TIF, GIF, PNG, and 
JPG files.
I can get the image and put it where I want on the server, but is there a 
way to finesse the GD lib to create a jpeg from whatever image type they 
upload?  If someone just has an idea that may or may not work, I'm open to 
suggestions, pseudo-code is welcome.  Seems that somewhere in the GD lib's 
capabilities there's a way to squeeze out what i want, but I can't grasp it.
Thank you,
screamingpanda





_
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


Re: [PHP] Restate: using php to rotate ad banners

2003-03-01 Thread Joseph Bannon
 Don't reinvent the wheel :)
 
 http://www.phpadsnew.com/one/


Then how would people learn? Eventually everyone that
knows how to make the wheel will die and the knowledge
to make it will be forgotten.

J.



__
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



[PHP] Re: Restate: using php to rotate ad banners

2003-03-01 Thread Joseph Bannon
 The other problem is that if I open two browser
 windows to your site, one after the other, and see 
 two banners, and then click on the first one, am
 I going to go to the site for the second one?


Yes, that is one of the main problems. Would using
sessions help end this?

J.



__
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] Restate: using php to rotate ad banners

2003-03-01 Thread Joseph Bannon
 Would this do it for you?


No, that is that the problem. Showing the banner is.
It's when they click on it.

__
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



[PHP] 2 questions !

2003-03-01 Thread Vincent M.
Hello,

I didn't find in the doc how to:
 - Know the full path of the current directory. Like /var/www/to/the/path
- Know under which user work apache, to know when I create a file whose 
file it is...

Thanks.

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


[PHP] Stream file content to the web (possibly OT)

2003-03-01 Thread Reuben D. Budiardja

Hello,
I have a file that the content always change every second or so. I want to 
display this to the web. Is this possible to do using PHP? If yes how?
I can have the content displayed to the web only update every 5 seconds or so, 
for example. Will this put the server into heavy load?

If PHP is not the best way to do this, does anyone knows if Java applet can do 
this?

Thanks

RDB

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



[PHP] Downloading via FTP in parts

2003-03-01 Thread Siddharth
Hello, 

I was wondering how I could download a file via FTP in parts. (For eg
0bytes - 400 byes and then from 401 bytes to 801 bytes)

Thank you,

- Siddharth Hegde



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



[PHP] Re: 2 questions !

2003-03-01 Thread Greg Beaver

Vincent M. [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello,

 I didn't find in the doc how to:
   - Know the full path of the current directory. Like /var/www/to/the/path

try using dirname(__FILE__) or dirname($_SERVER['PATH_TRANSLATED'])

 - Know under which user work apache, to know when I create a file whose
 file it is...

in unix, a safe installation will run apache as nobody.

Greg
--
phpDocumentor
http://www.phpdoc.org



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



[PHP] Upper and lower case.

2003-03-01 Thread Philip J. Newman
Question:

is it better to store user names as upper and lower case? should they bee
converted to one case?

I have a script the checks for names and  ...

Mark is not the same as mark, or MaRk ...

is there a way of making a string into lower case?


--
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]

+64 (9) 576 9491
+64 021-048-3999

--
Friends are like stars
You can't allways see them,
but they are always there.

--
Websites:

PhilipNZ.com - Design.
http://www.philipnz.com/
[EMAIL PROTECTED]

Philip's Domain // Internet Project.
http://www.philipsdomain.com/
[EMAIL PROTECTED]

Vital Kiwi / NEWMAN.NET.NZ.
http://www.newman.net.nz/
[EMAIL PROTECTED]



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



Re: [PHP] Upper and lower case.

2003-03-01 Thread Philip J. Newman
LOL got a reply to this before i ever got the message my self ... 

- Original Message - 
From: Philip J. Newman [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, March 02, 2003 10:56 AM
Subject: [PHP] Upper and lower case.


 Question:
 
 is it better to store user names as upper and lower case? should they bee
 converted to one case?
 
 I have a script the checks for names and  ...
 
 Mark is not the same as mark, or MaRk ...
 
 is there a way of making a string into lower case?
 
 
 --
 Philip J. Newman.
 Head Developer
 [EMAIL PROTECTED]
 
 +64 (9) 576 9491
 +64 021-048-3999
 
 --
 Friends are like stars
 You can't allways see them,
 but they are always there.
 
 --
 Websites:
 
 PhilipNZ.com - Design.
 http://www.philipnz.com/
 [EMAIL PROTECTED]
 
 Philip's Domain // Internet Project.
 http://www.philipsdomain.com/
 [EMAIL PROTECTED]
 
 Vital Kiwi / NEWMAN.NET.NZ.
 http://www.newman.net.nz/
 [EMAIL PROTECTED]
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



Re: FW: [PHP] Constants and Here Document Interpolation

2003-03-01 Thread Ernest E Vogelsinger
At 19:28 01.03.2003, Daniel R. Hansen said:
[snip]
Actually I did try it and couldn't think of a way to work around the matter.
Thanks for the suggestion.

-Original Message-
From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]
You simply could have tried it - it's trivial.

 [blah]
[snip] 

My apologies - by rereading my message it sounds straightforward arrogant
which it wasn't meant to be. I was referring to your statement didn't find
anything in the online docs that led me to the perception you didn't even
try it - sorry for that (but there are so many posters asking questions
that wouldn't even arise if they only had _tried_ it).

Hope my suggestion helps though :-)


-- 
   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] Checking Access to a directory Via a PHP/MYSQL Databace.

2003-03-01 Thread Ernest E Vogelsinger
At 21:12 01.03.2003, Philip J. Newman said:
[snip]
Is there a way that i can restrict access to an entire directory using
PHP/MYSQL so only valid users in the Database can have access to a resource?
[snip] 

1) Put that folder outside the document root of your webserver so they
cannot be retrieved by accessing their URL directly
2) After authenticating, server the files using readfile() or similar.

You could even use the ErrorDocument directive in Apache to run this.
Consider this deirectory layout:

   ~newmanpj/
  + -- htdocs== the web root (home of hidden_files.php)
  |  + -- hidden_files   == an empty directory, only .htaccess
available
  |
  + -- hidden_files  == the directory holding your files

The .htaccess file within the hidden directory contains
ErrorDocument 404 /hidden_files.php

Now when a user requests
http://www.newmanpj.com/hidden_files/somestuff.html, the hidden_files.php
will be triggered by apache, having $_SERVER['REDIRECT_URL'] set to the
requested URL.

hidden_files.php does the following:
1) Check if the request is for a hidden file:
   No = serve a general 404 Error message
   Yes = continue
2) Check authentication:
   Not authenticated = goto login (or return 401 Authenticate)
   Yes - readfile(requested_file)

Hope this helps,


-- 
   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] Calendar

2003-03-01 Thread Jason D. Williard
Is there an easy way to create a calendar in PHP, such as a calendar
function?  All I need is a dynamically created calendar to link to other
pages.

Jason D. Williard




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



RE: [PHP] Calendar

2003-03-01 Thread Darren Young
Check http://www.cascade.org.uk/software/php/calendar/

I've used that one on several sites.

-Original Message-
From: Jason D. Williard [mailto:[EMAIL PROTECTED] 
Sent: Saturday, March 01, 2003 4:28 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Calendar


Is there an easy way to create a calendar in PHP, such as a calendar
function?  All I need is a dynamically created calendar to link to other
pages.

Jason D. Williard




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

2003-03-01 Thread Anthony Ritter
Rich,
I've checked my php.ini files on my drive and all I've got is one.

The php_gd2.dll file is in:

C:/PHP/extensions

There was no default folder called extensions when I installed PHP so I made
a directory called extensions under PHP.

Everytime I take out the semicolon in the .ini file, the page won't load and
I've got to shut down Apache server manually.

If I put the semicolon back in, the page loads fine.

I don't have a clue.  Somewhere between the .ini file and Apache something
is very screwed up.

TR


---
[This E-mail scanned for viruses by gonefishingguideservice.com]


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



Re: [PHP] php.ini

2003-03-01 Thread Anthony Ritter
P.S.
If you get a moment, maybe you could send me a .txt file of your php.ini
file along with you php_gd2.dll setup.

That way I could check line for line.

Many thanks,
TR

---
[This E-mail scanned for viruses by gonefishingguideservice.com]


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



[PHP] A few questions...

2003-03-01 Thread The Head Sage
Hello all,

I've got several questions and i'm hoping i can find answers or links to 
places which contain the answers.

1. How can i set a script to run at a certain time?

For example, say i want to send a mass e-mail at 5:00pm every night which 
contains the latest updates to the website. I know how to generate the mail 
and then send it to everyone's e-mail in a MySQL table. But how do i set it 
to run automaticaly?

Answers for both Linux and Windows systems would be nice...

2. How do i open a HTML file, extract all the text and then break up the 
text into variables..

For example, i've got a HTML files which all have the same structure


Title: Magocracy
Author: TheHeadSage
E-Mail: [EMAIL PROTECTED]
Category: Comedy, Action
Keywords: Ilja, Magic, Ilkeria
Rating: PG-13
Spoilers: None, origional story.
Summary: [Sumary here]
Chapter Body

How would i get all the text and break it up into the variables $title, 
$author, $email
ect. So they can be insterted into the MySQL table under the approprate 
colums.

3. How do i open a Word Document and extract all the text?

As users would like to submit .doc files and i'd like the script to process 
them..

Thats all the questions so far, any tips, comments, ideas, questions even 
insults and flames are welcome!

Also please reply to the address: [EMAIL PROTECTED] as i dont 
trust hotmail.

Thanks in advance,

- Daniel TheHeadSage Spain
Founder of Voidsoft.
Server Administrator of The Void
Head of IRC Relations for Manga-Sketchbook.org
_
Hotmail now available on Australian mobile phones. Go to  
http://ninemsn.com.au/mobilecentral/hotmail_mobile.asp

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


Re: [PHP] A few questions...

2003-03-01 Thread Ernest E Vogelsinger
At 00:49 02.03.2003, The Head Sage said:
[snip]
1. How can i set a script to run at a certain time?

*nix: use cron (man crontab)
Windows: use the at command (help at)

2. How do i open a HTML file, extract all the text and then break up the 
text into variables..

For example, i've got a HTML files which all have the same structure


Title: Magocracy
Author: TheHeadSage
E-Mail: [EMAIL PROTECTED]
Category: Comedy, Action
Keywords: Ilja, Magic, Ilkeria
Rating: PG-13
Spoilers: None, origional story.
Summary: [Sumary here]

Chapter Body



How would i get all the text and break it up into the variables $title, 
$author, $email
ect. So they can be insterted into the MySQL table under the approprate 
colums.

Using the layout you are showing:
1) Read the file
2) Split headers from body (delimited by an empty line)
3) make an array from the headers, splitting each line by ': '

// Disclaimer: untested
// step 1
$hf = fopen($file, 'r') or die(Can't read $file);
$buffer=fread($hf, filesize($hf));
fclose($hf);

// step 2 - now you have the chapter ready
list($headers, $chapter) = preg_split(/(\n|\r|\r\n|\n\r){2,2}/s, $buffer);

// step 3
$headers = preg_split(/(\n|\r|\r\n|\n\r)/s, $headers);
$arkeywords = array(); // for the array method, see below
foreach ($headers as $line) {
list($var, $value) = preg_split('/:\s*/', $line, 2);
// you may rather use an associative array instead of variable names
// the variable method:
$$var = $value;
// the array method
$arkeywords[$var] = $value;
}

You now have the body text in $chapter, and either an associative
array, or the named variables of the header lines.

3. How do i open a Word Document and extract all the text?

You might try Word2X (see http://word2x.sourceforge.net/)
Disclaimer - never used it, just been told about it by my friend Google
(question was Winword conversion Linux).

Thats all the questions so far, any tips, comments, ideas, questions even 
insults and flames are welcome!

Nothing else?

Ok, you got something to work on now I believe... *grin*

- Daniel TheHeadSage Spain
Founder of Voidsoft.
Server Administrator of The Void

...hopefully not...


-- 
   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: Checking for HTTP:// at the start of a string and more ////

2003-03-01 Thread Kris Jones
Untested:

if (preg_match('/^http:\/\/[^\.\s]+\.[^\s]+\/$/i', $string))
   // valid string
else
   // invalid string
Should match a string beginning with 'http://', followed by one or more
characters that are no dots or whitespace, followed by a dot, followed by 
one or more characters that are not whitespace, and terminated with a 
slash. The terminating 'i' makes the search case insensitive.
I've also been looking for this information. Can you please point me to a 
list of those string codes? My search for them in the documentation has been 
fruitless.







_
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


RE: [PHP] php.ini

2003-03-01 Thread Rich Gray
 Rich,
 I've checked my php.ini files on my drive and all I've got is one.

 The php_gd2.dll file is in:

 C:/PHP/extensions

 There was no default folder called extensions when I installed
 PHP so I made
 a directory called extensions under PHP.

 Everytime I take out the semicolon in the .ini file, the page
 won't load and
 I've got to shut down Apache server manually.

 If I put the semicolon back in, the page loads fine.

 I don't have a clue.  Somewhere between the .ini file and Apache something
 is very screwed up.

 TR

You said in your earlier post that in your php.ini your extension_dir is set
to C:\PHP\ - this is wrong it should be c:/php/extensions
If the extensions directory was not there and you had to create it manually
then where did you get the php_gd2.dll from?
The extensions sub-directory should be there for a normal installation - did
you install from zip?

Rich


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



[PHP] stripslashes()

2003-03-01 Thread Dade Register
I know this is probably an easy question, but I am
using stripslashes() on a textarea var, and I don't
think it's working. It doesn't error, but in the
testarea it doesn't seem to work. Ex:

$var = Thank's;
$var = stripslashes($var);
echo $var;
Output = Thank\'s

Any ideas? Thanx.

-Dade

__
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] Re: Checking for HTTP:// at the start of a string and more ////

2003-03-01 Thread Ernest E Vogelsinger
At 01:17 02.03.2003, Kris Jones said:
[snip]
Untested:

if (preg_match('/^http:\/\/[^\.\s]+\.[^\s]+\/$/i', $string))
// valid string
else
// invalid string


I've also been looking for this information. Can you please point me to a 
list of those string codes? My search for them in the documentation has been 
fruitless.
[snip] 

It is all in the online manual. Start your studies at
http://www.php.net/manual/en/ref.pcre.php

Chapter LXXXVIII (read 88), titled Regular Expression Functions (Perl
compatible), which are my favorites... pay special attention on these
chapters:
Pattern Syntax (http://www.php.net/manual/en/pcre.pattern.syntax.php)
Pattern Modifiers
(http://www.php.net/manual/en/pcre.pattern.modifiers.php)



-- 
   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] stripslashes()

2003-03-01 Thread Ernest E Vogelsinger
At 01:48 02.03.2003, Dade Register said:
[snip]
I know this is probably an easy question, but I am
using stripslashes() on a textarea var, and I don't
think it's working. It doesn't error, but in the
testarea it doesn't seem to work. Ex:

$var = Thank's;
$var = stripslashes($var);
echo $var;
Output = Thank\'s
[snip] 

This can't work since there are no slashes to strip...

stripslashes() strips certain slashes from a string. Assume you have a
textarea where the user enters Thank's, so PHP converts this to
Thank\'s (assuming magic_quotes is set to on). Using stripslashes() here
will get rid of these slashes.

BTW - the sample you've sent will output Thank's - what are you doing
what you didn't show?


-- 
   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] stripslashes()

2003-03-01 Thread Dade Register
Well, only diff is it's a POST from a textarea. With
magicquotes on, you're right, it makes Thank's
become Thank\'s. how can I get rid of that? I'm
posting it to a text file.
-Dade
--- Ernest E Vogelsinger [EMAIL PROTECTED]
wrote:
 At 01:48 02.03.2003, Dade Register said:
 [snip]
 I know this is probably an easy question, but I am
 using stripslashes() on a textarea var, and I don't
 think it's working. It doesn't error, but in the
 testarea it doesn't seem to work. Ex:
 
 $var = Thank's;
 $var = stripslashes($var);
 echo $var;
 Output = Thank\'s
 [snip] 
 
 This can't work since there are no slashes to
 strip...
 
 stripslashes() strips certain slashes from a string.
 Assume you have a
 textarea where the user enters Thank's, so PHP
 converts this to
 Thank\'s (assuming magic_quotes is set to on).
 Using stripslashes() here
 will get rid of these slashes.
 
 BTW - the sample you've sent will output Thank's -
 what are you doing
 what you didn't show?
 
 
 -- 
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
 


__
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] stripslashes()

2003-03-01 Thread Ernest E Vogelsinger
At 02:05 02.03.2003, Dade Register said:
[snip]
Well, only diff is it's a POST from a textarea. With
magicquotes on, you're right, it makes Thank's
become Thank\'s. how can I get rid of that? I'm
posting it to a text file.
[snip] 

Use stripslashes().

Try this example:

?php

$var = $_REQUEST['blah'];
echo 'xmp$REQUEST[\'blah\']: ', $var, \\n;
$var = stripslashes($var);
echo 'stripslashe\'d: ', $var, '/xmp';
echo 'form method=post',
 'textarea name=blah',
 $var,
 '/textareabr /',
 'input type=submit/form';

?

You will notice the textarea transmits Thank\'s which is displayed in the
first line, and stripslashes() removes the backslash and displays Thank's.

Note that you also must use the stripslashe'd data when constructing the
textarea.


-- 
   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] Upper and lower case.

2003-03-01 Thread John W. Holmes
 is it better to store user names as upper and lower case? should they
bee
 converted to one case?

Store it where? It depends if the place you store it in and the
comparisons there are going to be case sensitive or not. Most database
fields are going to be case sensitive while a PHP comparison will not
be. 
 
 I have a script the checks for names and  ...
 
 Mark is not the same as mark, or MaRk ...

In PHP when you test with an equal to (==) they are not the same. You
can use the strcasecmp() function to compare string case insensitively,
though. In a general database VARCHAR field, they would be the same.

 is there a way of making a string into lower case?

Strtolower()

---John Holmes...



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



Re: [PHP] PHP Project for a newbie (me) or for hire?

2003-03-01 Thread David T-G
Dan --

Just a short followup to your note, though I hope to come back to it when
I get a breather.

Yes, anything is possible if you have the gumption :-)  You sound like
you've been around the web a bit and aren't scared, so feel free to dig
in and try it.  PHP is a fairly easy language to grasp, especially if you
speak any perl.

I enjoy the SAMS PHP Developer's Cookbook, though there are others out
there I'd love to have.  I'm one of those coders who would love to work
up a quote for the job if you're still in the market for hiring.

I like the idea; I once put in a bid on a sailboat cabin reservation
system for a fellow who ran a cruising sailboat with about 8 berths, and
this sounds quite similar.  I like little businesses like that who aren't
afraid of some technology :-)


HTH  HAND  at the very least Good Luck!

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



pgp0.pgp
Description: PGP signature


[PHP] Garbage at beginning of uploaded Text File

2003-03-01 Thread Monty
I have a form that allows someone to upload a text file, the contents of
which will be inserted into the database. When I fread() the file, there is
some garbage at the beginning and end of the text.

Here's what the text looks like:

This is the sentence of text.

Here's what it looks like after uploaded and fread():

*ch?d?m This is the sentence of text.SORT~


The text file being uploaded is a BBedit file, which should be a plain text
file. I'm not sure where this garbage is coming, and if there's an easy way
to remove it before I put this into the Database. I searched the PHP help
files for an hour and searched here, and couldn't find anything related.

I'm using PHP 4.2.3 on a Redhat Linux server.

Thanks.


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



RE: [PHP] Garbage at beginning of uploaded Text File

2003-03-01 Thread John W. Holmes
 I have a form that allows someone to upload a text file, the contents
of
 which will be inserted into the database. When I fread() the file,
there
 is
 some garbage at the beginning and end of the text.
 
 Here's what the text looks like:
 
 This is the sentence of text.
 
 Here's what it looks like after uploaded and fread():
 
 *ch?d?m This is the sentence of text.SORT~
 
 
 The text file being uploaded is a BBedit file, which should be a plain
 text
 file. I'm not sure where this garbage is coming, and if there's an
easy
 way
 to remove it before I put this into the Database. I searched the PHP
help
 files for an hour and searched here, and couldn't find anything
related.
 
 I'm using PHP 4.2.3 on a Redhat Linux server.
 
 Thanks.

Are you using Apache2? IIRC, there was a bug where data would get added
to the POST data, or something along those lines...

What if you just look at the file with a regular text editor? Do you see
that data there after it's uploaded and written to the server, or does
it just appear into the data when it's fread()?

---John W. Holmes...

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



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



[PHP] Fusebox PHP 4.3.1 on AIX

2003-03-01 Thread CDitty
Has anyone successfully gotten fusebox for php to work on AIX w/ 
4.3.1?  The server I am using has globals turned off, but I have this in 
the index file,

extract($_SERVER);
extract($_GET);
extract($_POST);
extract($_COOKIE);
but all I get is a blank screen.  The code is fine because when it is run 
on a regular linux box, it works fine.

Anyone offer any tips?

Chris

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


Re: [PHP] stripslashes()

2003-03-01 Thread Dade Register
I know I am doing the exact thing you are If you
or someone else doesn't mind, could you look @
http://dragonz-cavern.mine.nu/poems.phps and see what
I'm doing wrong? I am trying to parse it before it
gets stored in my txt file. plz help. I'd really
appreciate it.
-Dade
--- Ernest E Vogelsinger [EMAIL PROTECTED]
wrote:
 At 02:05 02.03.2003, Dade Register said:
 [snip]
 Well, only diff is it's a POST from a textarea.
 With
 magicquotes on, you're right, it makes Thank's
 become Thank\'s. how can I get rid of that? I'm
 posting it to a text file.
 [snip] 
 
 Use stripslashes().
 
 Try this example:
 
 ?php
 
 $var = $_REQUEST['blah'];
 echo 'xmp$REQUEST[\'blah\']: ', $var, \\n;
 $var = stripslashes($var);
 echo 'stripslashe\'d: ', $var, '/xmp';
 echo 'form method=post',
  'textarea name=blah',
  $var,
  '/textareabr /',
  'input type=submit/form';
 
 ?
 
 You will notice the textarea transmits Thank\'s
 which is displayed in the
 first line, and stripslashes() removes the backslash
 and displays Thank's.
 
 Note that you also must use the stripslashe'd data
 when constructing the
 textarea.
 
 
 -- 
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
 


__
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] Garbage at beginning of uploaded Text File

2003-03-01 Thread Monty
 Are you using Apache2? IIRC, there was a bug where data would get added
 to the POST data, or something along those lines...
 
 What if you just look at the file with a regular text editor? Do you see
 that data there after it's uploaded and written to the server, or does
 it just appear into the data when it's fread()?
 
 ---John W. Holmes...
 
John, when I open the file in a text editor I don't see the garbage, just
the text. I have Apache 1.3.22 on my server. I'm not writing the contents to
a file once uploaded to the server because I want to store it in a database
field. The garbage is added to the DB just as it appears when I echo the
variable to the screen after the file has been uploaded.

Also, I'm doing the fread() on the tmp_name after the file is uploaded,
because I don't need the file once I read the contents into a variable.

I was wondering if changing the enctype parameter in the form tag would
make a difference (but I don't know what to change it to). Currently it's
set to multipart/form-data.

Thanks!


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



Re: [PHP] stripslashes()

2003-03-01 Thread Ernest E Vogelsinger
At 03:37 02.03.2003, Dade Register said:
[snip]
I know I am doing the exact thing you are If you
or someone else doesn't mind, could you look @
http://dragonz-cavern.mine.nu/poems.phps and see what
I'm doing wrong? I am trying to parse it before it
gets stored in my txt file. plz help. I'd really
appreciate it.
[snip] 

You're doing everything right. If you have a look at the datfile you'll
notice there are NO backslashes. Right?

Ok, so the culprit must be fgets() - and indeed this can be found in the
online manual (http://www.php.net/manual/en/function.fgets.php), in the
user comments:

php at silisoftware dot com 13-Jun-2002 06:44   
Beware of magic_quotes_runtime !
php.ini-recommended for PHP v4.2.1 (Windows) had magic_quotes_runtime set
ON, and that addslash'd all input read via fgets()

So the solution here is to either add stripslashes() after your datfile
read, or to use set_magic_quotes_runtime(0) (see
http://www.php.net/manual/en/function.set-magic-quotes-runtime.php).



-- 
   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] stripslashes()

2003-03-01 Thread Dade Register
Thanx a lot for your help.
It adds to the .dat file. it's not fgets().
Dade [EMAIL PROTECTED]'s
That's from the dat file. any other ideas?
-Dade
--- Ernest E Vogelsinger [EMAIL PROTECTED]
wrote:
 At 03:37 02.03.2003, Dade Register said:
 [snip]
 I know I am doing the exact thing you are If
 you
 or someone else doesn't mind, could you look @
 http://dragonz-cavern.mine.nu/poems.phps and see
 what
 I'm doing wrong? I am trying to parse it before it
 gets stored in my txt file. plz help. I'd really
 appreciate it.
 [snip] 
 
 You're doing everything right. If you have a look at
 the datfile you'll
 notice there are NO backslashes. Right?
 
 Ok, so the culprit must be fgets() - and indeed this
 can be found in the
 online manual
 (http://www.php.net/manual/en/function.fgets.php),
 in the
 user comments:
 
 php at silisoftware dot com 13-Jun-2002 06:44   
 Beware of magic_quotes_runtime !
 php.ini-recommended for PHP v4.2.1 (Windows) had
 magic_quotes_runtime set
 ON, and that addslash'd all input read via fgets()
 
 So the solution here is to either add stripslashes()
 after your datfile
 read, or to use set_magic_quotes_runtime(0) (see

http://www.php.net/manual/en/function.set-magic-quotes-runtime.php).
 
 
 
 -- 
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
 


__
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] stripslashes()

2003-03-01 Thread Ernest E Vogelsinger
At 04:03 02.03.2003, Dade Register said:
[snip]
Thanx a lot for your help.
It adds to the .dat file. it's not fgets().
Dade [EMAIL PROTECTED]'s
That's from the dat file. any other ideas?
[snip] 

add this line vefore and after stripslashes() and see what you get:

echo 'xmp', $poem, '/xmp';

If I type I've set it up it should read

I\'ve set it up
I've set it up

or your stripslashes is not working.


-- 
   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] More Apache than PHP

2003-03-01 Thread Jason Sheets
If your server is IO bound and not CPU bound in most cases it will
continue to serve requests as long as the maximum number of concurrent
connections is not exceeded or they don't timeout.  

In any case your server should not give a 404 error because of being I/O
bound, 404 means document not found, they may be mistaking it with a
server too busy error message.

Jason
On Sat, 2003-03-01 at 15:50, Timothy Hitchens (HiTCHO) wrote:
 Greetings All...
 
 Usually I am helping others on the list but this time I am asking for
 help!!
 
 I was wondering if someone could offer some clarity for me as
 my years of using Apache has never seen the following as a possibility.
 
 Background: This server is using PHP along with Apache
 
 If a server (entire box) was I/O bound and wasn't coping with the load
 then
 would Apache simple close the connection (I think this) or serve a 404
 error.
 
 The reason for asking this is not that I have gone Mad but that a
 consulting firm is trying to tell us that our server is I/O bound
 and serving 404 errors.  I just can't see how.
 
 Thanks to all.
 
 
 Timothy Hitchens (HiTCHO)
 Web Application Consulting
 e-mail: [EMAIL PROTECTED]
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


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



[PHP] A JS problem

2003-03-01 Thread Dade Register
I know this is a php forum. Please don't be upset with
me, but I have a JS problem which nobody I know can
seem to figure out. Here goes:

script LANGUAGE=JavaScript
var w1 = 1000;
var h1 = 672;
if (w1 = screen.width){
if (h1 = screen.height){
document.write(a
href=/pics.php?view=popupimage=2003-01-January/image1.jpg
onclick=NewWindow(this.href,'popup','1000','672','no');return
false;img
src=/pics/2003-01-January/image1-thumb.jpg
border=0 alt=Image 1 of 64/anbsp;)}
else{
document.write(a
href=/pics.php?view=popupimage=2003-01-January/image1.jpg
onclick=NewWindow(this.href,'popup','1000','screen.height','yes');return
false;img
src=/pics/2003-01-January/image1-thumb.jpg
border=0 alt=Image 1 of 64/anbsp;)}
else{
document.write(a
href=/pics.php?view=popupimage=2003-01-January/image1.jpg
onclick=NewWindow(this.href,'popup','screen.width','screen.height','yes');return
false;img
src=/pics/2003-01-January/image1-thumb.jpg
border=0 alt=Image 1 of 64/anbsp;)}
/script

I am trying to make a popup window for a big image to
match it's size using php's getimagesize() function,
setting that in the browser as var w1 and h1. Then
trying to get JS to popup a window with or without
scroll bars depending on your screen size... I know
this is complicated. But it's fun. if anyone knows
anyplace that I am messing up, or wants to see the php
of this w/ the JS, let me know. Thanx to all for your
great advise.
-Dade

__
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] A JS problem

2003-03-01 Thread John W. Holmes
 document.write(a
 href=/pics.php?view=popupimage=2003-01-January/image1.jpg
 onclick=NewWindow(this.href,'popup','1000','672','no');return
 false;img
 src=/pics/2003-01-January/image1-thumb.jpg
 border=0 alt=Image 1 of 64/anbsp;)}

Shouldn't you be escaping some quotes here? The string your sending to
document.write() is delineated by double quotes, but there are double
quotes within the string itself. I'm sure that'll cause a JavaScript
error. Escape double quotes within the string with the \ character. 

document.write(a
href=\/pics.php?view=popupimage=2003-01-January/image1.jpg\
onclick=\NewWindow(this.href,'popup','1000','672','no');return
false;\img
src=\/pics/2003-01-January/image1-thumb.jpg\
border=\0\ alt=\Image 1 of 64\/anbsp;)}

---John W. Holmes...

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



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



[PHP] PHP scripts and the GPL/other licenses

2003-03-01 Thread Jeff Lewis
I am wondering if anyone out there has some really good references in
regards to scripts distributed as open source using the GPL. In the last
three years that I have worked on open source projects I have seen several
people steal a program, change the name and then try to distribute it as
something else.

So I am wondering what people here prefer to use for a license, is there
anyway to combat these kinds of people, etc.

Why do I ask now? Because it has happened again, only this time, the person
is actively marketing this new script.

Jeff



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



Re: [PHP] PHP scripts and the GPL/other licenses

2003-03-01 Thread Leif K-Brooks
They're doing nothing wrong as long as they distribute the source under 
the GPL.

Jeff Lewis wrote:

I am wondering if anyone out there has some really good references in
regards to scripts distributed as open source using the GPL. In the last
three years that I have worked on open source projects I have seen several
people steal a program, change the name and then try to distribute it as
something else.
So I am wondering what people here prefer to use for a license, is there
anyway to combat these kinds of people, etc.
Why do I ask now? Because it has happened again, only this time, the person
is actively marketing this new script.
Jeff



 

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


php-general Digest 2 Mar 2003 04:34:21 -0000 Issue 1913

2003-03-01 Thread php-general-digest-help

php-general Digest 2 Mar 2003 04:34:21 - Issue 1913

Topics (messages 137695 through 137752):

Re: Constants and Here Document Interpolation
137695 by: Danny Shepherd
137707 by: Ernest E Vogelsinger
137708 by: Daniel R. Hansen
137722 by: Ernest E Vogelsinger

Re: email pipe
137696 by: Michael Sims

Re: Get variable from PHP before submit
137697 by: Rich Gray

Re: Creating MySQL Entry Forms
137698 by: Bobby Patel

Re: Parse exec output
137699 by: Rich Gray

Re: php.ini
137700 by: Rich Gray
137727 by: Anthony Ritter
137728 by: Anthony Ritter
137732 by: Rich Gray

Re: mysql replication + mysql_pconnect
137701 by: Rich Gray

Re: Random not working?
137702 by: Rich Gray

Re: [PHP-DB] RE: [PHP] Random not working?
137703 by: Frank Keessen
137704 by: Dennis Cole

Re: [PHP-DB] Making Join
137705 by: Daniel Harik
137706 by: Daniel Harik

Re: Mysql Date got prob!
137709 by: Dhaval Desai

Checking Access to a directory Via a PHP/MYSQL Databace.
137710 by: Philip J. Newman
137723 by: Ernest E Vogelsinger

Re: .htpasswd and PayPal generated passwords
137711 by: Boaz Yahav

Using PHP to convert to JPEG
137712 by: Jason Paschal

Re: Restate: using php to rotate ad banners
137713 by: Joseph Bannon
137714 by: Joseph Bannon
137715 by: Joseph Bannon

2 questions !
137716 by: Vincent M.
137719 by: Greg Beaver

Stream file content to the web (possibly OT)
137717 by: Reuben D. Budiardja

Downloading via FTP in parts
137718 by: Siddharth

Upper and lower case.
137720 by: Philip J. Newman
137721 by: Philip J. Newman
137738 by: John W. Holmes

Calendar
137724 by: Jason D. Williard
137726 by: Darren Young

More Apache than PHP
137725 by: Timothy Hitchens \(HiTCHO\)
137748 by: Jason Sheets

A few questions...
137729 by: The Head Sage
137730 by: Ernest E Vogelsinger

Re: Checking for HTTP:// at the start of a string and more 
137731 by: Kris Jones
137734 by: Ernest E Vogelsinger

stripslashes()
137733 by: Dade Register
137735 by: Ernest E Vogelsinger
137736 by: Dade Register
137737 by: Ernest E Vogelsinger
137743 by: Dade Register
137745 by: Ernest E Vogelsinger
137746 by: Dade Register
137747 by: Ernest E Vogelsinger

Re: PHP Project for a newbie (me) or for hire?
137739 by: David T-G

Garbage at beginning of uploaded Text File
137740 by: Monty
137741 by: John W. Holmes
137744 by: Monty

Fusebox  PHP 4.3.1 on AIX
137742 by: CDitty

A JS problem
137749 by: Dade Register
137750 by: John W. Holmes

PHP scripts and the GPL/other licenses
137751 by: Jeff Lewis
137752 by: Leif K-Brooks

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---
Hello,

It doesn't look like it - a note in the constants manual entry reads:

PHP has no way of recognizing the constant from any other string of
characters within the heredoc block

Danny.

-Original Message-
From: Daniel R. Hansen [mailto:[EMAIL PROTECTED] 
Sent: 01 March 2003 15:57
To: [EMAIL PROTECTED]

Can anyone tell me if it is possible (and how) to use defined constants
within here document content?  I've not been successful finding anything
on this in the online docs.

Thanks!

Dan



---End Message---
---BeginMessage---
At 16:56 01.03.2003, Daniel R. Hansen said:
[snip]
Can anyone tell me if it is possible (and how) to use defined constants
within here document content?  I've not been successful finding anything
on this in the online docs.
[snip] 

You simply could have tried it - it's trivial.

The answer: no, you cannot have a constant within a string, be it heredoc
or quoted. A constant must always reside on native code level.

However you can easily concatenate strings and heredocs - both of the
examples below work correctly:

define('A_CONSTANT', 1);
$text1 = EOT
This heredoc text contains the constant A_CONSTANT (
EOT
. A_CONSTANT .  EOT
) outside the heredoc construct...
EOT;

$text2 = This quoted text contains the constant A_CONSTANT ( .
 A_CONSTANT .
 ) outside the string quotes...;
echo $text1br /$text2;

Output:
This heredoc text contains the constant A_CONSTANT (1) outside the heredoc
construct...
This quoted text contains the constant A_CONSTANT (1) outside the string
quotes...


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



Re: [PHP] PHP scripts and the GPL/other licenses

2003-03-01 Thread Jason Sheets
I generally use the BSD license for my code and PHP scripts, in some
cases I have used the GPL but IMHO the GPL is too restricting so I live
what I preach and release my code under the BSD License.

As far as people stealing code and renaming it I've seen several
commercial programs that are simply an open source or free software app
with spyware renamed, not a whole lot you can do without taking legal
action.

Jason
On Sat, 2003-03-01 at 21:26, Jeff Lewis wrote:
 I am wondering if anyone out there has some really good references in
 regards to scripts distributed as open source using the GPL. In the last
 three years that I have worked on open source projects I have seen several
 people steal a program, change the name and then try to distribute it as
 something else.
 
 So I am wondering what people here prefer to use for a license, is there
 anyway to combat these kinds of people, etc.
 
 Why do I ask now? Because it has happened again, only this time, the person
 is actively marketing this new script.
 
 Jeff
 
 
 
 -- 
 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 scripts and the GPL/other licenses

2003-03-01 Thread Jeff Lewis
And they aren't, that is our main issue...

So with the GPL, someone can change say...10 lines and rename the scripts
and distribute it as their own?

Jeff
- Original Message -
From: Leif K-Brooks [EMAIL PROTECTED]
To: Jeff Lewis [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Saturday, March 01, 2003 11:33 PM
Subject: Re: [PHP] PHP scripts and the GPL/other licenses


 They're doing nothing wrong as long as they distribute the source under
 the GPL.

 Jeff Lewis wrote:

 I am wondering if anyone out there has some really good references in
 regards to scripts distributed as open source using the GPL. In the last
 three years that I have worked on open source projects I have seen
several
 people steal a program, change the name and then try to distribute it
as
 something else.
 
 So I am wondering what people here prefer to use for a license, is there
 anyway to combat these kinds of people, etc.
 
 Why do I ask now? Because it has happened again, only this time, the
person
 is actively marketing this new script.
 
 Jeff
 
 
 
 
 

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







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



Re: [PHP] php.ini

2003-03-01 Thread Anthony Ritter
Rich,
I've got five screenshots at this URL:

www.gonefishingguideservice.com/php1.htm

If you get a chance please take a look.

I got php_gd2.dll from the zipfile (see photo) and the extensions
sub-directory was not there when I installed.

Many thanks,
TR
.


Rich Gray:
 You said in your earlier post that in your php.ini your extension_dir is
set
 to C:\PHP\ - this is wrong it should be c:/php/extensions
 If the extensions directory was not there and you had to create it
manually
 then where did you get the php_gd2.dll from?
 The extensions sub-directory should be there for a normal installation -
did
 you install from zip?

 Rich


---
[This E-mail scanned for viruses by gonefishingguideservice.com]


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



Re: [PHP] PHP scripts and the GPL/other licenses

2003-03-01 Thread Leif K-Brooks
Yes.  Just look at Linux, and its many distributions.  Most have changed 
more than 10 lines, but I don't believe the GPL says how much must be 
changed.

Jeff Lewis wrote:

So with the GPL, someone can change say...10 lines and rename the scripts
and distribute it as their own?
--
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


[PHP] Date question

2003-03-01 Thread Sebastian
Greetings all.

I have used strtotime() function in the past, and done this:

if($time = strtotime('24 hours ago')) {
$new = new!;
}

with it being in UNIX time stamp .. But now I have a different client where
the time stamp in mysql is formatted like:
2002-08-29 10:53:09

what function would I use in this case, date() ? If so, how would I do the
same exact thing?

thanks.

warm regards,
Sebastian - [BBR] Gaming Clan
http://www.broadbandreports.com


[PHP] Re: 2 questions !

2003-03-01 Thread Vincent M.
Greg Beaver wrote:
Vincent M. [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hello,

I didn't find in the doc how to:
 - Know the full path of the current directory. Like /var/www/to/the/path


try using dirname(__FILE__) or dirname($_SERVER['PATH_TRANSLATED'])

dirname($_SERVER['PATH_TRANSLATED'])is good for me.

How can I know all these variables, for example, now I need to know the 
upload_max_filesize ! And later, for sure, I will have to know another 
config option of the server...wich can be access by such variable.
How to know all these variable ?

Thanks.

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


RE: [PHP] Date question

2003-03-01 Thread John W. Holmes
 I have used strtotime() function in the past, and done this:
 
 if($time = strtotime('24 hours ago')) {
 $new = new!;
 }
 
 with it being in UNIX time stamp .. But now I have a different client
 where
 the time stamp in mysql is formatted like:
 2002-08-29 10:53:09
 
 what function would I use in this case, date() ? If so, how would I do
the
 same exact thing?

SELECT column - INTERVAL 24 HOUR FROM your_table WHERE ...

---John W. Holmes...

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



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



[PHP] What ?

2003-03-01 Thread Vincent M.
Hello,

I am the bus stop boy. The business I was talking about is an php 
gallery editor. You can see mine in action here:
  My photos of Montreal:
http://www.siova.net/photos/index.php?type=mtlimg=mtl_diapo=0pref_size=512version=2
  My photos of Toulouse, the city I was born in:
http://www.siova.net/photos/index.php?type=tseimg=tse_diapo=0pref_size=512version=2

Translation for better browsing:
Voir l'image suivante - See the next image
Voir l'image précédante - See the forward image
Chargement de l'image en cours...Veuillez patienter - Loading image 
in progress...Please wait

Have you ever seen such a good gallere browser ?
And look at my future concurent:
http://www.photopost.com/
See photopost in action:
http://www.fordf150.net/photopost
Another future concurent:
http://www.imagefolio.com
That's it at this time.

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


[PHP] authentication question...

2003-03-01 Thread Sunfire
hi
basic question about www-authenticate header...(least i hop its simple)
i have the code:
?php
header(WWW-Authenticate: basic realm='a realm');
header(HTTP/1.0 402 Unauthorized);//dont understand
//what this line does
echo you didnt login yet\n; //understand it but want
//something else like a header sent out...
dont understand what the second line is for and was wondering if that third
line that someone gets when you hit cancel can be turned into another
header? or is there a way to force a header block even if output has already
been put on the screen?














---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.458 / Virus Database: 257 - Release Date: 2/24/2003


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



Re: [PHP] Date question

2003-03-01 Thread Sebastian
sorry, I do not see how that will work. I need a function that will know if
2002-08-29 10:53:09 was 24 hours ago, and if true, new will appear.

warm regards,
Sebastian - [BBR] Gaming Clan
http://www.broadbandreports.com

- Original Message -
From: John W. Holmes [EMAIL PROTECTED]
To: 'Sebastian' [EMAIL PROTECTED]; 'php list'
[EMAIL PROTECTED]
Sent: Sunday, March 02, 2003 12:40 AM
Subject: RE: [PHP] Date question

|
| SELECT column - INTERVAL 24 HOUR FROM your_table WHERE ...
|
| ---John W. Holmes...

- Original Message -
From: John W. Holmes [EMAIL PROTECTED]
To: 'Sebastian' [EMAIL PROTECTED]; 'php list'
[EMAIL PROTECTED]
Sent: Sunday, March 02, 2003 12:40 AM
Subject: RE: [PHP] Date question


|  I have used strtotime() function in the past, and done this:
| 
|  if($time = strtotime('24 hours ago')) {
|  $new = new!;
|  }
| 
|  with it being in UNIX time stamp .. But now I have a different client
|  where
|  the time stamp in mysql is formatted like:
|  2002-08-29 10:53:09
| 
|  what function would I use in this case, date() ? If so, how would I do
| the
|  same exact thing?



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



Re: [PHP] Date question

2003-03-01 Thread Tom Rogers
Hi,

Sunday, March 2, 2003, 3:39:37 PM, you wrote:
S Greetings all.

S I have used strtotime() function in the past, and done this:

if($time = strtotime('24 hours ago')) {
S $new = new!;
S }

S with it being in UNIX time stamp .. But now I have a different client where
S the time stamp in mysql is formatted like:
S 2002-08-29 10:53:09

S what function would I use in this case, date() ? If so, how would I do the
S same exact thing?

S thanks.

S warm regards,
S Sebastian - [BBR] Gaming Clan
S http://www.broadbandreports.com

you can do if(strtotime($mysq_timestamp) = strtotime('24 hours ago')) {

strtotime can take a mysql timestamp directly I think

-- 
regards,
Tom


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



[PHP] File problem - PHP Quest

2003-03-01 Thread Monil Chheda
Hi,

I have a problem in grabbing data from a file.

I need to fetch data from raw log files and display it
in a proper tabular manner.

The log file contains:

AWSTATS DATA FILE 5.0 (build 1.345)
# If you remove this file, all statistics for date
2002-12 will be lost/reset.
# Position (offset in bytes) in this file of beginning
of each section
# for direct I/O access. If you made changes somewhere
in this file, you
# should also remove completely the MAP section
(AWStats will rewrite it
# at next update).
BEGIN_MAP 23
POS_GENERAL 1602  
POS_PAGEREFS 4060
POS_SEARCHWORDS 5537
POS_KEYWORDS 5769
POS_ERRORS 5916
POS_SIDER_404 6040
POS_EMAILSENDER 
POS_EMAILRECEIVER 
END_MAP

BEGIN_GENERAL 8
LastLine 20030101041055
FirstTime 20021201004812
LastTime 20021231204118
LastUpdate 20030101044540 392 0 391 0 1
TotalVisits 279 
TotalUnique 221 
MonthHostsKnown 0   
MonthHostsUnknown 258 
END_GENERAL

~~

I need the contents between BEGIN_MAP and END_MAP to
be displayed on the browser.
But I need each word seperate in a tabular form. For
Example on the browser it should display:

LOG DETAILS No.Of.Results.
POS_SEARCHWORDS 5537
POS_KEYWORDS5769

--

I am using the following script: But it doesnot work.
Kindly help me.

?php

if(!($myfile = fopen(test.txt,r)))
{
echo File $myfile could not be opened;
exit;
}
else
{
echo $myfile Opened;
exit;
}

while (!foef($myfile))
{
if(eregi(BEGIN_KEYWORDS))
{
while(eregi(END_KEYWORDS))
{
$myline = fgets($myfile,255);
echo $myline;
}
}
}

?


Thank you.

Best Regards,
Monil Chheda

+91-22-5699 1887
+91-22-2820 4125
+09821405705
http://www.eliteral.com
http://order.eliteral.com
http://domains.eliteral.com
http://services.eliteral.com


=
Best Regards,
Monil Chheda(INDIA)
http://domains.eliteral.com
===
===

__
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



[PHP] PHP SQL Code

2003-03-01 Thread Philip J. Newman
I would like yo show the users in a list that have a date that is more than
60 days old.


$sql = SELECT * FROM stompers WHERE sUpdated 
from_unixtime(unix_timestamp(now())-(15760*60)) AND sActive = 'Y' ORDER BY
sUpdated DESC;

This don't quite work ..

Any suggestions?


--
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]

+64 (9) 576 9491
+64 021-048-3999

--
Friends are like stars
You can't allways see them,
but they are always there.

--
Websites:

PhilipNZ.com - Design.
http://www.philipnz.com/
[EMAIL PROTECTED]

Philip's Domain // Internet Project.
http://www.philipsdomain.com/
[EMAIL PROTECTED]

Vital Kiwi / NEWMAN.NET.NZ.
http://www.newman.net.nz/
[EMAIL PROTECTED]



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



[PHP] Just to ask knowledgable ppl

2003-03-01 Thread Jason Paschal
Not directly PHP related, but I'm building a site in PHP at the moment, so 
I've been doing a bit of research...
I've been on the net for years, coding and surfing and coding.  And not 
always in that order. ;)  But only recently have I heard about web beacons, 
or single-pixel gifs.  Seems every site with these beacons mentions them in 
their privacy policy.  Shows you how much I pay to attention to them.  I was 
just curious as to how they work.  Is it just a matter of viewing server 
reports to see how often that image has been accessed?





_
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


[PHP] More Apache than PHP

2003-03-01 Thread Timothy Hitchens \(HiTCHO\)
Greetings All...

Usually I am helping others on the list but this time I am asking for
help!!

I was wondering if someone could offer some clarity for me as
my years of using Apache has never seen the following as a possibility.

Background: This server is using PHP along with Apache

If a server (entire box) was I/O bound and wasn't coping with the load
then
would Apache simple close the connection (I think this) or serve a 404
error.

The reason for asking this is not that I have gone Mad but that a
consulting firm is trying to tell us that our server is I/O bound
and serving 404 errors.  I just can't see how.

Thanks to all.


Timothy Hitchens (HiTCHO)
Web Application Consulting
e-mail: [EMAIL PROTECTED]


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



[PHP] Re: [PHP-I18N] addslashes(): Is it multi-byte safe?

2003-03-01 Thread Moriyoshi Koizumi
Jean-Christian Imbeault [EMAIL PROTECTED] wrote:

 Is addslashes() multi-byte safe?
 
 I will bu sing it to escape multi-byte input and wouldn't want it to 
 mangle anything...

Partially yes.

Strings encoded in GB2312(CP936), big5, Shift_JIS are known to be 
clobbered by addslashes().

UTF-8, EUC-JP, EUC-KR, EUC-CN and EUC-TW are not affected.

Moriyoshi


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



[PHP] Re: [PHP-I18N] addslashes(): Is it multi-byte safe?

2003-03-01 Thread Jean-Christian Imbeault
Moriyoshi Koizumi wrote:
Partially yes.

Strings encoded in GB2312(CP936), big5, Shift_JIS are known to be 
clobbered by addslashes().
Sh*t ... and I just added a whole bunch of addslashes() to my code to 
prevent SQL attacks. And of course my web pages are for Japanese ... and 
most of them will be using SJIS.

If I have internal_encoding set to EUC-JP does that mean that all POST 
or GET vars passed in will be translated to EUC-Jp and hence my 
addslahes will be fine?

I sure hope so ...

Jc

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


[PHP] Re: [PHP-I18N] addslashes(): Is it multi-byte safe?

2003-03-01 Thread Moriyoshi Koizumi
Jean-Christian Imbeault [EMAIL PROTECTED] wrote:

 Moriyoshi Koizumi wrote:
  
  Partially yes.
  
  Strings encoded in GB2312(CP936), big5, Shift_JIS are known to be 
  clobbered by addslashes().
 
 Sh*t ... and I just added a whole bunch of addslashes() to my code to 
 prevent SQL attacks. And of course my web pages are for Japanese ... and 
 most of them will be using SJIS.
 
 If I have internal_encoding set to EUC-JP does that mean that all POST 
 or GET vars passed in will be translated to EUC-Jp and hence my 
 addslahes will be fine?

That's the case as long as the browser precisely sends form contents as 
EUC-JP encoded strings and no automagical encoding conversion is performed 
there by mbstring module (I mean output_handler=mb_output_handler in ini 
settings). Then you have to prepare the page contents to be encoded in 
EUC-JP.

But it's very probable that clients send form contents in UTF-8 when GET 
method is used..

Moriyoshi


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



[PHP] Re: [PHP-DB] Random not working?

2003-03-01 Thread Doug Thompson
This recent thread from the mysql list explains a lot about the
problem.
http://lists.mysql.com/cgi-ez/ezmlm-cgi?1:mss:15034


hth,
Doug

On Sat, 1 Mar 2003 12:24:57 +0100, Frank Keessen wrote:

Hi All,

I'm trying to get a random record each time this script runs; Only it's giving me 
everytime the first record back.. No random at all..

// generate and execute query
$query = SELECT stedenid, naamstad, stadomschrijvk FROM steden ORDER BY RAND() LIMIT 
1;
$result = mysql_query($query) or die (Error in query: $query.  . mysql_error());
$row = mysql_fetch_object($result);
echo $row-naamstad;


Version info;

PHP 4.3.1
Mysql 3.23.54 

When i'm trying to excute the SELECT statement in phpmyadmin; i'm only getting the 
first record back and when i'm taking off the LIMIT 1 it will display all the records 
in ascending order so also not in random..


Regards,

Frank









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



[PHP] addslashes(): Is it multi-byte safe?

2003-03-01 Thread Jean-Christian Imbeault
Is addslashes() multi-byte safe?

I will bu sing it to escape multi-byte input and wouldn't want it to 
mangle anything...

Thanks,

Jc

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


[PHP] Random not working?

2003-03-01 Thread Frank Keessen
Hi All,

I'm trying to get a random record each time this script runs; Only it's giving me 
everytime the first record back.. No random at all..

// generate and execute query
$query = SELECT stedenid, naamstad, stadomschrijvk FROM steden ORDER BY RAND() LIMIT 
1;
$result = mysql_query($query) or die (Error in query: $query.  . mysql_error());
$row = mysql_fetch_object($result);
echo $row-naamstad;


Version info;

PHP 4.3.1
Mysql 3.23.54 

When i'm trying to excute the SELECT statement in phpmyadmin; i'm only getting the 
first record back and when i'm taking off the LIMIT 1 it will display all the records 
in ascending order so also not in random..


Regards,

Frank







RE: [PHP] Random not working?

2003-03-01 Thread Rich Gray
 Hi All,

 I'm trying to get a random record each time this script runs;
 Only it's giving me everytime the first record back.. No random at all..

 // generate and execute query
 $query = SELECT stedenid, naamstad, stadomschrijvk FROM steden
 ORDER BY RAND() LIMIT 1;
 $result = mysql_query($query) or die (Error in query: $query. 
 . mysql_error());
 $row = mysql_fetch_object($result);
 echo $row-naamstad;


 Version info;

 PHP 4.3.1
 Mysql 3.23.54

 When i'm trying to excute the SELECT statement in phpmyadmin; i'm
 only getting the first record back and when i'm taking off the
 LIMIT 1 it will display all the records in ascending order so
 also not in random..


 Regards,

 Frank


Frank

This really belongs on the MySQL list but there was a known issue with
RAND() on 3.23.54 - can you upgrade? If your table has an auto_increment ID
column then a workaround would be to use rand() in PHP to generate a random
ID then use that with a 'where id = '.$id in your query...

HTH
Rich


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



[PHP] Re: [PHP-DB] RE: [PHP] Random not working?

2003-03-01 Thread Frank Keessen
Thanks guys for the info; I will speak to my ISP!

Have a nice weekend!

Regards,

Frank
- Original Message -
From: Rich Gray [EMAIL PROTECTED]
To: Frank Keessen [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Sunday, March 02, 2003 2:36 AM
Subject: [PHP-DB] RE: [PHP] Random not working?


  Hi All,
 
  I'm trying to get a random record each time this script runs;
  Only it's giving me everytime the first record back.. No random at all..
 
  // generate and execute query
  $query = SELECT stedenid, naamstad, stadomschrijvk FROM steden
  ORDER BY RAND() LIMIT 1;
  $result = mysql_query($query) or die (Error in query: $query. 
  . mysql_error());
  $row = mysql_fetch_object($result);
  echo $row-naamstad;
 
 
  Version info;
 
  PHP 4.3.1
  Mysql 3.23.54
 
  When i'm trying to excute the SELECT statement in phpmyadmin; i'm
  only getting the first record back and when i'm taking off the
  LIMIT 1 it will display all the records in ascending order so
  also not in random..
 
 
  Regards,
 
  Frank


 Frank

 This really belongs on the MySQL list but there was a known issue with
 RAND() on 3.23.54 - can you upgrade? If your table has an auto_increment
ID
 column then a workaround would be to use rand() in PHP to generate a
random
 ID then use that with a 'where id = '.$id in your query...

 HTH
 Rich


 --
 PHP Database 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: [PHP-DB] RE: [PHP] Random not working?

2003-03-01 Thread Dennis Cole
You might try getting the random number before the query.

-Original Message-
From: Rich Gray [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 01, 2003 8:37 PM
To: Frank Keessen; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] RE: [PHP] Random not working?


 Hi All,

 I'm trying to get a random record each time this script runs;
 Only it's giving me everytime the first record back.. No random at all..

 // generate and execute query
 $query = SELECT stedenid, naamstad, stadomschrijvk FROM steden
 ORDER BY RAND() LIMIT 1;
 $result = mysql_query($query) or die (Error in query: $query. 
 . mysql_error());
 $row = mysql_fetch_object($result);
 echo $row-naamstad;


 Version info;

 PHP 4.3.1
 Mysql 3.23.54

 When i'm trying to excute the SELECT statement in phpmyadmin; i'm
 only getting the first record back and when i'm taking off the
 LIMIT 1 it will display all the records in ascending order so
 also not in random..


 Regards,

 Frank


Frank

This really belongs on the MySQL list but there was a known issue with
RAND() on 3.23.54 - can you upgrade? If your table has an auto_increment ID
column then a workaround would be to use rand() in PHP to generate a random
ID then use that with a 'where id = '.$id in your query...

HTH
Rich


-- 
PHP Database 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: [PHP-DB] Making Join

2003-03-01 Thread Daniel Harik
Mark wrote:

 
 --- Daniel Harik [EMAIL PROTECTED] wrote:
   Hello,
  
   I have 2 tables users table, that stores user info, and photos
 table,
   i want to select all users with one photo form photos table,
 but i don't
   want it to be photos * users = result.
  
   Is there way to do it?
  
  Assuming you mean, you have a table called user_info and another
 called
  photos and each of them has a common element AND there must be a
 photo for
  the user then you could use this sort of select...
  
  select user_info.name, photo.image from user_info, photo where
 user_info.id
  = photo.user_id
  
  The above will not display anything if there are no matching id
 to user_id
  so if one of your users didn't have a photo they would not get
 displayed.
  Also, if a user had more than one photo they would all be
 displayed.
  
  If your users are expected to have one and only one photo then
 you may
 want
  get rid of the photo table and just put the photo in the user
 table.
  
  HTH
 
 
 Thank You for your reply, but the problem is that users may have
 many
 photos, and i need to get only one, i use folllowing sql:
 SELECT users.username, photos.file FROM users left join photos on
 users.id=photos.userid
 
 
 And i get:
 
  username file
 dan  9a2de085e456e78ed66f079572638ff3.jpg
 dan  852d28e6fa730f6d29d69aacd1059ae7.jpg
 dan  672df2f16e89e3dc92ff74e3a0fa4b4f.jpg
 dan  8bae6f20ed6e12ba1c86d04b8ebc9e1f.jpg
 dan  7de9d2db2b2096cfc3f072f8c15a9e50.jpg
 404  f474a8ee5965f0a792e5b626fb30c2cd.jpg
 404  3acd391cf7abafa032c5e3b21eb7b322.jpg
 404  4e5df8cfa4bce5dd30c1166b8a86fa23.jpg
 Bedman  NULL
 
 but i want only 3 users from this join, not 3x3=9
 
 If you only want the users, and not the photos, then the previous
 post should do what you want. But if you also want the photo, and
 there's more than one photoo for a user, how will the code know which
 photo you want? Do you want a random photo from each user? The last
 photo from each user? The first?
 
 Mark

Random is fine

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



[PHP] Re: [PHP-DB] Making Join

2003-03-01 Thread Daniel Harik
Paul Burney wrote:

 on 2/28/03 3:15 PM, Daniel Harik at [EMAIL PROTECTED] appended the
 following bits to my mbox:
 
 Thank You for your reply, but the problem is that users may have many
 photos, and i need to get only one, i use folllowing sql:
 SELECT users.username, photos.file FROM users left join photos on
 users.id=photos.userid
 
 And i get:
 
 username file
 dan  9a2de085e456e78ed66f079572638ff3.jpg
 dan  852d28e6fa730f6d29d69aacd1059ae7.jpg
 dan  672df2f16e89e3dc92ff74e3a0fa4b4f.jpg
 dan  8bae6f20ed6e12ba1c86d04b8ebc9e1f.jpg
 dan  7de9d2db2b2096cfc3f072f8c15a9e50.jpg
 404  f474a8ee5965f0a792e5b626fb30c2cd.jpg
 404  3acd391cf7abafa032c5e3b21eb7b322.jpg
 404  4e5df8cfa4bce5dd30c1166b8a86fa23.jpg
 Bedman  NULL
 
 but i want only 3 users from this join, not 3x3=9
 
 So you just want the users who have pictures, but not all the pictures for
 each?  Something like:
 
 SELECT count(*) AS num_photos, username FROM photos LEFT JOIN users ON
 photos.userid=users.id GROUP BY userid
 
 You could add the file field in there as well, but it would only be
 returning one of the files (the first or last one for that user, but I
 don't know of a way for you to be specific).
 
 Hope that helps.
 
 Sincerely,
 


Thank You, group by users.id did the trick, but now i have another
problem, i want to select users with no photo as well, all with same
sql statment, so far i have 

SELECT users.id, users.gender, users.year, users.month, users.day, 
users.username, users.city, users.country, users.feet, users.inches, 
users.cm, users.openingLine, profiles.bodyType, profiles.ethnic, 
profiles.smoke, profiles.drink, profiles.children, profiles.religion, 
profiles.moment, photos.file FROM users,profiles, photos WHERE 
users.id=profiles.userid GROUP BY users.id

It works fine selecting random photo for user, but doesn't select users
with no photos.

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



[PHP] Re: [PHP-I18N] addslashes(): Is it multi-byte safe?

2003-03-01 Thread Jean-Christian Imbeault
From an email. Reposting to to list for thos who might have the same 
question later on :)

Moriyoshi Koizumi wrote:

 Oops, I should have said mbstring.encoding_translation=on actually :)
Ok. Turning that on.

In which case I am safe :) But then again anyone who would want to try
an SQL injection attack might try and send some SJIS ... better safe
than sorry :)


 It took some minutes to sort out what you're saying here.. By the word
 clients I meant browsers and there I was trying to mention a case that
 some browsers that have certain settings try to send GET queries in 
UTF-8
 while such queries are basically supposed to be encoded in the same
 encoding as that the page is written in.

Sorry if my intentions were not clear but I am trying to protect myself 
from SQL injection attacks by using addslashes() to user provided 
information. I cannot assume anything about the incoming data (not even 
the encoding) since anyone trying to hack my machine by using such a 
technique could pretty much send whatever they wanted using a telnet 
session or what not ...

 Anyway, Shift_JIS is not a great choice for PHP scripting.

Tell me about it. I have the hardest time getting the people who 
actually make the HTML page to use EUC instead of SJIS. Of course they 
all use MS platforms to create the HTML content so they can't understand 
why SJIS causes me pain when I try and edit it in *NIX box or parse it 
in PHP ...

Thanks for  the info!

Jc

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