php-general Digest 4 Mar 2002 09:45:37 -0000 Issue 1206

Topics (messages 87005 through 87058):

phpAdsNEW HELP!!!!
        87005 by: Georgie Casey

Re: phpAdsNew
        87006 by: DL Neil
        87013 by: Georgie Casey
        87054 by: DL Neil

Re: cursor focus
        87007 by: Steven Walker

% character in sprintf
        87008 by: Job Miller
        87009 by: Martin Towell
        87010 by: Lars Torben Wilson

Using php as a backend bridge between smtp and mysql
        87011 by: Ken Tossell
        87012 by: Ken Tossell

Re: HTTP Post to another server
        87014 by: Johnson, Kirk

using remote code
        87015 by: Ximon Eighteen
        87016 by: Dan Vande More

Convert Word Doc Header to Bold Tag
        87017 by: WANDA HANSEN

Re: CURL and multiple sites at once
        87018 by: Phillip Oertel

Need help with a PHP script
        87019 by: PHP
        87020 by: Douglas Maclaine-cross
        87021 by: Jim Winstead
        87023 by: PHP
        87029 by: Douglas Maclaine-cross
        87030 by: Martin Towell

IMAP, POP3 and NNTP functions - questions..
        87022 by: topside

Multiple Forms
        87024 by: Ramesh Nagendra Pillai
        87025 by: Martin Towell
        87026 by: Zak Greant

Pipe
        87027 by: Ken Tossell
        87028 by: Lars Torben Wilson

Storing Script information in MySQL
        87031 by: David Redmond
        87032 by: Martin Towell
        87035 by: David Redmond
        87037 by: Martin Towell

remove everything
        87033 by: Websitecd.aol.com
        87034 by: Martin Towell

How do I make the PHP script for fdisc?
        87036 by: GENESiS DESiGNS
        87056 by: Jason Wong

Re: How to generate an broun & white JPG with GD
        87038 by: Tom Rogers

.htaccess settings
        87039 by: Ashley M. Kirchner

Displaying Number values
        87040 by: Phillip S. Baker
        87042 by: Martin Towell
        87047 by: Samantha Savvakis

ID variable alsways set
        87041 by: Chris N
        87051 by: Rasmus Lerdorf

convert to lowercase
        87043 by: Websitecd.aol.com
        87044 by: Martin Towell
        87045 by: Jason Murray
        87048 by: Websitecd.aol.com
        87055 by: mojo jojo

PHP 4.1.2 and Segmentation Fault
        87046 by: Samantha Savvakis
        87049 by: Samantha Savvakis

ips and mysql table.
        87050 by: Kunal Jhunjhunwala
        87057 by: DL Neil

How to run a script leaving screen output of previous script
        87052 by: Alex Vargas

! Please Help. Need webhost with socket support
        87053 by: Underbrush

What is "->" mean in php?
        87058 by: Jack

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message ---
I just download the 6.1 beta of phpAdsNew off sourceforge and installed it
on my localhost. I set everything right but when I login to admin I get a
"undefined variable, $zoneid" error from config.inc

So I just added a "global $zoneid;" line and I half got into the admin page.
But I'm still getting loads of these errors. The script is unusable because
of all the errors. Does anyone know what the problem is? Could it be
something to do with magic_quotes or something??

TIA

--
Regards,
Georgie Casey
[EMAIL PROTECTED]

***************************
http://www.filmfind.tv
Ireland's Online Film Production Directory
***************************


--- End Message ---
--- Begin Message ---
Georgie,

> I'm getting loads of "undefined variable" errors with this script.
any1 know
> why?


You're using a recent release of PHP aren't you? Check out
http://www.php.net/manual/en/security.registerglobals.php for an
explanation of changes in 4.1.n.

Regards,
=dn

--- End Message ---
--- Begin Message ---
no, registerglobals has nothing to do with it
"Dl Neil" <[EMAIL PROTECTED]> wrote in message
158e01c1c2fc$57b0db80$c200a8c0@jrbrown...">news:158e01c1c2fc$57b0db80$c200a8c0@jrbrown...;
> Georgie,
>
> > I'm getting loads of "undefined variable" errors with this script.
> any1 know
> > why?
>
>
> You're using a recent release of PHP aren't you? Check out
> http://www.php.net/manual/en/security.registerglobals.php for an
> explanation of changes in 4.1.n.
>
> Regards,
> =dn
>


--- End Message ---
--- Begin Message ---
Georgie,

> > > I'm getting loads of "undefined variable" errors with this script.
> > any1 know
> > > why?
> >
> > You're using a recent release of PHP aren't you? Check out
> > http://www.php.net/manual/en/security.registerglobals.php for an
> > explanation of changes in 4.1.n.

> no, registerglobals has nothing to do with it


Which version of PHP are you using?
What is the error level setting in php.ini?
Are you working in a dev env or moving the code to prod - IOW why do you
want to get rid of the msg.

If the person/people who know about this script are not responding,
perhaps you could post some code and an example errmsg please?

Regards,
=dn

--- End Message ---
--- Begin Message ---
If you -could- use Javascript, it looks something like this:
        document.formName.textfieldName.focus()

Steven J. Walker
Walker Effects
www.walkereffects.com
[EMAIL PROTECTED]

On Sunday, March 3, 2002, at 12:55  PM, Markas wrote:

> Hi, PHP will do NOTHING with cursor position in your page, because it's
> running on server. Perhaps what you've read is generating some 
> Javascript
> (which actually places the cursor) with PHP...
>
> Hmmm, if you are not running Javascript, maybe an attribute TABINDEX, 
> which
> almost every html tag has, would help, but sorry if i'm mistaken, didnt
> check that...
>
>
> Ralph Jarvis <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED].;
>> I am not running Javascript, just PHP/HTML...
>> THe particular script I am having problems with has several decision
> points
>> and includes which I think is confusing the placement of the cursor
>>
>>
>> "Gaylen Fraley" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED].;
>>> This is not a php question. It is a JavaScript issue.  You need to add
>> this
>>> code to the bottom of your page:
>>>
>>> <script>
>>>     document.forms[0].text_box_name.focus();
>>> </script>
>>>
>>> --
>>> Gaylen
>>> PHP KISGB v4.0.1 Guest Book http://www.gaylenandmargie.com/phpwebsite/
>>>
>>> "Ralph Jarvis" <[EMAIL PROTECTED]> wrote in message
>>> news:[EMAIL PROTECTED].;
>>>> This is really a newbie question, but here goes.....
>>>>
>>>> I am running PHP4 with Apache on Redhat 6.2.
>>>>
>>>> I am sure I read this somewheres, but can't find it again. When I 
>>>> open
> a
>>>> webpage in a small password application that I wrote, the cursor is
> not
>> on
>>>> the first text box I need to fill in, I need to click on the text box
> to
>>>> begin typing. How do I get the cursor to "focus" on this text box?
>>>>
>>>> Many thanks in advance
>>>>
>>>> Ralph
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---

how do i escape the % character to appear in a sprintf
statement?

it doesn't mention that in the sprintf php manual
page.



job


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - sign up for Fantasy Baseball
http://sports.yahoo.com
--- End Message ---
--- Begin Message ---
try %%

-----Original Message-----
From: Job Miller [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 04, 2002 10:20 AM
To: [EMAIL PROTECTED]
Subject: [PHP] % character in sprintf 



how do i escape the % character to appear in a sprintf
statement?

it doesn't mention that in the sprintf php manual
page.



job


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - sign up for Fantasy Baseball
http://sports.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Job Miller writes:
> 
> how do i escape the % character to appear in a sprintf
> statement?
> 
> it doesn't mention that in the sprintf php manual
> page.
> 
> 
> 
> job

Yeah it does--it's the first item in the list. :)


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

--- End Message ---
--- Begin Message ---
Hi, 
I need to have php called from sendmail. I have set up an address to be
aliased to "|/usr/local/bin/proc-mail" but I get an error saying "service
unavailable". All permissions correct. See php code below. This is just a
test mechanism, right now, to send the email to a mysql database for a
free-webmail system.

#!/usr/local/bin/php -q
<?php 
$db_name = "mail"; 
$table_name = "Messages";
$connection = @mysql_pconnect("mysql.tossell.net","mail","fhsdbfhksdbfhjsd")
or die("Couldn't connect.");
$db = @mysql_select_db($db_name, $connection) or die("Couldn't select
database."); 
$sql = "insert into $table_name (rcpt, send, subject) VALUES
('ken','[EMAIL PROTECTED]','SUP?')";
mysql_select_db( $db_name, $connection );
mysql_query($sql); 
?> 

Thanks.


--- End Message ---
--- Begin Message ---
Hi, 
I need to have php called from sendmail. I have set up an address to be
aliased to "|/usr/local/bin/proc-mail" but I get an error saying "service
unavailable". All permissions correct. See php code below. This is just a
test mechanism, right now, to send the email to a mysql database for a
free-webmail system.

#!/usr/local/bin/php -q
<?php 
$db_name = "mail"; 
$table_name = "Messages";
$connection = @mysql_pconnect("mysql.tossell.net","mail","fhsdbfhksdbfhjsd")
or die("Couldn't connect.");
$db = @mysql_select_db($db_name, $connection) or die("Couldn't select
database."); 
$sql = "insert into $table_name (rcpt, send, subject) VALUES
('ken','[EMAIL PROTECTED]','SUP?')";
mysql_select_db( $db_name, $connection );
mysql_query($sql); 
?> 

Thanks.


--- End Message ---
--- Begin Message ---
Search the archive on "PostToHost", or see this link:

http://www.zend.com/zend/spotlight/mimocsumissions.php#Heading6

Kirk

> -----Original Message-----
> From: Quentin Bennett [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 01, 2002 3:19 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] HTTP Post to another server
> 
> 
> Hi,
> 
> I want to turn some form data in to and XML document, and the 
> HTTP Post that
> data to another server. Is that possible from PHP.
> 
> As a challenge, I know it is possible in ASP!
> 
> Thanks In Advance
> 
> Quentin Bennett
> mailto:[EMAIL PROTECTED]
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
--- End Message ---
--- Begin Message ---
Ignoring the issues of executing untrustworthy code can someone tell me why
this won't work and how I can achieve this?

Basically there is a remote php file on another web server that has a
function in it. I want to execute this function in my own code...

I'm guessing this probably won't work but it's a nice idea. The remote
function accesses a database on the remote machine and returns an array of
information.

The more I think about what I'm trying to do the more stupid it seems....

Anyway any attempt to require or include the file works fine but then I
can't use the function because it is "undefined". The php.net docs seem to
imply that this is possible.

Can anyone say if it is possible and if so what I am doing wrong please, ta.



--- End Message ---
--- Begin Message ---

I don't think this will work, because if it is configured correctly, that
file will be parsed by PHP before(as) apache gets it, meaning the only part
apache gives you is the result of all the code executing in that page.
Exactly like a web browser, php sees <?php echo "Hello, World!";?> and then
gives it to apache saying Hello, World!. Visit the function in your web
browser, and what you see will be exactly what your local script sees.
However, if php is not turned on to look through files of that type, (IE
.html .inc .phps in some cases) you can actually see the code and not the
end result, which is what you want.

Dan
-----Original Message-----
From: Ximon Eighteen [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, March 03, 2002 5:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP] using remote code

Ignoring the issues of executing untrustworthy code can someone tell me why
this won't work and how I can achieve this?

Basically there is a remote php file on another web server that has a
function in it. I want to execute this function in my own code...

I'm guessing this probably won't work but it's a nice idea. The remote
function accesses a database on the remote machine and returns an array of
information.

The more I think about what I'm trying to do the more stupid it seems....

Anyway any attempt to require or include the file works fine but then I
can't use the function because it is "undefined". The php.net docs seem to
imply that this is possible.

Can anyone say if it is possible and if so what I am doing wrong please, ta.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hello,
Is there a way to convert Bold text in word to Bold text in HTML using PHP?

Thank you,
Julian


--- End Message ---
--- Begin Message ---
 > curl_setopt($ch, CURLOPT_URL, "http://foo.bar.com/page1.html";);
 > curl_setopt($ch, CURLOPT_FILE, $fh1);
 > curl_exec($ch); //exec1
 > curl_setopt($ch, CURLOPT_URL, "http://foo.bar.com/page2.html";);
 > curl_setopt($ch, CURLOPT_FILE, $fh2);
 > curl_exec($ch); //exec2
 > curl_setopt($ch, CURLOPT_URL, "http://foo.bar.com/page3.html";);
 > curl_setopt($ch, CURLOPT_FILE, $fh3);

every time you set CURLOPT_URL and CURLOPT_FILE you overwrite the last 
value. that's why only the last page will be fetched ...

write a function that fetches ONE page and call that in a loop for every 
page you want to fetch.

something like this

function fetchAndSavePage($url)
{
        // put your fopen & curl code here
        // convert the $url into a useful filename

$pagesToFetch = array ("page1","page2","page3");

foreach ($pagesToFetch as $url)
{
        fetchAndSavePage($url);
}

good luck,
phil

--- End Message ---
--- Begin Message ---
<?php
if($a == 0 || $a == null) LogOn();
else if($a==1) CPMain();
function Authorize() {
  $username = $HTTP_POST_VARS['username'];
  $password = $HTTP_POST_VARS['password'];
  echo "T".$username.$password;
}
function CPMain() {
  Authorize();
} 
function LogOn() {
  echo "Please log on:";
  echo "<form method=\"post\" 
action=\"http://infinitep.t35.com/countmein/control.phtml\";>";
  echo "<input type=hidden name=\"a\" value=\"1\">";
  echo "<table border=0><tr><td>";
  echo "Username:</td><td>";
  echo "<input type=text name=\"username\" 
class=\"form1\"></td></tr><tr><td>";
  echo "Password:</td><td>";
  echo "<input type=password name=\"password\" 
class=\"form1\"></td></tr><tr><td>&nbsp;</td><td>";
  echo "<input type=submit class=\"form1\" value=\"Log 
On\"></td></tr></table>";
}
?>
I can't determine what's wrong. It prints T, but nothing else!
-- 

- Roy W.
--- End Message ---
--- Begin Message ---
echo "T".$username.$password;

is PHP 2 and earlier proper syntax for PHP 3+ is

echo "T"+$username+$password;

or

echo "T$username$password";

Doug
--- End Message ---
--- Begin Message ---
Php <[EMAIL PROTECTED]> wrote:
> function Authorize() {
   global $HTTP_POST_VARS;
>  $username = $HTTP_POST_VARS['username'];
>  $password = $HTTP_POST_VARS['password'];
>  echo "T".$username.$password;
> }

(insert the line above.)

jim
--- End Message ---
--- Begin Message ---
<?php
if($a == 0 || $a == null) LogOn();
else if($a==1) CPMain();
function Authorize() {
  $username = $HTTP_POST_VARS['username'];
  $password = $HTTP_POST_VARS['password'];
  echo "T".$username.$password;
}
function CPMain() {
  Authorize();
} 
function LogOn() {
  echo "Please log on:";
  echo "<form method=\"post\" 
action=\"http://infinitep.t35.com/countmein/control.phtml\";>";
  echo "<input type=hidden name=\"a\" value=\"1\">";
  echo "<table border=0><tr><td>";
  echo "Username:</td><td>";
  echo "<input type=text name=\"username\" 
class=\"form1\"></td></tr><tr><td>";
  echo "Password:</td><td>";
  echo "<input type=password name=\"password\" 
class=\"form1\"></td></tr><tr><td>&nbsp;</td><td>";
  echo "<input type=submit class=\"form1\" value=\"Log 
On\"></td></tr></table>";
}
?>
I can't determine what's wrong. It prints T, but nothing else!
-- 

- Roy W.
--- End Message ---
--- Begin Message ---
I can't believe I just sent this. For those who care it's the other way
around.

-----Original Message-----
From: Douglas Maclaine-cross 
Sent: Monday, March 04, 2002 14:08
To: 'PHP'; [EMAIL PROTECTED]
Subject: RE: [PHP] Need help with a PHP script


echo "T".$username.$password;

is PHP 2 and earlier proper syntax for PHP 3+ is

echo "T"+$username+$password;

or

echo "T$username$password";

Doug
--- End Message ---
--- Begin Message ---
instead of $HTTP_POST_VARS, try $_POST


-----Original Message-----
From: PHP [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 04, 2002 12:10 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Need help with a PHP script


<?php
if($a == 0 || $a == null) LogOn();
else if($a==1) CPMain();
function Authorize() {
  $username = $HTTP_POST_VARS['username'];
  $password = $HTTP_POST_VARS['password'];
  echo "T".$username.$password;
}
function CPMain() {
  Authorize();
} 
function LogOn() {
  echo "Please log on:";
  echo "<form method=\"post\" 
action=\"http://infinitep.t35.com/countmein/control.phtml\";>";
  echo "<input type=hidden name=\"a\" value=\"1\">";
  echo "<table border=0><tr><td>";
  echo "Username:</td><td>";
  echo "<input type=text name=\"username\" 
class=\"form1\"></td></tr><tr><td>";
  echo "Password:</td><td>";
  echo "<input type=password name=\"password\" 
class=\"form1\"></td></tr><tr><td>&nbsp;</td><td>";
  echo "<input type=submit class=\"form1\" value=\"Log 
On\"></td></tr></table>";
}
?>
I can't determine what's wrong. It prints T, but nothing else!
-- 

- Roy W.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I have a question or two regarding the IMAP, POP3 and NNTP functions.

Is there *any* way to use imap_fetchstructure() using an actually message
string instead of an imap_stream and messgae number. Basicly, I am storing
mail onto a MySQL DB. I want to be able to parse out the attatchments and
data. However, I cannot use these functions because it wants a mailbox and
not an actual peice of mail.

All I really need to be able to do is extract the data (dont need filename,
mimetype, etc) into a string, and i can use a base64 decode func to give me
the raw data. If anyone has suggestions or solutions, it would be greatly
appreciated.

Thanks,
-topside


--- End Message ---
--- Begin Message ---
Hai

I am having two forms in one php page I want to submit
it to second page. My query is 

1) Is it possible to submit 2 forms using single
submit button
2) If so, how to get both form details in the secon
page?

Thanx



__________________________________________________
Do You Yahoo!?
Yahoo! Sports - sign up for Fantasy Baseball
http://sports.yahoo.com
--- End Message ---
--- Begin Message ---
1) not unless you have them opening up a new window for each form
2) combine them into one form

Martin

-----Original Message-----
From: Ramesh Nagendra Pillai [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 04, 2002 2:27 PM
To: Php Mailing list
Subject: [PHP] Multiple Forms


Hai

I am having two forms in one php page I want to submit
it to second page. My query is 

1) Is it possible to submit 2 forms using single
submit button
2) If so, how to get both form details in the secon
page?

Thanx



__________________________________________________
Do You Yahoo!?
Yahoo! Sports - sign up for Fantasy Baseball
http://sports.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Sun, 2002-03-03 at 20:31, Martin Towell wrote:
> 1) not unless you have them opening up a new window for each form
> 2) combine them into one form

  Also, this topic is covered quite often on this list. Check the 
  list archives for the various solutions people have used.
  http://php.net/support.php has a link to the list archive.

  --zak


--- End Message ---
--- Begin Message ---
What var is the piped data placed in?

Php 4.1 executable rhlinux 2.4.17


--- End Message ---
--- Begin Message ---
On Sun, 2002-03-03 at 19:32, Ken Tossell wrote:
> What var is the piped data placed in?
> 
> Php 4.1 executable rhlinux 2.4.17

I'm gonna assume that you mean that you're doing something like this:

% cat somefile.txt | script.php

In which case, you'd need to fopen() the file 'php://stdin' and read
from it. 


Hope this helps,

Torben


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

--- End Message ---
--- Begin Message ---
Is it possible to store the contents of a PHP file within a field in a MySQL
table?
When the contents are retrieved, can they be executed by the PHP parser as
if it were part of the actual PHP file?

ie: have the following stored in the DB;

-- snip --
<?
echo "This is a test.<br>\n";
?>
-- snip --

Then run a PHP script to retrieve that from the DB and have below outputted
to the browser?

-- snip --
This is a test.<br>
-- snip --

Cheers
--- End Message ---
--- Begin Message ---
store it as text
when you get it back, do an exec() on it

-----Original Message-----
From: David Redmond [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 04, 2002 3:56 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Storing Script information in MySQL


Is it possible to store the contents of a PHP file within a field in a MySQL
table?
When the contents are retrieved, can they be executed by the PHP parser as
if it were part of the actual PHP file?

ie: have the following stored in the DB;

-- snip --
<?
echo "This is a test.<br>\n";
?>
-- snip --

Then run a PHP script to retrieve that from the DB and have below outputted
to the browser?

-- snip --
This is a test.<br>
-- snip --

Cheers

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I couldn't seem to get this working.  Contents of the "Text" field in the DB
are;

-- snip --
<?
for ($i = 0; $i < 100; $i++) {
   echo $i ."<br>\n";
}
?>
-- snip --

contents of the field are being stored in a variable, $strTest, running
below produces nothing;

-- snip --
<?
exec($strTest);
?>
-- snip --

I've removed the PHP delimetrs within the field and changed the code to
something more basic (echo "Test";) and nothing is being produced.

Any further ideas?

Cheers

-----Original Message-----
From: Martin Towell [mailto:[EMAIL PROTECTED]] 
Sent: Monday, 4 March 2002 2:59 PM
To: David Redmond; [EMAIL PROTECTED]
Subject: RE: [PHP] Storing Script information in MySQL


store it as text
when you get it back, do an exec() on it

-----Original Message-----
From: David Redmond [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 04, 2002 3:56 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Storing Script information in MySQL


Is it possible to store the contents of a PHP file within a field in a MySQL
table?
When the contents are retrieved, can they be executed by the PHP parser as
if it were part of the actual PHP file?

ie: have the following stored in the DB;

-- snip --
<?
echo "This is a test.<br>\n";
?>
-- snip --

Then run a PHP script to retrieve that from the DB and have below outputted
to the browser?

-- snip --
This is a test.<br>
-- snip --

Cheers

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
sorry - it's eval()

-----Original Message-----
From: David Redmond [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 04, 2002 4:09 PM
To: 'Martin Towell'; [EMAIL PROTECTED]
Subject: RE: [PHP] Storing Script information in MySQL


I couldn't seem to get this working.  Contents of the "Text" field in the DB
are;

-- snip --
<?
for ($i = 0; $i < 100; $i++) {
   echo $i ."<br>\n";
}
?>
-- snip --

contents of the field are being stored in a variable, $strTest, running
below produces nothing;

-- snip --
<?
exec($strTest);
?>
-- snip --

I've removed the PHP delimetrs within the field and changed the code to
something more basic (echo "Test";) and nothing is being produced.

Any further ideas?

Cheers

-----Original Message-----
From: Martin Towell [mailto:[EMAIL PROTECTED]] 
Sent: Monday, 4 March 2002 2:59 PM
To: David Redmond; [EMAIL PROTECTED]
Subject: RE: [PHP] Storing Script information in MySQL


store it as text
when you get it back, do an exec() on it

-----Original Message-----
From: David Redmond [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 04, 2002 3:56 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Storing Script information in MySQL


Is it possible to store the contents of a PHP file within a field in a MySQL
table?
When the contents are retrieved, can they be executed by the PHP parser as
if it were part of the actual PHP file?

ie: have the following stored in the DB;

-- snip --
<?
echo "This is a test.<br>\n";
?>
-- snip --

Then run a PHP script to retrieve that from the DB and have below outputted
to the browser?

-- snip --
This is a test.<br>
-- snip --

Cheers

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
What is the code to remove everything but numbers and letters from a string?

$output = str_replace("","",$output);

Regards,
Joseph A. Bannon
--- End Message ---
--- Begin Message ---
$output = ereg_replace("[^a-zA-Z0-9]", "", $output);
(not tested - but should work)

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 04, 2002 4:04 PM
To: [EMAIL PROTECTED]
Subject: [PHP] remove everything


What is the code to remove everything but numbers and letters from a string?

$output = str_replace("","",$output);

Regards,
Joseph A. Bannon

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

I have a web form that allows someone to fdisc there drive C:\ but how to I 
make the PHP script to run that?

By the way, I'm not using this to make someone real mad, I'm just curious and I 
will NOT put this script on the net, just on my local machine. Thanks,


-GENESiS DESiGNS
-Sean Kennedy
-http://www.gdesigns.vcn.com

--- End Message ---
--- Begin Message ---
On Sunday 03 March 2002 22:09, GENESiS DESiGNS wrote:
> Hello,
>
> I have a web form that allows someone to fdisc there drive C:\ but how to I
> make the PHP script to run that?
>
> By the way, I'm not using this to make someone real mad, I'm just curious
> and I will NOT put this script on the net, just on my local machine.


I'll assume you mean fdisk. You do realise that the fdisk command will be 
executed on the machine that the webserver is running on? Plus the MS-DOS 
fdisk command is interactive so it wouldn't do much good running it from a 
web page.

If you want to run system commands in general then look at "Program Execution 
functions".

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

/*
Bondage maybe, discipline never!
                -- T.K.
*/
--- End Message ---
--- Begin Message ---
Hi
Here is a better script to create sepia images from a jpeg, put it in the 
same place as your images and call it sepia.php.
Uselike this:
img src="/images/sepia.php/filename.jpg"

<?
         $filename = ereg_replace("/","",$PATH_INFO);
         if($filename != ""):
                 $start_red = 2;                         //red scale at black
                 $start_blue = 2.3;                      //blue scale at black
                 $red_scale = ($start_red-1)/256;                //red 
modifier as greyscale goes to white
                 $blue_scale = ($start_blue - 1)/256;    //ditto for blue
                 //build a sepia lookup table
                 $sepia = array();
                 for($x = 0;$x < 256;$x++){
                         $red = intval($x * ($start_red - ($x * $red_scale)));
                         if($red > 255) $red = 255;
                         $blue = intval($x / ($start_blue - ($x * 
$blue_scale)));
                         $sepia[$x][0] = $red;
                         $sepia[$x][1] = $blue;
                 }
                 $im =imagecreatefromjpeg($filename);
                 for($y = 0;$y < imagesy($im);$y++){
                         for($x = 0;$x < imagesx($im);$x++){
                                 $pixel = imagecolorat($im, $x, $y);
                                 $red = ($pixel & 0xFF0000) >> 16;
                                 $green = ($pixel & 0x00FF00) >> 8;
                                 $blue = $pixel & 0x0000FF;
                                 $alpha = $pixel & 0x7F000000;
                                 //get a greyscale value
                                 $gs = intval(($red * 0.3) + ($green * 
0.59) + ($blue * 0.11));
                                 $p = $alpha | $sepia[$gs][1] | ($gs << 8) 
| ($sepia[$gs][0] << 16);
                                 imagesetpixel ($im, $x, $y, $p);
                         }
                 }
                 Header("Content-type: image/jpeg");
                 ImageJpeg($im,'',50);
         endif;
?>



Probably will only work with php-4+ and gd 2+

Tom


At 02:42 AM 3/3/02, Andy wrote:
>Hi there,
>
>I was recently browsing throught phpbuilder and did see the user pictures
>there.
>
>They are not black/white, but kind of brown white which look pretty cool and
>might save some disk space compared to true color.
>Here is the link:
>http://phpbuilder.com/columns/ying20000602.php3?page=1
>
>Does anybody know how to do this with GD?
>
>Thanx for any help
>
>Andy
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---

    Under PHP3 I was able to do the following within an .htaccess file:

php3_magic_quotes_runtime off
php3_magic_quotes_gpc on

    How do I achieve the same thing under PHP4?

--
H | "Life is the art of drawing without an eraser." - John Gardner
  +--------------------------------------------------------------------
  Ashley M. Kirchner <mailto:[EMAIL PROTECTED]>   .   303.442.6410 x130
  Director of Internet Operations / SysAdmin    .     800.441.3873 x130
  Photo Craft Laboratories, Inc.            .     3550 Arapahoe Ave, #6
  http://www.pcraft.com ..... .  .    .       Boulder, CO 80303, U.S.A.


--- End Message ---
--- Begin Message ---
Hey All,

I want PHP to print out the value of a number in a variable as something 
like 01.
However whenever I try to I only get 1.

Is there a way around this?

Phillip

--- End Message ---
--- Begin Message ---
printf("%02i", $num);  should work

-----Original Message-----
From: Phillip S. Baker [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 04, 2002 4:39 PM
To: PHP Email List
Subject: [PHP] Displaying Number values


Hey All,

I want PHP to print out the value of a number in a variable as something 
like 01.
However whenever I try to I only get 1.

Is there a way around this?

Phillip


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

You can achieve this by using the printf or sprintf statements.

<?
$numberval = 1;
printf("My number = %02d", $numberval);
?>

This will print "01"

If numberval = 20 - it will only print "20".

The %02d is the key. %02 means - print 2 characters with leading zero's if
there aren't 2 characters.

%03 - 3 characters with leading zero's etc etc

Hope I've explained that ok.

Sam


Phillip S. Baker <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED].;
> Hey All,
>
> I want PHP to print out the value of a number in a variable as something
> like 01.
> However whenever I try to I only get 1.
>
> Is there a way around this?
>
> Phillip
>


--- End Message ---
--- Begin Message ---
Ive just found a rather weird bug that im experiencing. Im running PHP 4.1.2
with Apache 1.3.23 on Linux Redhat 7. When ever I try and use variable $id
it always has a value of 1 no matter what. It only does it if its in a get,
think a post too. I can hard code it in a script and itll have a correct
value but in a GET it gets messed up. Ive tried running it several ways of
having it be first in the list or last, no matter what its always 1.

Example:
url = http://www.domain.com/test.php?id=12345&name=Kalamazoo

File :
<?php
echo "name = $name<br>";
echo "id = $id<br>";
echo "<a href=\"$PHP_SELF?id=12345&name=Kalamazoo\">click</a>";
?>

Result :
name = Kalamazoo
id = 1
click ( http://www.domain.com/test.php?id=12345&name=Kalamazoo )

Anyone have any ideas what this could come from?



--- End Message ---
--- Begin Message ---
Do a phpinfo() and check to see if you  perhaps have a cookie with the
name "id" set with the value "1".  If your look at variables_order in your
php.ini file, you will see that cookie data will override get-method data.
To force a read from the GET data, use $_GET['id'] instead of $id.

-Rasmus

On Sun, 3 Mar 2002, Chris N wrote:

> Ive just found a rather weird bug that im experiencing. Im running PHP 4.1.2
> with Apache 1.3.23 on Linux Redhat 7. When ever I try and use variable $id
> it always has a value of 1 no matter what. It only does it if its in a get,
> think a post too. I can hard code it in a script and itll have a correct
> value but in a GET it gets messed up. Ive tried running it several ways of
> having it be first in the list or last, no matter what its always 1.
>
> Example:
> url = http://www.domain.com/test.php?id=12345&name=Kalamazoo
>
> File :
> <?php
> echo "name = $name<br>";
> echo "id = $id<br>";
> echo "<a href=\"$PHP_SELF?id=12345&name=Kalamazoo\">click</a>";
> ?>
>
> Result :
> name = Kalamazoo
> id = 1
> click ( http://www.domain.com/test.php?id=12345&name=Kalamazoo )
>
> Anyone have any ideas what this could come from?
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
What is the code to make a string into lower case?


Regards,
Joseph A. Bannon









--- End Message ---
--- Begin Message ---
strtolower()

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 04, 2002 4:55 PM
To: [EMAIL PROTECTED]
Subject: [PHP] convert to lowercase


What is the code to make a string into lower case?


Regards,
Joseph A. Bannon










-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
> What is the code to make a string into lower case?

Could you please check the manual before you ask like this?

It's strToLower().

http://www.php.net/strtolower

Jason

-- 
Jason Murray
[EMAIL PROTECTED]
Web Developer, Melbourne IT
"Work now, freak later!"
--- End Message ---
--- Begin Message ---
I'm sorry boss, I didn't know it was added to the manual.


Regards,
Joseph A. Bannon



--- End Message ---
--- Begin Message ---
$string = strtolower($string);

<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED].;
> What is the code to make a string into lower case?
>
>
> Regards,
> Joseph A. Bannon
>
>
>
>
>
>
>
>
>


--- End Message ---
--- Begin Message ---
Hi,

I recently upgraded my development web server from PHP 4.0.6 to PHP 4.1.2 in
the wake of the security alert.

Details:

SCO Openserver 5.0.6
Apache 1.3.20 with SSL
PHP 4.1.2
Libxml 2.4.16
Mysql 3.23.48

PHP configure:

./configure \
--with-apache=/u/apps/apache_1.3.20_wssl \
--with-mysql=/usr/local/mysql-3.23.48 \
--with-dom \
--enable-track-vars \
--enable-trans-sid \
--with-zlib-dir=/usr/local/lib

Apache Configure

./configure \
--prefix=/usr/local/apache
--activate-module=src/php4/libphp4.a
--enable-module=rewrite

Since the upgrade, I am receiving Segementation Faults in the log files when
accessing some of my existing code. It is not happening all the time, only
occasionally. I haven't been able to pin point where the problem is.

Here is the output from the backtrace - I ran the php binary on one of the
files that segfaulted and it created a core dump.

Here is the output from the gdb of the core:

----------------------------------------------------------------------------
-----------
# gdb /usr/local/bin/php core

Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-pc-sco3.2v5.0.5"...
Core was generated by `php'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/local/lib/libz.so.1...done.
Loaded symbols for /usr/local/lib/libz.so.1
Reading symbols from /usr/lib/libresolv.so.1...done.
Loaded symbols for /usr/lib/libresolv.so.1
Reading symbols from /usr/local/lib/libmysqlclient.so10...done.
Loaded symbols for /usr/local/lib/libmysqlclient.so10
Reading symbols from /usr/local/lib/libxml2.so2...done.
Loaded symbols for /usr/local/lib/libxml2.so2
Reading symbols from /usr/lib/libsocket.so.2...done.
Loaded symbols for /usr/lib/libsocket.so.2
Reading symbols from /usr/lib/libc.so.1...done.
Loaded symbols for /usr/lib/libc.so.1
#0  0x8105b5d in execute ()
(gdb) bt
#0  0x8105b5d in execute ()
#1  0x74656e61 in ?? ()
Cannot access memory at address 0x72746e69
(gdb)
----------------------------------------------------------------------------
--------------

>From this, I really cannot tell what the issue is.

One of the files I'm getting the fault with is using the "require" command.

If I comment out the "require" command, this file seems to work. Thing is -
alot of other files are using the require command on this same file, and
they do not have a segmentation fault. I checked out the file that is being
required - nothing looks wrong with that. Ran: /usr/local/bin/php <file> on
the required file - all is ok. No core dump.

I cannot put this release of PHP onto the production server because of these
problems, but I need to get the release out because of the security alert.
:|

What other details can I check?

Thanks,
Sam



--- End Message ---
--- Begin Message ---
Another backtrace that gives a bit more information :

#gdb /usr/local/bin/php core
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-pc-sco3.2v5.0.5"...
Core was generated by `php'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/local/lib/libz.so.1...done.
Loaded symbols for /usr/local/lib/libz.so.1
Reading symbols from /usr/lib/libresolv.so.1...done.
Loaded symbols for /usr/lib/libresolv.so.1
Reading symbols from /usr/local/lib/libmysqlclient.so10...done.
Loaded symbols for /usr/local/lib/libmysqlclient.so10
Reading symbols from /usr/local/lib/libxml2.so2...done.
Loaded symbols for /usr/local/lib/libxml2.so2
Reading symbols from /usr/lib/libsocket.so.2...done.
Loaded symbols for /usr/lib/libsocket.so.2
Reading symbols from /usr/lib/libc.so.1...done.
Loaded symbols for /usr/lib/libc.so.1
#0  open_file_for_scanning (file_handle=0x6e696d) at
zend_language_scanner.c:2947
2947            switch (file_handle->type) {
(gdb) bt
#0  open_file_for_scanning (file_handle=0x6e696d) at
zend_language_scanner.c:2947
#1  0x80d5eee in compile_file (file_handle=0x6e696d, type=2) at
zend_language_scanner.c:3006
#2  0x80e86d3 in zend_execute_scripts (type=1986356271, retval=0x7366632f,
file_count=1818585135)
    at zend.c:810
#3  0x752ffd9e in ?? ()
#4  0x805da80 in main (argc=2, argv=0x80471ac) at cgi_main.c:738
#5  0x805c9fb in _start ()
(gdb)

Samantha Savvakis <[EMAIL PROTECTED]> wrote in message news:...;
> Hi,
>
> I recently upgraded my development web server from PHP 4.0.6 to PHP 4.1.2
in
> the wake of the security alert.
>
> Details:
>
> SCO Openserver 5.0.6
> Apache 1.3.20 with SSL
> PHP 4.1.2
> Libxml 2.4.16
> Mysql 3.23.48
>
> PHP configure:
>
> ./configure \
> --with-apache=/u/apps/apache_1.3.20_wssl \
> --with-mysql=/usr/local/mysql-3.23.48 \
> --with-dom \
> --enable-track-vars \
> --enable-trans-sid \
> --with-zlib-dir=/usr/local/lib
>
> Apache Configure
>
> ./configure \
> --prefix=/usr/local/apache
> --activate-module=src/php4/libphp4.a
> --enable-module=rewrite
>
> Since the upgrade, I am receiving Segementation Faults in the log files
when
> accessing some of my existing code. It is not happening all the time, only
> occasionally. I haven't been able to pin point where the problem is.
>
> Here is the output from the backtrace - I ran the php binary on one of the
> files that segfaulted and it created a core dump.
>
> Here is the output from the gdb of the core:
>
> --------------------------------------------------------------------------
--
> -----------
> # gdb /usr/local/bin/php core
>
> Copyright 2000 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you
are
> welcome to change it and/or distribute copies of it under certain
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for
details.
> This GDB was configured as "i386-pc-sco3.2v5.0.5"...
> Core was generated by `php'.
> Program terminated with signal 11, Segmentation fault.
> Reading symbols from /usr/local/lib/libz.so.1...done.
> Loaded symbols for /usr/local/lib/libz.so.1
> Reading symbols from /usr/lib/libresolv.so.1...done.
> Loaded symbols for /usr/lib/libresolv.so.1
> Reading symbols from /usr/local/lib/libmysqlclient.so10...done.
> Loaded symbols for /usr/local/lib/libmysqlclient.so10
> Reading symbols from /usr/local/lib/libxml2.so2...done.
> Loaded symbols for /usr/local/lib/libxml2.so2
> Reading symbols from /usr/lib/libsocket.so.2...done.
> Loaded symbols for /usr/lib/libsocket.so.2
> Reading symbols from /usr/lib/libc.so.1...done.
> Loaded symbols for /usr/lib/libc.so.1
> #0  0x8105b5d in execute ()
> (gdb) bt
> #0  0x8105b5d in execute ()
> #1  0x74656e61 in ?? ()
> Cannot access memory at address 0x72746e69
> (gdb)
> --------------------------------------------------------------------------
--
> --------------
>
> From this, I really cannot tell what the issue is.
>
> One of the files I'm getting the fault with is using the "require"
command.
>
> If I comment out the "require" command, this file seems to work. Thing
is -
> alot of other files are using the require command on this same file, and
> they do not have a segmentation fault. I checked out the file that is
being
> required - nothing looks wrong with that. Ran: /usr/local/bin/php <file>
on
> the required file - all is ok. No core dump.
>
> I cannot put this release of PHP onto the production server because of
these
> problems, but I need to get the release out because of the security alert.
> :|
>
> What other details can I check?
>
> Thanks,
> Sam
>
>
>


--- End Message ---
--- Begin Message ---
Hey,
I came across this interesting problem somebody was having. I couldnt find a
solution. Hope one of you can :

I have a mysql table which stores the IP Address of my site visitors. When I
try to sort these Ip address in the ascending or descending order the order
is completely out of order. I am currently storing the IP addresses under a
varchar column. An int column would not store the values after the second
"."

Any suggestions?
Regards,
Kunal Jhunjhunwala

"Minds think with ideas, not information. No amount of data, bandwidth, or
processing power can substitute for inspired thought." - Clifford Stoll

--- End Message ---
--- Begin Message ---
Hey Kunal,

> I have a mysql table which stores the IP Address of my site visitors.
When I
> try to sort these Ip address in the ascending or descending order the
order
> is completely out of order. I am currently storing the IP addresses
under a
> varchar column. An int column would not store the values after the
second
> "."


You don't show examples of "completely out of order"!

My guess is that you(r friend) have not stored the IP address as four
octets in dotted notation, and therefore "20.123.456.789" succeeds
"100.123.456.789". In which case, left pad with zeros.

Regards,
=dn

--- End Message ---
--- Begin Message ---
Hi. I want to run a php script without leaving the php that calls that
script.

Let's say I have a script called mypage.php which displays html. There is a
link to link.php, which makes some database maintenance and has no output. I
want to be able to run link.php from mypage.php, but don't want to display
anything new on screen.

As it is, when link.php runs, it displays a blank screen. I guess I could
insert a header to reload mypage.php, but I wonder if there is a way of not
leaving mypage.php at all. Is this posible?

Thanks,

-Alex


--- End Message ---
--- Begin Message ---
Dear Group,

Can anyone recomend a good webhost with socket support.  I need to be able to use the 
socket_bind(), socket_create(), etc. . . functions.

Any and all suggestions are greatly appreciated, - Underbrush
--- End Message ---
--- Begin Message ---
Dear all
There is one symbol in PHP that i always see is "->", could anyone pls tell
me what is this, and what does that do?
Here is the statement i saw could some pls explain what it means?

if (!empty($row->usd_period)

Thx a lot
Jack
[EMAIL PROTECTED]


--- End Message ---

Reply via email to