php-general Digest 27 Jul 2003 21:42:12 -0000 Issue 2201
Topics (messages 157058 through 157104):
Re: Set Cookie in PHP and call with Perl
157058 by: Curt Zirzow
157067 by: John W. Holmes
Mail or Authentication or redirection of SMTP
157059 by: Ron Allen
157060 by: Ron Allen
memory consumption from a script
157061 by: Torsten Rosenberger
157066 by: John W. Holmes
157069 by: Peter James
157089 by: John W. Holmes
157095 by: Peter James
Hard disk number
157062 by: pehepe php
157063 by: Adrian
can we know hard disk no via a php script?
157064 by: pehepe php
157065 by: Khalid El-Kary
Re: Read values from Text Area Box
157068 by: John W. Holmes
FTP_PUT problems
157070 by: Rausch Alexandru
157071 by: Rausch Alexandru
157076 by: Rausch Alexandru
157085 by: Jason Wong
small request
157072 by: Ryan A
157073 by: chris.blurredvision.org
157074 by: Peter James
157075 by: Shaunak Kashyap
PHP, MySQL and null?
157077 by: Jonas Thorell
157079 by: David Smith
157081 by: Jonas Thorell
157083 by: Jonas Thorell
157086 by: David Smith
157088 by: Curt Zirzow
Please HELP me
157078 by: Rausch Alexandru
157082 by: Peter James
Re: small request (done)
157080 by: Ryan A
Re: Get the current file name
157084 by: Burhan Khalid
Re: header & headers_sent BUG
157087 by: Marek Kilimajer
Recompiling the PHP Binary with PCNTL
157090 by: David Goodchild
157091 by: Jason Wong
157094 by: David Goodchild
157099 by: Jason Wong
157101 by: David Goodchild
157102 by: Thomas Seifert
Half solved......(conclusion)
157092 by: Ryan A
Re: Parsing PHP
157093 by: Jeff Moore
Your E-Book
157096 by: The Billion Dollar Club
157097 by: Adrian
157098 by: skate
157100 by: Jason Wong
Sessions GET vs. Cookies
157103 by: Nicholas Robinson
157104 by: Chris Shiflett
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 ---
* Thus wrote TWSC HQ ([EMAIL PROTECTED]):
> Hi there -
>
> Is this possible :
> How do i call the cookie value (surname) with Perl if it was set with PHP?
>
> SAMPLE:
>
> PHP Cookie set:
>
> <?
> setcookie("surname", "mc Seveney", time()+31536000, "/","",0);
> ?>
>
> Need to call this cookie with a .pl extension file (perl)
How do you mean call? you want to get the value or set it?
The cookie is in the headers which happens to be spefic to HTTP
protocol. And there are a gazilian ways to retrieve that from perl
which all depends on how your running perl. Both of which have
nothing to do with php.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---
TWSC HQ wrote:
Is this possible :
How do i call the cookie value (surname) with Perl if it was set with PHP?
Yes, a cookie is still a cookie no matter where it's set. Ask on a Perl
list how you read cookies.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
PHP|Architect: A magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
Here is my problem. When I send emails locally theough the Exchange Server
I have no problems sending mail. When I try to send emails to another site
through the MTA funtion_mail pops up. One of two things came to mind.
First is that we have anonymous forwarding of emails turned off for
security, meaning that I need to login to the Exchange server in order to
send emails. Or the second part as I have seen on so many PHP sites is that
I need a valid email address to send from. My question on the valid email
address is if it has to be the primary or can it be the secondary address
for an Exchange account? I created a secondary address and it still does
not work, but it was only about 5 minutes ago so it may not have replicated
as of yet. Any clues on what to do?
--- End Message ---
--- Begin Message ---
Do I need to login into the server for this?
"Ron Allen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Here is my problem. When I send emails locally theough the Exchange
Server
> I have no problems sending mail. When I try to send emails to another
site
> through the MTA funtion_mail pops up. One of two things came to mind.
> First is that we have anonymous forwarding of emails turned off for
> security, meaning that I need to login to the Exchange server in order to
> send emails. Or the second part as I have seen on so many PHP sites is
that
> I need a valid email address to send from. My question on the valid email
> address is if it has to be the primary or can it be the secondary address
> for an Exchange account? I created a secondary address and it still does
> not work, but it was only about 5 minutes ago so it may not have
replicated
> as of yet. Any clues on what to do?
>
>
--- End Message ---
--- Begin Message ---
Hello
is it possible to find out the memory consumption on a php script ?
I trie to develop a chat with php and SHM and want to fiend out how
much memory is used to scale the chat server
BR/Torsten
--- End Message ---
--- Begin Message ---
Torsten Rosenberger wrote:
is it possible to find out the memory consumption on a php script ?
I trie to develop a chat with php and SHM and want to fiend out how
much memory is used to scale the chat server
No, not now. I seem to remember talk about a function that would help
with this being available in PHP5, but I can't find anything in the
documentation.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
PHP|Architect: A magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
A while ago, Philip Olson wrote:
> As of 4.3.2, if you compile PHP with --enable-memory-limit
> you may use memory_get_usage(). This is documented and
> will show up when the next PHP manual is built.
This function is not documented in the PHP manual, but is in the zend copy:
http://www.zend.com/manual/function.memory-get-usage.php
HTH.
Pete.
--
Peter James
[EMAIL PROTECTED]
php|architect
The Magazine for PHP Professionals
http://www.phparch.com
----- Original Message -----
From: "John W. Holmes" <[EMAIL PROTECTED]>
To: "Torsten Rosenberger" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Sunday, July 27, 2003 7:39 AM
Subject: Re: [PHP] memory consumption from a script
> Torsten Rosenberger wrote:
> > is it possible to find out the memory consumption on a php script ?
> > I trie to develop a chat with php and SHM and want to fiend out how
> > much memory is used to scale the chat server
>
> No, not now. I seem to remember talk about a function that would help
> with this being available in PHP5, but I can't find anything in the
> documentation.
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> PHP|Architect: A magazine for PHP Professionals – www.phparch.com
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Peter James wrote:
A while ago, Philip Olson wrote:
As of 4.3.2, if you compile PHP with --enable-memory-limit
you may use memory_get_usage(). This is documented and
will show up when the next PHP manual is built.
This function is not documented in the PHP manual, but is in the zend copy:
http://www.zend.com/manual/function.memory-get-usage.php
Ah, that's the one I was looking for. Are there any downsides to
compiling PHP with --enable-memory-limit or is that something that's
normally done?
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
PHP|Architect: A magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
I think it's pretty standard. It just means that you can control how much
memory your script uses.
--
Peter James
[EMAIL PROTECTED]
php|architect
The Magazine for PHP Professionals
http://www.phparch.com
----- Original Message -----
From: "John W. Holmes" <[EMAIL PROTECTED]>
To: "Peter James" <[EMAIL PROTECTED]>
Cc: "Torsten Rosenberger" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Sunday, July 27, 2003 10:50 AM
Subject: Re: [PHP] memory consumption from a script
> Peter James wrote:
> > A while ago, Philip Olson wrote:
> >
> >
> >>As of 4.3.2, if you compile PHP with --enable-memory-limit
> >>you may use memory_get_usage(). This is documented and
> >>will show up when the next PHP manual is built.
> >
> > This function is not documented in the PHP manual, but is in the zend
copy:
> >
> > http://www.zend.com/manual/function.memory-get-usage.php
>
> Ah, that's the one I was looking for. Are there any downsides to
> compiling PHP with --enable-memory-limit or is that something that's
> normally done?
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> PHP|Architect: A magazine for PHP Professionals – www.phparch.com
>
>
>
>
--- End Message ---
--- Begin Message ---
Can we know clients' hard disk number with a phpscript. If yes what is the
code?
Thank you.
_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus
--- End Message ---
--- Begin Message ---
> Can we know clients' hard disk number with a phpscript. If yes what is the
> code?
of course no, because php is running on the server ;)
------------------------
--
Adrian
mailto:[EMAIL PROTECTED]
www: http://www.planetcoding.net
www: http://www.webskyline.de
--- End Message ---
--- Begin Message ---
Can we know clients' hard disk number with a phpscript. If yes what is the
code?
Thank you.
_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
--- End Message ---
--- Begin Message ---
Can we know clients' hard disk number with a phpscript. If yes what is the
code?
what do you mean by clients' hard disk number ?
you simply can't because PHP runs on the server-side, maybe you can know it
using javascript, but this - if it was available - will not be cross-browser
or cross-platform. since it will be a browser-sepcific API. and i would like
to know the use of knowing such a thing within a PHP script :-)
Thank you.
_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
--- End Message ---
--- Begin Message ---
KEN - 2mediaZone wrote:
(B> I'm trying to find out how to get multiple values from text area box
(B> <textarea></textarea>.
(B>
(B> Values are like this.
(B>
(B> aaa\n
(B> bbb\n
(B> ccc\n
(B> ddd\n
(B> eee\n
(B>
(B> I need to take "\n" from each value and put all the values to array.
(B
(BUse explode() to split the value on the new lines. Then you have each
(Bvalue in an array.
(B
(B$ar = explode("\n",$_POST['text_value']);
(B
(B(Why does this font make the backslash character look like a Y character
(Bwith a couple horizontal lines through it?)
(B
(B--
(B---John Holmes...
(B
(BAmazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
(B
(BPHP|Architect: A magazine for PHP Professionals - www.phparch.com
--- End Message ---
--- Begin Message ---
I have some problem with uploading a file from my harddisk using a ftp connection.
Here are the 2 files:
test.php contains the form:
<table>
<form method="get" action="test2.php" enctype="multipart/form-data">
<tr class=cen>
<td>Titlu gif</td>
<td> :: </td>
<td><input type="file" name="util" class=form1><br><input type="submit"
value="expediaza"</td>
</tr>
</form>
</table>
and test2.php is the script for upload :
<?
$ftp_server="*****";
$con = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($con, "*****", "*******");
if ((!$con) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server";
$error=1;
} else {
echo "Connected to $ftp_server <br>";
}
$util=strtolower($util);
$destination="tit.gif";
if(ftp_put($con, $destination, $util, FTP_BINARY)){echo "OK ,am pus titlul <br>";}
else{ echo "eroare<br>";$error=1;}
?>
Thanks in advanced
--- End Message ---
--- Begin Message ---
I have some problem with uploading a file from my harddisk using a ftp connection.
Here are the 2 files:
test.php contains the form:
<table>
<form method="get" action="test2.php" enctype="multipart/form-data">
<tr class=cen>
<td>Titlu gif</td>
<td> :: </td>
<td><input type="file" name="util" class=form1><br><input type="submit"
value="expediaza"</td>
</tr>
</form>
</table>
and test2.php is the script for upload :
<?
$ftp_server="*****";
$con = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($con, "*****", "*******");
if ((!$con) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server";
$error=1;
} else {
echo "Connected to $ftp_server <br>";
}
$util=strtolower($util);
$destination="tit.gif";
if(ftp_put($con, $destination, $util, FTP_BINARY)){echo "OK ,am pus titlul <br>";}
else{ echo "eroare<br>";$error=1;}
?>
Thanks in advanced
--- End Message ---
--- Begin Message ---
I have some problem with uploading a file from my harddisk using a ftp connection.
Here are the 2 files:
test.php contains the form:
<table>
<form method="get" action="test2.php" enctype="multipart/form-data">
<tr class=cen>
<td>Titlu gif</td>
<td> :: </td>
<td><input type="file" name="util" class=form1><br><input type="submit"
value="expediaza"</td>
</tr>
</form>
</table>
and test2.php is the script for upload :
<?
$ftp_server="*****";
$con = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($con, "*****", "*******");
if ((!$con) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server";
$error=1;
} else {
echo "Connected to $ftp_server <br>";
}
$util=strtolower($util);
$destination="tit.gif";
if(ftp_put($con, $destination, $util, FTP_BINARY)){echo "OK ,am pus titlul <br>";}
else{ echo "eroare<br>";$error=1;}
?>
Thanks in advanced
--- End Message ---
--- Begin Message ---
On Sunday 27 July 2003 10:22, Rausch Alexandru wrote:
> I have some problem with uploading a file from my harddisk using a ftp
> connection. Here are the 2 files:
You don't upload local files using the ftp_*() functions. You follow the
examples in manual > Handling file uploads.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Miller's Slogan:
Lose a few, lose a few.
*/
--- End Message ---
--- Begin Message ---
Hi,
I want to find out if this is my browsers fault or the settings in my
php.ini, can you goto http://bestwebhosters.com/my.login.php then look at
the page source and tell me if there is a hidden variable after the form tag
with the name "PHPSESSID"
Thanks for helping.
Cheers,
-Ryan
--- End Message ---
--- Begin Message ---
Ryan,
I'm getting the PHPSESSID variable.
Chris
Quoting Ryan A <[EMAIL PROTECTED]>:
> Hi,
> I want to find out if this is my browsers fault or the settings in my
> php.ini, can you goto http://bestwebhosters.com/my.login.php then look at
> the page source and tell me if there is a hidden variable after the form tag
> with the name "PHPSESSID"
>
> Thanks for helping.
>
> Cheers,
> -Ryan
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Yes.
.
--
Peter James
[EMAIL PROTECTED]
php|architect
The Magazine for PHP Professionals
http://www.phparch.com
----- Original Message -----
From: "Ryan A" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, July 27, 2003 8:34 AM
Subject: [PHP] small request
> Hi,
> I want to find out if this is my browsers fault or the settings in my
> php.ini, can you goto http://bestwebhosters.com/my.login.php then look at
> the page source and tell me if there is a hidden variable after the form
tag
> with the name "PHPSESSID"
>
> Thanks for helping.
>
> Cheers,
> -Ryan
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
> I want to find out if this is my browsers fault or the settings in my
> php.ini, can you goto http://bestwebhosters.com/my.login.php then look at
> the page source and tell me if there is a hidden variable after the form
tag
> with the name "PHPSESSID"
>
Yes.
Shaunak
--- End Message ---
--- Begin Message ---
Okay, how do I make PHP 4.3.2. and MySQL 4.0.13 to agree on what null means?
I'm trying to get a form to add a new record into my database where one of
the
Fields might be null and for said field to actually be a null record once
into
The database as well...
This is the script in question (a simple "Let the user add links to the
site" thingy).
It may not be the most elegant way of solving things...($name,$url and
$comment are
Variables found in $_POST if it's not obvious btw).
<?php
extract ($_POST, EXTR_PREFIX_SAME,"ww");
$fail=0;
$fail2=0;
if ($name==""):
echo "I need a name for the new site!";
return;
endif;
if ($url==""):
echo "The site needs an URL!";
return;
endif;
if ($comment==""):
$comment=null;
endif;
$link = mysql_connect("localhost") or die("Could not connect : " .
mysql_error());
mysql_select_db("intranet") or die("Could not select database");
$query = "SELECT id from site where name=\"$name\"";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
while ($row = mysql_fetch_row($result)) {
$fail=$row[0];
}
if ($fail>0):
echo "Sorry, that name already exist!";
return;
endif;
mysql_free_result($result);
$query = "SELECT id from site where url=\"$url\"";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
while ($row = mysql_fetch_row($result)) {
$fail2=$row[0];
}
if ($fail2>0):
echo "Sorry, that URL already exist!";
return;
endif;
mysql_free_result($result);
$name2=mysql_escape_string($name);
$url2=mysql_escape_string($url);
$comment2=mysql_escape_string($comment);
$query = "INSERT into site(id,name,url,comment) VALUES
(null,'$name2','$url2','$comment2')";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
mysql_close($link);
echo "Sitename=$name";
echo "<br>Site's URL=$url";
if (is_null($comment)):
echo "<br>No comment";
else:
echo "<br>Comment=$comment";
endif;
echo "<p>Added!";
?>
If I have null direcly in the query string (like this part...VALUES
(null,'test'...) it works
Like excepted (the id field is an auto_increment one so the id is
automatically changed to
The next available id-number).
However, what fails is when I set a variable to be null and adds that to the
query. The
Record is inserted into the database alright but the comment-field (in this
case) doesn't
Get filled in with MySQL's the null-value. It gets filled with a zero-length
string instead
Which screws things up, since I no longer can use constructs like "select
id,name from site where comment is null;"
Not a problem on this specific table but on another table where I'm about to
write the insert-script it is a
Huge problem!
Many thanks if someone has a good solution for this!
---
"... and pray that there's intelligent life somewhere out in space, because
there's bugger all down here on Earth!" - Eric Idle - the Meaning of Life
---
/Jonas
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.501 / Virus Database: 299 - Release Date: 2003-07-14
--- End Message ---
--- Begin Message ---
Have you tried inserting it without including the id field in the insert
statement? I have several tables with auto increments and I never even
bother putting that field in the insert statement.
David
-----Original Message-----
From: Jonas Thorell [mailto:[EMAIL PROTECTED]
Sent: Sunday, July 27, 2003 9:44 AM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP, MySQL and null?
Okay, how do I make PHP 4.3.2. and MySQL 4.0.13 to agree on what null means?
I'm trying to get a form to add a new record into my database where one of
the
Fields might be null and for said field to actually be a null record once
into
The database as well...
This is the script in question (a simple "Let the user add links to the
site" thingy).
It may not be the most elegant way of solving things...($name,$url and
$comment are
Variables found in $_POST if it's not obvious btw).
<?php
extract ($_POST, EXTR_PREFIX_SAME,"ww");
$fail=0;
$fail2=0;
if ($name==""):
echo "I need a name for the new site!";
return;
endif;
if ($url==""):
echo "The site needs an URL!";
return;
endif;
if ($comment==""):
$comment=null;
endif;
$link = mysql_connect("localhost") or die("Could not connect : " .
mysql_error());
mysql_select_db("intranet") or die("Could not select database");
$query = "SELECT id from site where name=\"$name\"";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
while ($row = mysql_fetch_row($result)) {
$fail=$row[0];
}
if ($fail>0):
echo "Sorry, that name already exist!";
return;
endif;
mysql_free_result($result);
$query = "SELECT id from site where url=\"$url\"";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
while ($row = mysql_fetch_row($result)) {
$fail2=$row[0];
}
if ($fail2>0):
echo "Sorry, that URL already exist!";
return;
endif;
mysql_free_result($result);
$name2=mysql_escape_string($name);
$url2=mysql_escape_string($url);
$comment2=mysql_escape_string($comment);
$query = "INSERT into site(id,name,url,comment) VALUES
(null,'$name2','$url2','$comment2')";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
mysql_close($link);
echo "Sitename=$name";
echo "<br>Site's URL=$url";
if (is_null($comment)):
echo "<br>No comment";
else:
echo "<br>Comment=$comment";
endif;
echo "<p>Added!";
?>
If I have null direcly in the query string (like this part...VALUES
(null,'test'...) it works
Like excepted (the id field is an auto_increment one so the id is
automatically changed to
The next available id-number).
However, what fails is when I set a variable to be null and adds that to the
query. The
Record is inserted into the database alright but the comment-field (in this
case) doesn't
Get filled in with MySQL's the null-value. It gets filled with a zero-length
string instead
Which screws things up, since I no longer can use constructs like "select
id,name from site where comment is null;"
Not a problem on this specific table but on another table where I'm about to
write the insert-script it is a
Huge problem!
Many thanks if someone has a good solution for this!
---
"... and pray that there's intelligent life somewhere out in space, because
there's bugger all down here on Earth!" - Eric Idle - the Meaning of Life
---
/Jonas
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.501 / Virus Database: 299 - Release Date: 2003-07-14
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
>Have you tried inserting it without including the id field in the insert
statement? I have several tables with auto increments and I never even
bother
>putting that field in the insert statement.
Well, no. But that's not where the problem is. If I was unclear - the
id-field work as it should. It's when I try to use
A variable in the query-string the problem pops up.
IOW - INSERT INTO SITE (id,name,url,comment) VALUES
(null,'testname','testurl','testcomment');
Works
INSERT INTO SITE (id,name,url,comment) VALUES
(null,'$name','$url','$comment');
Does not when I've set $comment=null;
If every field has a proper value (when everything had been filled in on the
form),
Everything works as expected.
/Jonas
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.501 / Virus Database: 299 - Release Date: 2003-07-14
--- End Message ---
--- Begin Message ---
Sorry, wrote wrong here so one more try.
Well, no. But that's not where the problem is. If I was unclear - the
id-field work as it should. It's when I try to use A variable in the
query-string the problem pops up.
IOW - INSERT INTO SITE (id,name,url,comment) VALUES
(null,'testname','testurl',null)
Works
INSERT INTO SITE (id,name,url,comment) VALUES
(null,'$name','$url','$comment')
Does not when I've set $comment=null;
If every field has a proper value (when everything had been filled in on the
form), Everything works as expected.
/Jonas
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.501 / Virus Database: 299 - Release Date: 2003-07-14
--- End Message ---
--- Begin Message ---
Actually that's my bad. That's what I get for doing a hundred other things
while I'm reading my email. Sorry. I really don't know why null would be
different under PHP and mysql; I'm not even sure it is. Right now I'm
reloading my server due to a lighting hit (REALLY REALLY bad storms), so I
really can't even play with it. However I was thinking (and this would be
trying not knowing) that maybe you could change:
if ($comment==""):
$comment=null;
endif;
to
if ($comment==""):
$comment='null';
endif;
Granted it is text whether then a null variable, but it would give you a
possible fix. Of course it goes without saying that you would have to change
your script below when it checks for a null value to check for the text
'null'. At least this way you it would be like you typed it in...of course
this may not be the best way. Sorry about the misunderstanding...like I said
my bad.
David
-----Original Message-----
From: Jonas Thorell [mailto:[EMAIL PROTECTED]
Sent: Sunday, July 27, 2003 10:10 AM
To: 'David Smith'; [EMAIL PROTECTED]
Subject: RE: [PHP] PHP, MySQL and null?
Sorry, wrote wrong here so one more try.
Well, no. But that's not where the problem is. If I was unclear - the
id-field work as it should. It's when I try to use A variable in the
query-string the problem pops up.
IOW - INSERT INTO SITE (id,name,url,comment) VALUES
(null,'testname','testurl',null)
Works
INSERT INTO SITE (id,name,url,comment) VALUES
(null,'$name','$url','$comment')
Does not when I've set $comment=null;
If every field has a proper value (when everything had been filled in on the
form), Everything works as expected.
/Jonas
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.501 / Virus Database: 299 - Release Date: 2003-07-14
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
* Thus wrote Jonas Thorell ([EMAIL PROTECTED]):
> Sorry, wrote wrong here so one more try.
>
> Well, no. But that's not where the problem is. If I was unclear - the
> id-field work as it should. It's when I try to use A variable in the
> query-string the problem pops up.
>
> IOW - INSERT INTO SITE (id,name,url,comment) VALUES
> (null,'testname','testurl',null)
>
> Works
>
> INSERT INTO SITE (id,name,url,comment) VALUES
> (null,'$name','$url','$comment')
>
> Does not when I've set $comment=null;
>
> If every field has a proper value (when everything had been filled in on the
> form), Everything works as expected.
The problem is when the string gets translated (variables expanded)
and sent to mysql is that the string looks like this:
INSERT INTO SITE (id,name,url,comment) VALUES
(null,'Name of url','http://blah/','')
So when the database sees the query it thinks you want to put and
empty sting there, not null. To achieve what you want to do you
have to make sure that the word, NULL, without quotes around it,
gets sent to the databaase.
$comment2 = trim($comment); // also clear out space just in case
if (strlen($comment2)) {
// escape the string
$comment2 = mysql_escape_string($comment2);
// wrap the string in single quotes for the db
$comment2 = "'$comment2'";
} else {
// send the keyword NULL to the database
$comment2 = "null";
}
Now in your SQL statement you would put the $comment2 variable in
the proper place without the single quotes:
INSERT INTO SITE (id,name,url,comment) VALUES
(null,'$name','$url',$comment2)
Now your sql statment will be (if comment was left blank:)
INSERT INTO SITE (id,name,url,comment) VALUES
(null,'Name of url','http://blah/',null)
or if it had a value:
INSERT INTO SITE (id,name,url,comment) VALUES
(null,'Name of url','http://google.com/','This should be first')
HTH,
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---
I have some problem with uploading a file from my harddisk using a ftp connection.
Here are the 2 files:
test.php contains the form:
<table>
<form method="get" action="test2.php" enctype="multipart/form-data">
<tr class=cen>
<td>Titlu gif</td>
<td> :: </td>
<td><input type="file" name="util" class=form1><br><input type="submit"
value="expediaza"</td>
</tr>
</form>
</table>
and test2.php is the script for upload :
<?
$ftp_server="*****";
$con = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($con, "*****", "*******");
if ((!$con) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server";
$error=1;
} else {
echo "Connected to $ftp_server <br>";
}
$util=strtolower($util);
$destination="tit.gif";
if(ftp_put($con, $destination, $util, FTP_BINARY)){echo "OK ,am pus titlul <br>";}
else{ echo "eroare<br>";$error=1;}
?>
Thanks in advanced
--- End Message ---
--- Begin Message ---
You're not giving us much to work with here. What's the actual problem?
Regardless, I can see a couple of thing wrong here.
1. You're trying to do a multipart/form-data transfer using GET. You need
to use POST.
2. Unless you've got register_globals on, and even if you do, you should be
referencing your uploaded file with $_FILES['util']['tmp_name']
3. You should read the manual here:http://ca2.php.net/features.file-upload
HTH.
Pete.
--
Peter James
[EMAIL PROTECTED]
php|architect
The Magazine for PHP Professionals
http://www.phparch.com
----- Original Message -----
From: "Rausch Alexandru" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 26, 2003 8:50 PM
Subject: [PHP] Please HELP me
I have some problem with uploading a file from my harddisk using a ftp
connection.
Here are the 2 files:
test.php contains the form:
<table>
<form method="get" action="test2.php" enctype="multipart/form-data">
<tr class=cen>
<td>Titlu gif</td>
<td> :: </td>
<td><input type="file" name="util" class=form1><br><input type="submit"
value="expediaza"</td>
</tr>
</form>
</table>
and test2.php is the script for upload :
<?
$ftp_server="*****";
$con = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($con, "*****", "*******");
if ((!$con) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server";
$error=1;
} else {
echo "Connected to $ftp_server <br>";
}
$util=strtolower($util);
$destination="tit.gif";
if(ftp_put($con, $destination, $util, FTP_BINARY)){echo "OK ,am pus titlul
<br>";}
else{ echo "eroare<br>";$error=1;}
?>
Thanks in advanced
--- End Message ---
--- Begin Message ---
Hi,
Just wanted to say thank you to all those who tested and replied.
Thank you.
Cheers,
-Ryan
----- Original Message -----
From: "Shaunak Kashyap" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, July 27, 2003 4:35 PM
Subject: [PHP] Re: small request
> > I want to find out if this is my browsers fault or the settings in my
> > php.ini, can you goto http://bestwebhosters.com/my.login.php then look
at
> > the page source and tell me if there is a hidden variable after the form
> tag
> > with the name "PHPSESSID"
> >
>
> Yes.
>
> Shaunak
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
On Friday, July 25, 2003, 4:59:24 PM, Shaun wrote:
S> thanks for your reply,
S> but that doesn't seem to work either, how about removing everything after
S> and including the ?, how would i do that?
try echo basename($_SERVER['PHP_SELF'])
Please trim your posts :)
--
Regards,
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
--- End Message ---
--- Begin Message ---
read www.php.net/variables.scope
Eric Fleming wrote:
I am having some problems using variables in included files. Can someone
please look at my code below and see how I might accomplish what I am trying
to do?
<?php
$subnav = "home";
include("incHeader.php");
?>
<!--- CONTENT AREA --->
The content would go here.
<!--- END CONTENT AREA --->
<?php include ("incFooter.php"); ?>
Now, when I try to reference the subnav variable in the inHeader.php or
incFooter.php files, it comes up blank. I am basically trying to adjust the
navigation on each page depending on the page I am on. I am just learning
PHP, have programmed in ColdFusion for years and in ColdFusion this was not
a problem. Any ideas?
Eric Fleming
--- End Message ---
--- Begin Message ---
Hi all,
I have a webserver using Ensim, some of you may or may not know of it. PHP
is installed and Apache is using PHP as a module. The server also has the
php binary. I would liek to recompile the current PHP Binary
using --with-pcntl and whatever it was originally compiled with ....
How do I go about doing this?
Dave
--- End Message ---
--- Begin Message ---
On Monday 28 July 2003 01:26, David Goodchild wrote:
> I have a webserver using Ensim, some of you may or may not know of it. PHP
> is installed and Apache is using PHP as a module. The server also has the
> php binary. I would liek to recompile the current PHP Binary
> using --with-pcntl and whatever it was originally compiled with ....
>
> How do I go about doing this?
php -i
to see what the "Configure Command" was, then modify it with whatever you want
to include.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Life's too short to dance with ugly women.
*/
--- End Message ---
--- Begin Message ---
Thank-you,
How do i recompile it with : --with-pcntl though? This is what i need to
add as soon as i can. I tired looking for the pcntl.so file but i cant find
that either.
"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Monday 28 July 2003 01:26, David Goodchild wrote:
>
> > I have a webserver using Ensim, some of you may or may not know of it.
PHP
> > is installed and Apache is using PHP as a module. The server also has
the
> > php binary. I would liek to recompile the current PHP Binary
> > using --with-pcntl and whatever it was originally compiled with ....
> >
> > How do I go about doing this?
>
> php -i
>
> to see what the "Configure Command" was, then modify it with whatever you
want
> to include.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> Life's too short to dance with ugly women.
> */
>
--- End Message ---
--- Begin Message ---
On Monday 28 July 2003 01:54, David Goodchild wrote:
Please do not top-post!
> How do i recompile it with : --with-pcntl though? This is what i need to
> add as soon as i can. I tired looking for the pcntl.so file but i cant
> find that either.
What _exactly_ are you having problems with? And why are you looking for a
pcntl.so file? AFAIK when compiling a CGI/CLI version of PHP you end up with
a self-contained binary.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
I refuse to have a battle of wits with an unarmed person.
*/
--- End Message ---
--- Begin Message ---
"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Monday 28 July 2003 01:54, David Goodchild wrote:
>
> Please do not top-post!
>
> > How do i recompile it with : --with-pcntl though? This is what i need
to
> > add as soon as i can. I tired looking for the pcntl.so file but i cant
> > find that either.
>
> What _exactly_ are you having problems with? And why are you looking for a
> pcntl.so file? AFAIK when compiling a CGI/CLI version of PHP you end up
with
> a self-contained binary.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> I refuse to have a battle of wits with an unarmed person.
> */
>
My exact problem is this: I do not know how to recompile an already
installed PHP binary with the option --with-pcntl ...
--- End Message ---
--- Begin Message ---
On Sun, 27 Jul 2003 20:13:22 +0100 [EMAIL PROTECTED] (David Goodchild) wrote:
> My exact problem is this: I do not know how to recompile an already
> installed PHP binary with the option --with-pcntl ...
>
You can't "recompile a binary", you compile a new version with the compile-options
of your old binary.
thomas
--- End Message ---
--- Begin Message ---
Hi everyone,
Just in case you or anybody in the future (maybe reading the archive) come
accross the same problem here is how i have solved it and made all my
scripts run perfectly again as they were before.
I just created a .htaccess file and added these 2 lines since i dont have
direct access to the php.ini file:
php_value session.use_cookies 1
php_value session.use_trans_sid 0
(Based on John Holmes reply)
This will only affect the directory which you put this in of course.
I found that even though session.use_cookies was on the
session.use_trans_sid was overriding it, I added the "php_value
session.use_cookies 1" just to make sure. I dont know if the overriding is
normal for everyone so check it out for youself if you have problems.
Below is my first message for this thread in case you are intrested.
Thank you everyone who replied.
Cheers,
-Ryan
> Hi,
> Ok, have half solved why my scripts all of a sudden stopped working.
>
> This is how my scripts are setup:
> There is a form(login.php) where the user puts in his user/pass, then this
> is authenticated(auth.php) by the database and a few other sessions are
> created (email,cust_number) and also username,password sessions are
created.
> Then i am using a header("Location....") to send it to details.php,
> details.php will check and make sure that the following sessions have been
> created username,password,email,cust_number, if any are not valid it will
> kick ther person back to login.php...this was working before but not now.
>
> I went to my forms source and checked where it was sending my submitted
form
> and found a hidden text box there with this data:
> <input type="hidden" name="PHPSESSID"
> value="46081aa70da693f5edeecc069ed8a627" />
>
> so i took that "PHPSESSID" and its value and added it to my
> header("Location....") like so:
> header("Location:details.php?PHPSESSID=46081aa70da693f5edeecc069ed8a627")
>
> and every damn thing is working again...
>
> can ANYBODY please tell me what the @#%# is that PHPSESSID, how it got
into
> my login page and how do i work with it?
> because now I have manually put it in my file, do i need to always put it?
> how do i get it as a variable and finally how can i take it out of my
> computer and jump on it for causing me 5 hours of pain and suffering.any
> ways of killing it slowly too is appreciated.
>
> Even if you cant answer the first questions the last two will do, the
> [EMAIL PROTECTED]@#%@ [EMAIL PROTECTED]@# PHPSESSID....
>
> Thanks in advance,
> -Ryan
--- End Message ---
--- Begin Message ---
On Saturday, July 26, 2003, at 03:06 AM, Nikhil G. Daddikar wrote:
I am using PHP to develop and web app.
The app also has a scripting language for the *end user*. I was
thinking if I could expose a very simple subset of PHP to them
(foreach, if-then-else, variable assignments and comments) and then
simply "eval" it. But I don't want them to use calls like system or do
infinite loops etc. that will screw up the system.
I was thinking if I had a PHPparser that returns tokens, then I can
eliminate the call to unwanted funtions, etc.
Any ideas on how I should proceed?
use smarty
http://smarty.php.net/
--- End Message ---
--- Begin Message ---
The Revolutionary Book
Your Boss Doesn't Want You to Read !
Does an extra $500 to $1000 a week sound exciting?
HINT: It's not what you think
Dear Friend:
Everybody is looking to make more money online, but the biggest problem
is that VERY few things actually work.
We have an exclusive system for making money from home and it only
requires a few hours a week of your free time.
Best is. You work once, get paid forever …………………………..
A recent revolutionary discovery has allowed many average people the ability
to create another source of income in their life.
For a limited time only, you can receive a FREE copy of your
own personal 'hot off the presses' e-book,
"How to Achieve Unlimited Freedom: The Confidential Discovery of the Century"
by Dr. Tim Jaeger valued at $19.95 !!
Click Below to receive it
absolutely FREE !
Click Here
NOTE - This is NOT SPAM - This message is sent in compliance of the new e-mail bill:
SECTION 301. Per Section 301, paragraph (a)(2)(C) of S. 1618. This message is NOT Spam
as long as you are provided with a way to remove your name from this mailing list. All
further transmissions to you from me may be stopped at no cost to you by e-mailing
[EMAIL PROTECTED] from your e-mail address with the word REMOVE in the subject line.
This e-mail must be from or contain the address you wish to have removed.
--- End Message ---
--- Begin Message ---
oh fuck you, damn spammer...
i hope someone hacks your damn spam server...
------------------------
> The Revolutionary Book
> Your Boss Doesn't Want You to Read !
> Does an extra $500 to $1000 a week sound exciting?
> HINT: It's not what you think
> Dear Friend:
> Everybody is looking to make more money online, but the biggest problem
> is that VERY few things actually work.
> We have an exclusive system for making money from home and it only
> requires a few hours a week of your free time.
> Best is. You work once, get paid forever …………………………..
> A recent revolutionary discovery has allowed many average people the ability
> to create another source of income in their life.
> For a limited time only, you can receive a FREE copy of your
> own personal 'hot off the presses' e-book,
> "How to Achieve Unlimited Freedom: The Confidential Discovery of the Century"
> by Dr. Tim Jaeger valued at $19.95 !!
> Click Below to receive it
> absolutely FREE !
> Click Here
> NOTE - This is NOT SPAM - This message is sent in compliance of the new e-mail bill:
> SECTION 301. Per Section 301, paragraph (a)(2)(C) of S. 1618. This message is NOT
> Spam as long as you are
> provided with a way to remove your name from this mailing list. All further
> transmissions to you from me may be stopped at no cost to you by e-mailing [EMAIL
> PROTECTED] from your e-mail
> address with the word REMOVE in the subject line. This e-mail must be from or
> contain the address you wish to have removed.
------------------------
--
Adrian
mailto:[EMAIL PROTECTED]
www: http://www.planetcoding.net
www: http://www.webskyline.de
--- End Message ---
--- Begin Message ---
dammit!!! the link doesn't work... i was REALLY excited to find out what my
boss doesn't want me to know!!!
it's also reassuring to know (reading at the bottom) that this is NOT
SPAM!!! i feel safe knowing that this isn't actually spam, and that all
members of this list actually requested this email...
----- Original Message -----
From: "Adrian" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, July 27, 2003 7:03 PM
Subject: Re: [PHP] Your E-Book
> oh fuck you, damn spammer...
> i hope someone hacks your damn spam server...
>
> ------------------------
> > The Revolutionary Book
> > Your Boss Doesn't Want You to Read !
>
> > Does an extra $500 to $1000 a week sound exciting?
>
> > HINT: It's not what you think
>
> > Dear Friend:
>
> > Everybody is looking to make more money online, but the biggest problem
> > is that VERY few things actually work.
>
> > We have an exclusive system for making money from home and it only
> > requires a few hours a week of your free time.
>
> > Best is. You work once, get paid forever ............
>
> > A recent revolutionary discovery has allowed many average people the
ability
> > to create another source of income in their life.
>
>
>
> > For a limited time only, you can receive a FREE copy of your
> > own personal 'hot off the presses' e-book,
> > "How to Achieve Unlimited Freedom: The Confidential Discovery of the
Century"
> > by Dr. Tim Jaeger valued at $19.95 !!
>
>
> > Click Below to receive it
> > absolutely FREE !
>
>
> > Click Here
>
>
>
>
>
>
>
>
>
>
>
> > NOTE - This is NOT SPAM - This message is sent in compliance of the new
e-mail bill: SECTION 301. Per Section 301, paragraph (a)(2)(C) of S. 1618.
This message is NOT Spam as long as you are
> > provided with a way to remove your name from this mailing list. All
further transmissions to you from me may be stopped at no cost to you by
e-mailing [EMAIL PROTECTED] from your e-mail
> > address with the word REMOVE in the subject line. This e-mail must be
from or contain the address you wish to have removed.
>
> ------------------------
> --
> Adrian
> mailto:[EMAIL PROTECTED]
> www: http://www.planetcoding.net
> www: http://www.webskyline.de
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
--- End Message ---
--- Begin Message ---
On Monday 28 July 2003 02:14, skate wrote:
> dammit!!! the link doesn't work... i was REALLY excited to find out what
> my boss doesn't want me to know!!!
>
> it's also reassuring to know (reading at the bottom) that this is NOT
> SPAM!!! i feel safe knowing that this isn't actually spam, and that all
> members of this list actually requested this email...
Please stop responding to spam with spam! And if you really cannot resist the
urge to respond at least have the courtesy to trim your response so that we
don't have to see the spam over and over again.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
The announcement of the one meeting you most wanted to attend will arrive in
the mail the day after the event.
-- Postal Postulate
*/
--- End Message ---
--- Begin Message ---
Hi
First time on the list and this may be a silly question. I'm developing a site
that uses sessions. I have enabled cookies and checked that a valid cookie
with the appropriate session id is being set. However, I've noticed that
links in my pages are getting the sessionid added as a GET parameter. Can
anything be done to stop this as, presumably, they aren't necessary in this
situation.
TIA
Nick
--- End Message ---
--- Begin Message ---
--- Nicholas Robinson <[EMAIL PROTECTED]> wrote:
> I've noticed that links in my pages are getting the sessionid
> added as a GET parameter.
The session.use_trans_sid directive is enabled in your php.ini. Disable it if
you do not want this behavior.
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
--- End Message ---