Re: [PHP] HELP PLEASE!

2002-03-28 Thread heinisch

At 27.03.2002  21:20, you wrote:
Even if I didn´t read your code exactly, the fault is
the do while loop
replace it with something like this
while ($row = mysql_fetch_array($result))
{
 for($i=0,$i  count($row);$i++)
 { // add something to make it fancy like a table or so
 echo $row[$i];
 }
}
in php4* there is something like foreach, which I do not exactly know
HTH Oliver
Hello,

My problem is I have a form that submits it info to a mysql table, well 
then I
have a page that calls it from the mysql table and displays whatever is in 
the
mysql table. So, what script do I use to make it display multiple entrys?? 
Here
is the code:

---

?php
$title = Powder Basin Motocross, INC. | | Rider Profiles;
include('header.php');
$conn = mysql_connect (host, un, pw)
 or die(Coudn't connect to the MySQL server.);
mysql_select_db (pbmi_riderprofiles)
 or die(Couldn't the select MySQL database.);
?
table border=0 cellspacing=0 cellpadding=0tr
td class=mainheader width=475 align=center bgcolor=#66:: Rider
Profiles ::/td
/tr
tr
td valign=top align=left
font size=?=$fontsize? face=?=$fontface?a href=index.php?
topic=addprofileAdd your profile/a/font
hr width=475 align=left noshade
table border=0 cellspacing=0 cellpadding=0
tr
tdfont size=?=$fontsize? face=?=$fontface?bnbsp;First
Name:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles first_name); if ($row =
mysql_fetch_array($result)) { do { echo $row[first_name]; } while ($row =
mysql_fetch_array($result)); } ?/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?bnbsp;Last
Name:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles last_name); if ($row =
mysql_fetch_array($result)) { do { echo $row[last_name]; } while ($row =
mysql_fetch_array($result)); } ?/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?
 bnbsp;D.O.B:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles dob); if ($row = mysql_fetch_array
($result)) { do { echo $row[dob]; } while ($row = mysql_fetch_array
($result)); } ?/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?
 bnbsp;City:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles city); if ($row = mysql_fetch_array
($result)) { do { echo $row[city]; } while ($row = mysql_fetch_array
($result)); } ?/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?
 bnbsp;State:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles state); if ($row = 
mysql_fetch_array
($result)) { do { echo $row[state]; } while ($row = mysql_fetch_array
($result)); } ?/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?bnbsp;E-
mail:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface?a href=mailto:?
=$riderfile[$i + 5]??php $result = mysql_query (SELECT * FROM
riderprofiles email); if ($row = mysql_fetch_array($result)) { do { echo $row
[email]; } while ($row = mysql_fetch_array($result)); } ?/a/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?bnbsp;Dirt
Bike:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles dirt_bike); if ($row =
mysql_fetch_array($result)) { do { echo $row[dirt_bike]; } while ($row =
mysql_fetch_array($result)); } ?/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?
 bnbsp;Class:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles race_class); if ($row =
mysql_fetch_array($result)) { do { echo $row[race_class]; } while ($row =
mysql_fetch_array($result)); } ?/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?bnbsp;Years
Riding:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles yr); if ($row = mysql_fetch_array
($result)) { do { echo $row[yr]; } while ($row = mysql_fetch_array
($result)); } ?/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?bnbsp;Favorite
Track:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles favorite_track); if ($row =
mysql_fetch_array($result)) { do { echo $row[favorite_track]; } while 
($row =
mysql_fetch_array($result)); } ?/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?
 bnbsp;Sponsors:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles sponsors); if ($row =
mysql_fetch_array($result)) { do { echo $row[sponsors]; } while ($row =
mysql_fetch_array($result)); } ?/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?
 bnbsp;Injuries:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles injuries); if ($row =

Re: [PHP] New php functions?

2002-03-28 Thread Jon Farmer

 It was probably the last thing you looked for there. I know I
 constantly go back to look up Date() placeholders.

I know the feeling! In the end I printed the Date page out, folded it up and
stapled it into my PHP pocket ref book

--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969
PGP Key available, send email with subject: Send PGP Key

:)



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




Re: [PHP] HELP PLEASE!

2002-03-28 Thread hugh danaher

The difficulty of using a FOR loop in a WHILE loop is that the data record
doesn't change until the next WHILE loop.
I've used variations of the following to get multiple columns of data from a
database query.  A variation of this should work.

while ($cards=mysql_fetch_array($result))
  {
  if ($num==1) print tr;
  print td;
  print $db[item];
  print /td;
   $num++;
  if ($num==3)
   {
   print /tr;
   $num=1;
   }
   }
if ($num==2) print /tr;
   print /table;
Hope this helps,
Hugh

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, March 28, 2002 12:33 AM
Subject: Re: [PHP] HELP PLEASE!


At 27.03.2002  21:20, you wrote:
Even if I didn´t read your code exactly, the fault is
the do while loop
replace it with something like this
while ($row = mysql_fetch_array($result))
{
 for($i=0,$i  count($row);$i++)
 { // add something to make it fancy like a table or so
 echo $row[$i];
 }
}
in php4* there is something like foreach, which I do not exactly know
HTH Oliver
Hello,

My problem is I have a form that submits it info to a mysql table, well
then I
have a page that calls it from the mysql table and displays whatever is in
the
mysql table. So, what script do I use to make it display multiple entrys??
Here
is the code:

---

?php
$title = Powder Basin Motocross, INC. | | Rider Profiles;
include('header.php');
$conn = @mysql_connect (host, un, pw)
 or die(Coudn't connect to the MySQL server.);
mysql_select_db (pbmi_riderprofiles)
 or die(Couldn't the select MySQL database.);
?
table border=0 cellspacing=0 cellpadding=0tr
td class=mainheader width=475 align=center bgcolor=#66::
Rider
Profiles ::/td
/tr
tr
td valign=top align=left
font size=?=$fontsize? face=?=$fontface?a href=index.php?
topic=addprofileAdd your profile/a/font
hr width=475 align=left noshade
table border=0 cellspacing=0 cellpadding=0
tr
tdfont size=?=$fontsize? face=?=$fontface?bnbsp;First
Name:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles first_name); if ($row =
mysql_fetch_array($result)) { do { echo $row[first_name]; } while ($row =
mysql_fetch_array($result)); } ?/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?bnbsp;Last
Name:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles last_name); if ($row =
mysql_fetch_array($result)) { do { echo $row[last_name]; } while ($row =
mysql_fetch_array($result)); } ?/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?
 bnbsp;D.O.B:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles dob); if ($row =
mysql_fetch_array
($result)) { do { echo $row[dob]; } while ($row = mysql_fetch_array
($result)); } ?/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?
 bnbsp;City:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles city); if ($row =
mysql_fetch_array
($result)) { do { echo $row[city]; } while ($row = mysql_fetch_array
($result)); } ?/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?
 bnbsp;State:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles state); if ($row =
mysql_fetch_array
($result)) { do { echo $row[state]; } while ($row = mysql_fetch_array
($result)); } ?/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?bnbsp;E-
mail:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface?a href=mailto:?
=$riderfile[$i + 5]??php $result = mysql_query (SELECT * FROM
riderprofiles email); if ($row = mysql_fetch_array($result)) { do { echo
$row
[email]; } while ($row = mysql_fetch_array($result)); }
?/a/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?bnbsp;Dirt
Bike:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles dirt_bike); if ($row =
mysql_fetch_array($result)) { do { echo $row[dirt_bike]; } while ($row =
mysql_fetch_array($result)); } ?/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?
 bnbsp;Class:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles race_class); if ($row =
mysql_fetch_array($result)) { do { echo $row[race_class]; } while ($row =
mysql_fetch_array($result)); } ?/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?bnbsp;Years
Riding:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles yr); if ($row =
mysql_fetch_array
($result)) { do { echo $row[yr]; } while ($row = mysql_fetch_array
($result)); } ?/font/td
/tr
tr
tdfont size=?=$fontsize? face=?=$fontface?bnbsp;Favorite
Track:/b/font/td
tdfont size=?=$fontsize? face=?=$fontface??php $result =
mysql_query (SELECT * FROM riderprofiles 

Re: [PHP] while loop: detect next loop?

2002-03-28 Thread Tom Rogers

Hi
add the newline and white space first like this
$data_printed = ;
while ($row = mysql_fetch_assoc($result)) {
 if($data_printed != ){
 $data_printed .=  \n;
 }
 $data_printed = file id=\ . $row['file_id'] . \ . 
$row['file_name'] . /file;
}

That will add to all except the last one.
Tom



At 07:04 AM 28/03/2002, you wrote:
There is a nice feature of a for loop, that I would like to replicate 
somehow within a while loop.  The short question is this -- is there any 
way to detect if the while loop has one or more iterations remaining 
(after the current iteration) to go through, so that I can [for instance] 
add a comma or a newline or something to the text that is printed in the 
loop iteration?

In a for loop I can do this:

for ($c = 0; $c  sizeof($array); $c++) {
   $data_printed = $array[$c];
   if ($c  sizeof($array) - 1) {
 $data_printed .= \n;
   }
}

I have a while loop like this:

while ($row = mysql_fetch_assoc($result)) {
   $data_printed = file id=\ . $row['file_id'] . \
 . $row['file_name'] . /file;
}

This prints things like this:
file id=1somefile.txt/filefile id=2otherfile.pdf/file

etc

I do not want to blindly add a newline and some whitespace to EVERY 
iteration, because this is XML and the whitespace is significant (and this 
code will impact thousands of files), but I can't think of a clever way of 
adding the newline and whitespace to every iteration EXCEPT the last one.

TIA for any Jedi insight,


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[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] Re: Regex Form Filter Help

2002-03-28 Thread liljim

Hello James,

James Taylor [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have a site where users can type whatever they want in and it posts it
to a
 database.  I'm trying to eliminate whatever types of abuse I can think of,
 and, since I'm using nl2br on the posts, I'm afraid a user might just hold
 down enter for a couple of seconds and scroll everything off the page. I'm
 trying to figure out a regex pattern that searches for say, more than 5
br
 / strings in a row, and anything after 5 gets stripped out.  Any ideas on
 how to possibly do this?

First of all, store all of your information in your database as it's
entered, and perform the regex and other string manipulation on the code
when you bring it out of the database.  That way, if you decide you could do
something better than you're currently doing later on, you have the raw
data to deal with.

Anyway, now to your problem:

?

$string = lots of






























new

lines

















grr!;

// Change the 2 to whatever you want: if you want
// to limit to three new lines, change to 3 and add another
// \n (new line)
$string = preg_replace(/(\r?\n){2,}/, \n\n, $string);

echo nl2br($string);

?

Hope it helps.

James



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




[PHP] Opening up a generic text file

2002-03-28 Thread Ron

I want to open up a generic text file from the same server that my www is
on.

$file= fopen(The full URL/finance/daily.txt,r);
$rf=fread($file,100);
$new=substr ($rf,0);
fclose($file);
echo (center$new/center);
?

I keep on getting errors...any suggestions on how I can do this???

Warning: fopen(**, r) - Invalid argument in
*:\*\*\daily.php on line 4

Warning: Supplied argument is not a valid File-Handle resource in
*:\*\*\daily.php on line 5

Warning: Supplied argument is not a valid File-Handle resource in
*:\*\*\daily.php on line 7




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




[PHP] Re: Opening up a generic text file

2002-03-28 Thread Ron

Figured it out on a windows platform you have implicitly specify the path
c:\
Ron [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I want to open up a generic text file from the same server that my www is
 on.

 $file= fopen(The full URL/finance/daily.txt,r);
 $rf=fread($file,100);
 $new=substr ($rf,0);
 fclose($file);
 echo (center$new/center);
 ?

 I keep on getting errors...any suggestions on how I can do this???

 Warning: fopen(**, r) - Invalid argument in
 *:\*\*\daily.php on line 4

 Warning: Supplied argument is not a valid File-Handle resource in
 *:\*\*\daily.php on line 5

 Warning: Supplied argument is not a valid File-Handle resource in
 *:\*\*\daily.php on line 7






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




[PHP] Regular Expression Problem continues

2002-03-28 Thread Sharat Hegde

Hello,

I am still having problems with the regular expressions. Looks like there 
has been a change in the way they are handled between PHP3 and PHP4, since 
the code worked with PHP3 !!

I need to search for all words having alphanumberic characters as well as _ 
(underscore) which are prefixed and suffixed with __ (2 underscores).

The regular expression I am using is
eregi(__([a-z0-9_]+)__, Hello __WO_RD__ Test, $Matches)

I am expecting the above code to return __WO_RD__ as the match, but it does 
not seem to work. Can someone help out.

With Regards,
Sharat


_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




[PHP] Need some help on security with php and mysql

2002-03-28 Thread hamish

Hello all,
I am using php and mysql with phpmyadmin. I am trying to set up a username 
and password in mysql so that when I use 

if(!$db_conn = mysql_connect('localhost', 'username', password)) {
  echo 'Could not connect to the Database Server';
} 

with the correct username and password it will connect me. I used phpmyadmin 
to add the user to the users table in the mysql database. I used the 
following sql statement: 

INSERT INTO user (Host,User,Password) 
VALUES('localhost','jeffrey',PASSWORD('biscuit')); 

and the record was created in the table. 

When I try to connect to the db via the php 

if(!$db_conn = mysql_connect('localhost', 'jeffrey', biscuit)) {
  echo 'Could not connect to the Database Server';
} 

it tells me: 

Warning: Access denied for user: 'jeffrey@localhost' (Using password: YES) 
in /home/httpd/htdocs/helpdesk/test.php 


What have I done wrong? 

cheers 

Hamish 

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




Re: [PHP] Regular Expression Problem continues

2002-03-28 Thread Rasmus Lerdorf

This code works fine:

eregi(__([a-z0-9_]+)__, Hello __WO_RD__ Test, $Matches);
echo $Matches[1];

produces:

WO_RD

-Rasmus

On Thu, 28 Mar 2002, Sharat Hegde wrote:

 Hello,

 I am still having problems with the regular expressions. Looks like there
 has been a change in the way they are handled between PHP3 and PHP4, since
 the code worked with PHP3 !!

 I need to search for all words having alphanumberic characters as well as _
 (underscore) which are prefixed and suffixed with __ (2 underscores).

 The regular expression I am using is
 eregi(__([a-z0-9_]+)__, Hello __WO_RD__ Test, $Matches)

 I am expecting the above code to return __WO_RD__ as the match, but it does
 not seem to work. Can someone help out.

 With Regards,
 Sharat


 _
 Send and receive Hotmail on your mobile device: http://mobile.msn.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] Need some help on security with php and mysql

2002-03-28 Thread Rasmus Lerdorf

Did you flush the privileges?  Using either flush privileges or mysqladmin
reload?  And besides, you really should be using a GRANT query to do this.

-Rasmus

On Thu, 28 Mar 2002, hamish wrote:

 Hello all,
 I am using php and mysql with phpmyadmin. I am trying to set up a username
 and password in mysql so that when I use

 if(!$db_conn = mysql_connect('localhost', 'username', password)) {
   echo 'Could not connect to the Database Server';
 }

 with the correct username and password it will connect me. I used phpmyadmin
 to add the user to the users table in the mysql database. I used the
 following sql statement:

 INSERT INTO user (Host,User,Password)
 VALUES('localhost','jeffrey',PASSWORD('biscuit'));

 and the record was created in the table.

 When I try to connect to the db via the php

 if(!$db_conn = mysql_connect('localhost', 'jeffrey', biscuit)) {
   echo 'Could not connect to the Database Server';
 }

 it tells me:

 Warning: Access denied for user: 'jeffrey@localhost' (Using password: YES)
 in /home/httpd/htdocs/helpdesk/test.php


 What have I done wrong?

 cheers

 Hamish

 --
 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] Is this code safe?

2002-03-28 Thread Richard Ellerbrock

$result=mysql_query(DELETE FROM customer
WHERE customer=$cust,
$ds) and
$result=mysql_query(DELETE FROM custinfo
WHERE customer=$cust,
$ds) and
$result=mysql_query(DELETE FROM revdns
WHERE customer=$cust,
$ds) and
AuditLog($ds, sprintf(my_(User %s deleted customer cust %u),
 $HTTP_SERVER_VARS[PHP_AUTH_USER], $cust));


Note that the code is one long line. Am I safe to assume that the
last statement (AuditLog), will only be executed if all the preceding
statements complete without error and that the statement will be short
circuited and stop if anything fails?

I know this is safe for C. Is it safe for php, and also, will it be
safe in the future?

Please copy via e-mail.

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




[PHP] Re: Is this code safe?

2002-03-28 Thread Hugh Bothwell


Richard Ellerbrock [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 $result=mysql_query(DELETE FROM customer
 WHERE customer=$cust,
 $ds) and
 $result=mysql_query(DELETE FROM custinfo
 WHERE customer=$cust,
 $ds) and
 $result=mysql_query(DELETE FROM revdns
 WHERE customer=$cust,
 $ds) and
 AuditLog($ds, sprintf(my_(User %s deleted customer cust %u),
  $HTTP_SERVER_VARS[PHP_AUTH_USER], $cust));

Note: you had better do a thorough job of validating $cust, lest someone
pass something charming like

$cust = '39428 or customer  0';

which might be enough to make your whole *week* interesting.



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




Re: [PHP] Need some help on security with php and mysql

2002-03-28 Thread heinisch

Did you restart mysql ?
could you see your entrances when using mysql on console
with master/masterpassword?
Oliver
At 28.03.2002  10:37, you wrote:
Hello all,
I am using php and mysql with phpmyadmin. I am trying to set up a username 
and password in mysql so that when I use
if(!$db_conn = mysql_connect('localhost', 'username', password)) {
  echo 'Could not connect to the Database Server';
}
with the correct username and password it will connect me. I used 
phpmyadmin to add the user to the users table in the mysql database. I 
used the following sql statement:
INSERT INTO user (Host,User,Password) 
VALUES('localhost','jeffrey',PASSWORD('biscuit'));
and the record was created in the table.
When I try to connect to the db via the php
if(!$db_conn = mysql_connect('localhost', 'jeffrey', biscuit)) {
  echo 'Could not connect to the Database Server';
}
it tells me:
Warning: Access denied for user: 'jeffrey@localhost' (Using password: YES) 
in /home/httpd/htdocs/helpdesk/test.php

What have I done wrong?
cheers
Hamish


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




[PHP] ereg_replace or chr bug?

2002-03-28 Thread Ando

Ok, what i wanna do is replace the codes in html with ascii equivalents:

$text= ereg_replace('#([0-9]+);' , chr('\1') , $text);
But somehow it doesnt work, i have no idea why.

When i use
$text= ereg_replace('#([0-9]+);' , '\1' , $text);
it replaces everything correctly

But
$text= ereg_replace('#([0-9]+);' , chr('\1') , $text);
just replaces everything with an empty string

using php 3.0.12




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




RE: [PHP] ereg_replace or chr bug?

2002-03-28 Thread Rick Emery

From the manual for chr()

Returns a one-character string containing the character specified by ascii.

It replaces one (1) character, not a string

-Original Message-
From: Ando [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 6:59 AM
To: [EMAIL PROTECTED]
Subject: [PHP] ereg_replace or chr bug?


Ok, what i wanna do is replace the codes in html with ascii equivalents:

$text= ereg_replace('#([0-9]+);' , chr('\1') , $text);
But somehow it doesnt work, i have no idea why.

When i use
$text= ereg_replace('#([0-9]+);' , '\1' , $text);
it replaces everything correctly

But
$text= ereg_replace('#([0-9]+);' , chr('\1') , $text);
just replaces everything with an empty string

using php 3.0.12




-- 
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] Get a specified amount of text?

2002-03-28 Thread Rick Emery

string substr (string string, int start [, int length])

-Original Message-
From: Donald [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 23, 2002 5:08 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Get a specified amount of text?


In Visual Basic there is a function called left.
usage: left(string, len)
It allows you to get the first 'len' characters of 'string'.

Is there a similar function in PHP?

I have a value:
3.405
That I just want to crop to 3.40
If I pass 3.405 to MySQL it adds it like this: 3.41

Thanks
-Donald



-- 
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] ereg_replace or chr bug?

2002-03-28 Thread Ando

Not sure what you mean here
$text= ereg_replace('#([0-9]+);' , chr('\1') , $text);

should replace for example #65; with chr('65') (\1 means everything in
brackets in regular expression), which is 'A'   .

Rick Emery wrote:

 From the manual for chr()

 Returns a one-character string containing the character specified by ascii.

 It replaces one (1) character, not a string


 -Original Message-
 From: Ando [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, March 28, 2002 6:59 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] ereg_replace or chr bug?

 Ok, what i wanna do is replace the codes in html with ascii equivalents:

 $text= ereg_replace('#([0-9]+);' , chr('\1') , $text);
 But somehow it doesnt work, i have no idea why.

 When i use
 $text= ereg_replace('#([0-9]+);' , '\1' , $text);
 it replaces everything correctly

 But
 $text= ereg_replace('#([0-9]+);' , chr('\1') , $text);
 just replaces everything with an empty string

 using php 3.0.12

 --
 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] ASP vs PHP

2002-03-28 Thread Ciro Martins


Hi!


I've been programming in PHP for long. But one question that always is
coming to my mind is to know if there exists some kind of tools (like
for SP. It exists a tool called ASPWebTools for wich it is possible to
develop applications written in ASP and connecting with DB like SQL
Server in an automatic way) that can help in the development of
applications using PHP and databases. For instance, that could allow to
develop automatically forms to connect to databases using PHP.

Does anyone know any related application or tools.
Because in ASP with that tool is more easy to develop code.

Thanks in advance

Ciro Martins


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




RE: [PHP] ereg_replace or chr bug?

2002-03-28 Thread Rick Emery

chr() expects you to pass it a numeric value.  You are passing it a string.
For instance,
if $text= #45, then you are trying to do:  chr(45), which is not the
same as chr(45).
Hence, ereg_replace() fails and simply returns the original string, $text.

-Original Message-
From: Ando [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 7:08 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] ereg_replace or chr bug?


Not sure what you mean here
$text= ereg_replace('#([0-9]+);' , chr('\1') , $text);

should replace for example #65; with chr('65') (\1 means everything in
brackets in regular expression), which is 'A'   .

Rick Emery wrote:

 From the manual for chr()

 Returns a one-character string containing the character specified by
ascii.

 It replaces one (1) character, not a string


 -Original Message-
 From: Ando [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, March 28, 2002 6:59 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] ereg_replace or chr bug?

 Ok, what i wanna do is replace the codes in html with ascii equivalents:

 $text= ereg_replace('#([0-9]+);' , chr('\1') , $text);
 But somehow it doesnt work, i have no idea why.

 When i use
 $text= ereg_replace('#([0-9]+);' , '\1' , $text);
 it replaces everything correctly

 But
 $text= ereg_replace('#([0-9]+);' , chr('\1') , $text);
 just replaces everything with an empty string

 using php 3.0.12

 --
 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] ereg_replace or chr bug?

2002-03-28 Thread Ando

Uh why do you think that?
Try
print chr(65);
works the same as as
print chr(65);

Rick Emery wrote:

 chr() expects you to pass it a numeric value.  You are passing it a string.
 For instance,
 if $text= #45, then you are trying to do:  chr(45), which is not the
 same as chr(45).
 Hence, ereg_replace() fails and simply returns the original string, $text.

 -Original Message-
 From: Ando [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, March 28, 2002 7:08 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] ereg_replace or chr bug?

 Not sure what you mean here
 $text= ereg_replace('#([0-9]+);' , chr('\1') , $text);

 should replace for example #65; with chr('65') (\1 means everything in
 brackets in regular expression), which is 'A'   .

 Rick Emery wrote:

  From the manual for chr()
 
  Returns a one-character string containing the character specified by
 ascii.
 
  It replaces one (1) character, not a string

 
  -Original Message-
  From: Ando [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, March 28, 2002 6:59 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] ereg_replace or chr bug?
 
  Ok, what i wanna do is replace the codes in html with ascii equivalents:
 
  $text= ereg_replace('#([0-9]+);' , chr('\1') , $text);
  But somehow it doesnt work, i have no idea why.
 
  When i use
  $text= ereg_replace('#([0-9]+);' , '\1' , $text);
  it replaces everything correctly
 
  But
  $text= ereg_replace('#([0-9]+);' , chr('\1') , $text);
  just replaces everything with an empty string
 
  using php 3.0.12
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

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


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




[PHP] RADIUS - supported in PHP?

2002-03-28 Thread Benji Spencer

 From the initial documentation I have found, the answer to my question is 
No, however I am just seeking confirmation of it.

Does PHP support RADIUS?

If not, does anyone know of any scripts/classes for PHP which deal with RADIUS?

thanks

benji

---
Ben Spencer
Web Support
[EMAIL PROTECTED]
x 2288


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




RE: [PHP] ASP vs PHP

2002-03-28 Thread J. Scott Johnson

I've seen a tool called Code Charge which claims to do that.

http://www.codecharge.com/index2.html

And, I think that the new Zend tools make this easier (but I really haven't
started evaluation yet).

www.zend.com

Scott

* * * * * * * * * * * * * * * * * * * * * * * * * *
J. Scott Johnson
PHP Consulting and Design Work
* * * * * * * * * * * * * * * * * * * * * * * * * *
Virtual:
* * * * * * * * * * * * * * * * * * * * * * * * * *
[EMAIL PROTECTED]
http://www.fuzzygroup.com/
Yahoo IM: fuzzygroup



-Original Message-
From: Ciro Martins [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 7:49 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP] ASP vs PHP



Hi!


I've been programming in PHP for long. But one question that always is
coming to my mind is to know if there exists some kind of tools (like
for SP. It exists a tool called ASPWebTools for wich it is possible to
develop applications written in ASP and connecting with DB like SQL
Server in an automatic way) that can help in the development of
applications using PHP and databases. For instance, that could allow to
develop automatically forms to connect to databases using PHP.

Does anyone know any related application or tools.
Because in ASP with that tool is more easy to develop code.

Thanks in advance

Ciro Martins


--
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] RADIUS - supported in PHP?

2002-03-28 Thread Hunter, Ray

What are you trying to do with radius and php?



Thank you,

Ray Hunter
Firmware Engineer

ENTERASYS NETWORKS


 -Original Message-
 From: Benji Spencer [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, March 28, 2002 6:35 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] RADIUS - supported in PHP?
 
 
  From the initial documentation I have found, the answer to 
 my question is 
 No, however I am just seeking confirmation of it.
 
 Does PHP support RADIUS?
 
 If not, does anyone know of any scripts/classes for PHP which 
 deal with RADIUS?
 
 thanks
 
 benji
 
 ---
 Ben Spencer
 Web Support
 [EMAIL PROTECTED]
 x 2288
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



RE: [PHP] Can you use null?

2002-03-28 Thread Rick Emery

you test for a NULL value with PHP's isset() function.

if( ! isset($image_name) )
{
...   display no image   ...
}

-Original Message-
From: Chuck PUP Payne [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 9:32 PM
To: PHP General
Subject: [PHP] Can you use null?


I am wanting to know if I can use null to call up an image? I am writing a
page that talks to calls to a database for cars. There a field where calls
on photo names, but if someone doesn't have a photo. Mysql puts null, I want
to be able to use that null to call an image.


 
 | Chuck Payne  |
 | Magi Design and Support  |
 | www.magidesign.com   |
 | [EMAIL PROTECTED]   |
 

BeOS, Macintosh 68K, Classic, and OS X, Linux Support.
Web Design you can afford.

Never be bullied into silence. Never allow yourself to be made a victim.
Accept no one's definition of your life; define yourself.- Harvey Fierstein



-- 
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] RADIUS - supported in PHP?

2002-03-28 Thread Benji Spencer


What are you trying to do with radius and php?

I really don't know yet. We are looking at implementing RADIUS as a 
authentication scheme. I only roughly understand RADIUS, which doesn't help 
much. I looked at the RADUIS Apache module, which is where I am gaining 
most of my knowledge. It appears to function much like any other 
authentication scheme (at least to some extent) like LDAP or using a 
database (or NT Domain...or...or). As Apache can authentication against 
RADIUS, I assumed that such a thing could also be achieved via PHP.

Currently we have an Intranet Portal which authenticates against LDAP. We 
would want to change this over to RADIUS if we implemented RADIUS. How this 
is done, If it can be done, and what does it take are all questions which 
are up in the air at this point.

 From my understanding, RADIUS is more or less a ticketing mechanism. It is 
configured on the back end to check various sources (files, SQL, LDAP), and 
then provides a ticket if authentication is passed. It is this ticked which 
is passed around by the client and used to authenticate to the same 
resource, as well as other resources (if you have a valid ticket, you are 
not asked for username/password info?).

How close am I in understanding this, as well as making this all work in PHP?

thanks..

benji

---
Ben Spencer
Web Support
[EMAIL PROTECTED]
x 2288


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




[PHP] Re: accessing a mysql column by number

2002-03-28 Thread Jens Lehmann


 Is there a way to access a column in Mysql just by using a number?

Please refer to the MySQL-Documentation. A database doesn't have
any predefined structure, so you're responsible for doing this. Can you
explain why you need this feature?

 Like if you had three columns called column1, column2, and
 column3 and I wanted to access column3 just by using the number 3

This could simply be done by using prefixes:

$col = $prefix.$number

Jens



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




RE: [PHP] Re: accessing a mysql column by number

2002-03-28 Thread Rick Emery

Jens,

A database does have a structure.  The order in which the columns/fields are
defined is their numeric order.
Second, mysql_fetch_row() will accomplish what he needs.
Third, we answered this yesterday.

-Original Message-
From: Jens Lehmann [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 8:18 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: accessing a mysql column by number



 Is there a way to access a column in Mysql just by using a number?

Please refer to the MySQL-Documentation. A database doesn't have
any predefined structure, so you're responsible for doing this. Can you
explain why you need this feature?

 Like if you had three columns called column1, column2, and
 column3 and I wanted to access column3 just by using the number 3

This could simply be done by using prefixes:

$col = $prefix.$number

Jens



-- 
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] RADIUS - supported in PHP?

2002-03-28 Thread Hunter, Ray

Actually, that is more of a Kerberos system that you are thinking of.

Here is some info on radius:

Taken from rfc 2865 Remote Authentication Dial In User Service (RADIUS).

Key features of RADIUS are:

   Client/Server Model

  A Network Access Server (NAS) operates as a client of RADIUS.  The
  client is responsible for passing user information to designated
  RADIUS servers, and then acting on the response which is returned.

  RADIUS servers are responsible for receiving user connection
  requests, authenticating the user, and then returning all
  configuration information necessary for the client to deliver
  service to the user.

  A RADIUS server can act as a proxy client to other RADIUS servers
  or other kinds of authentication servers.

   Network Security

  Transactions between the client and RADIUS server are
  authenticated through the use of a shared secret, which is never
  sent over the network.  In addition, any user passwords are sent
  encrypted between the client and RADIUS server, to eliminate the
  possibility that someone snooping on an unsecure network could
  determine a user's password.


Basically there is a encryption by using the shared secret, however that
secret is never passed across the network.  The only tough problem here is
that you really need to know what is coming in each packet.  There is
encryption is each packet that must be dealt with.  To do authentication
with radius you need to create sockets and communication back and forth with
the NAS server.  This can be some what more complex and you need a more
powerful language than php.  I use c and sometimes c++.  I like to use php
for the snmp functionality that allows me to query the radius mibs on
network devices.  This gives me authentication and accounting information.

I suggest you read up on these rfcs: 2618, 2619, 2620, 2621, 2865, 2866,
2867, 2869, and 3162.


You could also try writing a radius extension for php?




Thank you,

Ray Hunter
Firmware Engineer

ENTERASYS NETWORKS


 -Original Message-
 From: Benji Spencer [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, March 28, 2002 7:07 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] RADIUS - supported in PHP?
 
 
 
 What are you trying to do with radius and php?
 
 I really don't know yet. We are looking at implementing RADIUS as a 
 authentication scheme. I only roughly understand RADIUS, 
 which doesn't help 
 much. I looked at the RADUIS Apache module, which is where I 
 am gaining 
 most of my knowledge. It appears to function much like any other 
 authentication scheme (at least to some extent) like LDAP or using a 
 database (or NT Domain...or...or). As Apache can 
 authentication against 
 RADIUS, I assumed that such a thing could also be achieved via PHP.
 
 Currently we have an Intranet Portal which authenticates 
 against LDAP. We 
 would want to change this over to RADIUS if we implemented 
 RADIUS. How this 
 is done, If it can be done, and what does it take are all 
 questions which 
 are up in the air at this point.
 
  From my understanding, RADIUS is more or less a ticketing 
 mechanism. It is 
 configured on the back end to check various sources (files, 
 SQL, LDAP), and 
 then provides a ticket if authentication is passed. It is 
 this ticked which 
 is passed around by the client and used to authenticate to the same 
 resource, as well as other resources (if you have a valid 
 ticket, you are 
 not asked for username/password info?).
 
 How close am I in understanding this, as well as making this 
 all work in PHP?
 
 thanks..
 
 benji
 
 ---
 Ben Spencer
 Web Support
 [EMAIL PROTECTED]
 x 2288
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



[PHP] Uploading files without an HTML form

2002-03-28 Thread Sam Rose

Hi there,

I was wondering if it is possible to upload an known file without having to
use an HTML form with the post command?

If so, could you point me in the right direction?

Thanks alot

Sam Rose

p.s. I'm only on the digest list, so it would be really handy if you could
send any replies back to me as well. Thanks.



[PHP] a CNN headline news grabber

2002-03-28 Thread Ron

Does anyone know of a CNN headline news grabber. I found one, but it returns
a blank page everytime. Or does anybody have a grabber that I can
customize???



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




RE: [PHP] Uploading files without an HTML form

2002-03-28 Thread Collins, Robert

If you know the file location, and the location doesn't change you could do
an fopen() and basically read and rewrite the file.


Robert W. Collins II
Webmaster
New Orleans Regional Transit Authority
Phone : (504) 248-3826
Email : [EMAIL PROTECTED]


-Original Message-
From: Sam Rose [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 8:12 AM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Uploading files without an HTML form


Hi there,

I was wondering if it is possible to upload an known file without having to
use an HTML form with the post command?

If so, could you point me in the right direction?

Thanks alot

Sam Rose

p.s. I'm only on the digest list, so it would be really handy if you could
send any replies back to me as well. Thanks.

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




RE: [PHP] a CNN headline news grabber

2002-03-28 Thread Collins, Robert

I had written one but CNN keeps changing their page format so it was too
hard to keep it up-to-date. That is probably why the one you have is
returning a blank page.

Robert W. Collins II
Webmaster
New Orleans Regional Transit Authority
Phone : (504) 248-3826
Email : [EMAIL PROTECTED]


-Original Message-
From: Ron [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 8:32 AM
To: [EMAIL PROTECTED]
Subject: [PHP] a CNN headline news grabber


Does anyone know of a CNN headline news grabber. I found one, but it returns
a blank page everytime. Or does anybody have a grabber that I can
customize???



-- 
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] New PHP4 Based on Zend 2.0 Engine Almost Ready for Release

2002-03-28 Thread Rick Emery

If you've read the Zend 2.0 Engine documentation, you'll know that PHP4 is
getting a BUNCH of cool functionality
To: php-dev at lists dot php dot net mailto:[EMAIL PROTECTED] 
From: Andi Gutmans andi at zend dot com mailto:[EMAIL PROTECTED] 
Date: Sat, 23 Mar 2002 12:38:12 +0200 
Hey,

Most big language changes planned for the Zend Engine 2 have been made. I 
think it's not a good idea to make many more changes before we get out a 
version based on the current changes. The changes have been deep in the 
guts of the Engine and we should get it rock solid before thinking of more 
things which might be nice to add. I need LOTS of testing and already know 
of some code which might need some improvement.
I would like to package a preview version to get a large PHP audience to 
check it out and test drive it a bit. I think if I improve the ZEND_CHANGES 
document that should be enough documentation to get people to test drive 
things.
It's probably best to base this version on the 4.2.0 branch as the 4.3.0 
will probably take some time to be stable due to the huge amount of streams 
changes.
I will try and get something packaged in the next couple of weeks (I still 
want to do some testing of my own).

Andi



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




[PHP] Reopen of File in PHP

2002-03-28 Thread Moschitz Martin

Hi!

I need to reopen a file in php - how can i manage this?

The problem is the following:
at the beginning of my main php file I am including a picture, which refers
to a php-image-file. I am creating a Text File in this Image File and I need
to open this in the main php file. But I don´t have the filepointer anymore
and I must reopen the file. how can i do this?

thanxs
martin

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




[PHP] SQL Question

2002-03-28 Thread Sebastian A.

How do I sort out data from mysql_fetch_row() or mysql_fetch_array? For
example say I wanted to list all my users alphabetically. How would I do
this? Or say I had a form and I wanted to present the content to the user
*AFTER* they have filled it out so that they can check for mistakes.
Mysql_fetch_row() returns all the rows in a field, so I would guess that I
have to sort using PHP. Can anyone provide me with an idea as to how I could
accomplish this?

Thanks


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




RE: [PHP] Reopen of File in PHP

2002-03-28 Thread Rick Emery

What do you mean you don´t have the filepointer anymore?  File pointer to
what?  The image file?  Is the image file dynamically created using PHP?  I
must be dense...I don't understand.


-Original Message-
From: Moschitz Martin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 8:40 AM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Reopen of File in PHP 


Hi!

I need to reopen a file in php - how can i manage this?

The problem is the following:
at the beginning of my main php file I am including a picture, which refers
to a php-image-file. I am creating a Text File in this Image File and I need
to open this in the main php file. But I don´t have the filepointer anymore
and I must reopen the file. how can i do this?

thanxs
martin

-- 
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] SQL Question

2002-03-28 Thread Rick Emery

 How do I sort out data from mysql_fetch_row() or mysql_fetch_array? For
 example say I wanted to list all my users alphabetically. How would I do
 this? 

You would sort in your SQL statement, not PHP.
SELECT * FROM my table ORDER BY field_name;

 Or say I had a form and I wanted to present the content to the user
 *AFTER* they have filled it out so that they can check for mistakes.
 Mysql_fetch_row() returns all the rows in a field

Why would the data be in the mysql database?  You would simply pass the
field values to the next page, where the user would verify/validate the
data.  Then, you'd write to the database.

-Original Message-
From: Sebastian A. [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 8:35 AM
To: PHP General List (PHP.NET)
Subject: [PHP] SQL Question


How do I sort out data from mysql_fetch_row() or mysql_fetch_array? For
example say I wanted to list all my users alphabetically. How would I do
this? Or say I had a form and I wanted to present the content to the user
*AFTER* they have filled it out so that they can check for mistakes.
Mysql_fetch_row() returns all the rows in a field, so I would guess that I
have to sort using PHP. Can anyone provide me with an idea as to how I could
accomplish this?

Thanks


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

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




Re: [PHP] SQL Question

2002-03-28 Thread Jason Wong

On Thursday 28 March 2002 22:34, Sebastian A. wrote:
 How do I sort out data from mysql_fetch_row() or mysql_fetch_array? For
 example say I wanted to list all my users alphabetically. How would I do
 this? Or say I had a form and I wanted to present the content to the user
 *AFTER* they have filled it out so that they can check for mistakes.
 Mysql_fetch_row() returns all the rows in a field, so I would guess that I
 have to sort using PHP. Can anyone provide me with an idea as to how I
 could accomplish this?

1) This type of question should best be posted to the php-db list.

2) Sorting should best be done from mysql using the ORDER BY clause:

  SELECT this, that, the, other 
FROM table
   ORDER BY that

3) If you insist on sorting in PHP then read all the rows from your query 
into an array and use one of the array sort functions -- asort() etc.



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

/*
Things are more like they used to be than they are now.
*/

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




Re: [PHP] a CNN headline news grabber

2002-03-28 Thread Erik Price


On Thursday, March 28, 2002, at 09:31  AM, Ron wrote:

 Does anyone know of a CNN headline news grabber. I found one, but it 
 returns
 a blank page everytime. Or does anybody have a grabber that I can
 customize???

Do they provide RDF content? (I would think, but maybe not.)  If so, 
then I would use that rather than try to grab their HTML page and parse 
it.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




Re: [PHP] New php functions?

2002-03-28 Thread Jason Wong

On Thursday 28 March 2002 17:13, Jon Farmer wrote:
  It was probably the last thing you looked for there. I know I
  constantly go back to look up Date() placeholders.

It begs the question, why don't you just download the manual? It's available 
in a myriad of different formats, one of which must suit you. It may not be 
bang up-to-date and it may not have the (sometimes) useful user comments but 
it sure saves you a lot of time and bandwidth.

 I know the feeling! In the end I printed the Date page out, folded it up
 and stapled it into my PHP pocket ref book

It's a step in the right direction :)


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

/*
Q:  What do you say to a Puerto Rican in a three-piece suit?
A:  Will the defendant please rise?
*/

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




Re: [PHP] Re: accessing a mysql column by number

2002-03-28 Thread Jens Lehmann

Hi Rick,

thanks for correcting me. (numeric order)

I thought he just wants to select one col. (SELECT 3rd column FROM table
... )

I didn't read your answer because it was not in the same thread (reading the
news
with MS Outlook Express), because the subject-line changed. Can you suggest
me
a newsreader which can manage this? I assume this is the wrong place to ask,
so
if you don't want to answer, please tell me where to find the answer.
(I didn't find it in any FAQs.) Sorry for asking such a stupid question.

Jens


 Jens,

 A database does have a structure.  The order in which the columns/fields
are
 defined is their numeric order.
 Second, mysql_fetch_row() will accomplish what he needs.
 Third, we answered this yesterday.

 -Original Message-
 From: Jens Lehmann [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, March 28, 2002 8:18 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: accessing a mysql column by number



  Is there a way to access a column in Mysql just by using a number?

 Please refer to the MySQL-Documentation. A database doesn't have
 any predefined structure, so you're responsible for doing this. Can you
 explain why you need this feature?

  Like if you had three columns called column1, column2, and
  column3 and I wanted to access column3 just by using the number 3

 This could simply be done by using prefixes:

 $col = $prefix.$number

 Jens



 --
 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] SSL and Apache

2002-03-28 Thread pong-TC

Hello All

This is quite off the topic.  Does anyone advise me how to install SSL on
Apache server?  I used to do on IIS by using Verisign.  It was quite easy.
 Because I am not used to with the Apache, I don't where I should start..

Any help, please.

Thank you.
Pong


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




[PHP] setcookie with array (was serialize)

2002-03-28 Thread Rodrigo Peres

Hi list,

Regarding my last post about serialize, I've tried many things but couldn't
make it function.

I'm trying to store the data from a form in order to allow my user to stop
the process of filling the form and retrieve later what was inserted before.

Among many other thing I tried this little script only to test but didn't
work. why??

if(isset($submit)) {
$x = addslashes($HTTP_POST_VARS);
$y = serialize($x);
setcookie(posted,$y)
}
if($posted) {
$w = unserialize($posted);
$j = stripslashes($w);
echo(count($j));
}

The script aways returns 1, but I've submited 10 values.

Thank's in advance

Rodrigo


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




[PHP] Source Code for the CNN Grabber

2002-03-28 Thread Ron

This is the source, which is to advanced for me to debug!!!
Waiting on their responce and maybe they can help me.Anybody have any
clues

?
##
# spider_cnn.php
#
# Copyright W3matter.com LLC
# http://www.w3matter.com
##
# Released under the GNU
# Please keep this copyright
# notice intact.
##


#- Spider CNN for latest headlines

#- Fetch the page and remove newlines
$page = join(,file(http://www.cnn.com/;));
$page = str_replace(\n,,$page);

#- Grab the latest news segment from the page
if(preg_match(/OTHER TOP NEWS(.*?)\/other news/,$page,$match))
{
#- Grep each headline and it's URL
if(preg_match_all('/a href=(.*?)(.*?)\/a/',$match[1],$matches))
{
$out  = h3Today's CNN Headlines/h3;
$out .= font size=-1\n;
$out .= ul\n;

$num = count($matches[1]);
for($x=0;$x$num;$x++)
{
$url   = http://www.cnn.com.$matches[1][$x];
$title = $matches[2][$x];
$out .= li a href=$url target=blank$title/a\n;
}

$out .= /ul\n;
$out .= /font\n;

echo $out;

}
}

?





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




Re: [PHP] Source Code for the CNN Grabber

2002-03-28 Thread Chris Boget

 This is the source, which is to advanced for me to debug!!!
 Waiting on their responce and maybe they can help me.Anybody have any
 clues

Perhaps if you told us what was going wrong?

Chris


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




[PHP] Re: Source Code for the CNN Grabber

2002-03-28 Thread Ron

Sorry meant to reply to my previous postAll it does is return a
blank page!
Ron [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 This is the source, which is to advanced for me to debug!!!
 Waiting on their responce and maybe they can help me.Anybody have any
 clues

 ?
 ##
 # spider_cnn.php
 #
 # Copyright W3matter.com LLC
 # http://www.w3matter.com
 ##
 # Released under the GNU
 # Please keep this copyright
 # notice intact.
 ##


 #- Spider CNN for latest headlines

 #- Fetch the page and remove newlines
 $page = @join(,file(http://www.cnn.com/;));
 $page = str_replace(\n,,$page);

 #- Grab the latest news segment from the page
 if(preg_match(/OTHER TOP NEWS(.*?)\/other news/,$page,$match))
 {
 #- Grep each headline and it's URL
 if(preg_match_all('/a href=(.*?)(.*?)\/a/',$match[1],$matches))
 {
 $out  = h3Today's CNN Headlines/h3;
 $out .= font size=-1\n;
 $out .= ul\n;

 $num = count($matches[1]);
 for($x=0;$x$num;$x++)
 {
 $url   = http://www.cnn.com.$matches[1][$x];
 $title = $matches[2][$x];
 $out .= li a href=$url target=blank$title/a\n;
 }

 $out .= /ul\n;
 $out .= /font\n;

 echo $out;

 }
 }

 ?







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




Re: [PHP] Enabling PHP in Apache when PHP is linked INTO the server?

2002-03-28 Thread Jason Wong

On Thursday 28 March 2002 23:40, Max Wilson wrote:
 I have an Apache server built with mod_php4.c linked into the executable.
 e.g.

 bash-2.03$ httpd -l
 Compiled-in modules:
   http_core.c
   mod_env.c
   
   mod_php4.c
   mod_perl.c


 What changes do i need to make to http.conf before I can use php in web
 pages which will work please?

Probably something like:


  AddType application/x-httpd-php .php4 .php3 .phtml .php .inc
  AddType application/x-httpd-php-source .phps


Change the extensions to suit your needs.


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

/*
I am a deeply superficial person.
-- Andy Warhol
*/

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




[PHP] How is code in PHP interpreted, from 1st line to last? i dont think so

2002-03-28 Thread Moschitz Martin

How can I say php to execute graf.php until it´s finished and then move on
to the rest of the code?

echo img src='graf.php;
...
more code
...

tanxs

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




Re: [PHP] How is code in PHP interpreted, from 1st line to last? i dont think so

2002-03-28 Thread Chris Boget

 How can I say php to execute graf.php until it´s finished and then move on
 to the rest of the code?

 echo img src='graf.php;
 ...
 more code
 ...

echo img src=';
include( graf.php );
echo ;

Chris


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




RE: [PHP] RADIUS - supported in PHP?

2002-03-28 Thread Benji Spencer


Actually, that is more of a Kerberos system that you are thinking of.

That is the other option. I am not the one making the discussions and have 
only been asked to investigate how RADIUS would interact with the web (as 
RADIUS)  would also be how dial up users would be authenticated.

I suggest you read up on these rfcs: 2618, 2619, 2620, 2621, 2865, 2866, 
2867, 2869, and 3162.

thanks..I will look at them.

You could also try writing a radius extension for php?

I did find one PHP script which used RADIUS for authentication...I was just 
wondering if there were other options and if this all made sense or not.

thanks

benji

---
Ben Spencer
Web Support
[EMAIL PROTECTED]
x 2288


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




RE: [PHP] How is code in PHP interpreted,from 1st line to last? i do nt think so

2002-03-28 Thread Darren Gamble

Good day,

Please keep this conversation on the list.

As my message says, no, in HTML you don't have text and images together.
The image is retrieved from the server by the client in a completely
different request.

The main request basically says An image goes here.  Go ask over there to
go get that image.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Moschitz Martin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 8:58 AM
To: 'Darren Gamble'
Subject: AW: [PHP] How is code in PHP interpreted, from 1st line to
last? i do nt think so


But the problem with include tag is, that I can´t display images and text
together, or can i?

thx
martin

-Ursprüngliche Nachricht-
Von: Darren Gamble [mailto:[EMAIL PROTECTED]]
Gesendet am: Donnerstag, 28. März 2002 16:49
An: 'Moschitz Martin'; [EMAIL PROTECTED]
Betreff: RE: [PHP] How is code in PHP interpreted, from 1st line to
last? i do nt think so

Good day.

If you want some php code to execute another file of php code and the
continue afterwards, use the include() statement.

Please note that with the example you've listed there, the code isn't
executed the way that you might think.  The client will receive all of the
html from the PHP script first.  Then, the client will look at the img tag
and figured out that it has to request graf.php, which is does (which will
be executed separately).


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Moschitz Martin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 8:46 AM
To: [EMAIL PROTECTED]
Subject: [PHP] How is code in PHP interpreted, from 1st line to last? i
do nt think so


How can I say php to execute graf.php until it´s finished and then move on
to the rest of the code?

echo img src='graf.php;
...
more code
...

tanxs

-- 
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] How is code in PHP interpreted,from 1st line to last? i do nt think so

2002-03-28 Thread Darren Gamble

Good day,

No, there is no real way in HTML to have this work.  You would be best off
looking at WHY you need the image to be done first, and change your
programming appropriately to take into account how HTML works.

A very messy solution would be to have an include statement that generates
an image someplace, referenced by your main program.  This will cause the
image to be generated before the rest of the code is executed.  But, then
you'll have to worry about cleaning it up later.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Moschitz Martin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 9:06 AM
To: 'Darren Gamble'; Moschitz Martin
Cc: Php
Subject: AW: [PHP] How is code in PHP interpreted, from 1st line to
last? i do nt think so


As my message says, no, in HTML you don't have text and images together.
The image is retrieved from the server by the client in a completely
different request.

The main request basically says An image goes here.  Go ask over there
to
go get that image.

so, do you have any solution for me, how i can get the image processed
first? include doesn´t work...

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




[PHP] Group moderation formula

2002-03-28 Thread SP

Everyone gets an arbitrary 100 points ranking to start with.  Everyone can
vote for or against a proposal.  If you vote for a proposal and it gets
approved by the majority then you get more points.  If you vote against a
proposal and it gets approved then you lose points.  The more points you
have for your ranking the more weight you have in your voting.  So the
more times you are right in your approval the more weight you get.

Does anyone have any ideas or formula they would use to figure out how the
points should be awarded?


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




AW: [PHP] How is code in PHP interpreted, from 1st line to last? i do nt think so

2002-03-28 Thread Moschitz Martin

As my message says, no, in HTML you don't have text and images together.
The image is retrieved from the server by the client in a completely
different request.

The main request basically says An image goes here.  Go ask over there
to
go get that image.

so, do you have any solution for me, how i can get the image processed
first? include doesn´t work...

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




[PHP] Enabling PHP in Apache when PHP is linked INTO the server?

2002-03-28 Thread Max Wilson

I have an Apache server built with mod_php4.c linked into the executable.
e.g.

bash-2.03$ httpd -l
Compiled-in modules:
  http_core.c
  mod_env.c
  
  mod_php4.c
  mod_perl.c


What changes do i need to make to http.conf before I can use php in web
pages which will work please?

--
Thanks lots



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




Re: [PHP] setcookie with array (was serialize)

2002-03-28 Thread Jason Wong

On Thursday 28 March 2002 23:25, Rodrigo Peres wrote:
 Hi list,

 Regarding my last post about serialize, I've tried many things but couldn't
 make it function.

 I'm trying to store the data from a form in order to allow my user to stop
 the process of filling the form and retrieve later what was inserted
 before.

 Among many other thing I tried this little script only to test but didn't
 work. why??

 if(isset($submit)) {
 $x = addslashes($HTTP_POST_VARS);

addslashes works on string, $HTTP_POST_VARS is an array?

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

/*
Take care of the luxuries and the necessities will take care of themselves.
-- Lazarus Long
*/

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




RE: [PHP] SQL Question

2002-03-28 Thread Rick Emery

What do you mean ORDER BY 'S' ??

yes, it can be a column or combination of columns and data.

What are you trying to DO?

-Original Message-
From: Sebastian A. [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 10:30 AM
To: PHP General List (PHP.NET)
Subject: RE: [PHP] SQL Question


When you say ORDER BY that, is it also possible to do that via letters
such as ORDER BY 'S', because from what I understand, ORDER BY has to be a
column.

-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 3:49 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] SQL Question

On Thursday 28 March 2002 22:34, Sebastian A. wrote:
 How do I sort out data from mysql_fetch_row() or mysql_fetch_array? For
 example say I wanted to list all my users alphabetically. How would I do
 this? Or say I had a form and I wanted to present the content to the user
 *AFTER* they have filled it out so that they can check for mistakes.
 Mysql_fetch_row() returns all the rows in a field, so I would guess that I
 have to sort using PHP. Can anyone provide me with an idea as to how I
 could accomplish this?

1) This type of question should best be posted to the php-db list.

2) Sorting should best be done from mysql using the ORDER BY clause:

  SELECT this, that, the, other
FROM table
   ORDER BY that

3) If you insist on sorting in PHP then read all the rows from your query
into an array and use one of the array sort functions -- asort() etc.



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

/*
Things are more like they used to be than they are now.
*/

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


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

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




[PHP] classes- getting their slowly but surely I think

2002-03-28 Thread Caspar Kennerdale

just a quick query, hopefully someone can help (sorry for these repeat
schooboy questions)

re classes-

Can you create an instance of a class and use its 'value' within an instance
of another instance of the same class?


For example I have created two classes- html.class and db.class

I am creating an instance of the db.class to give an array containing the
rows from a table.

I would like to create a table using my HTML.class and using a while loop
create a tr using the date collected from each row in my db.class.

This all works fine.
However when I embed this newly created table into a cell of another table
created with html.class, the table is still created but it does not appear
in the cell, but outside of the desired table- so I have two tables side by
side instead of one table embedded within the cell of another?

Is this a code/ syntax issue or have I misunderstood the scope of classes?

Thanks


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




RE: [PHP] classes- getting their slowly but surely I think

2002-03-28 Thread Rick Emery

this appears to be a coding issue.

show your code...we can't read your mind...

-Original Message-
From: Caspar Kennerdale [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 6:45 PM
To: PHP
Subject: [PHP] classes- getting their slowly but surely I think


just a quick query, hopefully someone can help (sorry for these repeat
schooboy questions)

re classes-

Can you create an instance of a class and use its 'value' within an instance
of another instance of the same class?


For example I have created two classes- html.class and db.class

I am creating an instance of the db.class to give an array containing the
rows from a table.

I would like to create a table using my HTML.class and using a while loop
create a tr using the date collected from each row in my db.class.

This all works fine.
However when I embed this newly created table into a cell of another table
created with html.class, the table is still created but it does not appear
in the cell, but outside of the desired table- so I have two tables side by
side instead of one table embedded within the cell of another?

Is this a code/ syntax issue or have I misunderstood the scope of classes?

Thanks


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

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




RE: [PHP] SQL Question

2002-03-28 Thread Marcus Rasmussen

You could do it this way

WHERE column LIKE 's%' ORDER BY column

Now you'll get all rows sorted and where column is staring with an 's' or 'S'

-
On 28-03-02 at 17:30 Sebastian A. wrote:
-

When you say ORDER BY that, is it also possible to do that via letters
such as ORDER BY 'S', because from what I understand, ORDER BY has to be a
column.

-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 3:49 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] SQL Question

On Thursday 28 March 2002 22:34, Sebastian A. wrote:
 How do I sort out data from mysql_fetch_row() or mysql_fetch_array? For
 example say I wanted to list all my users alphabetically. How would I do
 this? Or say I had a form and I wanted to present the content to the user
 *AFTER* they have filled it out so that they can check for mistakes.
 Mysql_fetch_row() returns all the rows in a field, so I would guess that
I
 have to sort using PHP. Can anyone provide me with an idea as to how I
 could accomplish this?

1) This type of question should best be posted to the php-db list.

2) Sorting should best be done from mysql using the ORDER BY clause:

  SELECT this, that, the, other
FROM table
   ORDER BY that

3) If you insist on sorting in PHP then read all the rows from your query
into an array and use one of the array sort functions -- asort() etc.



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

/*
Things are more like they used to be than they are now.
*/

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


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




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




[PHP] arrays of strings - accessing elements of array elements

2002-03-28 Thread Lee P Reilly

Hi,

Dodgy subject header or what...

I have array of strings called $composition, and I itterate through this
using:
$composition[$i]

Is there any way to echo the first character of the string by doing
something like:
$composition[$i][0] or ($composition[$i)][0] ?

I can easily just do something like:
$temp_var = $composition[$i];
echo $temp_var[0];
, but I want to know if it's possible to do it another way.

Any input greatly appreciated!

- Best regards,

Lee


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




Re: [PHP] Enabling PHP in Apache when PHP is linked INTO the server?

2002-03-28 Thread Max Wilson

Is that all?


 Probably something like:


   AddType application/x-httpd-php .php4 .php3 .phtml .php .inc
   AddType application/x-httpd-php-source .phps


 On Thursday 28 March 2002 23:40, Max Wilson wrote:
  I have an Apache server built with mod_php4.c linked into the
executable.
  e.g.
 
  bash-2.03$ httpd -l
  Compiled-in modules:
http_core.c
mod_env.c

mod_php4.c
mod_perl.c
 
 
  What changes do i need to make to http.conf before I can use php in web
  pages which will work please?




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




[PHP] question

2002-03-28 Thread Chris Frommann

I was directed to this email address to ask a question, hope I'm not mailing the wrong 
person. Anyways, how would I get T in the date() function to display EST instead of 
Eastern Standard Time?

Thanks,
Chris



[PHP] Sending a header redirect mid-page

2002-03-28 Thread Dan Tappin

I am trying to add error trapping to my site.  In particular I want to
direct visitors to an error page when for what ever reason a MySQL
connection can not be made.  Rather than a page full of errors I want a
generic 'we are temporarily closed performing maintenance etc.. etc'

Basically after a failed mysql_connect attempt I want a redirection to this
error page.  I have searched the PHP site and mailing lists and I have seen
a few solutions.

In particular I found the use of ob_start() before the header info is send
on the page then the use of the follow for the redirect:

if($dbfail) {

ob_end_clean();
header(Location: http://.$SERVER_NAME./closed.php;);
exit;  // Halt the rest of the page from loading

};

I have also thought about just using a mysql_connect test in the header of
each page that I have a mysql query in and have the redirect there.  I want
to have such an include any way to add some generic functions to call from
anywhere as well.

My only concern is that I am adding another mysql_connect and I don't want
to slow things down any (things are blazing fast now but I want to keep it
that way).

It would be really nice if there was a one line function that could do this.
I also use Lasso and they have a simple [URL_Redirect:'http://domain.com']
tag which does the job.

I am also unfamiliar with the output buffer functions even after reading up
on them in the manual.  If I call ob_start() at the start of my page do I
need to call a closing ob function after my $dbfail code if the connection
is successful and my redirect ob_end_clean(); call is not made?

Any help would be greatly appreciated.

Thanks,

Dan
P.S. Please CC me/the list as I am on Digest Mode :^)
-- 
Dan Tappin
Wavefront Communications Limited
P:(403) 241-0062
F:(403) 241-0302
E: [EMAIL PROTECTED]



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




[PHP] running commands as root from a script

2002-03-28 Thread Ken Nagorski

Hi there,

I have a little problem. I need to run a few commands for Courier from a
script. What I have is a php based application that makes it easy to create
and manage virtual domains and the addresses for them from the web. However
when You Apply the changes everything is written to /tmp dir and the a
little perl script parses the file and moves things where they need to go
and then runs couriers makealiases command. Now you can't run a perl script
SUID so I wrote a C program that just calls system() and runs the script and
it is SUID. This doens't work however. No matter what I do. It is like
Courier ignores this.

I can't imagine there isn't anyone who has not run into the problem of
automating things via PHP and not had to run a system command as root at
some point in time. I am wondering what the different approaches to this
problem are.

Thanks
Ken




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




[PHP] Re: [PHP-DB] how to get consistent UTC from gmmktime (w/o dst-offset) ????

2002-03-28 Thread DL Neil

Hi Patrick,
[I have put this back on the list, because greater minds might come up
with a better explanation!?]

There appears to be an issue with gm time functions. gmmktime() is
supposed to take a GMT date and return a GMT UNIX TimeStamp (as per
mktime() but with no DST parameter). Conversely date() and gmdate() take
a UNIX TimeStamp and format a string representation of the date-time.

The question is how gmmktime() should perform when working with
date-times on both sides of the summer time discontinuity.

Assuming your server is running in a timezone that will change to/from
Summer Time over the coming weekend (others may be able to adjust
dates/offsets to run 'backwards' to cover last weekend, where relevant),
try running the following code; and explaining why the gm functions do
not complement each other (see below (way on down) for Patrick's
original observations):

table border=0 cellpadding=5 width=100%
  tr
td width=20%/td
td width=20%Time Key Value/td
td width=20%Local/td
td width=20%GMT/td
td width=20%Comment/td
  /td
  tr
  tr
td colspan=5
hr
/td
  /tr

?php
$tsNow = time();
$dtLoc = date(   D d.m.Y H:i I, $tsNow );
$dtGMT = gmdate( D d.m.Y H:i I, $tsNow );
echo tr .
   tdNow TSbrproduces dates:/td .
   td$tsNow/td .
   tdbr$dtLoc/td .
   tdbr$dtGMT/td .
 tdas expected/td .
   /tr ;

$ss   = date( s, $tsNow );
$hh   = substr($dtLoc, 15, 2);
$mm   = substr($dtLoc, 18, 2);
$DD   = substr($dtLoc,  4, 2);
$MM   = substr($dtLoc,  7, 2);
$ = substr($dtLoc, 10, 4);
$DST  = substr($dtLoc, 21, 1);
$mkLoc   =   mktime( $hh, $mm, $ss, $MM, $DD, $, $DST );
$gmmkLoc = gmmktime( $hh, $mm, $ss, $MM, $DD, $ );
$hh   = substr($dtGMT, 15, 2);
$mm   = substr($dtGMT, 18, 2);
$DD   = substr($dtGMT,  4, 2);
$MM   = substr($dtGMT,  7, 2);
$ = substr($dtGMT, 10, 4);
$DST  = substr($dtGMT, 21, 1);
$mkGMT   =   mktime( $hh, $mm, $ss, $MM, $DD, $, $DST );
$gmmkGMT = gmmktime( $hh, $mm, $ss, $MM, $DD, $ );
echo tr .
   td colspan=2Run above dates through mktime() to revert to TS/td
.
   td$mkLoc/td .
   td$mkGMT/td .
 tdboth correct/td .
   /tr ;
echo tr .
   td colspan=2Run above dates through gmmktime() to revert to
TS/td .
   td$gmmkLocbr/td .
   td$gmmkGMT/td .
 tdboth incorrect???/td .
   /tr ;

echo tr .
   td colspan=2Run above (incorrect) TS through date()/td .
//$dtLoc = date(   D d.m.Y H:i I, $tsNow );
//$dtGMT = gmdate( D d.m.Y H:i I, $tsNow );
   td . date( D d.m.Y H:i I, $gmmkLoc ) . br/td .
   td . date( D d.m.Y H:i I, $gmmkGMT ) . /td .
 tdcontinue incorrect/td .
   /tr ;

echo tr .
   td colspan=2Run above (incorrect) TS through gmdate()/td .
   td . gmdate( D d.m.Y H:i I, $gmmkLoc ) . br/td .
   td . gmdate( D d.m.Y H:i I, $gmmkGMT ) . /td .
 tdcontinue incorrect/td .
   /tr ;

echo trtd colspan=5hr/td/tr ;

$ts1wk = $tsNow + ( 7 * 24 * 60 * 60 );
$dtLoc = date(   D d.m.Y H:i I, $ts1wk );
$dtGMT = gmdate( D d.m.Y H:i I, $ts1wk );
echo tr .
   tdTS in one week's timebrproduces dates:/td .
   td$ts1wk/td .
   tdbr$dtLoc/td .
   tdbr$dtGMT/td .
 tdlocal clock springs forwards/td .
   /tr ;

$ss   = date( s, $ts1wk );
$hh   = substr($dtLoc, 15, 2);
$mm   = substr($dtLoc, 18, 2);
$DD   = substr($dtLoc,  4, 2);
$MM   = substr($dtLoc,  7, 2);
$ = substr($dtLoc, 10, 4);
$DST  = substr($dtLoc, 21, 1);
$mkLoc   =   mktime( $hh, $mm, $ss, $MM, $DD, $, $DST );
$gmmkLoc = gmmktime( $hh, $mm, $ss, $MM, $DD, $ );
$hh   = substr($dtGMT, 15, 2);
$mm   = substr($dtGMT, 18, 2);
$DD   = substr($dtGMT,  4, 2);
$MM   = substr($dtGMT,  7, 2);
$ = substr($dtGMT, 10, 4);
$DST  = substr($dtGMT, 21, 1);
$mkGMT   =   mktime( $hh, $mm, $ss, $MM, $DD, $, $DST );
$gmmkGMT = gmmktime( $hh, $mm, $ss, $MM, $DD, $ );
echo tr .
   td colspan=2Run above dates through mktime() to revert to TS/td
.
   td$mkLoc/td .
   td$mkGMT/td .
 tdboth correct - using dst!/td .
   /tr ;
echo tr .
   td colspan=2Run above dates through gmmktime() to revert to
TS/td .
   td$gmmkLocbr/td .
   tdbr$gmmkGMT/td .
 tdlocal incorrectbr- GMT correct/td .
   /tr ;

echo tr .
   td colspan=2Run above (correct) gmTS through date()/td .
   td . date( D d.m.Y H:i I, $gmmkGMT ) . /td .
   td/td .
 tdcontinues correct/td .
   /tr ;

echo tr .
   td colspan=2Run above (correct) gmTS through gmdate()/td .
   td/td .
   td . gmdate( D d.m.Y H:i I, $gmmkGMT ) . /td .
 tdcontinues correct/td .
   /tr ;

echo tr .
   td colspan=2Run above (incorrect) gmTS through date()/td .
   td . date( D d.m.Y H:i I, $gmmkLoc ) . /td .
   td/td .
 tdcontinues incorrect/td .
   /tr ;

echo tr .
   td colspan=2Run above (incorrect) gmTS through gmdate()/td .
   td/td .
   td . gmdate( D d.m.Y H:i I, $gmmkLoc ) . /td .
 tdcontinues incorrect/td .
   /tr ;

echo trtd colspan=5hr/td/tr ;

$tsLoc = mktime( );
$tsGMT = gmmktime( );
echo tr .
   td*mktime( NOW)/td .
   td . date( 'D d.m.Y H:i I' ) . /td .
   td$tsLoc/td .
   td$tsGMT/td .
 tdthink they should be 

Re: [PHP] SQL Question

2002-03-28 Thread Jason Wong

On Friday 29 March 2002 00:30, Sebastian A. wrote:
 When you say ORDER BY that, is it also possible to do that via letters
 such as ORDER BY 'S', because from what I understand, ORDER BY has to be a
 column.

In my example, 'this', 'that', 'the',  'other' are all columns. So yes, 
ORDER BY , where  is a column.


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

/*
To refuse praise is to seek praise twice.
*/

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




RE: [PHP] running commands as root from a script

2002-03-28 Thread Darren Gamble

Good day,

A bit off topic, but you can run a Perl script setuid.  You have to pass a
flag to Perl to let it know that it's OK, though (it's -U, I believe) which
would appear in your first she-bang line.

I've never had to run a PHP script setuid.  I would imagine that one would
have to write it CGI-like instead of via the server module.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Ken Nagorski [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 10:37 AM
To: [EMAIL PROTECTED]
Subject: [PHP] running commands as root from a script


Hi there,

I have a little problem. I need to run a few commands for Courier from a
script. What I have is a php based application that makes it easy to create
and manage virtual domains and the addresses for them from the web. However
when You Apply the changes everything is written to /tmp dir and the a
little perl script parses the file and moves things where they need to go
and then runs couriers makealiases command. Now you can't run a perl script
SUID so I wrote a C program that just calls system() and runs the script and
it is SUID. This doens't work however. No matter what I do. It is like
Courier ignores this.

I can't imagine there isn't anyone who has not run into the problem of
automating things via PHP and not had to run a system command as root at
some point in time. I am wondering what the different approaches to this
problem are.

Thanks
Ken




-- 
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] running commands as root from a script

2002-03-28 Thread Jason Wong

On Friday 29 March 2002 01:44, Darren Gamble wrote:
 Good day,

 A bit off topic, but you can run a Perl script setuid.  You have to pass a
 flag to Perl to let it know that it's OK, though (it's -U, I believe) which
 would appear in your first she-bang line.

 I've never had to run a PHP script setuid.  I would imagine that one would
 have to write it CGI-like instead of via the server module.

Some systems disable setuid Perl scripts (RH for example). The only way to 
enable it is to recompile Perl.




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

/*
Whenever I hear anyone arguing for slavery, I feel a strong impulse to
see it tried on him personally.
-- Abraham Lincoln
*/

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




Re: [PHP] Enabling PHP in Apache when PHP is linked INTO the server?

2002-03-28 Thread Jason Wong

On Friday 29 March 2002 01:25, Max Wilson wrote:
 Is that all?

  Probably something like:
 
 
AddType application/x-httpd-php .php4 .php3 .phtml .php .inc
AddType application/x-httpd-php-source .phps

Did you want more?

OK, you need to restart the httpd server as well.


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

/*
The worst sin towards our fellow creatures is not to hate them,
but to be indifferent to them; that's the essence of inhumanity.
-- G.B. Shaw
*/

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




RE: [PHP] SQL Question

2002-03-28 Thread Miguel Cruz

On Thu, 28 Mar 2002, Sebastian A. wrote:
 When you say ORDER BY that, is it also possible to do that via letters
 such as ORDER BY 'S', because from what I understand, ORDER BY has to be
 a column.

The object of order by should be something that changes for each row, or 
else the statement is meaningless.

If you order by s, you aren't really doing anything, because the letter
s is always the letter s, regardless of the data in the database.

miguel


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




Re: [PHP] FTP RAW

2002-03-28 Thread Analysis Solutions

 I have written the code to upload using RAW FTP commands.

Cool!

How'd you get it to work?

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

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




Re: [PHP] setcookie with array (was serialize)

2002-03-28 Thread Miguel Cruz

On Thu, 28 Mar 2002, Rodrigo Peres wrote:
 if(isset($submit)) {
 $x = addslashes($HTTP_POST_VARS);
 $y = serialize($x);
 setcookie(posted,$y)
 }

1) You probably should call serialize on the array to turn it into a
string before trying any string transformations like addslashes. If you 
don't understand what is going on, help yourself out by printing out the 
values every step of the way.

2) You don't need to use addslashes anyway because it has nothing to do
with cookies; they are not quoted.

miguel


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




Re: [PHP] Regular Expression Problem continues

2002-03-28 Thread Sharat Hegde

Rasmus,

The code worked fine in PHP Version 3.x

It does not work with PHP Version 4.1.1. That is where I have a problem.

With Regards,
Sharat

From: Rasmus Lerdorf [EMAIL PROTECTED]
To: Sharat Hegde [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: Re: [PHP] Regular Expression Problem continues
Date: Thu, 28 Mar 2002 02:33:16 -0800 (PST)

This code works fine:

eregi(__([a-z0-9_]+)__, Hello __WO_RD__ Test, $Matches);
echo $Matches[1];

produces:

WO_RD

-Rasmus

On Thu, 28 Mar 2002, Sharat Hegde wrote:

  Hello,
 
  I am still having problems with the regular expressions. Looks like 
there
  has been a change in the way they are handled between PHP3 and PHP4, 
since
  the code worked with PHP3 !!
 
  I need to search for all words having alphanumberic characters as well 
as _
  (underscore) which are prefixed and suffixed with __ (2 underscores).
 
  The regular expression I am using is
  eregi(__([a-z0-9_]+)__, Hello __WO_RD__ Test, $Matches)
 
  I am expecting the above code to return __WO_RD__ as the match, but it 
does
  not seem to work. Can someone help out.
 
  With Regards,
  Sharat
 
 
  _
  Send and receive Hotmail on your mobile device: http://mobile.msn.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





_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




Re: [PHP] Regular Expression Problem continues

2002-03-28 Thread Miguel Cruz

Works for me in 4.1.1 (and 4.1.2) too. Are you sure there's not something 
else going on? Can you provide an unadulterated code sample pasted 
directly from your problem script?

miguel

On Thu, 28 Mar 2002, Sharat Hegde wrote:
 The code worked fine in PHP Version 3.x
 
 It does not work with PHP Version 4.1.1. That is where I have a problem.
 
 With Regards,
 Sharat
 
 From: Rasmus Lerdorf [EMAIL PROTECTED]
 To: Sharat Hegde [EMAIL PROTECTED]
 CC: [EMAIL PROTECTED]
 Subject: Re: [PHP] Regular Expression Problem continues
 Date: Thu, 28 Mar 2002 02:33:16 -0800 (PST)
 
 This code works fine:
 
 eregi(__([a-z0-9_]+)__, Hello __WO_RD__ Test, $Matches);
 echo $Matches[1];
 
 produces:
 
 WO_RD


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




Re: [PHP] Regular Expression Problem continues

2002-03-28 Thread Rasmus Lerdorf

I just tried it on 4.1.x and it is working fine.

On Thu, 28 Mar 2002, Sharat Hegde wrote:

 Rasmus,

 The code worked fine in PHP Version 3.x

 It does not work with PHP Version 4.1.1. That is where I have a problem.

 With Regards,
 Sharat

 From: Rasmus Lerdorf [EMAIL PROTECTED]
 To: Sharat Hegde [EMAIL PROTECTED]
 CC: [EMAIL PROTECTED]
 Subject: Re: [PHP] Regular Expression Problem continues
 Date: Thu, 28 Mar 2002 02:33:16 -0800 (PST)
 
 This code works fine:
 
 eregi(__([a-z0-9_]+)__, Hello __WO_RD__ Test, $Matches);
 echo $Matches[1];
 
 produces:
 
 WO_RD
 
 -Rasmus
 
 On Thu, 28 Mar 2002, Sharat Hegde wrote:
 
   Hello,
  
   I am still having problems with the regular expressions. Looks like
 there
   has been a change in the way they are handled between PHP3 and PHP4,
 since
   the code worked with PHP3 !!
  
   I need to search for all words having alphanumberic characters as well
 as _
   (underscore) which are prefixed and suffixed with __ (2 underscores).
  
   The regular expression I am using is
   eregi(__([a-z0-9_]+)__, Hello __WO_RD__ Test, $Matches)
  
   I am expecting the above code to return __WO_RD__ as the match, but it
 does
   not seem to work. Can someone help out.
  
   With Regards,
   Sharat
  
  
   _
   Send and receive Hotmail on your mobile device: http://mobile.msn.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
 




 _
 Send and receive Hotmail on your mobile device: http://mobile.msn.com



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




[PHP] Cannot find php.ini

2002-03-28 Thread Todd Cary

My NT server has the OS in the directory, WINNT2, and the php.ini is not
being read that is in that directory.  What am I missing?

Todd

--
Dr. Todd Cary
Ariste Software
2200 D Street Extension
Petaluma, CA 94952
707-773-4523
[EMAIL PROTECTED]



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




[PHP] Emulating POST ?

2002-03-28 Thread Devin Atencio


I need to somehow write a PHP Script that will POST
XML type stuff to UPS like this:

?xml version=1.0?
AccessRequest xml:lang=en-US
   AccessLicenseNumberTEST262223144CAT/AccessLicenseNumber
   UserIdtestUser/UserId
   PasswordtestPW/Password
/AccessRequest
 

?xml version=1.0?
 TrackRequest xml:lang=en-US
  Request
   TransactionReference
CustomerContextExample 1/CustomerContext
XpciVersion1.0001/XpciVersion
   /TransactionReference
   RequestActionTrack/RequestAction
   RequestOptionactivity/RequestOption
  /Request
  TrackingNumber1Z12345E1512345676/TrackingNumber
 /TrackRequest

How could I do this? Any help would be greatly appreciated?


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




RE: [PHP] Emulating POST ?

2002-03-28 Thread Johnson, Kirk

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

Kirk

 -Original Message-
 From: Devin Atencio [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, March 28, 2002 12:14 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Emulating POST ?
 
 
 
 I need to somehow write a PHP Script that will POST
 XML type stuff to UPS like this:

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




RE: [PHP] Emulating POST ?

2002-03-28 Thread Rick Emery

http://sourceforge.net/projects/snoopy/

-Original Message-
From: Devin Atencio [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 1:14 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Emulating POST ?



I need to somehow write a PHP Script that will POST
XML type stuff to UPS like this:

?xml version=1.0?
AccessRequest xml:lang=en-US
   AccessLicenseNumberTEST262223144CAT/AccessLicenseNumber
   UserIdtestUser/UserId
   PasswordtestPW/Password
/AccessRequest
 

?xml version=1.0?
 TrackRequest xml:lang=en-US
  Request
   TransactionReference
CustomerContextExample 1/CustomerContext
XpciVersion1.0001/XpciVersion
   /TransactionReference
   RequestActionTrack/RequestAction
   RequestOptionactivity/RequestOption
  /Request
  TrackingNumber1Z12345E1512345676/TrackingNumber
 /TrackRequest

How could I do this? Any help would be greatly appreciated?


-- 
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] new $_SESSION variables vs. session_register/unregister

2002-03-28 Thread Steven Jarvis

The manual says:

 If you are using $HTTP_SESSION_VARS/$_SESSION, do not use 
 session_register(), session_is_registered() and session_unregister().

If that's the case, how do I unregister $_SESSION variables? Do I just 
use unset() or is there another way?

I'm pretty new to PHP and I'm just getting started using sessions. The 
book I'm using to learn sessions isn't new enough to include how to deal 
with the new $_SESSION global variables array, and the manual's dire 
warning isn't explained thoroughly enough for me.

Thanks!

Steven

--
Steven Jarvis
Web Developer
Arkansas Democrat-Gazette
Northwest Edition
NWAnews.com


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




Re: [PHP] new $_SESSION variables vs. session_register/unregister

2002-03-28 Thread Steven Jarvis

Uh... doh!

I was reading this:

Note: If $_SESSION (or $HTTP_SESSION_VARS for PHP 4.0.6 or less) is 
used, use unset() to unregister a session variable.

incorrectly.

In my haste, I was basically not parsing the parentheses. I see now that 
I just treat the $_SESSION variables like any other variable and use 
unset() and isset() (in place of session_is_registered().

I apologize for the noise.

Steven


On Thursday, March 28, 2002, at 01:21  PM, Steven Jarvis wrote:

 The manual says:

 If you are using $HTTP_SESSION_VARS/$_SESSION, do not use 
 session_register(), session_is_registered() and session_unregister().

 If that's the case, how do I unregister $_SESSION variables? Do I just 
 use unset() or is there another way?

 I'm pretty new to PHP and I'm just getting started using sessions. The 
 book I'm using to learn sessions isn't new enough to include how to 
 deal with the new $_SESSION global variables array, and the manual's 
 dire warning isn't explained thoroughly enough for me.

 Thanks!

 Steven

 --
 Steven Jarvis
 Web Developer
 Arkansas Democrat-Gazette
 Northwest Edition
 NWAnews.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] Re: Sessions/Cookies and HTTP Auth

2002-03-28 Thread Steve Clay

Just as a note, recent builds of Mozilla have a cookie manager that is
the best for seeing exactly what's going on with your cookies.  You
can list by name or host and see all the properties of each.  Know
when your session cookies are sent/deleted, know if PHP is allowing
use of the same SESSID in a new session..

BTW the rest of the browser is tops as well.

As for David's post, keep in mind PHP won't generate an error if
a cookie isn't accepted.  I bet when cookies are turned off in some
browsers, the browser may accept it but throw it away.  Like junk
mail.  Could be wrong about this though..

Steve

Wednesday, March 27, 2002, 10:10:19 PM, David wrote:
DM 3.  I am thinking that I should get an error because I presume that
DM session_start() will attempt to set a cookie (which it appears to do).  
DM (I tried setcookie() too and the cookie was accepted.)
-- 
[EMAIL PROTECTED] ** http://mrclay.org


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




[PHP] where i get .so [dll] file of linux ?

2002-03-28 Thread Prachait Saxena

Hello

I would like to Know, where Site or Link i can get complied .so [dll] files.
of linux

as i have php_sockets.dll which works very fine in Windows enviroment. but
on linux

Can you suggest any other option for this.

I am using  dl(php_sockets.dll); while writing my code for windows and
what to same for Linux


--
Bye, and  Have a nice day.

Prachait Saxena
---
Phone :-  +91 - 712 - 544476
Email   :-  [EMAIL PROTECTED] (Official)
   [EMAIL PROTECTED](Official)
   [EMAIL PROTECTED] (Personal)
ICQ :-  71855637
MSN   :-  prachait
Yahoo Messenger :- getprachait

 If you do for other's !
 Other's will do for you !!

Visit me at http://www.sitesontesting.com/prachait



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




Re: [PHP] Regular Expression Problem continues

2002-03-28 Thread Sharat Hegde

Yesthere may be something else going wrong. The source code of the test 
file I have is:

?php
if (eregi(__([a-z0-9_]+)__, Hello __WO_RD__ Test, $Matches))
print Match Found with  . $Matches[1] . br;
else
print Match Not Foundbr;
?

The source is on my server in a test directory at 
http://www.byronholidays.com/inikatest/testereg.php3 or 
http://www.byronholidays.com/inikatest/testereg.php

To check the PHP version on the server, you can run
http://www.byronholidays.com/inikatest/checkenv.php3

Regards,
Sharat

From: Miguel Cruz [EMAIL PROTECTED]
To: Sharat Hegde [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: Re: [PHP] Regular Expression Problem continues
Date: Thu, 28 Mar 2002 12:51:44 -0600 (CST)

Works for me in 4.1.1 (and 4.1.2) too. Are you sure there's not something
else going on? Can you provide an unadulterated code sample pasted
directly from your problem script?

miguel

On Thu, 28 Mar 2002, Sharat Hegde wrote:
  The code worked fine in PHP Version 3.x
 
  It does not work with PHP Version 4.1.1. That is where I have a problem.
 
  With Regards,
  Sharat
 
  From: Rasmus Lerdorf [EMAIL PROTECTED]
  To: Sharat Hegde [EMAIL PROTECTED]
  CC: [EMAIL PROTECTED]
  Subject: Re: [PHP] Regular Expression Problem continues
  Date: Thu, 28 Mar 2002 02:33:16 -0800 (PST)
  
  This code works fine:
  
  eregi(__([a-z0-9_]+)__, Hello __WO_RD__ Test, $Matches);
  echo $Matches[1];
  
  produces:
  
  WO_RD


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





_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


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




Re: [PHP] Regular Expression Problem continues

2002-03-28 Thread Rasmus Lerdorf

In your configure flags you have: --with-regex=system

Why did you do this?  Recompile without that switch and see if things
change.

-Rasmus


On Thu, 28 Mar 2002, Sharat Hegde wrote:

 Yesthere may be something else going wrong. The source code of the test
 file I have is:

 ?php
   if (eregi(__([a-z0-9_]+)__, Hello __WO_RD__ Test, $Matches))
   print Match Found with  . $Matches[1] . br;
   else
   print Match Not Foundbr;
 ?

 The source is on my server in a test directory at
 http://www.byronholidays.com/inikatest/testereg.php3 or
 http://www.byronholidays.com/inikatest/testereg.php

 To check the PHP version on the server, you can run
 http://www.byronholidays.com/inikatest/checkenv.php3

 Regards,
 Sharat

 From: Miguel Cruz [EMAIL PROTECTED]
 To: Sharat Hegde [EMAIL PROTECTED]
 CC: [EMAIL PROTECTED]
 Subject: Re: [PHP] Regular Expression Problem continues
 Date: Thu, 28 Mar 2002 12:51:44 -0600 (CST)
 
 Works for me in 4.1.1 (and 4.1.2) too. Are you sure there's not something
 else going on? Can you provide an unadulterated code sample pasted
 directly from your problem script?
 
 miguel
 
 On Thu, 28 Mar 2002, Sharat Hegde wrote:
   The code worked fine in PHP Version 3.x
  
   It does not work with PHP Version 4.1.1. That is where I have a problem.
  
   With Regards,
   Sharat
  
   From: Rasmus Lerdorf [EMAIL PROTECTED]
   To: Sharat Hegde [EMAIL PROTECTED]
   CC: [EMAIL PROTECTED]
   Subject: Re: [PHP] Regular Expression Problem continues
   Date: Thu, 28 Mar 2002 02:33:16 -0800 (PST)
   
   This code works fine:
   
   eregi(__([a-z0-9_]+)__, Hello __WO_RD__ Test, $Matches);
   echo $Matches[1];
   
   produces:
   
   WO_RD
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 




 _
 Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


 --
 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] Getting just the filename

2002-03-28 Thread Sharat Hegde

Hello,

Is there a simple way of getting just the filename from strings which give 
the filename along with the path.

For example, I need test.txt from c:\myfiles\test.txt
It should also work with the / character, in other words, give test.txt 
from /htdocs/myfiles/test.txt

With Regards,
Sharat



_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




RE: [PHP] Getting just the filename

2002-03-28 Thread Rick Emery

string basename (string path [, string suffix])

i recommend you read the manual before posting

-Original Message-
From: Sharat Hegde [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 1:49 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Getting just the filename


Hello,

Is there a simple way of getting just the filename from strings which give 
the filename along with the path.

For example, I need test.txt from c:\myfiles\test.txt
It should also work with the / character, in other words, give test.txt 
from /htdocs/myfiles/test.txt

With Regards,
Sharat



_
Send and receive Hotmail on your mobile device: http://mobile.msn.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] Regular Expression Problem continues

2002-03-28 Thread Sharat Hegde

The files are hosted on a 3rd party hosted ISP. On my local machine it works 
fine. While I try and request for a recompile of the system, is there an 
alternate way out?

By the way, what is the significance of the switch --with-regex=system

Rasmus and Miguel, Thanks for your help.

With Regards,
Sharat


From: Rasmus Lerdorf [EMAIL PROTECTED]
To: Sharat Hegde [EMAIL PROTECTED]
CC: [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: [PHP] Regular Expression Problem continues
Date: Thu, 28 Mar 2002 11:40:41 -0800 (PST)

In your configure flags you have: --with-regex=system

Why did you do this?  Recompile without that switch and see if things
change.

-Rasmus


On Thu, 28 Mar 2002, Sharat Hegde wrote:

  Yesthere may be something else going wrong. The source code of the 
test
  file I have is:
 
  ?php
  if (eregi(__([a-z0-9_]+)__, Hello __WO_RD__ Test, $Matches))
  print Match Found with  . $Matches[1] . br;
  else
  print Match Not Foundbr;
  ?
 
  The source is on my server in a test directory at
  http://www.byronholidays.com/inikatest/testereg.php3 or
  http://www.byronholidays.com/inikatest/testereg.php
 
  To check the PHP version on the server, you can run
  http://www.byronholidays.com/inikatest/checkenv.php3
 
  Regards,
  Sharat
 
  From: Miguel Cruz [EMAIL PROTECTED]
  To: Sharat Hegde [EMAIL PROTECTED]
  CC: [EMAIL PROTECTED]
  Subject: Re: [PHP] Regular Expression Problem continues
  Date: Thu, 28 Mar 2002 12:51:44 -0600 (CST)
  
  Works for me in 4.1.1 (and 4.1.2) too. Are you sure there's not 
something
  else going on? Can you provide an unadulterated code sample pasted
  directly from your problem script?
  
  miguel
  
  On Thu, 28 Mar 2002, Sharat Hegde wrote:
The code worked fine in PHP Version 3.x
   
It does not work with PHP Version 4.1.1. That is where I have a 
problem.
   
With Regards,
Sharat
   
From: Rasmus Lerdorf [EMAIL PROTECTED]
To: Sharat Hegde [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: Re: [PHP] Regular Expression Problem continues
Date: Thu, 28 Mar 2002 02:33:16 -0800 (PST)

This code works fine:

eregi(__([a-z0-9_]+)__, Hello __WO_RD__ Test, $Matches);
echo $Matches[1];

produces:

WO_RD
  
  
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 
 
 
  _
  Get your FREE download of MSN Explorer at 
http://explorer.msn.com/intl.asp.
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 





_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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




Re: [PHP] Regular Expression Problem continues

2002-03-28 Thread Rasmus Lerdorf

 While I try and request for a recompile of the system, is there an
 alternate way out?

Why don't you use the PCRE functions instead.

The equivalent preg would be:

  preg_match(/__([a-z0-9_]+)__/i, Hello __WO_RD__ Test, $Matches)

 By the way, what is the significance of the switch --with-regex=system

It means that it was compiled against the system regex library as opposed
to the one shipped with PHP.

-Rasmus


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




RE: [PHP] Getting just the filename

2002-03-28 Thread Vail, Warren

One of the things I like about PHP, is if you think of something that you
need like this, someone else has already thought about it and provided a
function to do it.  Try;

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


Warren Vail
Tools, Metrics  Quality Processes
(415) 667-7814
Pager (877) 774-9891
215 Fremont 02-658


-Original Message-
From: Sharat Hegde [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 11:49 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Getting just the filename


Hello,

Is there a simple way of getting just the filename from strings which give 
the filename along with the path.

For example, I need test.txt from c:\myfiles\test.txt
It should also work with the / character, in other words, give test.txt 
from /htdocs/myfiles/test.txt

With Regards,
Sharat



_
Send and receive Hotmail on your mobile device: http://mobile.msn.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] Sending a header redirect mid-page

2002-03-28 Thread Dan Tappin

 -Original Message-
 From: Dan Tappin [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, March 28, 2002 12:36 PM
 
 My only concern is that I am adding another mysql_connect and
 
 Why do it twice?  The connection will still be there later in the script.

Yes... I realized that after I hit send :^)

 I don't want to slow things down any (things are blazing fast now but I
 want to keep it that way).
 
 It's not worth worrying about microseconds

That's what I figured.
 
 It would be really nice if there was a one line function that
 could do this. I also use Lasso and they have a simple
 [URL_Redirect:'http://domain.com'] tag which does the job.
 
 You could write a function that does that like:
 function connect_to_db($host,$dbName,$user,$pass,$redirectTo) {
 $db = mysql_connect($host,$user,$pass);
 if (!db) {
 log(mysql_error());
 header(Location: $redirectTo);
 exit;
 }
 if (!mysql_select_db($dbname,$db)) {
  log(mysql_error());
  header(Location: $redirectTo);
  exit;
 }
 return $db;
 }

That is a really good idea.  Now do I need to do something like this:

? include('phpmysqlstuff.inc'); ?
html
Blaa blaa blaa
/html
? ob_end_clean(); ?

 
 I am also unfamiliar with the output buffer functions even
 after reading up on them in the manual.  If I call ob_start()
 at the start of 
 my page do I need to call a closing ob function after my $dbfail code if
 the connection is successful and my redirect ob_end_clean(); call is
 not made? 
 
 No, ob_end* ends the buffering.

I still do not get the ob stuff.  Is there any issue with having a
ob_start(); in my initial include and no ob_end* after this.  I guess I
still really don't understand what is actual happening when I call
ob_start().  All I know if that I can then call the header function where
ever I want later.
 
I just want to know if I am creating any type security, or memory issue by
calling ob_start and then not calling ob_end*.  I am going to take a guess
that when the server hits the end of the file the end is called anyway.

Thanks,

Dan


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




Re: [PHP] where i get .so [dll] file of linux ?

2002-03-28 Thread Rouvas Stathis

Prachait Saxena wrote:
 
 Hello
 
 I would like to Know, where Site or Link i can get complied .so [dll] files.
 of linux
 
 as i have php_sockets.dll which works very fine in Windows enviroment. but
 on linux
 
 Can you suggest any other option for this.
 
 I am using  dl(php_sockets.dll); while writing my code for windows and
 what to same for Linux

In Linux you don't use dl(). Instead, you compile PHP with the modules
you need and they are there when you call them.

-Stathis.

 
 --
 Bye, and  Have a nice day.
 
 Prachait Saxena

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




[PHP] FreeMovie/PHP 1.1.2 is out

2002-03-28 Thread Jacek Artymiak

FreeMovie/PHP 1.1.2 is out at http://freemovie.sourceforge.net

Enjoy,

Jacek



-- 

Okresl Swoje potrzeby - my znajdziemy oferte za Ciebie!
[ http://oferty.onet.pl ]


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




RE: [PHP] Loading Images

2002-03-28 Thread Kevin Stone

Huh.. hmm.. maybe this is possible after all.  I'll have to test that
out when I get home.  If it works it could sure save me a headache or
two.

By the way most counters/trackers that I've seen are just simple
javascripts which gather the browser information then request a tiny
image from the server with the information in the URL string.  This all
goes into the server's standard log file.  Then to count the hit the
server just reads the log file and parses out the values in the URL
string.  But I guess it's the same basic principle.

-Kevin


-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, March 26, 2002 5:24 PM
To: php
Subject: Re: [PHP] Loading Images

U, is that correct?

I thought (although never tried) that you could reference an image as

IMG SRC=image.php?id=3 or simular, in which case the headers and
everything else CAN be sent in the image tag, which is embeded in a HTML
page -- isn't that how they do counters etc etc??

At the moment, I'm just storing my images in my file system, and storing
the
URLs in my database (as discussed by someone else in this thread), which
works fine, as long as nobody deletes the image without deleting the URL
from the DB.

On the topic of preventing users from saving images, the attempts are
futile, because they can also just look at your source to DL the image
from
it's URL.

One thing I have seen work instead of disabling right-click is to have a
clear layer (DIV) above the whole page, which (for me) prevents me from
selecting text + images from below.  Although I don't know how reliable
this
is.


Justin French
-
http://indent.com.au
http://soundpimps.com
-






on 27/03/02 10:16 AM, Kevin Stone ([EMAIL PROTECTED]) wrote:

 It is quite easy to store images in a database and display them on the
 screen.  You can find tutorials about this online (sorry I don't have
 any direct links).  There are also numerous FREE scripts pre-written
 that you can integrate into your site, or use to learn how to do this
 yourself.
 
 There is a catch however... and that is you will not be able to
display
 anything else along with those images because special content headers
 must be sent to let the browser know what kind of data it's receiving.
 Is it a JPEG, GIF or PNG?  If the headers are not sent, or the wrong
 headers are sent, the image will either not display or the user will
see
 endless rows of junk text spewed onto the screen (the binary data in
 ASCII form!!).
 
 So this method will only work if you want to display the images in a
 frame, one at a time, and by them selves.  You won't be able to
 intermingle HTML so forget about doing dynamic menus with this method.
 
 The way these dynamic sites work is by storing the paths to each image
 in the database rather than the images themselves... so you're back to
 the file system solution.
 
 Anyway I hope this helps answer some of the questions you were having
 about this method.  :)
 
 -Kevin
 
 -Original Message-
 From: Omland Christopher m [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, March 26, 2002 2:45 PM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Loading Images
 
 I wasn't so much concearned about security of users grabbin pics. I am
 more trying to learn how these people load there menus dynamically and
 pics dynamically. Do you have any links to pages or code that describe
 how
 to make a link in the db to pics on my filesystem?
 Thanks.
 -Chris
 
 On Tue, 26 Mar 2002 [EMAIL PROTECTED] wrote:
 
 At 26.03.2002  12:47, you wrote:
 
 I don't have any code for this, but I'm hoping someone can point me
 in the
 right direction. I want to load images or navigation menus
 dynamically. Is
 it possible to build a database of images and then use php to
display
 them? Or something along these lines. I know this must be possible,
 becuase I see sites that do something like this, and I cant seem to
 right
 click the image and save it. Does this make any sense?
 Thanks.
 -Chris
 Storing images in a db is not a good idea. instead store them
 in your filesystem an have a reference to them in your db.
 Then you can make everything ;-)
 
 Even there´s no real security for grabbing pics. If your client can
 see them,
 they are on his/her machine. To prevent the right-click, you have to
 use
 JavaScript, but that only works, if the user has it switched on.
 A little more secure is putting the pics in flash-movies. But I think
 there are
 already programs out, which allow to extract pictures and
componenets.
 HTH Oliver
 
 
 --
 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] Loading Images

2002-03-28 Thread Rouvas Stathis

As long as preventing users to download a picture you display, my .02Eu
opinion is that is is a fruitless task. A determined user will _always_
find a way to store the picture you send him. After all, you do send
data to him, therefore the data can be manipulated at will:-)

As far as some code to do it, see attached souce.
In the attached source, modify directories as needed.
Invoke with : php -q gif2function.php  test.php
Then point your browser to test.php.

warning: Select a dir with few images. If yopu want to know what happens
when you overdo it, goto
URL:http://helios.mm.di.uoa.gr/~rouvas/giflib.php to see what happened
to me!

tested only on linux.

Kevin Stone wrote:
 
 Huh.. hmm.. maybe this is possible after all.  I'll have to test that
 out when I get home.  If it works it could sure save me a headache or
 two.
 
 By the way most counters/trackers that I've seen are just simple
 javascripts which gather the browser information then request a tiny
 image from the server with the information in the URL string.  This all
 goes into the server's standard log file.  Then to count the hit the
 server just reads the log file and parses out the values in the URL
 string.  But I guess it's the same basic principle.
 
 -Kevin
 
 -Original Message-
 From: Justin French [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, March 26, 2002 5:24 PM
 To: php
 Subject: Re: [PHP] Loading Images
 
 U, is that correct?
 
 I thought (although never tried) that you could reference an image as
 
 IMG SRC=image.php?id=3 or simular, in which case the headers and
 everything else CAN be sent in the image tag, which is embeded in a HTML
 page -- isn't that how they do counters etc etc??
 
 At the moment, I'm just storing my images in my file system, and storing
 the
 URLs in my database (as discussed by someone else in this thread), which
 works fine, as long as nobody deletes the image without deleting the URL
 from the DB.
 
 On the topic of preventing users from saving images, the attempts are
 futile, because they can also just look at your source to DL the image
 from
 it's URL.
 
 One thing I have seen work instead of disabling right-click is to have a
 clear layer (DIV) above the whole page, which (for me) prevents me from
 selecting text + images from below.  Although I don't know how reliable
 this
 is.
 
 Justin French
 -
 http://indent.com.au
 http://soundpimps.com
 -
 
 on 27/03/02 10:16 AM, Kevin Stone ([EMAIL PROTECTED]) wrote:
 
  It is quite easy to store images in a database and display them on the
  screen.  You can find tutorials about this online (sorry I don't have
  any direct links).  There are also numerous FREE scripts pre-written
  that you can integrate into your site, or use to learn how to do this
  yourself.
 
  There is a catch however... and that is you will not be able to
 display
  anything else along with those images because special content headers
  must be sent to let the browser know what kind of data it's receiving.
  Is it a JPEG, GIF or PNG?  If the headers are not sent, or the wrong
  headers are sent, the image will either not display or the user will
 see
  endless rows of junk text spewed onto the screen (the binary data in
  ASCII form!!).
 
  So this method will only work if you want to display the images in a
  frame, one at a time, and by them selves.  You won't be able to
  intermingle HTML so forget about doing dynamic menus with this method.
 
  The way these dynamic sites work is by storing the paths to each image
  in the database rather than the images themselves... so you're back to
  the file system solution.
 
  Anyway I hope this helps answer some of the questions you were having
  about this method.  :)
 
  -Kevin
 
  -Original Message-
  From: Omland Christopher m [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, March 26, 2002 2:45 PM
  To: [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP] Loading Images
 
  I wasn't so much concearned about security of users grabbin pics. I am
  more trying to learn how these people load there menus dynamically and
  pics dynamically. Do you have any links to pages or code that describe
  how
  to make a link in the db to pics on my filesystem?
  Thanks.
  -Chris
 
  On Tue, 26 Mar 2002 [EMAIL PROTECTED] wrote:
 
  At 26.03.2002  12:47, you wrote:
 
  I don't have any code for this, but I'm hoping someone can point me
  in the
  right direction. I want to load images or navigation menus
  dynamically. Is
  it possible to build a database of images and then use php to
 display
  them? Or something along these lines. I know this must be possible,
  becuase I see sites that do something like this, and I cant seem to
  right
  click the image and save it. Does this make any sense?
  Thanks.
  -Chris
  Storing images in a db is not a good idea. instead store them
  in your filesystem an have a reference to them in your db.
  Then you can make everything ;-)
 
  Even theres 

RE: [PHP] Loading Images

2002-03-28 Thread Darren Gamble

Good day,

Yep, this is possible all right.  I use this to display my rrdtool images.

Just have the php program as the target for the image, and then supply the
right header.  For a gif image:

header(Cache-control: private, no-cache);
header(Expires: Mon, 26 Jul 1997 05:00:00 GMT); // Past date
header(Pragma: no-cache);
header(Content-type: image/gif);

Then, just output the raw data.  If you gather it with a shell command, use
passthru() .

There isn't anything to stop the user from saving the image, although the
above headers will request that the user's client not cache it.  You can
make it more difficult for the user by supplying a Javascript override
function to be executed when the user uses their right-mouse button over the
image.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Omland Christopher m [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 26, 2002 12:47 PM
To: Chris
Cc: [EMAIL PROTECTED]
Subject: [PHP] Loading Images


I don't have any code for this, but I'm hoping someone can point me in the
right direction. I want to load images or navigation menus dynamically. Is
it possible to build a database of images and then use php to display
them? Or something along these lines. I know this must be possible,
becuase I see sites that do something like this, and I cant seem to right
click the image and save it. Does this make any sense?
Thanks.
-Chris



-- 
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] browscap.ini

2002-03-28 Thread webbie

Is there somewhere a standardized/universal browscap.ini?

It seems to me that everyone simply snatches one from someone else and then
builds on top of it.

The most recent browscap.ini files that I find out there are still missing Lynx
and Mozilla handlers.

It would be nice if there were a type of open-source browscap.ini resource where
everyone contributed $HTTP_USER_AGENT strings as new releases come out.

Lee.

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




[PHP] XSLT; XML = PHP code

2002-03-28 Thread Erik Price

I am using XSLT functions in PHP to transform a string (whose data is a 
string of XML) into another string.  Ideally, the second string will 
consist of PHP code.  I would like this outputted PHP code to be 
executed within the same script as the that which performs this 
transformation.

Here is what I am wondering -- will I be able to evaluate the variable 
containing the new string somehow?  In other words, I will have PHP code 
trapped in a variable, which I will need to have evaluated in order to 
have the code inside executed.  How can I take a variable containing PHP 
code and have it get executed along with the rest of the script?

In other words,

$php_code_in_here = 'echo hi there;';  // PHP code in a variable

Will this variable just be evaluated by the script as it is parsed??




Forgive me if the answer is staring me in the face, I'm just not seeing 
it.



Thanks,

Erik







Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




  1   2   >