[PHP] show something

2002-02-05 Thread val petruchek

Hello, list!

I've php script that works for seveeral minutes (3-5) - it indexes my site
and when page is indexed it echoes a one-row table (page bla.bla.bla
indexed). But browser shows it only when it gets all the page.

I want it to show line by line... I know it can be done in perl
(www.tracert.com)

How can this be done in php: sending to a browser parts of html generated?

Valentin Petruchek (aki Zliy Pes)
*** Cut the beginning ***
http://zliypes.com.ua
mailto:[EMAIL PROTECTED]




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




Re: [PHP] mysql fails

2002-02-05 Thread val petruchek

> Suppress the error message:
> $result = @mysql_query("sql statement",$db);

DL Neil, thank you: INSERT IGNORE is exactly what i need. You helped me
greatly!

Matt, thaks you for help too, but my non-perfect english doesn't allow me to
express my thoughts correctly.

Thanks!

Valentin Petruchek (aki Zliy Pes)
*** Cut the beginning ***
http://zliypes.com.ua
mailto:[EMAIL PROTECTED]




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




[PHP] Sessions and Classes

2002-02-05 Thread PHP-List

What is the proper way to transfer class properties through-out my pages...

let's say i have a ShoppingCart Class and i have methods like
addToCart(id, qty) and deleteFromCart(id)
also i have properties like CartItems("id" => array(), "qty"=> array())

this is what i do...

//when the user enters my site, i do some...
-
if (!session_is_registered("myCart")){
$myCart = new ShoppingCart();
 (some other stuffs...)
session_register("myCart");
}
else {
$myCart = new ShoppingCart();
}

--
if the object in the session is not present
i would create an instance and then register 
it to the session.
else if it is present, i would just reconstruct it...
because if i don't, even though it is in the 
sessions, the properties and methods are 
not constructed (no handler, i don't know how 
to call it).

my code works, but is there any other way
to do this, because i think it's kinda slow 

another question, is it ok to have a database-driven
shopping cart? i make use of the database to as the 
actual cart holder?


i need your opinions on these


thanks!



Brian Feliciano
---

i lost my connection to the list for a while, so
i have never heard your answers, please post it again or
email it to me directly..

thanks...



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



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




[PHP] Mysql

2002-02-05 Thread Roman Duriancik

Pleae help me !

I need delete record from table user.mysql in mysql database, i log on in
mysql like root and I log on on linux server like root. But when I write
command : delete from user where user=''; mysql send me error message :
ERROR 1036 Table 'user; is read only !
Thans for you helps...

roman




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




Re: [PHP] Checkboxe problem

2002-02-05 Thread Mike Maltese

just use iseet();

if(isset($private)){
//do stuff
}
- Original Message -
From: "Gaylen Fraley" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 05, 2002 8:41 PM
Subject: [PHP] Checkboxe problem


> I have a form with 1 checkbox and have coded it like this:
>
> 
>
> When the form is submitted, $HTTP_POST_VARS[private] only exists IF
checkbox
> is checked.  It doesn't exist otherwise, which is causing a problem
because
> there are several other elements before and after.  What happens is the
> value AFTER "private" is actually populating "private" if "private" is
empty
> (not checked).  I am, no doubt, missing something small, but critical
here.
> Can someone point out the error of my ways and explain how to get the
> checkbox key/value pair into the post vars array when the value is not
> checked?
>
> TIA,
>
> --
> Gaylen
> PHP KISGB v3.22 Guest Book http://www.gaylenandmargie.com/phpwebsite/
>
>
>
>
> --
> 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] Fw: why !^ in email?

2002-02-05 Thread nina


- Original Message -
From: "YY" <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Wednesday, February 06, 2002 1:29 PM
Subject: why !^ in email?


> why appear !^ in email when I send HTML email with mail() function? It
works
> w/ those HTML codes, but I've no idea why there are some "!" signs appear
in
> the email. Can anyone help?
>
>
>


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




[PHP] Re: Using strings in switches

2002-02-05 Thread Justin Garrett

Try it.

But to answer your question, yes.  Don't forget to put quotes around your
strings in the case statements.

switch($name){
case "beesly":
break;
}


"Phantom" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> The manual shows that you can use switches with numeric values but is it
> also possible to use strings?  Is this possible?  If not, what can I
> do?  Just a bunch of if statements?
>
>  if (isset($Name)) {
>  switch ($Name)
>  case Homer Simpson:
>  echo "DO'H";
>  break;
>  case Fred Flinstone:
>  echo "Yabba Dabba Do";
>  break;
>   default:
>echo "Do not know you";
>break;
>  }
>  }
> ?>
>



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




[PHP] Using strings in switches

2002-02-05 Thread phantom

The manual shows that you can use switches with numeric values but is it
also possible to use strings?  Is this possible?  If not, what can I
do?  Just a bunch of if statements?

";
 break;
 case Fred Flinstone:
 echo "Yabba Dabba Do";
 break;
  default:
   echo "Do not know you";
   break;
 }
 }
?>


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




RE: [PHP] Checkboxe problem

2002-02-05 Thread Niklas Lampén

There is no way. How would you then know if the checkbox was checked or
not?
I use 'em like this

and then check if $private is "myValue" or not.

If you really have to get some data thru, use hidden inputs.


Niklas


-Original Message-
From: Gaylen Fraley [mailto:[EMAIL PROTECTED]] 
Sent: 6. helmikuuta 2002 6:41
To: [EMAIL PROTECTED]
Subject: [PHP] Checkboxe problem


I have a form with 1 checkbox and have coded it like this:



When the form is submitted, $HTTP_POST_VARS[private] only exists IF
checkbox is checked.  It doesn't exist otherwise, which is causing a
problem because there are several other elements before and after.  What
happens is the value AFTER "private" is actually populating "private" if
"private" is empty (not checked).  I am, no doubt, missing something
small, but critical here. Can someone point out the error of my ways and
explain how to get the checkbox key/value pair into the post vars array
when the value is not checked?

TIA,

--
Gaylen
PHP KISGB v3.22 Guest Book http://www.gaylenandmargie.com/phpwebsite/




-- 
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] breaking out of two loops

2002-02-05 Thread Lars Torben Wilson

On Mon, 2002-02-04 at 20:19, Daniel Grace wrote:
> "Lars Torben Wilson" <[EMAIL PROTECTED]> wrote in message

> >
> > From the manual:
> >
> >break accepts an optional numeric argument which tells it how
> >many nested enclosing structures are to be broken out of
> >
> > You can find this at http://www.php.net/break (which will take you
> > to http://www.php.net/manual/en/control-structures.break.php).
> >
> >
> > Hope this helps,
> >
> > Torben
> 
> That being said, break only breaks out of looping constructs. A break placed
> within an if-block will break out of the loop around it. There isn't a
> direct way to break out of an if-block alone (if that's your intent), though
> this will work:

Not true, as break works on switch() as well; switch() would be fairly
useless without it. :) You are correct that it does not consider an if()
block to be an enclosing loop, though. 


Torben

> do {
> if(condition) {
> ...
> ...
> ...
> break;
> }
> } while(0);
> 
> -- Daniel Grace

-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


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




[PHP] Checkboxe problem

2002-02-05 Thread Gaylen Fraley

I have a form with 1 checkbox and have coded it like this:



When the form is submitted, $HTTP_POST_VARS[private] only exists IF checkbox
is checked.  It doesn't exist otherwise, which is causing a problem because
there are several other elements before and after.  What happens is the
value AFTER "private" is actually populating "private" if "private" is empty
(not checked).  I am, no doubt, missing something small, but critical here.
Can someone point out the error of my ways and explain how to get the
checkbox key/value pair into the post vars array when the value is not
checked?

TIA,

--
Gaylen
PHP KISGB v3.22 Guest Book http://www.gaylenandmargie.com/phpwebsite/




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




Re: [PHP] Convert 24hr to 12hr

2002-02-05 Thread Lars Torben Wilson

On Tue, 2002-02-05 at 18:44, Gary wrote:
> Hello All,
>   Can someone please RTFM me so I can convert MySQL 24 hour time to 12 
> hour time.
> TIA
> gary

Use MySQL's date_format() function with the %r specifier in your query:

  shanna% mysql 
  Reading table information for completion of table and column names
  You can turn off this feature to get a quicker startup with -A
  
  Welcome to the MySQL monitor.  Commands end with ; or \g.
  Your MySQL connection id is 2401 to server version: 3.22.32-log
  
  Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
  
  mysql> select date_format(now(), '%T');
  +--+
  | date_format(now(), '%T') |
  +--+
  | 20:17:30 |
  +--+
  1 row in set (0.00 sec)
  
  mysql> select date_format(now(), '%r');
  +--+
  | date_format(now(), '%r') |
  +--+
  | 08:17:39 PM  |
  +--+
  1 row in set (0.00 sec)
  
  mysql> quit
  Bye
  
  shanna% 

This is documented at:

  http://www.mysql.com/doc/D/a/Date_and_time_functions.html

Your query would then be something like the following, assuming a table
named my_table and a date/time column named my_column:

  select date_format(my_column, '%r') from my_table

Alternatively, select the date as a timestamp and feed it to strftime():

  http://www.php.net/strftime


Hope this helps,

Torben


-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


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




Re: [PHP] << Previous n Articles

2002-02-05 Thread Jason Wong

On Wednesday 06 February 2002 12:02, jtjohnston wrote:
> Jason,
>
> I'm not ssure I follow.
> $offset is the number i read in in my 
> $limit is the number displayed.
> $num_rows is the number of rows in my database.

Correct.


> What are you doing with $previous? $previous would be my string, not the
> previous offset?
> Could you show me again?

OK, you're stepping through your results and displaying $limit number of 
records each time. 

$offset holds your current place inside that set of results. 

To get to your next set of results you're adding $limit to $offset each time.

So how do you get the previous set of results? Subtract $limit from $offset!


> > > if(!$offset)
> > > {
> > > $offset = 0;
> > > }
> > > $limit = 5;
> > > $num_rows = 13;#I get this from a mysql operation
> > >
> > > #
> > > $new_offset = $offset + $limit;
> > > $disp = $limit;
> > > if ($new_offset + $limit > $num_rows)
> > > {
> > >   $disp = $num_rows - $new_offset;
> > > }
> > > if ($disp > 0)
> > > {
> > >   $nextinsert  = "  >
> > HREF=\"index.html?offset=".$new_offset."\">Next ".$disp." Articles
> > >>\n";
> >
> > > }
> >
> > Something like:
> >
> >   $previous = $offset - $limit;
> >   if ($previous < 0) { $previous = 0; }
> >
> > then incorporate $previous into your previous link in a similar fashion
> > to the next link.



-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
A fail-safe circuit will destroy others.
-- Klipstein
*/

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




Re: [PHP] << Previous n Articles

2002-02-05 Thread jtjohnston

Jason,

I'm not ssure I follow.
$offset is the number i read in in my 
$limit is the number displayed.
$num_rows is the number of rows in my database.

What are you doing with $previous? $previous would be my string, not the
previous offset?
Could you show me again?

> > if(!$offset)
> > {
> > $offset = 0;
> > }
> > $limit = 5;
> > $num_rows = 13;#I get this from a mysql operation
> >
> > #
> > $new_offset = $offset + $limit;
> > $disp = $limit;
> > if ($new_offset + $limit > $num_rows)
> > {
> >   $disp = $num_rows - $new_offset;
> > }
> > if ($disp > 0)
> > {
> >   $nextinsert  = "  HREF=\"index.html?offset=".$new_offset."\">Next ".$disp." Articles
> >>\n";
> > }
> >
>
> Something like:
>
>   $previous = $offset - $limit;
>   if ($previous < 0) { $previous = 0; }
>
> then incorporate $previous into your previous link in a similar fashion to
> the next link.


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




Re: [PHP] << Previous n Articles

2002-02-05 Thread Jason Wong

On Wednesday 06 February 2002 09:59, jtjohnston wrote:
> I'm using this code to create a "Next n Articles >>" on my index.page
> from my mysql database.
> I worked most of it out myself. Then I got some help. It works. I
> thought I understood my own code enough to be able to construct a "<<
> Previous n Articles". I guess not. My coding skills need help.
> So how do I reverse my code to construct the previous n articles from my
> sql database.
>
> if(!$offset)
> {
> $offset = 0;
> }
> $limit = 5;
> $num_rows = 13;#I get this from a mysql operation
>
> #
> $new_offset = $offset + $limit;
> $disp = $limit;
> if ($new_offset + $limit > $num_rows)
> {
>   $disp = $num_rows - $new_offset;
> }
> if ($disp > 0)
> {
>   $nextinsert  = "  HREF=\"index.html?offset=".$new_offset."\">Next ".$disp." Articles
> >>\n";
> }
>

Something like: 

  $previous = $offset - $limit;
  if ($previous < 0) { $previous = 0; }

then incorporate $previous into your previous link in a similar fashion to 
the next link.


hth


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Random, n.:
As in number, predictable.  As in memory access, unpredictable.
*/

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




[PHP] Convert 24hr to 12hr

2002-02-05 Thread Gary

Hello All,
  Can someone please RTFM me so I can convert MySQL 24 hour time to 12 
hour time.
TIA
gary


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




[PHP] modDb Contribution

2002-02-05 Thread Vincent - D. Ertner

Hi PHPers,

in late 2001 I had a customer that was interested in a kind of
universal (my)SQL module for PHPNuke / phpWebsite. Thus I ordered the
development and - as fair as life is - the customer went straight into
bankruptcy.

Now I have a first beta of "modDb" - as we call it - and almost no
need to push it further. At least - kind fellows - the programmers
offered to do some additional work on modDb.

Now ... to keep a long story short ... which is the best way to bring
this to a kind of happy end? Where could I contribute it? On the one
hand I would love to contribute it under GPL - on the other hand it
cost something ...

Please let me in on your thoughts about this matter! Thanx in advance
...

-- 
Cheers,

Vince

 '''
 ô¿ô
  -


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




[PHP] autoindex

2002-02-05 Thread jtjohnston

I want to reset the autoindex in a mysql table using php if I can.
I found this. Can anyone help?

http://www.mysql.com/doc/m/y/myisamchk_other_options.html

J


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




[PHP] Re: Dynamic Dropdown menu question.

2002-02-05 Thread jtjohnston

Michael,
I think you're trying to kill yourself coding. here's what I do for myself:


Select Someone
EM."\">".$mydata->FirstName."
".$mydata->LastName."\n";
 }

mysql_close($myconnection);
?>



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




[PHP] << Previous n Articles

2002-02-05 Thread jtjohnston

I'm using this code to create a "Next n Articles >>" on my index.page
from my mysql database.
I worked most of it out myself. Then I got some help. It works. I
thought I understood my own code enough to be able to construct a "<<
Previous n Articles". I guess not. My coding skills need help.
So how do I reverse my code to construct the previous n articles from my
sql database.

if(!$offset)
{
$offset = 0;
}
$limit = 5;
$num_rows = 13;#I get this from a mysql operation

#
$new_offset = $offset + $limit;
$disp = $limit;
if ($new_offset + $limit > $num_rows)
{
  $disp = $num_rows - $new_offset;
}
if ($disp > 0)
{
  $nextinsert  = " Next ".$disp." Articles
>>\n";
}

 Thanks if you have a second.

John


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




[PHP] RePOST: Sessions and Classes

2002-02-05 Thread PHP-List

What is the proper way to transfer class properties through-out my pages...

let's say i have a ShoppingCart Class and i have methods like
addToCart(id, qty) and deleteFromCart(id)
also i have properties like CartItems("id" => array(), "qty"=> array())

this is what i do...

//when the user enters my site, i do some...
-
if (!session_is_registered("myCart")){
$myCart = new ShoppingCart();
 (some other stuffs...)
session_register("myCart");
}
else {
$myCart = new ShoppingCart();
}

--
if the object in the session is not present
i would create an instance and then register 
it to the session.
else if it is present, i would just reconstruct it...
because if i don't, even though it is in the 
sessions, the properties and methods are 
not constructed (no handler, i don't know how 
to call it).

my code works, but is there any other way
to do this, because i think it's kinda slow 

another question, is it ok to have a database-driven
shopping cart? i make use of the database to as the 
actual cart holder?


i need your opinions on these


thanks!



Brian Feliciano
---

i lost my connection to the list for a while, so
i have never heard your answers, please post it again or
email it to me directly..

thanks...



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




Re: [PHP] date(), time() different to system time

2002-02-05 Thread Anth Courtney

On Tue, 5 Feb 2002, DL Neil wrote:

Hello DL,

> =some of the better-looking amongst us are not guys (and then some of us are...)

Sorry! :)

> Check out the meaning of "EST".
> Sixteen hours behind NSW, Australian time would make it New York time wouldn't it?

*trumpet fanfare*

Thanks for that. Problem is now fixed after adjusting the system time so
that it is /now/ correct.

cheers,
Anth

--
  Anth Courtney - Systems Administrator / Programmer
[EMAIL PROTECTED] - PLANET NETCOM - www.pnc.com.au
--




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




Re: [PHP] Dynamic Dropdown menu question.

2002-02-05 Thread bvr


Lose the single quotes, quoting a single variable is nonsense.

Quotes are used to define strings, it is a feature (called substitution)
of PHP that allows you to use a variable within a string.

The reason it doesn't work is that this subtitution is only performed on
strings enclosed in "'s (double quotes).

bvr.

On Tue, 05 Feb 2002 17:23:06 -0700, Michael O'Neal wrote:
>if ($job_id == '$my_job_id') {
>
>echo " selected ";
>} 
>




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




Re: [PHP] Dynamic Dropdown menu question.

2002-02-05 Thread Jeff Sheltren

Hi, looking at your sql statement, it seems like you are always setting 
my_job_id and job_id to the same value for each row in the table.  "select 
job_id AS my_job_id" is just putting the value of job_id in a variable 
called my_job_id.  Could you tell us the structure of your mysql table please?

Jeff

At 05:23 PM 2/5/2002 -0700, Michael O'Neal wrote:
>Hi.
>
>I'm working on an "edit" page where the pull down menu is populated from a
>database.  I can't figure out how to print "selected" when that particular
>record is the one associated with the current ID.  Can anyone help?
>
>Here's my current code:
>
>
>
>
>include("common.inc");
>
>
>$connection = @mysql_connect("$db_host","$db_user","$db_pass") or
>die("Couldn't Connect.");
>$db = @mysql_select_db($db_name, $connection) or die("Couldn't select
>database.");
>
>
>$sql ="SELECT job_id,category,description,job_id AS my_job_id FROM
>$cat_table_name";
>$result = @mysql_query($sql, $connection) or die("Error #". mysql_errno() .
>": " . mysql_error());
>
>while ($row = mysql_fetch_array($result)) {
>
>$job_id=$row['job_id'];
>$category=$row['category'];
>$description=$row['description'];
>$my_job_id=$row['my_job_id'];
>
>
>echo "
> if ($job_id == '$my_job_id') {
>
> echo " selected ";
> }
>
>echo " >$title";
>
>
>}
>
>$num = @mysql_num_rows($result);
>
>
>?>
>
>
>
>This is about the 5th iteration of this menu I've been working on.  If
>anyone has any ideas, please email me at [EMAIL PROTECTED] as I am on the
>digest.
>
>Thanks,
>
>mto
>
>--
>
>Michael O'Neal
>Web Producer
>-
>  M   A   N   G   O
>B  O  U  L  D  E  R
>-
>http://www.thinkmango.com
>e- [EMAIL PROTECTED]
>p- 303.442.1821
>f- 303.938.8507
>
>
>
>--
>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] Dynamic Dropdown menu question.

2002-02-05 Thread Lars Torben Wilson

On Tue, 2002-02-05 at 16:23, Michael O'Neal wrote:
> Hi.
> 
> I'm working on an "edit" page where the pull down menu is populated from a
> database.  I can't figure out how to print "selected" when that particular
> record is the one associated with the current ID.  Can anyone help?
> 
> Here's my current code:
> 
> 
> 
>  
> include("common.inc");
> 
> 
> $connection = @mysql_connect("$db_host","$db_user","$db_pass") or

This isn't your problem, but you do not really need to quote the above
variables.

> die("Couldn't Connect.");
> $db = @mysql_select_db($db_name, $connection) or die("Couldn't select
> database.");
> 
> 
> $sql ="SELECT job_id,category,description,job_id AS my_job_id FROM
> $cat_table_name";
> $result = @mysql_query($sql, $connection) or die("Error #". mysql_errno() .
> ": " . mysql_error());
> 
> while ($row = mysql_fetch_array($result)) {
> 
> $job_id=$row['job_id'];
> $category=$row['category'];
> $description=$row['description'];
> $my_job_id=$row['my_job_id'];
> 
> 
> echo " 
> if ($job_id == '$my_job_id') {
 
 
This is your problem: remove the quotes. PHP does not interpolate 
single-quoted strings:

http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single

[snip]


Hope this helps,

Torben

> -- 
> 
> Michael O'Neal
> Web Producer
-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


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




[PHP] Dynamic Dropdown menu question.

2002-02-05 Thread Michael O'Neal

Hi.

I'm working on an "edit" page where the pull down menu is populated from a
database.  I can't figure out how to print "selected" when that particular
record is the one associated with the current ID.  Can anyone help?

Here's my current code:



$title";


}

$num = @mysql_num_rows($result);


?>



This is about the 5th iteration of this menu I've been working on.  If
anyone has any ideas, please email me at [EMAIL PROTECTED] as I am on the
digest.

Thanks,

mto

-- 

Michael O'Neal
Web Producer
-
 M   A   N   G   O
B  O  U  L  D  E  R
-
http://www.thinkmango.com
e- [EMAIL PROTECTED]
p- 303.442.1821
f- 303.938.8507



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




[PHP] safe mode/mkdir problem - HELP!

2002-02-05 Thread Roberto P.Martins Jr

Hello!

I'm trying to create a directory, let's say: /some/dir. My script
(create_dir.cgi) is located at the cgi-bin directory and begins with
#!/usr/bin/php. So it's like any other script, isn't it?

The problem is: running php in safe mode with the script permissions:

rwxr-xr-x   8   rootroot1234 Nov 14 12:28 create_dir.cgi

I got:
Warning:  MkDir failed (Permission denied) in
/var/www/cgi-bin/create_dir.cgi on line xxx

When executing the instruction: mkdir('/some/dir', 0755);

But /some permissions are:

drwxr-xr-x8 root root 4096 Nov 14 12:28 /some

Running in safe mode, I thought that I could use mkdir() to create it,
because the ownerships are the same! Am I wrong? Safe mode only give
access when the ownerships are the same.

When I change the ownership to /some
to the uid/gid apache is running (apache(48)/apache(48)), I get:

Warning:  SAFE MODE Restriction in effect.  The script whose uid is 0 is
not allowed to access /some/dir owned by uid 48 in
/var/www/cgi-bin/create_dir.cgi on line xxx

And another doubt is: running my script as a cgi, with the php binary
outside the webserver tree, it runs like any other script (as written in
the manual). I should be able to run it is setuid flags and get complete
access, but even in this case the uid/gid that my script runs is always
the webserver process uid/gid (apache/apache)

I'm running RedHat Linux 7.2 with apache 1.3.22 and php 4.0.6. The php
package includes the php apache module and the php binary.

Thanks in advance,
Roberto

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




Re: [PHP] How do I keep form inputs from being cleared - Please Help!

2002-02-05 Thread Miles Thompson


http://www.thickbook.com
choose  the tutorial for a form with custom error messages.

Miles Thompson

At 06:40 PM 2/5/2002 -0500, SpamSucks86 wrote:
>I have a registration form and if a user enters bad information and the
>php script generates an error, I want the user to be able to hit back
>and have his inputs still there. Most websites I've ever used do this,
>but for some reason, my form loses all its data when the back button is
>pushed. This doesn't seem like something unique to PHP, but I thought
>maybe you guys could shed some light. Maybe a header which instructs the
>browser to cache it? Btw, I plan on having the script reprint the form
>with the old values anyway, but for reference I'd really like to know
>because I haven't been able to figure it out. Thanks for any help! =)
>
>-Me


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




Re: [PHP] date(), time() different to system time

2002-02-05 Thread DL Neil

Hey Anth,

> Hey guys,

=some of the better-looking amongst us are not guys (and then some of us are...)

> I'm running a RH7.2 box with apache 1.3.20 installed and php-4.1.1
> installed as a DSO.
>
> Everything is working fine, except that the output from any date() or
> time() references is 16 hours behind the system time (and hwtime) on the
> machine.
>
> The machine gets its time from an ntp server which is correct; this setup
> is similar for other boxes on the network which have no problems with the
> date or time in php being correct.
>
> If I output date('T') then the correct timezone (EST...I'm in Aus) is
> displayed, but any time or dates are 16 hours behind.
>
> Where does php read the time/date values from? Is there something I can
> tweak or something that I should look at to correct this? I know I could
> kludge around it in users php code by tacking an extra 16 hours onto each
> value but obviously that's not a good solution for a box which will be
> used by others!
>
> Any thoughts / headsup would be appreciated.


Check out the meaning of "EST".
Sixteen hours behind NSW, Australian time would make it New York time wouldn't it?

Rather than the three-character codes, check out the +or- settings in the date 
functions to check that you
and your server are in the same time zone.

=dn



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




Re: [PHP] Problem...header already sent by

2002-02-05 Thread Ryan F. Bayhonan

Hello again Peter,

I describe my reply below.

> I must run it as Apache module.  Can someone tell me how do I change
> the setting to run as an APACHE module instead?

I'll be replying to this question in a Windows Operating System setting. You
have 2 option in installing PHP as in Win OS, either to use the executable
installer less than 1MB file size or to use the zip file almost 4MB file
size (I recommend to use the zip file installer since its more complete
interms of modules and othre dlls).

Unzipped the zip file into any directory you want then just read and follow
the instruction found on the install.txt file. The install.txt file also
indicated how to install PHP as a module on Apache, a minor changes on the
httpd.conf must be made. The install.txt file will tell you how.

Until then

Regards,

Ryan F. Bayhonan


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




[PHP] How do I keep form inputs from being cleared - Please Help!

2002-02-05 Thread SpamSucks86

I have a registration form and if a user enters bad information and the
php script generates an error, I want the user to be able to hit back
and have his inputs still there. Most websites I've ever used do this,
but for some reason, my form loses all its data when the back button is
pushed. This doesn't seem like something unique to PHP, but I thought
maybe you guys could shed some light. Maybe a header which instructs the
browser to cache it? Btw, I plan on having the script reprint the form
with the old values anyway, but for reference I'd really like to know
because I haven't been able to figure it out. Thanks for any help! =)
 
-Me



Re: [PHP] MySQL selecting the maximum value from a column

2002-02-05 Thread Lars Torben Wilson

On Tue, 2002-02-05 at 15:12, Melanie Gann wrote:
> Thank you all you listeners out there. I'll try to be respectful of your
> time and patience, and apoligize in advance for my "greeness" - I am 2
> weeks into PHP/MySQL.
> 
> I am trying to select the higest value from the column Thought_Num below.
> But it returns nothing. 
> 
>  $db = mysql_connect("localhost", "root");
> mysql_select_db("DynaSite",$db);
> $result = mysql_query("SELECT MAX(Thought_Num) FROM quotes",$db);
> $myrow = mysql_fetch_array($result);
> print "the result is $myrow[Thought_Num]";
> ?>
> 
> If I change my select to something that without the MAX (e.g. Select from
> quotes where DocID=1), the code works fine. 
> 
> Thanks in advance for your help.

Essentially, your problem here is that your query 'SELECT
MAX(Thought_Num) FROM quotes' will return a column named
'MAX(Though_Num)'--so you either need to do this:

   print "the result is $myrow[MAX(Thought_Num)]";

Or, much preferably, explicitly name the column in the query:

   SELECT max(Thought_Num) as Thought_Num FROM QUOTES

...and then access it as you had before.
 
> Regards,
> Melanie


Hope this helps,

Torben


-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


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




RE: [PHP] Can anyone jog my memory on HTTP_REFERER & Javascript "location:replace"?

2002-02-05 Thread Lazor, Ed

If I understand what I think you're asking, you're trying to access the
results in Javascript of something the PHP script processed... use your php
script to spit out some javascript.  For example:

print "\n";
print "$Result = ".$Results.";\n";
print "";



-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 04, 2002 2:09 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Can anyone jog my memory on HTTP_REFERER & Javascript
"location:replace"?


Hi!

I had found a way around the problem and it work, but when I enabled the
web security features, it messed up.  So, with some debugging and I found
the problem and I'm not sure how to find a way around it.  You see 

I use page1.php to do certain features but the problem is that PHP
execution get done before the file (non-PHP programming) in passthru('...')
get done later.  So, I can't get the result before PHP finish executing.
There, I came up with the Javascript where the non-PHP scripting can spit
out the Javascript code and the Javascript take care of it.  It work so
well.  To my dismay, the PHP pick up the HTTP_REFERER doesn't work because
HTTP_REFERER was all blank when Javascript use "location.replace('');" code.
So, it messed up the webpage.  Is there a way to get the HTTP_REFERER code?
Or a different Javascript code?  I mean there's no way to get the PHP
execution to pause while the non-PHP programming get done first.  Is there?

Thanks,
 Scott



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

This message is intended for the sole use of the individual and entity to
whom it is addressed, and may contain information that is privileged,
confidential and exempt from disclosure under applicable law.  If you are
not the intended addressee, nor authorized to receive for the intended
addressee, you are hereby notified that you may not use, copy, disclose or
distribute to anyone the message or any information contained in the
message.  If you have received this message in error, please immediately
advise the sender by reply email and delete the message.  Thank you very
much.   

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




RE: [PHP] MySQL selecting the maximum value from a column

2002-02-05 Thread Martin Towell

what happens if you do this?

$result = mysql_query("SELECT MAX(Thought_Num) as Thought_Num FROM
quotes",$db);

I'm thinking that the column name in your original query is being called
"MAX(Thought_Num)" and not "Thought_Num".

Martin

-Original Message-
From: Melanie Gann [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 06, 2002 10:12 AM
To: [EMAIL PROTECTED]
Subject: [PHP] MySQL selecting the maximum value from a column


Thank you all you listeners out there. I'll try to be respectful of your
time and patience, and apoligize in advance for my "greeness" - I am 2
weeks into PHP/MySQL.

I am trying to select the higest value from the column Thought_Num below.
But it returns nothing. 



If I change my select to something that without the MAX (e.g. Select from
quotes where DocID=1), the code works fine. 

Thanks in advance for your help.

Regards,
Melanie


Second Street Web Design
http://www.second-street.com



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



[PHP] MySQL selecting the maximum value from a column

2002-02-05 Thread Melanie Gann

Thank you all you listeners out there. I'll try to be respectful of your
time and patience, and apoligize in advance for my "greeness" - I am 2
weeks into PHP/MySQL.

I am trying to select the higest value from the column Thought_Num below.
But it returns nothing. 



If I change my select to something that without the MAX (e.g. Select from
quotes where DocID=1), the code works fine. 

Thanks in advance for your help.

Regards,
Melanie


Second Street Web Design
http://www.second-street.com



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




RE: [PHP] How do I display variables in text boxes when the value of a drop down menu changes?

2002-02-05 Thread Martin Towell

to "access" php var in javascript, you'll need to set up javascript vars
with the values of the php vars you want to use.

eg.



  alert(foobar);  // will display nothing - not set yet
  foobar = "";
  alert(foobar);  // now will display "testing"


remember, to get the vars back to php, you'll need to make a request to the
server using one of serveral methods

hope that helps
Martin

-Original Message-
From: Don [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 06, 2002 9:00 AM
To: php list
Subject: [PHP] How do I display variables in text boxes when the value
of a drop down menu changes?


Hi,

I have a PHP script that displays a form.  On one section of the form, there
is a drop down menu followed by a few text boxes.  I'd like to alter the
values of the text boxes when the user changes the selection in the dropdown
menu.

What I've done is create 10 arrays (the drop down menu has 10 items hence
one array per item).  Each time the user changes the selection in the drop
down menu, I figure I'd:

a) save the current variables to the array corfresponding to the old
selection
b) fill the text boxes with vales of the array corresponding to the new
selection

Is this possible using PHP?  I figure that since PHP is server side, I will
have to use JavaScript to provide some of the functionality I require but
how do I set and access PHP variables from JavaScript?

If the above is not workable, Is there another way I can accomplish this?

Thanks in advance,
Don



[PHP] date(), time() different to system time

2002-02-05 Thread Anth Courtney

Hey guys,

I'm running a RH7.2 box with apache 1.3.20 installed and php-4.1.1
installed as a DSO.

Everything is working fine, except that the output from any date() or
time() references is 16 hours behind the system time (and hwtime) on the
machine.

The machine gets its time from an ntp server which is correct; this setup
is similar for other boxes on the network which have no problems with the
date or time in php being correct.

If I output date('T') then the correct timezone (EST...I'm in Aus) is
displayed, but any time or dates are 16 hours behind.

Where does php read the time/date values from? Is there something I can
tweak or something that I should look at to correct this? I know I could
kludge around it in users php code by tacking an extra 16 hours onto each
value but obviously that's not a good solution for a box which will be
used by others!

Any thoughts / headsup would be appreciated.

cheers,
Anth

--
  Anth Courtney - Systems Administrator / Programmer
[EMAIL PROTECTED] - PLANET NETCOM - www.pnc.com.au
--




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




[PHP] Re: Books on PHP

2002-02-05 Thread Manuel Lemos

Hello,

Ronald D Wahlen wrote:
> 
> Hello,
> 
> I am new to PHP and was wondering if anyone can point me the right direction
> with
> PHP urls and books to learn how to develop web sites using PHP. I read some
> of the information on www.php.net web site and have the PHP Bible.

Look here for a long list of books with some reviewed.

http://phpclasses.UpperDesign.com/products.html

Regards,
Manuel Lemos

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




[PHP] How do I display variables in text boxes when the value of a drop down menu changes?

2002-02-05 Thread Don

Hi,

I have a PHP script that displays a form.  On one section of the form, there is a drop 
down menu followed by a few text boxes.  I'd like to alter the values of the text 
boxes when the user changes the selection in the dropdown menu.

What I've done is create 10 arrays (the drop down menu has 10 items hence one array 
per item).  Each time the user changes the selection in the drop down menu, I figure 
I'd:

a) save the current variables to the array corfresponding to the old selection
b) fill the text boxes with vales of the array corresponding to the new selection

Is this possible using PHP?  I figure that since PHP is server side, I will have to 
use JavaScript to provide some of the functionality I require but how do I set and 
access PHP variables from JavaScript?

If the above is not workable, Is there another way I can accomplish this?

Thanks in advance,
Don



[PHP] mktime() problem

2002-02-05 Thread toni baker

How can I make sure the user enters a date in format
mm/dd/ and the date must be between the year 1600
and 2038.

The script below meets the criterion above, except
mktime() or strtotime() does not validate year 1600
dates.  Any suggestions?  Thanks
 
$dateparts = explode('/', $Date);
$month = $dateparts[0];
$day = $dateparts[1];
$year = $dateparts[2];
$date1 = date ("m/d/Y", mktime
(0,0,0,$month,$day,$year));
if (!$Date) {
  $submit = 0;
  $Date = "Date Required";
}
elseif (!checkdate($month,$day,$year)) {
  $submit = 0;
  $Date = "Invalid Date";
}
elseif ($Date != $date1) {
  $submit = 0;
  $Date = "Invalid Date";
}
elseif ($year < 1600 || $year > 2030) {
  $submit = 0;
  $Date = "Invalid Date";
}  

  

__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

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




Re: [PHP] Re: Changes in Sessions (PHP Versions)

2002-02-05 Thread Yasuo Ohgaki

Trun off "register_globals", then it should work with track vars.

--
Yasuo Ohgaki

Travis Simpson wrote:
> Hey,
> 
> I changed it from:
> 
> $HTTP_SESSION_VARS["$key"] = $value;
> 
> To:
> 
> session_register("$key");
> $key = $value;
> 
> And now it works fine.
> 
> At first, when I wrote the $key = $value... It made no sense... I was
> just doing it because I didn't know what else to try. And it actually
> works ;) I figured it would set the variable $key to the value of
> $value. But it didn't. It created a new variable. Naming it the value of
> $key. And giving that new variable the value of $value.
> 
> Does this confuse anybody else?? ;)
> 
> Thanks for all your help,
> -Travis


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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




[PHP] RE: 72dpi with gdlibrary2?

2002-02-05 Thread Andrew Chase

IANAGE (I Am Not A GD Expert), but as far as I know the GD functions dealing
with image size don't concern themselves with the resolution of an image in
terms of dots per inch, just with the number of pixels.

Since most uses of the GD library functions in PHP will have to do with
creating/manipulating images to send to the browser, it should be safe to
assume that any image created with PHP will be 72 DPI.

If you're talking about resizing a much larger image (for instance, a 3.5
inch by 5 inch JPEG created at 300 DPI), you just need to do some math to
figure out how much to shrink it.

If your source resolution is 300 DPI and your target resolution is 72 DPI,
you need to multiply the number of pixels in the width and height of the 300
DPI original by a factor of 72/300, which equals .24.

Or to put it another way:

5 inches at 300 DPI = 1500 pixels.

5 inches at 72 DPI = 360 pixels.

1500 pixels * .24 = 360 pixels.

I hope that wasn't utterly confusing, but IANAMT (I Am Not A Math Teacher),
either. :P

You'll probably want to take a look at the imagecopyresized and
imagecopyresampled functions:

http://www.php.net/manual/en/function.imagecopyresized.php
http://www.php.net/manual/en/function.imagecopyresampled.php

(Imagecopyresampled produces much nicer results, but it's only available in
4.06 and later.)

-Andy

> -Original Message-
> From: Andy [mailto:[EMAIL PROTECTED]]
>
> I would like to create images with 72 dpi with gdlibrary2.01
>
> Is this possible?


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




Re: [PHP] Books on PHP

2002-02-05 Thread LaserJetter

I'll second that comment on the documentation with PHP.
I bought the Definitive HTML Reference a few years back as an HTML reference
because there was no single place where you could get a high quality
refernce for all the HTML, CSS and JavaScript commands.
The online documentation is pretty good, but I feel nothing can beat the
Windows HTML-Help version: Its speedy, has an excellent search and it saves
connecting to the net just to look something up.

LJ


"Kevin Stone" <[EMAIL PROTECTED]> wrote in message
01c1ae8d$8d8b8f80$6401a8c0@kevin">news:01c1ae8d$8d8b8f80$6401a8c0@kevin...
> I got started with a book called, "PHP and MySQL Web Development" by
> Luke Welling and Laura Thomson, published by SAMS.   This book is
> clearly written with the "self-taught" programmer in mind, tearing apart
> numerous real-world examples and explaining relevant concepts in depth.
> It does not go into theory or advanced topics making it a terrible book
> for the experienced programmer.  It is also not a good function
> reference.  But far as reference goes, I say forget the books.  Nothing
> can beat the function search at www.php.net.
>
> --
> Kevin Stone
> [EMAIL PROTECTED]
> www.helpelf.com
>
> > -Original Message-
> > From: Ronald D Wahlen [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, February 05, 2002 2:07 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Books on PHP
> >
> > Hello,
> >
> > I am new to PHP and was wondering if anyone can point me the right
> > direction
> > with
> > PHP urls and books to learn how to develop web sites using PHP. I read
> > some
> > of the information on www.php.net web site and have the PHP Bible.
> >
> > Thanks,
> > Ron
> >
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>



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




[PHP] Re: File Upload -- File Trailer Partial

2002-02-05 Thread Michael Kimsal

Richard Lynch wrote:
> Please Cc: me -- I can't keep up with anything like the full volume of 
> PHP-General any more and have only lurked for quite some time :-(





> I guess I'm seeking reassurance that:
> 
> A) File upload not known to be broken
> B) move_uploaded_file completely finishes and CLOSES a file before 
> returning
> 

> Here is the top bit of phpinfo():
> PHP Version 4.2.0-dev
> 

Perhaps it's because it's a 'dev' version?  Did you see this in 4.1?  Or 
below?


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




[PHP] Curl Support Not Compiling

2002-02-05 Thread Gabriel Richards

I'm trying to get PHP to compile with CURL support (on my Linux server), but
it's not working and I'm not getting an error message.

I've installed curl correctly I think. /usr/local/include/curl contains
curl.h easy.h and other header files. /usr/local/lib has libcurl.a.

I said ./configure --with-curl=/usr/local (also tried /usr/local/lib and
/usr/local/include)

No errors for ./configure, no errors for make or make install. But I get
"call to undefined function curl_init()"

Help is appreciated!

Gabe



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




Re: [PHP] whic OS is under?

2002-02-05 Thread Lars Torben Wilson

On Mon, 2002-02-04 at 05:45, Ivo Stoykov wrote:
> Hi group:
> 
> Is there a way to guess which OS the script is running? I couldn't find
> anything in the manual about this.
> 
> Thank you
> 
> Ivo

The constant PHP_OS will tell you. For a list of all currently 
defined constants, try http://www.php.net/get_defined_constants.


Hope this helps,

Torben

-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


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




[PHP] POST to SSL Server without CURL?

2002-02-05 Thread Gabriel Richards

Thank you for your very helpful guidance to this point!

My host doesn't have the CURL module installed and it is unlikely they will
do it (PHP running on NT).

Apparently I can't just fsockopen("www.ups.com", 443); ???

Is there another way?

Gabe



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




[PHP] File Upload -- File Trailer Partial

2002-02-05 Thread Richard Lynch

Please Cc: me -- I can't keep up with anything like the full volume 
of PHP-General any more and have only lurked for quite some time :-(

I'm consistently seeing file uploads get only the trailing N bytes of 
the file if the file is over a certain size.

This is on applications that worked flawlessly under previous 
versions on the "old" ISP, but I had to start using 
http://php.net/move_uploaded_file and working around/through safe 
mode on the new ISP.

The limit does *NOT* seem to be a constant, but perhaps the ISP's 
attempt to alter the File Upload Limit has affected this over time...

I guess I'm seeking reassurance that:

A) File upload not known to be broken
B) move_uploaded_file completely finishes and CLOSES a file before returning

The variance in the amount of data succesfully acquired "feels" like 
move_uploaded_file is leaving the file open, and then I fopen() it, 
and get the latter half of the file due to file-pointer cross-wiring 
or something.

Here is the top bit of phpinfo():
PHP Version 4.2.0-dev

System  OpenBSD o2 2.9 conf#0 i386
Build Date  Jan 29 2002 15:56:06
Configure Command'./configure' 
'--with-apache=../apache_1.3.22' 
'--with-config-file-path=/var/www/conf' '--enable-trans-sid' 
'--enable-ftp' '--enable-sockets' '--with-openssl' '--with-gd' 
'--with-jpeg-dir=/usr/local/lib' '--with-png-dir=/usr/local/lib' 
'--with-tiff-dir=/usr/local/lib' '--with-zlib-dir=/usr/include' 
'--with-mysql' '--with-pdflib' '--with-mcrypt' 
'--with-pgsql=/usr/local'
Server API  Apache
Virtual Directory Support   disabled
Configuration File (php.ini) Path   /var/www/conf/php.ini
ZEND_DEBUG  disabled
Thread Safety   disabled
This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.2.0, Copyright (c) 1998-2002 Zend Technologies
-- 
Got Music? http://l-i-e.com/artists.htm

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




[PHP] Re: whic OS is under?

2002-02-05 Thread LaserJetter

There is something. Its one of the enironment vars I think.  Look for UNAME
or U something.
I'm not sure if this gives the current OS or the OS on which PHP was
compiled though.



"Ivo Stoykov" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi group:
>
> Is there a way to guess which OS the script is running? I couldn't find
> anything in the manual about this.
>
> Thank you
>
> Ivo
>
>



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




RE: [PHP] Books on PHP

2002-02-05 Thread Kevin Stone

I got started with a book called, "PHP and MySQL Web Development" by
Luke Welling and Laura Thomson, published by SAMS.   This book is
clearly written with the "self-taught" programmer in mind, tearing apart
numerous real-world examples and explaining relevant concepts in depth.
It does not go into theory or advanced topics making it a terrible book
for the experienced programmer.  It is also not a good function
reference.  But far as reference goes, I say forget the books.  Nothing
can beat the function search at www.php.net.

--
Kevin Stone
[EMAIL PROTECTED]
www.helpelf.com

> -Original Message-
> From: Ronald D Wahlen [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 05, 2002 2:07 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Books on PHP
> 
> Hello,
> 
> I am new to PHP and was wondering if anyone can point me the right
> direction
> with
> PHP urls and books to learn how to develop web sites using PHP. I read
> some
> of the information on www.php.net web site and have the PHP Bible.
> 
> Thanks,
> Ron
> 
> 
> 
> 
> 
> --
> 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] Duplicate e-mails

2002-02-05 Thread Analysis and Solutions

Hi Anthony:

Anthony Rodriguez wrote:
> 
> The following php script sends two (2) e-mails to each addressee.  Why?

I'll bet the email addresses in question are listed in the table twice.  Open
up a MySQL command line prompt and enter "select * from con_inf;" to make
sure.  To keep this from happening, you can delete the duplicates then add a
unique index on the "e_mail" field in the MySQL table definition.


> $qry_1="select * from con_inf";

Side Issue 1:  why are you selecting everything (via "*") rather than just
"e_mail", since that's all you're using in the script?


> $result_1=mysql_query($qry_1,$connection) or die ("No query # 1!");
> 
> while ($row_1=mysql_fetch_array($result_1, MYSQL_ASSOC))
> 
> {
> $e_mail=$row_1["e_mail"];
> mail("$e_mail",

Side Note 2:  You can combiune those two lines into one:
   mail($row_1['e_mail'],


> mysql_free_result($result_1);
> mysql_close($connection);

Side Note 3:  You don't worry about these commands in scripts you're about to
exit anyway.

Enjoy,

--Dan

-- 
PHP scripts that make your job easier
  http://www.analysisandsolutions.com/code/
 SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409

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




[PHP] Books on PHP

2002-02-05 Thread Ronald D Wahlen

Hello,

I am new to PHP and was wondering if anyone can point me the right direction
with
PHP urls and books to learn how to develop web sites using PHP. I read some
of the information on www.php.net web site and have the PHP Bible.

Thanks,
Ron





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




[PHP] Duplicate e-mails

2002-02-05 Thread Anthony Rodriguez

The following php script sends two (2) e-mails to each addressee.  Why?

\n");
};

mysql_free_result($result_1);

mysql_close($connection);

header ("location:done.htm");

exit;

?>

Anthony Rodriguez
([EMAIL PROTECTED])


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




[PHP] Re: HowTo Send HTTP POST from Within Scrip

2002-02-05 Thread Julio Nobrega Trabalhando

  It's usually done with fsockopen();, and curl module functions for SSL
servers. There are a few classes for each method, on the most tradicional
snippets and clasess websites.

  I enjoyed using one called Snoopy. Also the manual pages comments are very
helpful (both on fsockopen(); related functions and curl module ones).

--

Julio Nobrega.

Um dia eu chego lá:
http://sourceforge.net/projects/toca

"Gabriel Richards" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi eveyone.
>
> I'm trying to build an application to interface with UPS Online Tools
> server. I have to send it an XML formatted request via HTTP POST, and I'm
> not sure how.
>
> Normally, PHP receives such requests when a user clicks a button on a form
I
> created, but how do I initiate a POST from with a script? Better yet, how
do
> I get the response?
>
> Thanks for help!
> Gabe
>
> -
> Ender Technology Corp.
> Websites, Database Applications, Hosting
> (310) 516-7411
> [EMAIL PROTECTED]
> http://www.endertechnology.com/
>
> -
> Ender Technology Corp.
> Websites, Database Applications, Hosting
> (310) 516-7411
> [EMAIL PROTECTED]
> http://www.endertechnology.com/
>
>



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




RE: [PHP] HowTo Send HTTP POST from Within Scrip

2002-02-05 Thread Johnson, Kirk

Search the archives on "PostToHost", or also go here:

http://www.zend.com/zend/spotlight/mimocsumissions.php#Heading6
http://marc.theaimsgroup.com/?l=php-general&m=92353052714384&w=2

I think if you also search on "UPS" you will find discussion of this exact
problem.

Good luck!

Kirk

> -Original Message-
> From: Gabriel Richards [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 05, 2002 12:42 PM
> To: PHP General
> Subject: [PHP] HowTo Send HTTP POST from Within Scrip
> 
> 
> Hi eveyone.
> 
> I'm trying to build an application to interface with UPS Online Tools
> server. I have to send it an XML formatted request via HTTP 
> POST, and I'm
> not sure how.
> 
> Normally, PHP receives such requests when a user clicks a 
> button on a form I
> created, but how do I initiate a POST from with a script? 
> Better yet, how do
> I get the response?
> 
> Thanks for help!
> Gabe
> 
> -
> Ender Technology Corp.
> Websites, Database Applications, Hosting
> (310) 516-7411
> [EMAIL PROTECTED]
> http://www.endertechnology.com/
> 
> -
> Ender Technology Corp.
> Websites, Database Applications, Hosting
> (310) 516-7411
> [EMAIL PROTECTED]
> http://www.endertechnology.com/
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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




RE: [PHP] Re: Changes in Sessions (PHP Versions)

2002-02-05 Thread Johnson, Kirk

This suggests that register_globals was set to 'off' in the first case and
'on' in the second case. The lines below are perfect examples of how to
change the code when changing the register_globals setting in php.ini.

Kirk

> -Original Message-
> From: Travis Simpson [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 05, 2002 12:08 PM
> To: [EMAIL PROTECTED]
> Cc: 'Yasuo Ohgaki'
> Subject: RE: [PHP] Re: Changes in Sessions (PHP Versions)
> 
> 
> Hey,
> 
> I changed it from:
> 
> $HTTP_SESSION_VARS["$key"] = $value;
> 
> To:
> 
> session_register("$key");
> $key = $value;
> 
> And now it works fine.

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




Re: [PHP] Check if var is a domain name

2002-02-05 Thread Mike Frazer

Your reg-ex wouldn't quite work.  Remember, .info, .name, .coop and other
new TLDs are out or are coming out soon.  A limit of {2,3} would rule them
all out as invalid.

It's only really possible if you have a list of all available TLDs and
compare in part to that.  There are like 130 TLDs too, so it's not the most
practical thig in the world.

Mike Frazer




"Jeff Sheltren" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi, I would use a regular expression to check it.  This is a pretty
general
> one, but I think it should do the trick.  It searches for 1 or more upper
> or lowercase letters, followed by a literal dot, followed by 2 or 3
> lowercase letters.  Of course there are valid domains that would not match
> this (foobar.co.uk) for example, but it should work with the values you
> specified.
>
> if (ereg("^[a-zA-Z]+\\.[a-z]{2,3}$", $var)) {
>  // valid domain
> }
> else{
>  // not valid
> }
>
> Jeff
>
> At 07:59 AM 2/5/2002 -0800, Brandon Orther wrote:
> >Hello,
> >
> >Does anyone know a function or how I could make a function to check a
> >variable for being a valid domain name without the "www. 
> >" In fron of it?
> >
> >Ex. $var = "mynewdomain.com"   that would be TRUE
> >
> >Ex2. $var = "www.mynewdomain.com"   that would be FALSE
> >
> >Ex3. $var = "My Great Domain"   that would be FALSE
> >
> >And so on.
> >
> >Does anyone have a function that makes sure there are no illegal
> >characters and there is a period in the middle of the text?
> >
> >
> >
> >Brandon Orther
> >WebIntellects Design/Development Manager
> >[EMAIL PROTECTED]
> >800-994-6364
> >www.webintellects.com
> >
> >
>
>



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




[PHP] Re: Links to other pages

2002-02-05 Thread Mike Frazer

You're server will only parse PHP files that come from your server's doot
cirectory or one of the virtualhost root directories, and then only when
called through the right protocol.  If you call a file directly from a drive
(in this case, F), you aren't accessing it through the server, and therefore
are not parsing the file because the server never sees it.

The reason standard HTML works that way is because HTML is browser parsed.
The browser makes the decision.  PHP is server-parsed, and then sends across
the correct headers to force the browser into printing the output as HTML or
XML or whatever is being sent.

Try changing your $CFG->dirroot to a values based on your server root or a
vhost root (for whichever site the script below is for).

Mike Frazer



"Morten Nielsen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> I have a link on my page that looks like this:
>
> $CFG->dirroot= "f:/Inetpub/wwwroot/mymarket2";
> Login
>
> The link is displayed right on my page, but when I press it a dialog box
is
> saying that I am downloading the php file and wether I want to open or
save
> it.
> Can anybody tell me what is wrong?
>
> Thanks,
> Morten
>
>



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




[PHP] HowTo Send HTTP POST from Within Scrip

2002-02-05 Thread Gabriel Richards

Hi eveyone.

I'm trying to build an application to interface with UPS Online Tools
server. I have to send it an XML formatted request via HTTP POST, and I'm
not sure how.

Normally, PHP receives such requests when a user clicks a button on a form I
created, but how do I initiate a POST from with a script? Better yet, how do
I get the response?

Thanks for help!
Gabe

-
Ender Technology Corp.
Websites, Database Applications, Hosting
(310) 516-7411
[EMAIL PROTECTED]
http://www.endertechnology.com/

-
Ender Technology Corp.
Websites, Database Applications, Hosting
(310) 516-7411
[EMAIL PROTECTED]
http://www.endertechnology.com/



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




Re: [PHP] Problem...header already sent by

2002-02-05 Thread Peter Ruan

Ryan,
   I just tried it with my Linux box and I get the authentication 
box...which is good sign.  So it looks like a PHP in MS Windows (the 
'fabulous' windows) setting which from the error.log file indicates as well.

/** error message listed in error.log **/
[Mon Feb 04 22:36:30 2002] [error] [client 127.0.0.1] malformed header 
from script. Bad header=HTTP/1.0 401 Unauthorized: /apache/php/php.exe


In looks like a setting problem in some .ini file.  Do you know how to 
correct this problem?

Thanks for the help!
-Peter






Ryan F. Bayhonan wrote:

> It will work as expected Peter.
> 
>  header ("WWW-authenticate: Basic realm=\"Private\"");
> header ("HTTP/1.0 401 Unauthorized");
> echo "Unauthorized";
> exit;
> ?>
> 
> So where do we go from here??
> 
> Ryan
> 
> 
> 


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




RE: [PHP] Easy Question -- Show/ Hide text based on output of query

2002-02-05 Thread Edward R. Bailey

Thanks for all your help, but I figured out what I did wrong

I was calling the memberNotes field using

 echo $get_detail->Fields("memberNotes") 

so when I replaced $memberNotes in the script with
$get_detail->Fields("memberNotes") it worked like a charm

 If ($get_detail->Fields("memberNotes")) {
 $notes = "Notes:";
} else {
 $notes = "";
}

Dumb error on my part. 

Thank you very much for your patience,

Ed


> -Original Message-
> From: Jason Wong [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, February 05, 2002 1:53 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Easy Question -- Show/ Hide text based on 
> output of query
> 
> 
> On Wednesday 06 February 2002 02:53, Edward R. Bailey wrote:
> > Sorry -- Here it is
> >
> >
> >   >  $notes = " > size=-1>Notes:";
> >} else {
> >  $notes = "";
> >}
> >  ?>
> >
> > Then I call $notes using --
> >
> > echo ($notes)
> 
> I meant your *whole* script -- never mind, have you tried 
> echo($memberNotes) 
> to see what that contains? Are you sure it doesn't contain 
> spaces or other 
> non-visible characters?
> 
> 
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> 
> /*
> "All language designers are arrogant.  Goes with the 
> territory..." (By Larry Wall) */
> 
> -- 
> 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] Re: Changes in Sessions (PHP Versions)

2002-02-05 Thread Travis Simpson

Hey,

I changed it from:

$HTTP_SESSION_VARS["$key"] = $value;

To:

session_register("$key");
$key = $value;

And now it works fine.

At first, when I wrote the $key = $value... It made no sense... I was
just doing it because I didn't know what else to try. And it actually
works ;) I figured it would set the variable $key to the value of
$value. But it didn't. It created a new variable. Naming it the value of
$key. And giving that new variable the value of $value.

Does this confuse anybody else?? ;)

Thanks for all your help,
-Travis

-Original Message-
From: Yasuo Ohgaki [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, February 05, 2002 2:33 AM
To: Travis Simpson
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: Changes in Sessions (PHP Versions)


If you really need to use 4.0.6, try to use different
session save handler and/or serializer. Try WDDX
serializer at first, then try verious combinations.

If you use other save handler/serializer, it may work.
I suggest you to upgrade, though...

--
Yasuo Ohgaki


Travis Simpson wrote:
> Sorry, I probably worded my question wrong.
> 
> I am creating a 10 step (or so) form that is non-linear... The user
> enters all of their information and is able to go back and change
> information that they have filled in. So I have the form (POST)
> information set into session variables as soon as they click "Next" in
> the form. Well, with 4.1.1 there were no problems... It ALL worked
> perfectly. But unfortunately, in 4.0.6 it doesn't act the same.
> 
> I just have a foreach loop go through all the POST variables and make
> them into SESSION variables,
> 
> --- Snippet ---
> start_session();
> foreach ($HTTP_POST_VARS as $key => $value) {
>   $HTTP_SESSION_VARS["$key"] = $value;
> }
> --- End Snippet ---
> 
> Easy enough... Now, I have all the 10 steps linked to on the side bar.
> Step 1
> 
> But for some weird reason, those links BLANK all the session
variables.
> I tested this by doing a count() on the HTTP_SESSION_VARS array. And
as
> soon as I click one of the Step links on the side, it clears all of
> them. I am not sure if I am doing this wrong, but it works fine (as I
> said) in 4.1.1.
> 
> Another problem that I seem to be having... Is that 4.0.6 almost seems
> like it is maxing out with a certain number of SESSION variables. Once
> it has so many, it just starts over.
> 
> I will just post the link here tomorrow, unfortunately I don't have
the
> files on this computer.
> 
> I hope this is a little more clear.
> 
> Thanks,
> -Travis
> 
> 
> 
> -Original Message-
> From: Yasuo Ohgaki [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, February 04, 2002 6:11 PM
> To: [EMAIL PROTECTED]; Travis Simpson
> Subject: [PHP] Re: Changes in Sessions (PHP Versions)
> 
> 
> Travis Simpson wrote:
> 
>>Hey,
>>
>>I am just wondering if there were any changes done to the session 
>>"engine" or settings between PHP 4.0.6 and 4.1.1.
>>
>>I have been getting nothing but grief from 4.0.6 and 4.1.1 seems to 
>>work fine.
>>
>>
> 
> 
> What did work with 4.0.6 and what didn't with 4.1.1?
> 
> If you are trying to use mm/msession save handler, it's broken
somewhat.
> 
> 


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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


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




[PHP] Links to other pages

2002-02-05 Thread Morten Nielsen

Hi,

I have a link on my page that looks like this:

$CFG->dirroot= "f:/Inetpub/wwwroot/mymarket2";
Login

The link is displayed right on my page, but when I press it a dialog box is
saying that I am downloading the php file and wether I want to open or save
it.
Can anybody tell me what is wrong?

Thanks,
Morten



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




Re: [PHP] Easy Question -- Show/ Hide text based on output of query

2002-02-05 Thread Jason Wong

On Wednesday 06 February 2002 02:53, Edward R. Bailey wrote:
> Sorry -- Here it is
>
>
>$notes = " size=-1>Notes:";
>} else {
>  $notes = "";
>}
>  ?>
>
> Then I call $notes using --
>
> echo ($notes)

I meant your *whole* script -- never mind, have you tried echo($memberNotes) 
to see what that contains? Are you sure it doesn't contain spaces or other 
non-visible characters?


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
"All language designers are arrogant.  Goes with the territory..."
(By Larry Wall)
*/

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




RE: [PHP] Easy Question -- Show/ Hide text based on output of query

2002-02-05 Thread Edward R. Bailey

Sorry -- Here it is


 Notes:";
   } else {
 $notes = "";
   }
 ?>

Then I call $notes using --

echo ($notes)

> -Original Message-
> From: Jason Wong [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, February 05, 2002 1:39 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Easy Question -- Show/ Hide text based on 
> output of query
> 
> 
> On Wednesday 06 February 2002 02:38, Edward R. Bailey wrote:
> > I used echo($notes) at the bottom of the page and the 
> output of $notes 
> > prints reardless of whether or not the db field 
> $memberNotes contains 
> > any data. It seems to me that $notes is always acting as if 
> > $memberNotes always contains data. Is their some way to 
> invoke $notes 
> > only if $memberNotes returns any data?
> 
> 
> Please post your full code.
> 
> 
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> 
> /*
> "I go on working for the same reason a hen goes on laying eggs."
> - H. L. Mencken
> */
> 
> -- 
> 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] Easy Question -- Show/ Hide text based on output of query

2002-02-05 Thread Jason Wong

On Wednesday 06 February 2002 02:38, Edward R. Bailey wrote:
> I used echo($notes) at the bottom of the page and the output of $notes
> prints reardless of whether or not the db field $memberNotes contains
> any data. It seems to me that $notes is always acting as if $memberNotes
> always contains data. Is their some way to invoke $notes only if
> $memberNotes returns any data?


Please post your full code.


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
"I go on working for the same reason a hen goes on laying eggs."
- H. L. Mencken
*/

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




RE: [PHP] Easy Question -- Show/ Hide text based on output of query

2002-02-05 Thread Edward R. Bailey

I used echo($notes) at the bottom of the page and the output of $notes
prints reardless of whether or not the db field $memberNotes contains
any data. It seems to me that $notes is always acting as if $memberNotes
always contains data. Is their some way to invoke $notes only if
$memberNotes returns any data?

Thanks for your help,
ED



> -Original Message-
> From: Jason Wong [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, February 05, 2002 1:22 PM
> To: PHP General Mailing List
> Subject: Re: [PHP] Easy Question -- Show/ Hide text based on 
> output of query
> 
> 
> On Wednesday 06 February 2002 02:14, Edward R. Bailey wrote:
> 
> Please keep the discussion on the list!
> 
> > Thanks for responding! Yes the "memberNotes" database field only 
> > contains information in about a third of the records so I wanted to 
> > hide the entire field and label when their was no relevent data.
> >
> > I made the change you suggested, but the field label does 
> not show up 
> > when "memberNotes" contains data. As follows is the current 
> script. Is 
> > what what you suggested?
> >
> >
> >  > $notes = " > size=\"/-1\"/>Notes:";
> >   } else {
> > $notes = " > size=\"/-1\"/>";
> >   }
> > ?>
> 
> What are those forward slashes (/) doing in $notes? Try 
> getting rid of them, 
> they don't look very HTML to me :)
> 
> Also try echo($notes) OUTSIDE of a  construct to see 
> what it contains.
> 
> 
> hth
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> 
> /*
> Q:What do Winnie the Pooh and John the Baptist have in common?
> A:The same middle name.
> */
> 
> -- 
> 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] Easy Question -- Show/ Hide text based on output of query

2002-02-05 Thread Jason Wong

On Wednesday 06 February 2002 02:14, Edward R. Bailey wrote:

Please keep the discussion on the list!

> Thanks for responding! Yes the "memberNotes" database field only
> contains information in about a third of the records so I wanted to hide
> the entire field and label when their was no relevent data.
>
> I made the change you suggested, but the field label does not show up
> when "memberNotes" contains data. As follows is the current script. Is
> what what you suggested?
>
>
>  $notes = " size=\"/-1\"/>Notes:";
>   } else {
> $notes = " size=\"/-1\"/>";
>   }
> ?>

What are those forward slashes (/) doing in $notes? Try getting rid of them, 
they don't look very HTML to me :)

Also try echo($notes) OUTSIDE of a  construct to see what it contains.


hth
-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Q:  What do Winnie the Pooh and John the Baptist have in common?
A:  The same middle name.
*/

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




Re: [PHP] Problem...header already sent by

2002-02-05 Thread Jason Wong

On Wednesday 06 February 2002 01:52, Peter Ruan wrote:
> Hi Jason,
>   Yeap, I ran 'phpinfo()' Server API=CGI.  I look at the manual and you are
> right, I must run it as Apache module.  Can someone tell me how do I change
> the setting to run as an APACHE module instead?

Well, you don't change the setting as such. On a Linux system you would've 
have to recompile PHP and possibly Apache as well. On a Windows system you 
would probably just download the relevant files and install.


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
linux: because a PC is a terrible thing to waste
([EMAIL PROTECTED] put this on Tshirts in '93)
*/

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




Re: [PHP] Easy Question -- Show/ Hide text based on output of query

2002-02-05 Thread Jason Wong

On Wednesday 06 February 2002 00:03, Edward R. Bailey wrote:
> Hi,
>
> I am working on a page the displays the output of a query in a table and
> I only want to show the field labels that have corresponding output from
> the database. I am only really concerned with the last label in the
> table.
>
> The label is called "Notes" and the corresponding field in the database
> is "memberNotes"
>
> So I wrote the following script where I think I am saying if memberNotes
> returns any value then print the output of $notes in the table cell
> where it is called, but nothing happens and the output of $notes is not
> displayed regardless whether "memberNotes" has any output.
>
>  Gremlins Associates -> www.gremlins.com.hk

/*
Where is John Carson now that we need him?
-- RLG
*/

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




Re: [PHP] Problem...header already sent by

2002-02-05 Thread Peter Ruan

Hi Jason,
  Yeap, I ran 'phpinfo()' Server API=CGI.  I look at the manual and you are
right, I must run it as Apache module.  Can someone tell me how do I change
the setting to run as an APACHE module instead?

Thanks,
-Peter

"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> On Tuesday 05 February 2002 15:20, Peter wrote:
> > Hi Ryan,
> >   Thanks for the examples.  Okay, I deleted the other stuff and just put
> > this code and I get this from
> > my interpreter?  Is this a setting problem?
>
>
> Are you running PHP as a CGI? If so, what you want to do cannot be done.
See
> chapter "HTTP authentication with PHP".
>
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
>
> /*
> You will triumph over your enemy.
> */



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




Re: [PHP] add value to serialized array?

2002-02-05 Thread Bas Jobsen

Hello,

OKay, when i replace the last rows with:

$fp=fopen("test.txt","r");
flock($fp,1);
$array=array_merge($array,unserialize(fread($fp,filesize("test.txt";
flock($fp,3);
fclose($fp);

it works.

But now i want to place this in a class, and it goes wrong again.

Hope you can help, thanks,

Bas
 
--
save($array);
}

}
$test= new test;

$array=$test->read();

echo $array[0].$array[1].$array[2];

$test->push($array,"three");
//$test->save($array);

$array=$test->read();

echo $array[0].$array[1].$array[2];

?>
--



Op dinsdag 05 februari 2002 12:24, schreef u:
> Hi,
>
> At start test.txt contains a serialized array with value "one" and "two".
> a:2:{i:0;s:3:"one";i:1;s:3:"two";}
> after one run this is:
> a:3:{i:0;s:3:"one";i:1;s:3:"two";i:2;s:4:"tree";}
>
> But the last row prints nothing. Why?
>
> Tnx,
>
> Bas
>
>  $array=array();
> $fp=fopen("test.txt","r");
> flock($fp,1);
> $array=unserialize(fread($fp,filesize("test.txt")));
> flock($fp,3);
> fclose($fp);
>
> array_push($array,"tree");
>
> $fp=fopen("test.txt","w+");
> flock($fp,2);
> fwrite($fp,serialize($array));
> flock($fp,3);
> fclose($fp);
>
> $fp=fopen("test.txt","r");
> flock($fp,1);
> $array=unserialize(fread($fp,filesize("test.txt")));
> flock($fp,3);
> fclose($fp);
>
> echo $array[0].$array[1].$array[2];
> ?>

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




Re: [PHP] What can I ask here?

2002-02-05 Thread Dave

Don't forget about

www.phpguru.org
www.hotscripts.com

Two other great sites for information and sample scripts.

Dave

"Jason Lotito" <[EMAIL PROTECTED]> wrote in message
037201c1ae61$b7e25a10$3b0a@JASON">news:037201c1ae61$b7e25a10$3b0a@JASON...
> You can also find good information for PHP here:
>
> www.phpdeveloper.org
> www.phpbuilder.com
> www.newbienetwork.net
> www.phpbeginner.com
> www.php.net // of course =)
> www.devshed.com
>
> Jason Lotito
> Programmer & Developer
> Clockmedia Inc.
> Designing Tomorrow's Games, Today!
> 1-877-625-6256
> 514-908-2800
> Fax: 514-908-2803
>
> - Original Message -
> From: "Girish Nath" <[EMAIL PROTECTED]>
> To: "Scott" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Tuesday, February 05, 2002 11:18 AM
> Subject: Re: [PHP] What can I ask here?
>
>
> > Hi
> >
> > You'll find the mailing list archive an excellent source of info :
> >
> > http://marc.theaimsgroup.com/?l=php-general&r=1&w=2
> >
> > Regards :)
> >
> >
> > Girish
> > --
> > www.girishnath.co.uk
> >
> >
> > - Original Message -
> > From: "Scott" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, February 05, 2002 4:07 PM
> > Subject: [PHP] What can I ask here?
> >
> >
> > Just want to make sure I am in the right forum...
> >
> > I am new to PHP and will be doing alot of coding with it in the near
> future.
> >
> > So I will be asking alot of newb questions...
> >
> > Thanks,
> >
> > Batch
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>



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




Re: [PHP] Unable to get ImageTTFText output

2002-02-05 Thread Neil Freeman

Girish,

After a bit of searching around it appears that this is a bug of early
versions of PHP, re-introduced in PHP v4.0.6 (the version I was using). I have
upgraded to 4.10 and ImageTTFText now works fine.

Neil

Girish Nath wrote:

> Hi
>
> I had similar problems when just specifying the font file in the same
> directory eg ./arial.ttf but got it to work okay when i used the full path
> eg :
>
> $fontfile = "/apache/htdocs/arial.ttf";
>
> ImageTTFText($im, 20, 0, 3, 3, $text_colour, $fontfile, "My text");
>
> Regards
>
> Girish
> --
> www.girishnath.co.uk
>
> - Original Message -
> From: "Neil Freeman" <[EMAIL PROTECTED]>
> To: "PHP General" <[EMAIL PROTECTED]>
> Sent: Tuesday, February 05, 2002 2:59 PM
> Subject: [PHP] Unable to get ImageTTFText output
>
> Hi there,
>
> I am trying to use the ImageTTFText function to output some text onto an
> existing image. Problem being though that the text does not get
> outputted. I have placed the ttf file 'arial.ttf' within the same
> directory as my script. Here is a snippet of my code:
>
> Header("Content-Type: image/png");
> $im = ImageCreateFromPNG("original_image.png");
>
> $text_colour = ImageColorAllocate($im, 255, 255, 255);
>
> ImageTTFText($im, 20, 0, 3, 3, $text_colour, "/arial.ttf", "My
> text");
>
> ImagePNG($im);
>
> All this outputs is my original PNG image (with no text). I have used
> the following line instead of ImageTTFText and all works well.
>
> ImageString($im, 4, 3, 3, "My text", $text_colour);
>
> Using phpinfo() I have checked the GD section and the following is
> outputted:
>
> GD Support - enabled
> GD Version - 2.0 or higher
> FreeType Support - enabled
> FreeType Linkage - with freetype
> JPG Support - enabled
> PNG Support - enabled
> WBMP Support - enabled
>
> Does anyone have any suggestions as to why this does not work? Has
> anyone else used the ImageTTFText function successfully?
>
> Neil
> 
>  Email:  [EMAIL PROTECTED]
>  [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
>
> ***
>  This message was virus checked with: SAVI 3.53 Jan 2002
>  last updated 30th January 2002
> ***

--

 Email:  [EMAIL PROTECTED]
 [EMAIL PROTECTED]




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




Re: [PHP] Check if var is a domain name

2002-02-05 Thread Jeff Sheltren

Hi, I would use a regular expression to check it.  This is a pretty general 
one, but I think it should do the trick.  It searches for 1 or more upper 
or lowercase letters, followed by a literal dot, followed by 2 or 3 
lowercase letters.  Of course there are valid domains that would not match 
this (foobar.co.uk) for example, but it should work with the values you 
specified.

if (ereg("^[a-zA-Z]+\\.[a-z]{2,3}$", $var)) {
 // valid domain
}
else{
 // not valid
}

Jeff

At 07:59 AM 2/5/2002 -0800, Brandon Orther wrote:
>Hello,
>
>Does anyone know a function or how I could make a function to check a
>variable for being a valid domain name without the "www. 
>" In fron of it?
>
>Ex. $var = "mynewdomain.com"   that would be TRUE
>
>Ex2. $var = "www.mynewdomain.com"   that would be FALSE
>
>Ex3. $var = "My Great Domain"   that would be FALSE
>
>And so on.
>
>Does anyone have a function that makes sure there are no illegal
>characters and there is a period in the middle of the text?
>
>
>
>Brandon Orther
>WebIntellects Design/Development Manager
>[EMAIL PROTECTED]
>800-994-6364
>www.webintellects.com
>
>



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




Re: [PHP] PHP / MYSQL security bug

2002-02-05 Thread Analysis and Solutions

Hi Folks:

Gerard Onorato wrote on the PHP-GENERAL mailing list:
> 
> Security Advisory DW020203-PHP
> Release: 3rd February 2002
> PHP Safe Mode Filesystem Circumvention Problem
>
> ... snip ...
>
> FIX
> Currently, no fix exists. 
> ... snip ...
> A suggested fix for the PHP developers might be to scan
> mysql_query()s for strings similar to "LOAD DATA LOCAL INFILE".

But they're forgetting about MySQL's permission handling.  The LOAD DATA
command can be controlled by the File_priv permission at the User level. 
Also, the Insert_priv can be regulated at many levels, including the User,
Database, table and column level.  Naturally, if one can't insert, there's no
way for them to run a LOAD DATA statement.

Enjoy,

--Dan

-- 
PHP scripts that make your job easier
  http://www.analysisandsolutions.com/code/
 SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409

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




RE: [PHP] PHP / MYSQL security bug

2002-02-05 Thread James Cox

The PHP developers are aware of this, and are working with MySQL to make it
safer.

it should be noted that PHP safe mode, whilst making the environment
generally safer, is not an easy-answer to webserver security. The only real
solution is to learn about better security and configuration.

--james

--
James Cox :: [EMAIL PROTECTED]
Was I helpful?  http://www.amazon.co.uk/exec/obidos/wishlist/23IVGHQ61RJGO/

> -Original Message-
> From: Gerard Onorato [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 05, 2002 4:00 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] PHP / MYSQL security bug
>
>
> Maybe I missed the thread but I was wondering if anyone has seen this
> report or done any testing on it.
>
> We tested it and it seems a pretty valid problem. Can anyone comment on a
> fix that may be in the works?
>
> Gerard
>
> --
> ---
> Security Advisory DW020203-PHP
> Release: 3rd February 2002
> PHP Safe Mode Filesystem Circumvention Problem
> Severity: Medium to high.
> Affects: PHP, all versions which include safe_mode feature.
> Platform: UNIX, Microsoft Windows, any platforms on which PHP is
> available.
> Vendor: http://php.net.
> Discovered: 12th January 2002, Dave Wilson <[EMAIL PROTECTED]>, using
> PHP 4.1.0 & Apache 2 on Linux.
>
> --
> 
>
> VULNERABILITY IN BRIEF
> PHP (since version 3?) includes a commonly used feature known as
> Safe Mode.
> When enabled, scripts are highly limited in their ability to access or
> execute local files, among other things.
> PHP relies on a wrapper function around all filesystem calls to perform
> access checks, but unforunately the bundled MySQL client library has not
> been modified to perform such checks on "LOAD DATA INFILE LOCAL"
> statements.
> If an attacker has access to a MySQL server (either provided by you or
> himself), he can use it as a proxy by which to download files residing on
> the safe_mode-enabled web server. For large ISPs relying on this feature
> for individual customer privacy, it could mean clients accessing each
> other's files, or viewing of files on an improperly secured server.
>
> FIX
> Currently, no fix exists. You may use other PHP safe_mode functions to
> disable the use of the MySQL client library, or secure your servers in a
> proper fashion.. A suggested fix for the PHP developers might be to scan
> mysql_query()s for strings similar to "LOAD DATA LOCAL INFILE".
> Happy hackers out there might like to look at libmysql.c:1764 if
> interested
> in fixing this problem, although that may only be possible from
> within PHP.
>
> EXAMPLE
> The attached script will (once configured correctly) attempt to read
> "/var/log/lastlog" via the SQL daemon and return it to the client.
> $ cp safe_mode.php /www
> $ wget -qO lastlog_via_mysql localhost/safe_mode.php
> $ diff /var/log/lastlog lastlog_via_mysql; echo $?
> 0
>
> COMMENTS
> Due to the nature of the PHP project, development is very rapid and hence
> many sites do not keep up with latest PHP versions. If a fix was
> available,
> it would take quite a while to propagate.
> It is likely that this is not an isolated problem in PHP, my bets are on
> PostgreSQL and other PHP database extensions missing this one too.
> The MySQL support has been enabled in PHP by default for as long as I can
> remember.
>
> DAVE WILSON
> Currently residing in Belfast, Northern Ireland, he is available for work
> relating to network security auditing, post-attack recovery and forensics,
> and penetration testing. He may be contacted at <[EMAIL PROTECTED]>. If
> you have any comments regarding this advisory, please contact him
> directly.
>
> Sun Feb 3 21:23:03 GMT 2002 -dw
>


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




Re: [PHP] What can I ask here?

2002-02-05 Thread Jason Lotito

You can also find good information for PHP here:

www.phpdeveloper.org
www.phpbuilder.com
www.newbienetwork.net
www.phpbeginner.com
www.php.net // of course =)
www.devshed.com

Jason Lotito
Programmer & Developer
Clockmedia Inc.
Designing Tomorrow's Games, Today!
1-877-625-6256
514-908-2800
Fax: 514-908-2803

- Original Message -
From: "Girish Nath" <[EMAIL PROTECTED]>
To: "Scott" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, February 05, 2002 11:18 AM
Subject: Re: [PHP] What can I ask here?


> Hi
>
> You'll find the mailing list archive an excellent source of info :
>
> http://marc.theaimsgroup.com/?l=php-general&r=1&w=2
>
> Regards :)
>
>
> Girish
> --
> www.girishnath.co.uk
>
>
> - Original Message -
> From: "Scott" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, February 05, 2002 4:07 PM
> Subject: [PHP] What can I ask here?
>
>
> Just want to make sure I am in the right forum...
>
> I am new to PHP and will be doing alot of coding with it in the near
future.
>
> So I will be asking alot of newb questions...
>
> Thanks,
>
> Batch
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




Re: [PHP] What can I ask here?

2002-02-05 Thread Girish Nath

Hi

You'll find the mailing list archive an excellent source of info :

http://marc.theaimsgroup.com/?l=php-general&r=1&w=2

Regards :)


Girish
--
www.girishnath.co.uk


- Original Message -
From: "Scott" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 05, 2002 4:07 PM
Subject: [PHP] What can I ask here?


Just want to make sure I am in the right forum...

I am new to PHP and will be doing alot of coding with it in the near future.

So I will be asking alot of newb questions...

Thanks,

Batch



--
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] What can I ask here?

2002-02-05 Thread Scott

Just want to make sure I am in the right forum...

I am new to PHP and will be doing alot of coding with it in the near future.

So I will be asking alot of newb questions...

Thanks,

Batch



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




[PHP] Check if var is a domain name

2002-02-05 Thread Brandon Orther

Hello,
 
Does anyone know a function or how I could make a function to check a
variable for being a valid domain name without the "www. 
" In fron of it?
 
Ex. $var = "mynewdomain.com"   that would be TRUE
 
Ex2. $var = "www.mynewdomain.com"   that would be FALSE
 
Ex3. $var = "My Great Domain"   that would be FALSE
 
And so on.
 
Does anyone have a function that makes sure there are no illegal
characters and there is a period in the middle of the text?
 
 
 
Brandon Orther 
WebIntellects Design/Development Manager
[EMAIL PROTECTED]
800-994-6364
www.webintellects.com

 



[PHP] Re: PHP module build problem

2002-02-05 Thread Anas Mughal

I just saw a posting on PHPBuilder that states that
Apache 1.3.14 has changed alloc.h to ap_alloc.h. So,
file renaming is suggested.

Maybe that could fix the problem. (I will give it a
try...)

I would be open to any other suggestions...

Thanks.



--- Anas Mughal <[EMAIL PROTECTED]> wrote:
> I am trying to build PHP3 into apache 1.3.
> I have vanilla PHP and Apache sources.
> When I do the final Apache 'make', I get an error
> message complaining about not able to find target
> for
> alloc.h. The 'alloc.h' file is declared as a
> dependency for 'mod_php3.o' in the Makefile in
> folder
> 'src/modules/php3'. 
> 
> Any advice would be greatly helpful.
> 
> =
> Anas Mughal
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> Tel: 973-249-6665
> 
> __
> Do You Yahoo!?
> Send FREE Valentine eCards with Yahoo! Greetings!
> http://greetings.yahoo.com
> 



=
Anas Mughal
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Tel: 973-249-6665

__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

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




[PHP] PHP / MYSQL security bug

2002-02-05 Thread Gerard Onorato

Maybe I missed the thread but I was wondering if anyone has seen this 
report or done any testing on it.

We tested it and it seems a pretty valid problem. Can anyone comment on a 
fix that may be in the works?

Gerard

-
Security Advisory DW020203-PHP
Release: 3rd February 2002
PHP Safe Mode Filesystem Circumvention Problem
Severity: Medium to high.
Affects: PHP, all versions which include safe_mode feature.
Platform: UNIX, Microsoft Windows, any platforms on which PHP is available.
Vendor: http://php.net.
Discovered: 12th January 2002, Dave Wilson <[EMAIL PROTECTED]>, using
PHP 4.1.0 & Apache 2 on Linux.

--

VULNERABILITY IN BRIEF
PHP (since version 3?) includes a commonly used feature known as Safe Mode.
When enabled, scripts are highly limited in their ability to access or
execute local files, among other things.
PHP relies on a wrapper function around all filesystem calls to perform
access checks, but unforunately the bundled MySQL client library has not
been modified to perform such checks on "LOAD DATA INFILE LOCAL"
statements.
If an attacker has access to a MySQL server (either provided by you or
himself), he can use it as a proxy by which to download files residing on
the safe_mode-enabled web server. For large ISPs relying on this feature
for individual customer privacy, it could mean clients accessing each
other's files, or viewing of files on an improperly secured server.

FIX
Currently, no fix exists. You may use other PHP safe_mode functions to
disable the use of the MySQL client library, or secure your servers in a
proper fashion.. A suggested fix for the PHP developers might be to scan
mysql_query()s for strings similar to "LOAD DATA LOCAL INFILE".
Happy hackers out there might like to look at libmysql.c:1764 if interested
in fixing this problem, although that may only be possible from within PHP.

EXAMPLE
The attached script will (once configured correctly) attempt to read
"/var/log/lastlog" via the SQL daemon and return it to the client.
$ cp safe_mode.php /www
$ wget -qO lastlog_via_mysql localhost/safe_mode.php
$ diff /var/log/lastlog lastlog_via_mysql; echo $?
0

COMMENTS
Due to the nature of the PHP project, development is very rapid and hence
many sites do not keep up with latest PHP versions. If a fix was available,
it would take quite a while to propagate.
It is likely that this is not an isolated problem in PHP, my bets are on
PostgreSQL and other PHP database extensions missing this one too.
The MySQL support has been enabled in PHP by default for as long as I can
remember.

DAVE WILSON
Currently residing in Belfast, Northern Ireland, he is available for work
relating to network security auditing, post-attack recovery and forensics,
and penetration testing. He may be contacted at <[EMAIL PROTECTED]>. If
you have any comments regarding this advisory, please contact him directly.

Sun Feb 3 21:23:03 GMT 2002 -dw



---
Outgoing mail is certified Virus Free By AVG Anti-Virus.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.319 / Virus Database: 178 - Release Date: 1/28/2002



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


[PHP] Easy Question -- Show/ Hide text based on output of query

2002-02-05 Thread Edward R. Bailey

Hi,

I am working on a page the displays the output of a query in a table and
I only want to show the field labels that have corresponding output from
the database. I am only really concerned with the last label in the
table.

The label is called "Notes" and the corresponding field in the database
is "memberNotes" 

So I wrote the following script where I think I am saying if memberNotes
returns any value then print the output of $notes in the table cell
where it is called, but nothing happens and the output of $notes is not
displayed regardless whether "memberNotes" has any output.

Notes:";
 }else {
  $notes = "";
 }
?>

In the table cell I placed the following



Can anyone see what I am doing wrong??

Thanks for the help

Ed


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




Re: [PHP] Getting variables from a text file

2002-02-05 Thread Girish Nath

Hi

It looks like a querystring, so read the contents of the file into a variable, then 
use the parse_str() function on that variable, you can specify if you want them to be 
stored in an array too.

http://www.php.net/manual/en/function.parse-str.php

Regards


Girish
--
www.girishnath.co.uk

  - Original Message - 
  From: David Orn Johannsson 
  To: [EMAIL PROTECTED] 
  Sent: Tuesday, February 05, 2002 2:50 PM
  Subject: [PHP] Getting variables from a text file


  I have this text file I have to retreve infromation from, in the fallowing format:

  date1=1/1/2002&title1=some title&headline1=some headline&full1=full 
article&date2=2/1/2002&title2=some title& and so on

   

  what would be the best thing for me to do to if I was to get the values of all the 
"variables" of the text file into a php document as variables.

   

  Regards, David

   

  

  Davíð Örn Jóhannssson

  Vefforritari

  

  Atómstöðin hf.

  Garðastræti 37

  101 Reykjavík

  

  sími: 595-3643

  fax: 595-3649

  [EMAIL PROTECTED]

  http://www.atom.is

  



   




Re: [PHP] Unable to get ImageTTFText output

2002-02-05 Thread Neil Freeman

Hi Girish. Thanks for the suggestion.

I have an Apache alias pointing to my site, along the lines of:
Alias /input "P:/Projects/data_input"

and have placed the ttf files within this directory (where the php script is
located as well). I've tried placing the ttf files in a sub-directory as well
- with no luck.

Any other ideas???

Neil


Girish Nath wrote:

> Hi
>
> I had similar problems when just specifying the font file in the same
> directory eg ./arial.ttf but got it to work okay when i used the full path
> eg :
>
> $fontfile = "/apache/htdocs/arial.ttf";
>
> ImageTTFText($im, 20, 0, 3, 3, $text_colour, $fontfile, "My text");
>
> Regards
>
> Girish
> --
> www.girishnath.co.uk
>
> - Original Message -
> From: "Neil Freeman" <[EMAIL PROTECTED]>
> To: "PHP General" <[EMAIL PROTECTED]>
> Sent: Tuesday, February 05, 2002 2:59 PM
> Subject: [PHP] Unable to get ImageTTFText output
>
> Hi there,
>
> I am trying to use the ImageTTFText function to output some text onto an
> existing image. Problem being though that the text does not get
> outputted. I have placed the ttf file 'arial.ttf' within the same
> directory as my script. Here is a snippet of my code:
>
> Header("Content-Type: image/png");
> $im = ImageCreateFromPNG("original_image.png");
>
> $text_colour = ImageColorAllocate($im, 255, 255, 255);
>
> ImageTTFText($im, 20, 0, 3, 3, $text_colour, "/arial.ttf", "My
> text");
>
> ImagePNG($im);
>
> All this outputs is my original PNG image (with no text). I have used
> the following line instead of ImageTTFText and all works well.
>
> ImageString($im, 4, 3, 3, "My text", $text_colour);
>
> Using phpinfo() I have checked the GD section and the following is
> outputted:
>
> GD Support - enabled
> GD Version - 2.0 or higher
> FreeType Support - enabled
> FreeType Linkage - with freetype
> JPG Support - enabled
> PNG Support - enabled
> WBMP Support - enabled
>
> Does anyone have any suggestions as to why this does not work? Has
> anyone else used the ImageTTFText function successfully?
>
> Neil
> 
>  Email:  [EMAIL PROTECTED]
>  [EMAIL PROTECTED]
> 
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> ***
>  This message was virus checked with: SAVI 3.53 Jan 2002
>  last updated 30th January 2002
> ***

--

 Email:  [EMAIL PROTECTED]
 [EMAIL PROTECTED]




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




RE: [PHP] testing for cookies on the server side (again, still can't get my head around it)

2002-02-05 Thread Johnson, Kirk

> So what's the flow of code to test for cookies on the server 
> side?  I'm
> pretty sure that the only way is to set a cookie, then test for it.

That is pretty much it. On the first page request to your application, if
PHP encounters a session_start() in your code, it will return a cookie named
PHPSESSID in the response headers. So you need to look for that cookie in
the request for the *second* page. If cookies are enabled in the browser,
the browser will return the cookie in the next request. Here's some code to
put at the top of the 2nd page:



I usually make my index.php page just set up the session, etc., then do an
automatic redirect to my second page, which is the first visible page. I put
the cookie check on this second page.

Kirk

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




Re: [PHP] Unable to get ImageTTFText output

2002-02-05 Thread Girish Nath

Hi

I had similar problems when just specifying the font file in the same
directory eg ./arial.ttf but got it to work okay when i used the full path
eg :

$fontfile = "/apache/htdocs/arial.ttf";

ImageTTFText($im, 20, 0, 3, 3, $text_colour, $fontfile, "My text");

Regards


Girish
--
www.girishnath.co.uk


- Original Message -
From: "Neil Freeman" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Tuesday, February 05, 2002 2:59 PM
Subject: [PHP] Unable to get ImageTTFText output


Hi there,

I am trying to use the ImageTTFText function to output some text onto an
existing image. Problem being though that the text does not get
outputted. I have placed the ttf file 'arial.ttf' within the same
directory as my script. Here is a snippet of my code:

Header("Content-Type: image/png");
$im = ImageCreateFromPNG("original_image.png");

$text_colour = ImageColorAllocate($im, 255, 255, 255);

ImageTTFText($im, 20, 0, 3, 3, $text_colour, "/arial.ttf", "My
text");

ImagePNG($im);

All this outputs is my original PNG image (with no text). I have used
the following line instead of ImageTTFText and all works well.

ImageString($im, 4, 3, 3, "My text", $text_colour);

Using phpinfo() I have checked the GD section and the following is
outputted:

GD Support - enabled
GD Version - 2.0 or higher
FreeType Support - enabled
FreeType Linkage - with freetype
JPG Support - enabled
PNG Support - enabled
WBMP Support - enabled

Does anyone have any suggestions as to why this does not work? Has
anyone else used the ImageTTFText function successfully?

Neil

 Email:  [EMAIL PROTECTED]
 [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] PHP module build problem

2002-02-05 Thread Anas Mughal

I am trying to build PHP3 into apache 1.3.
I have vanilla PHP and Apache sources.
When I do the final Apache 'make', I get an error
message complaining about not able to find target for
alloc.h. The 'alloc.h' file is declared as a
dependency for 'mod_php3.o' in the Makefile in folder
'src/modules/php3'. 

Any advice would be greatly helpful.

=
Anas Mughal
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Tel: 973-249-6665

__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

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




[PHP] Mysql

2002-02-05 Thread Roman Duriancik

Pleae help me !

I need delete record from table user.mysql in mysql database, i log on in
mysql like root and I log on on linux server like root. But when I write
command : delete from user where user=''; mysql send me error message :
ERROR 1036 Table 'user; is read only !
Thans for you helps...

roman




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




Re: [PHP] Change of Language

2002-02-05 Thread Edward van Bilderbeek - Bean IT

check out: setlocale()

Greets,

Edward

- Original Message -
From: "Nicolas Llamosas" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 05, 2002 4:13 PM
Subject: [PHP] Change of Language


> How can in change the language in my site? (spanish)
> for example using the function date. (LANG?)
>
> Thanks
> Nicolás Llamosas
>
>
> _
> MSN Photos es la manera más sencilla de compartir, editar e imprimir sus
> fotos favoritas. http://photos.latam.msn.com/Support/WorldWide.aspx
>
>
> --
> 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] Change of Language

2002-02-05 Thread Nicolas Llamosas

How can in change the language in my site? (spanish)
for example using the function date. (LANG?)

Thanks
Nicolás Llamosas


_
MSN Photos es la manera más sencilla de compartir, editar e imprimir sus 
fotos favoritas. http://photos.latam.msn.com/Support/WorldWide.aspx


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




[PHP] Unable to get ImageTTFText output

2002-02-05 Thread Neil Freeman

Hi there,

I am trying to use the ImageTTFText function to output some text onto an
existing image. Problem being though that the text does not get
outputted. I have placed the ttf file 'arial.ttf' within the same
directory as my script. Here is a snippet of my code:

Header("Content-Type: image/png");
$im = ImageCreateFromPNG("original_image.png");

$text_colour = ImageColorAllocate($im, 255, 255, 255);

ImageTTFText($im, 20, 0, 3, 3, $text_colour, "/arial.ttf", "My
text");

ImagePNG($im);

All this outputs is my original PNG image (with no text). I have used
the following line instead of ImageTTFText and all works well.

ImageString($im, 4, 3, 3, "My text", $text_colour);

Using phpinfo() I have checked the GD section and the following is
outputted:

GD Support - enabled
GD Version - 2.0 or higher
FreeType Support - enabled
FreeType Linkage - with freetype
JPG Support - enabled
PNG Support - enabled
WBMP Support - enabled

Does anyone have any suggestions as to why this does not work? Has
anyone else used the ImageTTFText function successfully?

Neil

 Email:  [EMAIL PROTECTED]
 [EMAIL PROTECTED]




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




[PHP] Getting variables from a text file

2002-02-05 Thread David Orn Johannsson








I have this text file I have to retreve infromation from, in
the fallowing format:

date1=1/1/2002&title1=some title&headline1=some
headline&full1=full article&date2=2/1/2002&title2=some
title& and so on

 

what would be the best thing for me to do to if I was to get
the values of all the “variables” of the text file into a php
document as variables.

 

Regards, David

 



Davíð
Örn Jóhannssson

Vefforritari



Atómstöðin
hf.

Garðastræti
37

101
Reykjavík



sími:
595-3643

fax:
595-3649

[EMAIL PROTECTED]

http://www.atom.is





 








Re: [PHP] How to get the URL into a var?

2002-02-05 Thread J.F.Kishor

hi,

I don't know whether this will solve your problem, but the
following prints the full path of the file that is being used.



$uri = getenv('REQUEST_URI'); 

$path = $HTTP_SERVER_VARS["PATH_TRANSLATED"];

// This prints /~user/subapp/test.php
   echo "
$uri
"; // This prints /home///public_html/subapp/test.php echo "
path : $path
"; regards - JFK kishor Nilgiri Networks On Sat, 2 Mar 2002, Andy wrote: > Hi there, > > I am trying to find out which dir the user is browsing. How can I get the > URL into a var? I tryed path_info, but it only returns the filename. > > Here is an example: > > URL: http://www.server.com/subapp/test.php > > Should return : > > subapp > > Is this possible?? > > Thanx for any help > > Cheers Andy > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] How do I find double values in an associative array

2002-02-05 Thread Jerry Verhoef (UGBI)

http://www.php.net/manual/en/function.array-count-values.php


Jerry

I feel like a manual... 

> -Original Message-
> From: Rainer [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 05, 2002 2:51 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] How do I find double values in an associative array
> 
> 
> Hello group,
> 
> Can anybody tell me how I easily compare values in an 
> associative array? I
> would like to find double values
> 
> I have for instance an array like:
> 
> $foo['key1'] = 'abc';
> $foo['key2'] = 'def';
> $foo['key3'] = 'abc';
> $foo['key4'] = 'ghi';
> 
> and I want to get the value 'abc' ...
> 
> Please send me an email ([EMAIL PROTECTED]) because 
> my newsgroups
> doesn't always work properly!
> 
> Thanx,
> Rainer.
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


The information contained in this email is confidential and
may be legally privileged. It is intended solely for the 
addressee. Access to this email by anyone else is 
unauthorized. If you are not the intended recipient, any 
form of disclosure, production, distribution or any action 
taken or refrained from in reliance on it, is prohibited and 
may be unlawful. Please notify the sender immediately.

The content of the email is not legally binding unless 
confirmed by letter bearing two authorized signatures.

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




[PHP] How do I find double values in an associative array

2002-02-05 Thread Rainer

Hello group,

Can anybody tell me how I easily compare values in an associative array? I
would like to find double values

I have for instance an array like:

$foo['key1'] = 'abc';
$foo['key2'] = 'def';
$foo['key3'] = 'abc';
$foo['key4'] = 'ghi';

and I want to get the value 'abc' ...

Please send me an email ([EMAIL PROTECTED]) because my newsgroups
doesn't always work properly!

Thanx,
Rainer.



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




[PHP] Name of file included

2002-02-05 Thread Ron Dyck

I need to access the name of a file included.

ie: in index.php I've included various files, among them navigation.inc.
Instead of manually typing  at the top of everyfile,
I'd like to use something like: 

===
  Ron Dyck
  WebbTech
  www.WebbTech.net
  [EMAIL PROTECTED]




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




RE: [PHP] Re: Sending files to the user...?

2002-02-05 Thread Jerry Verhoef (UGBI)

Your are on the right track.

Using the Header function is the way to do it.
But I guess you forget to take a look at the manual page. There are all
questions that you ask answered :) 

So take a look http://www.php.net/manual/en/function.header.php .

in short:
RFC: http://www.w3.org/Protocols/rfc2616/rfc2616
Force download:
header("Content-type: application/pdf");
header("Content-Disposition: attachment; filename=downloaded.pdf");

/* ... output pdf file ... */


Kind Regards,
Jerry
> -Original Message-
> From: Alan McFarlane [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 05, 2002 1:36 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: Sending files to the user...?
> 
> 
> Oh, and BTW, after sending the file, I will be redirecting 
> the user to a
> different page...
> 
> Alan McFarlane <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > The problem:
> >
> > How to I send a file to the user? Sounds simple but, assume I have a
> 'daily
> > report' option from my main web page. When the user clicks 
> on it, they are
> > taken to the file 'generate_report.php' (sample included).
> >
> > Now, this code should generate the report, compress it if 
> required and
> send
> > it ot the user - i.e. a dialog box opens asking the user to 
> open/save/run
> > the incoming file.
> >
> > Question is, how? - I've toyed with Content-Disposition but 
> I'm not sure
> of
> > any reference materials for this. (Perhaps someone knows the RFC)
> >
> > The code:
> >
> >  > /* file: generate_report.php */
> >
> > // build the report
> > $report = ""; /* basically an xml document
> >
> > // compress if possible
> > if (extension_loaded("zlib") && (strlen($report) > 1024))
> > {
> > $report = gzcompress($report);
> > $compress = true;
> > }
> > else
> > {
> > $compressed = false;
> > }
> >
> > $length = strlen($report);// I presume this can handle 
> binary data
> >
> > //header(" something ");
> >
> > ?>
> >
> >
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


The information contained in this email is confidential and
may be legally privileged. It is intended solely for the 
addressee. Access to this email by anyone else is 
unauthorized. If you are not the intended recipient, any 
form of disclosure, production, distribution or any action 
taken or refrained from in reliance on it, is prohibited and 
may be unlawful. Please notify the sender immediately.

The content of the email is not legally binding unless 
confirmed by letter bearing two authorized signatures.

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




[PHP] Re: Sending files to the user...?

2002-02-05 Thread Alan McFarlane

Oh, and BTW, after sending the file, I will be redirecting the user to a
different page...

Alan McFarlane <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> The problem:
>
> How to I send a file to the user? Sounds simple but, assume I have a
'daily
> report' option from my main web page. When the user clicks on it, they are
> taken to the file 'generate_report.php' (sample included).
>
> Now, this code should generate the report, compress it if required and
send
> it ot the user - i.e. a dialog box opens asking the user to open/save/run
> the incoming file.
>
> Question is, how? - I've toyed with Content-Disposition but I'm not sure
of
> any reference materials for this. (Perhaps someone knows the RFC)
>
> The code:
>
>  /* file: generate_report.php */
>
> // build the report
> $report = ""; /* basically an xml document
>
> // compress if possible
> if (extension_loaded("zlib") && (strlen($report) > 1024))
> {
> $report = gzcompress($report);
> $compress = true;
> }
> else
> {
> $compressed = false;
> }
>
> $length = strlen($report);// I presume this can handle binary data
>
> //header(" something ");
>
> ?>
>
>



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




  1   2   >