|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: php-general-digest-help
lists.php.netDate: Fri Aug 03 2001 - 23:55:00 CDT
php-general Digest 4 Aug 2001 04:55:00 -0000 Issue 795
Topics (messages 61155 through 61220):
php/sql code gives blank page
61155 by: sono.selectcomm.ab.ca
61157 by: Simon Robson
Multiple File Upload
61156 by: Arne
61158 by: Sam Masiello
61198 by: Richard Lynch
Re: web traffic report
61159 by: Eric Wood
61160 by: scott [gts]
61163 by: Matt Greer
61164 by: Corey Chapman
61176 by: Tim
61184 by: Richard Lynch
echo
61161 by: Jeremy Morano
61162 by: mike cullerton
61200 by: Richard Lynch
fopen a URL with = in it
61165 by: Corey Chapman
61167 by: scott [gts]
61168 by: Corey Chapman
61199 by: Richard Lynch
61217 by: Corey Chapman
thoughts on sessions and members
61166 by: mike cullerton
61169 by: Corey Chapman
trigger email with submit button
61170 by: Jerry Lake
61171 by: scott [gts]
61173 by: Ron Clark
61174 by: Philip Olson
Re: Hmmm?
61172 by: Ryan Fischer
scientific notation?
61175 by: Seth Northrop
61196 by: Richard Lynch
grab newsgroup posts
61177 by: Steph
61197 by: Richard Lynch
61201 by: Inércia Sensorial
Re: SQL syntax error in PHP script. dunno what's wrong
61178 by: Richard Lynch
Re: YA Session Problem
61179 by: Richard Lynch
IF ELSEIF ELSE??
61180 by: Gerard Samuel
61181 by: Adam Plocher
61182 by: Inércia Sensorial
61183 by: Richard Baskett
Re: ODBC
61185 by: Richard Lynch
Re: Retriving data from http request,
61186 by: Richard Lynch
Re: stop a file called foo.bar
61187 by: Richard Lynch
Re: PHP Manual in PDF Format
61188 by: Richard Lynch
Re: PHP Grammar Definition
61189 by: Richard Lynch
Re: bind() function always reporting Invalid argument.
61190 by: Richard Lynch
Re: Left Join extremely slow (MySQL)
61191 by: Richard Lynch
61204 by: William Poarch
61206 by: Queen
Re: php date bug ?
61192 by: Richard Lynch
Re: Error using databases
61193 by: Richard Lynch
Re: again
61194 by: Richard Lynch
Re: Minutes between tow dates
61195 by: Richard Lynch
persistence variable value - help
61202 by: Ardani Sarjito
Re:[PHP] IF ELSEIF ELSE??
61203 by: Jack Sasportas
61205 by: Richard Baskett
61215 by: Jack Sasportas
weird behavior with a form
61207 by: Benjamin Bleything
61208 by: Richard Baskett
61209 by: Benjamin Bleything
61210 by: Queen
61211 by: Richard Baskett
61213 by: Ben Bleything
61214 by: Benjamin Bleything
Need Help Compiling PHP with Apache modules
61212 by: Matthew Tyler
PHP MyAdmin Error---weird
61216 by: John Monfort
Re: PHP, C++, and LAN
61218 by: Keith Jeffery
Re: creating archive [<-- was re: php]
61219 by: David Minor
Reading with C 'struct' data
61220 by: CW Huang
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
I created a little php script to run and display stuff on my browser for
printing.
When I run the command I get a blank page though.
I tested the syntax of my command in mysql and on phpMyAdmin to make sure
it worked.
Here is the code:
-------------------------------------------------------------------------------
<?php
mysql_connect("localhost", "user", "password") or die("Could not
connect");
print ("Connected succesfully"); <----THIS DISPLAYS
mysql_selectdb("rtapd") or die("Could not select database");
print ("Selected database"); <-----THIS DISPLAYS
$query = "SELECT timestamp, msg_id, msg FROM pgr_msgs WHERE msg_id=2903092
AND timestamp >= 20010709000000 AND timestamp < 20010803000000";
$result = mysql_query($query) or die("Query Failed");
print ("Query executed and returned"); <-----THIS DISPLAYS
while($row == mysql_fetch_array($result)) {
$timestamp = $row["timestamp"];
$msg_id = $row["msg_id"];
$msg = $row["msg"];
echo" <br>
Time: <b>$timestamp</b><br>
Pager Number: <b>$msg_id</b><br>
Message: $msg<br><br>";
}
?>
-------------------------------------------------------------------------------
Is there something specific in this code that would cause the page to
display blank? (Blank except for the print statements at the top that
tell me whether it connected or not)
I do notice the page take awhile to load(the blank page)...it almost looks
like it is timing out maybe?
Thanks IN advance:)
Cheers
Sono
attached mail follows:
At 10:55 03/08/01 -0600, sono
selectcomm.ab.ca wrote:
>while($row == mysql_fetch_array($result)) {
This should be:
while($row = mysql_fetch_array($result)) {
(single equals -- assignment not comparison). Or was that just a typo?
Simon
attached mail follows:
Hi,
I want to upload multiple files in one step. I know how to handle the things
on PHP side, but how can I select more than one file in the select box. It
does not work with:
<FORM ENCTYPE="multipart/form-data" ACTION="_URL_" METHOD="POST">
<INPUT NAME="userfile" TYPE="file"></FORM>
I can only select one file. Is there a possibillity to select more, like in
windows explorer?
attached mail follows:
This link from the PHP manual might be of some help to you:
http://www.php.net/manual/en/features.file-upload.multiple.php
HTH
Sam Masiello
Software Quality Assurance Engineer
Synacor
(716) 853-1362 x289
smasiello
synacor.com
-----Original Message-----
From: Arne [mailto:anoehre
gmx.de]
Sent: Friday, August 03, 2001 1:03 PM
To: php-general
lists.php.net
Subject: [PHP] Multiple File Upload
Hi,
I want to upload multiple files in one step. I know how to handle the things
on PHP side, but how can I select more than one file in the select box. It
does not work with:
<FORM ENCTYPE="multipart/form-data" ACTION="_URL_" METHOD="POST">
<INPUT NAME="userfile" TYPE="file"></FORM>
I can only select one file. Is there a possibillity to select more, like in
windows explorer?
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
No, you'll have to have as many INPUT TYPE=FILE tags as you need uploads.
HTML/HTTP just won't let you do what you want, and PHP cannot change that.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Arne <anoehre
gmx.de> Newsgroups: php.general To: <php-general
lists.php.net> Sent: Friday, August 03, 2001 12:03 PM Subject: Multiple File Upload
> Hi, > > I want to upload multiple files in one step. I know how to handle the things > on PHP side, but how can I select more than one file in the select box. It > does not work with: > <FORM ENCTYPE="multipart/form-data" ACTION="_URL_" METHOD="POST"> > <INPUT NAME="userfile" TYPE="file"></FORM> > > I can only select one file. Is there a possibillity to select more, like in > windows explorer? > >
attached mail follows:
Has anyone figured a way to purge access-log files after webalizer is done using to data only so far back?
-eric ----- Original Message ----- > I'm rather fond of Webalizer (www.mrunix.net/webalizer).
attached mail follows:
for server-side software that can be completely automated, analog is rather nice.
it's freeware, for linux/unix
> -----Original Message-----
> From: Jack [mailto:jacky
activelifestyle.com]
> Sent: Friday, August 03, 2001 11:18 AM
> To: php-general
lists.php.net
> Subject: [PHP] web traffic report
>
>
> Hi people,
> Is anyone has any advice about what should be the very good web traffic
> report software? I need to use that to track all statistic data on my
> sites, including all clicks on image links and hyperlinks.
> Jack
> jacky
activelifestyle.com
> "Love your enemies, it will drive them nuts"
>
attached mail follows:
on 8/3/01 12:22 PM, scott [gts] at scott
graphictype.com wrote:
> for server-side software that can be completely > automated, analog is rather nice. > > it's freeware, for linux/unix
Analog is available for just about anything.
Matt
attached mail follows:
Can't you just run a cron job (set it to do it automatically every so often) to delete the file from your web account's tmp folder.. ?
> Has anyone figured a way to purge access-log files after webalizer is
done
> using to data only so far back?
>
> -eric
> ----- Original Message -----
> > I'm rather fond of Webalizer (www.mrunix.net/webalizer).
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-
admin
lists.php.net
>
>
>
Corey Chapman Xnull CEO (Chat with us: http://forum.xnull.com)
attached mail follows:
We set webalizer in incremental mode and run it after the logfiles are rotated nightly. I also merge files from several load-balanced servers together into one log that gets fed to webalizer for combined statistics.
My only complaint with it is that the development has more or less stopped on it, but it is open source if you want to tweak anything. :)
- Tim
On 03 Aug 2001 13:22:46 -0400, Eric Wood wrote:
> Has anyone figured a way to purge access-log files after webalizer is done
> using to data only so far back?
>
> -eric
> ----- Original Message -----
> > I'm rather fond of Webalizer (www.mrunix.net/webalizer).
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
Your process should be: logrotate access_log Use Webalizer on "old" log. Purge old log. Webalizer does not need the raw data after it has processed it once.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Corey Chapman <ze0
xnull.com> Newsgroups: php.general To: Eric Wood <eric
interplas.com>; <php-general
lists.php.net> Sent: Friday, August 03, 2001 1:38 PM Subject: Re: [PHP] web traffic report
> Can't you just run a cron job (set it to do it automatically every so > often) to delete the file from your web account's tmp folder.. ? > > > Has anyone figured a way to purge access-log files after webalizer is > done > > using to data only so far back? > > > > -eric > > ----- Original Message ----- > > > I'm rather fond of Webalizer (www.mrunix.net/webalizer). > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net > > For additional commands, e-mail: php-general-help
lists.php.net > > To contact the list administrators, e-mail: php-list- > admin
lists.php.net > > > > > > > > Corey Chapman > Xnull CEO > (Chat with us: http://forum.xnull.com)
attached mail follows:
$sql = "SELECT first_name, last_name, address, state, zip_code, country, company, occupation, telephone, fax, email, entry_name, password, package, registration_date, valid_until, max_users FROM $table_name WHERE uid = \"$uid\" ";
$result =
mysql_query($sql,$connection) or die("Couldn't execute query.");
---------------------------------------------------------------------------- ------------------------------------------- -----------When I echo $sql, I get this result -----------SELECT first_name, last_name ....... How can I echo the actual values?
attached mail follows:
on 8/3/01 11:30 AM, Jeremy Morano at jeremy
prepresshelp.com wrote:
> $sql = "SELECT first_name, last_name, address, state, zip_code, country,
> company, occupation, telephone, fax, email, entry_name, password, package,
> registration_date, valid_until, max_users
> FROM $table_name
> WHERE uid = \"$uid\"
> ";
>
>
> $result =
mysql_query($sql,$connection) or die("Couldn't execute query.");
>
> ----------------------------------------------------------------------------
> -------------------------------------------
> -----------When I echo $sql, I get this result
> -----------SELECT first_name, last_name .......
> How can I echo the actual values?
>
you have to loop through the results and then echo them.
while ($row = mysql_fetch_row($result)) { do_soemthing(); }
note that $row is an array
http://www.php.net/mysql http://www.php.net/mysql_fetch_row
-- mike cullerton
attached mail follows:
> $sql = "SELECT first_name, last_name, address, state, zip_code, country,
> company, occupation, telephone, fax, email, entry_name, password, package,
> registration_date, valid_until, max_users
> FROM $table_name
> WHERE uid = \"$uid\"
> ";
>
> $result =
mysql_query($sql,$connection) or die("Couldn't execute
query.");
>
> -----------When I echo $sql, I get this result
> -----------SELECT first_name, last_name .......
> How can I echo the actual values?
$sql is the QUERY (question) you send to the database.
$result is a "ticket number" (like a number at the meat counter in the deli) to the RESULT SET (answer) from the database.
So, echo $sql is good to make sure you are asking the question properly, but not much else.
You'll need to "present" your $result ticket to MySQL functions to get your data out:
while ($row = mysql_fetch_array($result)){ $first_name = $row['first_name']; # Or could use 0 instead of 'first_name' $last_name = $row['last_name']; # Or could use 1 ... . . . echo "$first_name, $last_name, ...<BR>\n"; }
Since you'll do this a lot, here's a short-cut: while (list($first_name, $last_name, ...) = mysql_fetch_row($result)){ echo "$first_name, $last_name, ....<BR>\n"; }
The mysql_fetch_row and mysql_fetch_array functions return each row, one by one, in slightly different array formats. The list() construct above "de-constructs" the array format returned by mysql_fetch_row() to turn the array of one row into individual variables.
http://php.net/mysql_fetch_row http://php.net/mysql_fetch_array
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
Something that's been driving me crazy for a few days. Could it be a bug in PHP?
Using the fopen function (or even the file function), I want to open a web page for read. Sounds easy? Well, say I want to have an "=" sign in the URL.. well that is where the problem comes. I have tried things like this:
$eq = urlencode("="); $URL = "http://www.something.com/file.php?thing".$eq."thething";;
I have tried many other combinations as well.. the problem is this: when PHP calls fopen(), it does not allow the = sign in the variable passed in. So I figured I should escape it..
fopen("http://www.something.com/file.php?thing\=thething","r";);
But that did not work either. It allows me to pass it in, but then it tries to open the literal \= in the url, which of course doesn't exist. The url has just an =. I thought encoding the whole or part URL would work. well it loads the page, but the page itself doesn't recognize the encoded = sign as being an = sign..
Bah! Anyone have any ideas.. ?
Corey Chapman Xnull CEO (Chat with us: http://forum.xnull.com)
attached mail follows:
why dont you try: fopen("http://www.something.com/file.php?thing=thething","r");
...and are you sure it's "not working", or just not returning anything???
try putting checks on *all* IO/net functions:
$fp = fopen( ... ) or die("Cannot open file!");
> -----Original Message-----
> From: Corey Chapman [mailto:jeff
host.xnull.com]On Behalf Of Corey
> Chapman
> Sent: Friday, August 03, 2001 2:46 PM
> To: php-general
lists.php.net
> Subject: [PHP] fopen a URL with = in it
>
>
> Something that's been driving me crazy for a few days. Could it
> be a bug in PHP?
>
> Using the fopen function (or even the file function), I want to open a
> web page for read. Sounds easy? Well, say I want to have an "=" sign in
> the URL.. well that is where the problem comes. I have tried things
> like this:
>
> $eq = urlencode("=");
> $URL = "http://www.something.com/file.php?thing".$eq."thething";;
>
> I have tried many other combinations as well.. the problem is this:
> when PHP calls fopen(), it does not allow the = sign in the variable
> passed in. So I figured I should escape it..
>
> fopen("http://www.something.com/file.php?thing\=thething","r";);
>
> But that did not work either. It allows me to pass it in, but then it
> tries to open the literal \= in the url, which of course doesn't
> exist. The url has just an =. I thought encoding the whole or part URL
> would work. well it loads the page, but the page itself doesn't
> recognize the encoded = sign as being an = sign..
>
> Bah! Anyone have any ideas.. ?
>
>
> Corey Chapman
> Xnull CEO
> (Chat with us: http://forum.xnull.com)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
It does not work with the = right in the URL.. PHP gives me a warning about the fopen statement or file statement if I do.. and then returns nothing.
If I escape it, it loads the proper URL, but then the page it opens does not recognize the defined variables because it loads http://www.something.com/file.php?thing\=thething instead of http://www.something.com/file.php?thing=thething...
> why dont you try:
> fopen("http://www.something.com/file.php?thing=thething","r");
>
> ...and are you sure it's "not working", or just
> not returning anything???
>
> try putting checks on *all* IO/net functions:
>
> $fp = fopen( ... )
> or die("Cannot open file!");
>
>
>
>
> > -----Original Message-----
> > From: Corey Chapman [mailto:jeff
host.xnull.com]On Behalf Of Corey
> > Chapman
> > Sent: Friday, August 03, 2001 2:46 PM
> > To: php-general
lists.php.net
> > Subject: [PHP] fopen a URL with = in it
> >
> >
> > Something that's been driving me crazy for a few days. Could it
> > be a bug in PHP?
> >
> > Using the fopen function (or even the file function), I want to
open a
> > web page for read. Sounds easy? Well, say I want to have an "="
sign in
> > the URL.. well that is where the problem comes. I have tried things
> > like this:
> >
> > $eq = urlencode("=");
> > $URL = "http://www.something.com/file.php?thing".$eq."thething";;
> >
> > I have tried many other combinations as well.. the problem is this:
> > when PHP calls fopen(), it does not allow the = sign in the
variable
> > passed in. So I figured I should escape it..
> >
> > fopen("http://www.something.com/file.php?thing\=thething","r";);
> >
> > But that did not work either. It allows me to pass it in, but then
it
> > tries to open the literal \= in the url, which of course doesn't
> > exist. The url has just an =. I thought encoding the whole or part
URL
> > would work. well it loads the page, but the page itself doesn't
> > recognize the encoded = sign as being an = sign..
> >
> > Bah! Anyone have any ideas.. ?
> >
> >
> > Corey Chapman
> > Xnull CEO
> > (Chat with us: http://forum.xnull.com)
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> > For additional commands, e-mail: php-general-help
lists.php.net
> > To contact the list administrators, e-mail: php-list-
admin
lists.php.net
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-
admin
lists.php.net
>
>
>
Corey Chapman Xnull CEO (Chat with us: http://forum.xnull.com)
attached mail follows:
You would only want URLEncode if "thething" had the "=" in it as part of the data...
"http://whatever.com/foo.php?operand=" . urlencode("=")
might be a URL for math geeks to talk about the "=" sign :-)
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Corey Chapman <ze0
xnull.com> Newsgroups: php.general To: <php-general
lists.php.net> Sent: Friday, August 03, 2001 1:45 PM Subject: fopen a URL with = in it
> Something that's been driving me crazy for a few days. Could it > be a bug in PHP? > > Using the fopen function (or even the file function), I want to open a > web page for read. Sounds easy? Well, say I want to have an "=" sign in > the URL.. well that is where the problem comes. I have tried things > like this: > > $eq = urlencode("="); > $URL = "http://www.something.com/file.php?thing".$eq."thething";; > > I have tried many other combinations as well.. the problem is this: > when PHP calls fopen(), it does not allow the = sign in the variable > passed in. So I figured I should escape it.. > > fopen("http://www.something.com/file.php?thing\=thething","r";); > > But that did not work either. It allows me to pass it in, but then it > tries to open the literal \= in the url, which of course doesn't > exist. The url has just an =. I thought encoding the whole or part URL > would work. well it loads the page, but the page itself doesn't > recognize the encoded = sign as being an = sign.. > > Bah! Anyone have any ideas.. ? > > > Corey Chapman > Xnull CEO > (Chat with us: http://forum.xnull.com)
attached mail follows:
So you're saying that I should be able to pass the = sign in just fine into the fopen call with no errors? I understand what you mean that if = was what the variable was defined as, then THAT is where I'd use urlencode ;) I wasn't too sure about that, but now I am.
Quite odd that it reports errors then when passing in an = sign. Perhaps PHP does not like to load url's like that..
> You would only want URLEncode if "thething" had the "=" in it as part
of the
> data...
>
> "http://whatever.com/foo.php?operand=" . urlencode("=")
>
> might be a URL for math geeks to talk about the "=" sign :-)
>
> --
> WARNING richard
zend.com address is an endangered species -- Use
> ceo
l-i-e.com
> Wanna help me out? Like Music? Buy a CD: http://l-i-
e.com/artists.htm
> Volunteer a little time: http://chatmusic.com/volunteer.htm
> ----- Original Message -----
> From: Corey Chapman <ze0
xnull.com>
> Newsgroups: php.general
> To: <php-general
lists.php.net>
> Sent: Friday, August 03, 2001 1:45 PM
> Subject: fopen a URL with = in it
>
>
> > Something that's been driving me crazy for a few days. Could it
> > be a bug in PHP?
> >
> > Using the fopen function (or even the file function), I want to
open a
> > web page for read. Sounds easy? Well, say I want to have an "="
sign in
> > the URL.. well that is where the problem comes. I have tried things
> > like this:
> >
> > $eq = urlencode("=");
> > $URL = "http://www.something.com/file.php?thing".$eq."thething";;
> >
> > I have tried many other combinations as well.. the problem is this:
> > when PHP calls fopen(), it does not allow the = sign in the variable
> > passed in. So I figured I should escape it..
> >
> > fopen("http://www.something.com/file.php?thing\=thething","r";);
> >
> > But that did not work either. It allows me to pass it in, but then
it
> > tries to open the literal \= in the url, which of course doesn't
> > exist. The url has just an =. I thought encoding the whole or part
URL
> > would work. well it loads the page, but the page itself doesn't
> > recognize the encoded = sign as being an = sign..
> >
> > Bah! Anyone have any ideas.. ?
> >
> >
> > Corey Chapman
> > Xnull CEO
> > (Chat with us: http://forum.xnull.com)
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-
admin
lists.php.net
>
>
>
Corey Chapman Xnull CEO (Chat with us: http://forum.xnull.com)
attached mail follows:
hey folks, hope the day is treating you well.
here's a programming theory/methodology type question for y'all. i am relatively new to programming and very new to object-oriented(ness).
suppose i have a site using sessions managed with an object $dog. $dog contains a member object $dog->member and $dog->member contains a memberid $dog->member->memberid.
member information (username and encrypted password) are stored in a database.
my index file begins
require_once("dog.inc"); // this is where the objects get defined session_start(); session_register("dog"); session_register("dog_member_id"); if (!is_object($dog)) $dog = new dog;
i can authenticate a user and carry that user along throughout the session within $dog->member. a member can also logout, meaning that $dog->member no longer refers to them. when a member logs out, there is still a session and valid $dog.
so, what are the favored ways of allowing folks to auto-login?
the approach i've taken is to set a cookie variable $dog_member_id. i assign their memberid to the session variable $dog_member_id and within my index file, i have
if (!isset($HTTP_COOKIE_VARS["dog_member_id"])) { if (isset($HTTP_SESSION_VARS["dog_member_id"])) { setcookie("dog_member_id",$dog_member_id); } }
then, i can check to see if $HTTP_COOKIE_VARS["dog_member_id"] is set when someone visits my page by having this in my index.
if ($HTTP_COOKIE_VARS["dog_member_id"] > 0) $dog->member = new Member($HTTP_COOKIE_VARS["dog_member_id"]); if ((!is_object($dog->member)) || (!$dog->member->is_member())) $dog->member = new Member(-1);
whew!
i had this all working in an older site not using objects, so i understand the basics of what's going on. i also can get this to work if i check for $HTTP_COOKIE_VARS["dog_member_id"] within my index file.
i believe i also had this working at one time by checking for $HTTP_COOKIE_VARS["dog_member_id"] within the dog object constructor, but of course can't get that to work now :)
is this a good approach? is it possible (should i want) to make this check within the dog constructor?
what are other approaches?
thanks everyone, mike
-- mike cullerton
attached mail follows:
You can use cookies to do this and just set a session cookie for however long they want to login for. Then if the time of the cookie's set time is xx from the current time, they cannot login (and it may be a good idea to set the member id in their cookie to a blank value).
Another approach for this, which we use in YaBB, is to write log files (or you could write to a database) for each member. This log file is updated each time they visit, so that their user id, last time of visit, and other vital info are stored (such as how long they or we wish them to be logged in). This allows them to go on any PC and be autlogged in/out.. and also do not have to worry about cookies.. '
In YaBB, we still write a cookie to store their memberid and such, but you could implement it all via cookie or all via log files..
(sorry i am not thinking straight)
> hey folks, hope the day is treating you well.
>
> here's a programming theory/methodology type question for y'all. i am
> relatively new to programming and very new to object-oriented(ness).
>
>
> suppose i have a site using sessions managed with an object $dog. $dog
> contains a member object $dog->member and $dog->member contains a
memberid
> $dog->member->memberid.
>
> member information (username and encrypted password) are stored in a
> database.
>
>
> my index file begins
>
> require_once("dog.inc"); // this is where the objects get defined
> session_start();
> session_register("dog");
> session_register("dog_member_id");
> if (!is_object($dog)) $dog = new dog;
>
> i can authenticate a user and carry that user along throughout the
session
> within $dog->member. a member can also logout, meaning that $dog-
>member no
> longer refers to them. when a member logs out, there is still a
session and
> valid $dog.
>
> so, what are the favored ways of allowing folks to auto-login?
>
> the approach i've taken is to set a cookie variable $dog_member_id. i
assign
> their memberid to the session variable $dog_member_id and within my
index
> file, i have
>
> if (!isset($HTTP_COOKIE_VARS["dog_member_id"])) {
> if (isset($HTTP_SESSION_VARS["dog_member_id"])) {
> setcookie("dog_member_id",$dog_member_id);
> }
> }
>
> then, i can check to see if $HTTP_COOKIE_VARS["dog_member_id"] is set
when
> someone visits my page by having this in my index.
>
> if ($HTTP_COOKIE_VARS["dog_member_id"] > 0)
> $dog->member = new Member($HTTP_COOKIE_VARS["dog_member_id"]);
> if ((!is_object($dog->member)) || (!$dog->member->is_member()))
> $dog->member = new Member(-1);
>
>
> whew!
>
> i had this all working in an older site not using objects, so i
understand
> the basics of what's going on. i also can get this to work if i check
for
> $HTTP_COOKIE_VARS["dog_member_id"] within my index file.
>
> i believe i also had this working at one time by checking for
> $HTTP_COOKIE_VARS["dog_member_id"] within the dog object constructor,
but of
> course can't get that to work now :)
>
> is this a good approach? is it possible (should i want) to make this
check
> within the dog constructor?
>
> what are other approaches?
>
> thanks everyone,
> mike
>
> -- mike cullerton
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-
admin
lists.php.net
>
>
>
Corey Chapman Xnull CEO (Chat with us: http://forum.xnull.com)
attached mail follows:
I'm sure this is possible, but I'm not sure if this is the right way to go about it.
if ($submit) { mail($from,$to etc...) }
any input is kindly regarded
Jerry Lake Interface Engineering Technician Europa Communications - http://www.europa.com Pacifier Online - http://www.pacifier.com
attached mail follows:
that would work great.
you might, however, want to do some format checking on the $from, $to, etc... variables.
if they're coming from the user
> -----Original Message-----
> From: Jerry Lake [mailto:jerryl
europa.com]
> Sent: Friday, August 03, 2001 3:40 PM
> To: php-general
> Subject: [PHP] trigger email with submit button
>
>
> I'm sure this is possible, but I'm not sure
> if this is the right way to go about it.
>
> if ($submit) {
> mail($from,$to etc...)
> }
>
> any input is kindly regarded
>
> Jerry Lake
> Interface Engineering Technician
> Europa Communications - http://www.europa.com
> Pacifier Online - http://www.pacifier.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
"scott [gts]" wrote:
> you might, however, want to do some format checking > on the $from, $to, etc... variables. > > if they're coming from the user > > > if ($submit) { > > mail($from,$to etc...) > > } > > > > any input is kindly regarded
If you are creating a script for the general user and not password protected then you are creating spammer heaven similar to the formmail.pl perl script when you allow users to type in "to", "from" and "cc" fields and the spams will all be coming from your server.
Ron Clark Sysadmin/Webmaster Armstrong Atlantic State University
attached mail follows:
Yeah, make sure they're all valid variables. Also on a related note, consider using isset() (or similar) instead as in the code below, if $submit is not set then PHP will issue an error (E_NOTICE). Granted most have error_reporting turned down enough to not show such errors, but it's a thought.
if(isset($submit)) vs. if($submit)
</picky>
Regards, Philip
On Fri, 3 Aug 2001, scott [gts] wrote:
> that would work great.
>
> you might, however, want to do some format checking
> on the $from, $to, etc... variables.
>
> if they're coming from the user
>
> > -----Original Message-----
> > From: Jerry Lake [mailto:jerryl
europa.com]
> > Sent: Friday, August 03, 2001 3:40 PM
> > To: php-general
> > Subject: [PHP] trigger email with submit button
> >
> >
> > I'm sure this is possible, but I'm not sure
> > if this is the right way to go about it.
> >
> > if ($submit) {
> > mail($from,$to etc...)
> > }
> >
> > any input is kindly regarded
> >
> > Jerry Lake
> > Interface Engineering Technician
> > Europa Communications - http://www.europa.com
> > Pacifier Online - http://www.pacifier.com
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> > For additional commands, e-mail: php-general-help
lists.php.net
> > To contact the list administrators, e-mail: php-list-admin
lists.php.net
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
You wrote: > additionally I also tend to always provide an alternative, especially if dealing > with nested ifs or loops, even if just a comment... call it habit (from where I > don't know). > > if($condition){ > do this > }else{ > # oops, $condition didn't exist > } > > saves a hell of alot of time when going back through the code 6 months later > trying to remember what was being done where. personal opinion mind you
It's a good idea. The only problem is when you come upon a situation where you don't want to do anything "else" at that point. Where you simply want to skip the rest of the if block if the condition isn't true, and continue on with the rest of your script. Then, using an else isn't what you want to do.
-- -Ryan :: ICQ - 595003 :: GigaBoard - http://www.gigaboard.net/
attached mail follows:
Does anyone know how to force numerics into scientific notation? I noticed that %e doesn't exist in the PHP implementations of s/printf.
Thanks in advance.
attached mail follows:
> Does anyone know how to force numerics into scientific notation? I > noticed that %e doesn't exist in the PHP implementations of s/printf.
http://php.net/number_format may have that...
If all else fails...
# Untested code: function scientific_format($number){ $base = $number; $mantissa = 0; if ($base < 0){ while ($base < -1){ $base *= 10; $mantissa--; } while ($base > -1){ $base /= 10; $mantissa++; } } else{ while ($base < 1){ $base *= 10; $mantissa--; } while ($base > 1){ $base /= 10; $mantissa++; } } $output = $base; if ($mantissa){ $output .= "E$mantissa"; } return $output; }
No promises on this code doing anything remotely like IEEE standards...
If you need that, look into BC_MATH.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
Hi Im working on a project where Im want to connect using PHP to a particular newsgroup and grab particular posts based on subject and store (if possible) the posts into MySQL.
Any help would be great!
Steph
attached mail follows:
There *have* to be PHP-based new-reader code samples in the archives...
http://zend.com http://webmonkey.com http://weberdev.com http://devshed.com http://hotscripts.com http://php.net/links.php
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Steph <steph
goamerica.net> Newsgroups: php.general To: <php-general
lists.php.net> Sent: Friday, August 03, 2001 4:28 PM Subject: grab newsgroup posts
> Hi Im working on a project where Im want to connect using PHP to a > particular newsgroup and grab particular posts based on subject and store > (if possible) the posts into MySQL. > > Any help would be great! > > Steph >
attached mail follows:
www.phpbuilder.com has a simple (yet enjoyable) tutorial on this.
"Richard Lynch" <ceo
l-i-e.com> wrote in message
news:029a01c11c6d$50098a20$6401a8c0
Lynchux100...
> There *have* to be PHP-based new-reader code samples in the archives...
>
> http://zend.com
> http://webmonkey.com
> http://weberdev.com
> http://devshed.com
> http://hotscripts.com
> http://php.net/links.php
>
> --
> WARNING richard
zend.com address is an endangered species -- Use
> ceo
l-i-e.com
> Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
> Volunteer a little time: http://chatmusic.com/volunteer.htm
> ----- Original Message -----
> From: Steph <steph
goamerica.net>
> Newsgroups: php.general
> To: <php-general
lists.php.net>
> Sent: Friday, August 03, 2001 4:28 PM
> Subject: grab newsgroup posts
>
>
> > Hi Im working on a project where Im want to connect using PHP to a
> > particular newsgroup and grab particular posts based on subject and
store
> > (if possible) the posts into MySQL.
> >
> > Any help would be great!
> >
> > Steph
> >
>
attached mail follows:
Or, suppose your site has something like this:
$query = "update user set password = password('$password') where userid = $userid";
All they have to do is alter $userid to, say, 1, which is probably *YOU*, the admin, that has full access, and whammo, they have admin access...
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Werner Stuerenburg <ws
art-quarter.com> To: Richard Lynch <ceo
l-i-e.com> Cc: <php-general
lists.php.net> Sent: Friday, August 03, 2001 3:49 AM Subject: Re: [PHP] SQL syntax error in PHP script. dunno what's wrong
> >> insert into test values (0,''; DELETE FROM test; ',1); > >> ERROR 1064: You have an error in your SQL syntax near '' at line 1 > > what about > > insert into test values (0,'\'; DELETE FROM test; ',1); > > the character ' is used to denote the beginning and the end of a > field value. If you have this character within the value, you > will have to escape it. It's as simple as that. > > -- > Herzlich > Werner Stuerenburg > > _________________________________________________ > ISIS Verlag, Teut 3, D-32683 Barntrup-Alverdissen > Tel 0(049) 5224-997 407 · Fax 0(049) 5224-997 409 > http://pferdezeitung.de >
attached mail follows:
> > That should be Location with a capital 'L'. It matters. > > I have probably 400+ scripts under my belt. I would say a good 150 of those > pages use header("location: ..") without it being capitalized. They work > perfectly fine. What is the difference?
The spec says 'L'. The spec says case-significant. *SOME* browsers will not do the right thing.
> I can't start the session for the first time and register a variable? Isn't > that what most people do?
Sure you can. But you can't *REDIRECT* in the same page and have it work on more than half the browsers.
The browser either sees the Cookie first, or the Location first. Half the browsers do it in one order, half in the other order.
Whichever half sees the Location before the Cookie, that browser will loop over and over doing the Location and never exectute the Cookie.
> IE 5 for the Mac: > When I hit ths page first (real page at: http://www.fromthduke.com/session/) > the echo of $PHPSESSID does not show up; it's not echoed to the screen. > > The echo of var 1 and var 2 work fine. Then the form, of course is there. > > So, if $PHPSESSID isn't there, that leads me to believe that the cookie was > not set. So, I go check (making sure that before this test the cookie was > not present before.) Low and behold, the cookie is there in my cookies list > and it's got a value.
Hmmmm. Not sure how/when $PHPSESSID gets set by PHP exactly. Normally, a Cookie being sent and the variable being set are two different actions.
When a Cookie is sent to the Browser, that does *NOT* set the variable -- The *NEXT* page view, the browser sends back the Cookie, and the variable is set.
Instead of using $PHPSESSID, use the other built-in functions/constants to see if those are set by the session_start() function.
Still... You are correct that all three variables should be in the session, regardless of when the Cookie/$PHPSESSID var gets set, I think.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
Whats wrong with this piece of code. Basically, it not doing the last else statement. 1. If no form was submitted exit. 2. If a form was submitted, check for 'empty' strings. 3. If all is good, echo "xxxxx";
Thanks all.
if (!$HTTP_POST_VARS) { exit(); } elseif ($HTTP_POST_VARS) { if (!$Age) { echo "Please enter your age.<br>\n"; } if (!$Email) { echo "Please enter your email.<br>\n"; } if (!$State) { echo "Please enter your Location.<br>\n";} } else echo "Thanks for your submission.";
attached mail follows:
Your if statement is saying: If $HTTP_POST_VARS is FALSE exit If $HTTP_POST_VARS is TRUE do blah. Else do the else statement...
It's either true or false, that else statement will never get hit.
-----Original Message-----
From: Gerard Samuel [mailto:trini0
optonline.net]
Sent: Friday, August 03, 2001 2:52 PM
To: PHP
Subject: [PHP] IF ELSEIF ELSE??
Whats wrong with this piece of code. Basically, it not doing the last else statement. 1. If no form was submitted exit. 2. If a form was submitted, check for 'empty' strings. 3. If all is good, echo "xxxxx";
Thanks all.
if (!$HTTP_POST_VARS) { exit(); } elseif ($HTTP_POST_VARS) { if (!$Age) { echo "Please enter your age.<br>\n"; } if (!$Email) { echo "Please enter your email.<br>\n"; } if (!$State) { echo "Please enter your Location.<br>\n";} } else echo "Thanks for your submission.";
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
"Gerard Samuel" <trini0
optonline.net> wrote in message
news:3B6B1CF3.8070809
optonline.net...
> Whats wrong with this piece of code. Basically, it not doing the last
> else statement.
> 1. If no form was submitted exit.
> 2. If a form was submitted, check for 'empty' strings.
> 3. If all is good, echo "xxxxx";
>
> Thanks all.
>
>
>
if (!$HTTP_POST_VARS) {
exit();
}elseif ($HTTP_POST_VARS) {
if (!$Age) {
echo "Please enter your age.<br>\n";
}
if (!$Email) {
echo "Please enter your email.<br>\n";
}
if (!$State) {
echo "Please enter your Location.<br>\n";
}
} else {
echo "Thanks for your submission.";
}
My guess is that you forgot the last two brackets? '{' and '}'
But I am not sure they are required, I guess they are when you begin with one, so that one must end the if.
attached mail follows:
if (!$HTTP_POST_VARS) exit(); else { if (!$Age) { echo "Please enter your age.<br>\n"; } if (!$Email) { echo "Please enter your email.<br>\n"; } if (!$State) { echo "Please enter your Location.<br>\n";} if ($Age && $Email && $State) echo "Thanks for your submission."; }
Your if and else statements used every possibility up, so that last else will never get hit. There are a lot of things you can do better with the above code, but it'll do what you want. For example something you might want to look at the type of data the person is entering, a little validation. I hope that helps.
Rick
> Whats wrong with this piece of code. Basically, it not doing the last > else statement. > 1. If no form was submitted exit. > 2. If a form was submitted, check for 'empty' strings. > 3. If all is good, echo "xxxxx"; > > Thanks all. > > > > if (!$HTTP_POST_VARS) { exit(); } > elseif ($HTTP_POST_VARS) { > if (!$Age) { echo "Please enter your age.<br>\n"; } if > (!$Email) { echo "Please enter your email.<br>\n"; } > if (!$State) { echo "Please enter your Location.<br>\n";} > } > else > echo "Thanks for your submission.";
attached mail follows:
Create a DSN using the ODBC Control Panel. Name the db something useful (I'll use "foo") and set up a username/password in that interface, and point the source at your ms-access filename.mdb
Then, something not unlike:
<?php $connection = odbc_connect("foo", "username", "password"); $query = "select id, name, whatever from yourtable order by name"; $records = odbc_exec($connection, $query) or die(odbc_error()); $recordcount = 0; while ($row = odbc_fetch_row($records)){ $id = odbc_result($records, $recordcount, 0); $name = odbc_result($records, $recordcount, 1); $whatever = odbc_result($records, $recordcount, 2); echo "$id: $name $whatever<BR>\n"; } ?>
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Jtjohnston <jtjohnston
courrier.usherb.ca> Newsgroups: php.general To: <php-general
lists.php.net> Sent: Thursday, August 02, 2001 10:41 PM Subject: ODBC
> Can someone show me how to display the contents of a table in a MS > Access file using ODBC on my Windows machine? > > Thanks, > John >
attached mail follows:
> How do I get the raw data from a http request?
There's some variable for it...
Add <?php phpinfo();?> to your POST-processing script to find out what the name is. :-)
Or, search http://php.net for "raw URI"
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
Also, look in your httpd.conf for the "htaccess" section where they specifically block out downloading of .htaccess files.
Finally, see if you can't survive by *MOVING* the file out of the web-tree entirely, and using include_path to let PHP get it, or http://php.net/fopen and friends.
Then the script kiddies can't download it.
Other users on your server can still get at it, though :-(
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Void <ben
hvc.co.za> Newsgroups: php.general To: <php-general
lists.php.net> Sent: Friday, August 03, 2001 4:22 AM Subject: stop a file called foo.bar
> stop a file called foo.bar from being downloaded with a web server ? > > Say you'r web site's name is foobar.net. > > .and... > > Script-kiddy Johny knows that, > but also knows that you'r secret file is called foo.bar > and it is saved in the root dir. of you'r web site. > > in a http browser little Johny > can simply type in http://www.foobar.net/foo.bar" > to download it, since the web server (i am on) > will trigger the clients download box to open, > because its not a wrapped extension, or php, or htm, or so . > > I have looked into the .htaccess file and added the directive > IndexIgnore *.* > there'r millions of directives and i am looking at them now, > > But please tell me if there IS NOT a directive I can add to the htacces file > to keep "little Johny" from downloading the file. > Because then i might just look the whole day long for nothing ! > > Thanx a lot for your time > > Ben > > enjoy the day :-) > > > > > > >
attached mail follows:
> Probably when Adobe stops picking on innocent cryptographers pointing out > weaknesses in their software and stops hiding the source for what they forced > through as the defacto standard for document distribution...
Last I heard, Adobe had dropped charges, and it was the US Government that won't back down... Details on http://eff.org almost for sure.
Also, the PDF format was only one of many options being promoted and marketed for some time -- It succeeded by popular demand and technical merit mostly, really, IMHO...
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
I'm pretty sure PHP uses bison/flex/yacc/lex stuff, so there might be an input file in the source you can use...
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: José león serna <vclcrawler
vclcrawler.com> Newsgroups: php.general To: <php-general
lists.php.net> Sent: Friday, August 03, 2001 5:32 AM Subject: PHP Grammar Definition
> Hello: > I'm looking for the formal grammar definition for PHP, Do you know where > I can find it? I'm trying to make a parser for it. > > Best Regards. > ------------------------------------------------ > QaDRAM, RAD development for the WEB > http://www.qadram.com > > VCLCrawler.com, your VCL search engine > http://www.vclcrawler.com > > W2Kwm, Windows 2000 interface for XWindow > http://www.vclcrawler.com/w2kwm/index.htm > > delphi.deeuropa.net, enlaces revisados sobre Delphi > http://delphi.deeuropa.net > > ebnoud.com, El Boletín No Oficial de Usuarios de Delphi > http://www.ebnoud.com >
attached mail follows:
Naive Question:
Your BIND server is running on port 10000?...
Is that for sure? I would have expected a port number < 1024.
I believe the protocal (3rd arg) argument to socket() should be 'udp' or 'tcp' rather than the documented int type and value of 0 you used... At least, there's a user-contributed not to that effect...
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: William Bailey <wb
pro-net.co.uk> Newsgroups: php.general To: PHP General List <php-general
lists.php.net> Sent: Friday, August 03, 2001 4:40 AM Subject: bind() function always reporting Invalid argument.
> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi, > > I can't seem to get the bind() socket function to work. Every time > i try to bind a socket i get 'Invalid argument'. > > I know that the manual says that this module is EXPERIMENTAL and > that ANYTHING can change WITHOUT NOTICE. But hopefully somebody will know > what i have to do to get it to work :-) > > I have attached the code that i'm currently using so that you can > see what is going on. > > Thanks, > William. > > > -----BEGIN PGP SIGNATURE----- > Version: PGPfreeware 5.0i for non-commercial use > Charset: noconv > > iQA/AwUBO2pxra39EoU2VrU1EQKTnwCfQo63BKgPaup4aEphTrwgsY/0+/MAoMfC > N/QVSnNYzLoIDMRcDg2360gB > =qTnU > -----END PGP SIGNATURE----- > >
attached mail follows:
Use MySQL's built in "analyze" ("describe"? SQL statement to see what's taking so long).
I'm betting on one server having an INDEX on the id or ex fields, and the other not.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: James Crowley <james
vbweb.co.uk> Newsgroups: php.general To: <php-general
lists.php.net> Sent: Friday, August 03, 2001 11:40 AM Subject: Left Join extremely slow (MySQL)
> Hi, > I had been using an INNER JOIN statement for a MySQL query, which > worked fine. However, my new ISP does not have the latest version of > MySQL. The version they have does not support conditions for Inner Join > statements, so I have tried switching to a Left Join instead. However, > the Left Join query takes 12.15 sec (which is obviously far too slow). > The Inner join statement, meanwhile, completed the query in 0.04. Any > idea why?? > > Here are the two statements (fast): > > SELECT i.id, i.title, i.description FROM dir_items i INNER JOIN > dir_assoc a ON a.itemid=i.id WHERE a.parentid=59 AND a.ex=0 > > Here are the two statements (slow): > > SELECT i.id, i.title, i.description FROM dir_items i LEFT JOIN dir_assoc > a ON a.itemid=i.id WHERE a.parentid=59 AND a.ex=0 > > Regards, > > - James > > Editor, VB Web > ================== > Web - http://www.vbweb.co.uk > Email - james
vbweb.co.uk > ICQ# - 60612011 > Fax - +44(0)8707052859 > ================== >
attached mail follows:
"explain"
- - - - - - - - - - Scott Poarch www.globalhost.com - - - - - - - - - -
> From: "Richard Lynch" <ceo
l-i-e.com>
> Organization: Lynch Interplanetary Enterprises
> Date: Fri, 3 Aug 2001 17:09:49 -0500
> To: <php-general
lists.php.net>
> Subject: [PHP] Re: Left Join extremely slow (MySQL)
>
> Use MySQL's built in "analyze" ("describe"? SQL statement to see what's
> taking so long).
>
> I'm betting on one server having an INDEX on the id or ex fields, and the
> other not.
>
> --
> WARNING richard
zend.com address is an endangered species -- Use
> ceo
l-i-e.com
> Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
> Volunteer a little time: http://chatmusic.com/volunteer.htm
> ----- Original Message -----
> From: James Crowley <james
vbweb.co.uk>
> Newsgroups: php.general
> To: <php-general
lists.php.net>
> Sent: Friday, August 03, 2001 11:40 AM
> Subject: Left Join extremely slow (MySQL)
>
>
>> Hi,
>> I had been using an INNER JOIN statement for a MySQL query, which
>> worked fine. However, my new ISP does not have the latest version of
>> MySQL. The version they have does not support conditions for Inner Join
>> statements, so I have tried switching to a Left Join instead. However,
>> the Left Join query takes 12.15 sec (which is obviously far too slow).
>> The Inner join statement, meanwhile, completed the query in 0.04. Any
>> idea why??
>>
>> Here are the two statements (fast):
>>
>> SELECT i.id, i.title, i.description FROM dir_items i INNER JOIN
>> dir_assoc a ON a.itemid=i.id WHERE a.parentid=59 AND a.ex=0
>>
>> Here are the two statements (slow):
>>
>> SELECT i.id, i.title, i.description FROM dir_items i LEFT JOIN dir_assoc
>> a ON a.itemid=i.id WHERE a.parentid=59 AND a.ex=0
>>
>> Regards,
>>
>> - James
>>
>> Editor, VB Web
>> ==================
>> Web - http://www.vbweb.co.uk
>> Email - james
vbweb.co.uk
>> ICQ# - 60612011
>> Fax - +44(0)8707052859
>> ==================
>>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
>
attached mail follows:
>"explain" >> >> Use MySQL's built in "analyze" ("describe"? SQL statement to see what's >> taking so long).
The statement is called EXPLAIN. You can find it described here: http://www.mysql.com/doc/E/X/EXPLAIN.html
>> I'm betting on one server having an INDEX on the id or ex fields, and the >> other not.
If the following fields are missing indexed your query will be slower. itemid id parentid ex
You can check the indexes on tables using SHOW INDEX FROM tablename. If the indexes are missing add them with ALTER TABLE ADD INDEX: http://www.mysql.com/doc/A/L/ALTER_TABLE.html
>> >>> I had been using an INNER JOIN statement for a MySQL query, which >>> worked fine. However, my new ISP does not have the latest version of >>> MySQL. The version they have does not support conditions for Inner Join >>> statements, so I have tried switching to a Left Join instead. However, >>> the Left Join query takes 12.15 sec (which is obviously far too slow). >>> The Inner join statement, meanwhile, completed the query in 0.04. Any >>> idea why?? >>> >>> Here are the two statements (fast): >>> >>> SELECT i.id, i.title, i.description FROM dir_items i INNER JOIN >>> dir_assoc a ON a.itemid=i.id WHERE a.parentid=59 AND a.ex=0 >>> >>> Here are the two statements (slow): >>> >>> SELECT i.id, i.title, i.description FROM dir_items i LEFT JOIN dir_assoc >>> a ON a.itemid=i.id WHERE a.parentid=59 AND a.ex=0 >>>
To do an INNER JOIN you simply do SELECT * FROM table_a, table_b WHERE table_a.id = table_b.id http://www.mysql.com/doc/J/O/JOIN.html
Exchanging an inner (full) join for a left join might not have desired result.
The MySQL documentation is very good. http://www.mysql.com/doc/index.html
Tina.
-- Tina Gunnarsson Phone: 408 732 1413 1616 Hollenbeck Ave. #20 Cell: 406 504 7310 Sunnyvale, CA 94087"We only begin to live when we conceive life as Tragedy..." - W. B. Yeats
attached mail follows:
> Just to throw one more unwelcome cat amongst the pigeons.. > > Different countries/time zones have summer time, I think almost all > countries do, but the actual days when they switch vary from country (yes I > know, bloody nusiance isn't it?) > > I know as an example of this theres about three weeks of the year where new > york is 6 hours behing UK, and the rest its only 5.
And, of course, some countries have time-zones that are off by a HALF hour. Yes, really.
USE THE BUILTIN FUNCTIONS
Somebody else has already gone to a great deal of trouble to get this date/time crap right, and you don't want to do it yourself.
All the mktime() functions know about time zones, and all of them know better than to give you nonsense dates. They'll wrap-around quite nicely for you.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
It's also remotely possible that some sort of transaction support is going on, and/or in conjunction with mysql_pconnect that only after a _pconnect is dead will the insert get committed...
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: <Jorge Fernando Tamez Seceñas> Newsgroups: php.general To: <php-general
lists.php.net> Sent: Friday, August 03, 2001 11:55 AM Subject: Error using databases
Hi:
I'm coding my first programs in PHP using MySQL in Windows. I instaled the Xitami Web Server for Windows.
I have a simple table "catalog" that includes 3 fields and one php script that insert records into the table "catalog" using a the label <FORM> and it works ok.
I have another php script that print a the records in a table of HTML and it doesn't work correctly. The fisrt time I run this code works Ok, but then I go to add a new record using the fisrt code and then return to scrip that print the table and it doesn´t consider the last records I added. I make the consult in mysql.exe and effectively there are the new records. I have to suthdown the server and start again and the second script work correclty.
I have been locking how to solve this problem by myself but a couldn´t. I think that it's a basic problem but I'm beginning in this programs.
If somebody can help me i would be thankful.
Thanks. George Tamez
attached mail follows:
Then you'll need to do an ftp_cd or something to go down in that sub-directory and do ftp_nlist again, I think...
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Eduardo Kokubo <kokubo
inf.univali.br> Newsgroups: php.general To: Miles Thompson <milesthompson
ns.sympatico.ca>; <php-general
lists.php.net> Cc: Eduardo Kokubo <kokubo
inf.univali.br> Sent: Friday, August 03, 2001 9:35 AM Subject: Re: [PHP] again
> I'm trying to it using PHP. I tried to use ftp_nlist to know the names of > the files and transfer them, but I think I need more than just the names and > locations of the files. Besides, I have to transfer the name of the > subdirectory too. > > > Eduardo, > > > > Are you trying to do this in PHP or interactively? If with PHP I won't be > > much help, as the I've not used its FTP functions. Otherwise it's a > > straightforward FTP operation. > > > > There may be a problem doing it from within PHP as the webserver is > > probably running as "nobody", who usually, and properly, has zilch for > > permissions. > > > > Not much help - Miles > > > > At 10:11 AM 8/3/01 -0300, Eduardo Kokubo wrote: > > >I'm still trying to transfer a directory form one server to another but > > >with no results. > > >I have the username and password of the ftp account source and I know > I'll > > >have to ask for the username and password of the destination. I can't > > >simply upload or copy the directory, but there must have an alternative > > >way. I know I have been asking a lot of questions and I already asked > this > > >one, but I'm new with php and we can't learn everything from books, so... > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net > > For additional commands, e-mail: php-general-help
lists.php.net > > To contact the list administrators, e-mail: php-list-admin
lists.php.net >
attached mail follows:
Something like:
select date_format('unix-timestamp', yoursessiontimestampcolumn) from sessiontable;
Then, you can just use time() and subtract to get the number of seconds, and divide by 60 for the minutes.
Or, better yet, you can use MySQL functions to select sessions that are old/new or whatever, and leave all the data calculations in MySQL.
http://mysql.org http://mysql.com
Dunno (or care) which has better docs now that they've split. Sigh.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Augusto Cesar Castoldi <castoldi
inf.ufsc.br> Newsgroups: php.general To: <php-general
lists.php.net> Sent: Friday, August 03, 2001 9:21 AM Subject: Minutes between tow dates
> Hi. > > I'm using the timestamp format (AAMMDDHHMMSS) on my session. > > how can I know the minutes between two dates. > > I'm doing: > > $date = $row_secao['date']; > $date_now=date("ymdHis"); > $x=$date_atual-$date; > if ($x > 1000) { > echo "Session expired."; > } > > but I have a problem when turns the hour, like this: > > date=010803105958 > date_now=010803110518 > > the sub is 4500 (45 minutes!), but in fact, the real time between is 6 > minutes... > > thanks. > > Augusto >
attached mail follows:
-- I'm new to PHP --
hi!
I'm trying to make a link which can function like a button (submit) and I can still move my variable from one page to another without losing my variable value stored by user on the previous page?
Thank you!
ardani
attached mail follows:
First you should manage your code nicer so that it is easier to read and troubleshoot. Go through this to find my notes...
if (!$HTTP_POST_VARS) { exit();} elseif ($HTTP_POST_VARS) { if (!$Age) { echo "Please enter your age.<br>\n"; } if
Why would you use elseif above ? you are asking the full question in the first line if (!$HTTP_POST_VARS) { exit();}
if it's NOT then why say elseif, it's else, it's either one or the other...that's one thing.
so lets change it to this: if (!$HTTP_POST_VARS) { exit(); } else { if (!$Age) { echo "Please enter your age.<br>\n"; }
if (!$Email) { echo "Please enter your email.<br>\n"; }
if (!$State) { echo "Please enter your Location.<br>\n"; }
(MARK) } else ( RIGHT HERE YOU DID NOT OPEN THE REST OF THE ELSE ) echo "Thanks for your submission.";
( RIGHT HERE YOU DID NOT CLSE THEN END OF THE CONDITION )
so the last lines replacing after (MARK) should look like this
} else { echo "Thanks for your submission."; }
As you can see keeping the code in this format makes it a lot easier to see what is being exectued within the condition, allows you to see the open & closes of the brackets, and should have easily let you see you were missing something.
Hope that explains it....
attached mail follows:
Just curious but that last else you told him to put in... what is that referring to? There is already an else statement, you can't have another. Unless you're putting the else statement after the if (!$State) which you would need to subtract the "}" before the else, but this would give you undesired results since this is just an else for the !$State statement.
I could be missing what you were getting at.. it's definitely possible :)
Rick
> First you should manage your code nicer so that it is easier to read > and troubleshoot. Go through this to find my notes... > > if (!$HTTP_POST_VARS) { exit();} > elseif ($HTTP_POST_VARS) { > if (!$Age) { echo "Please enter your age.<br>\n"; > } if > > Why would you use elseif above ? you are asking the full question in > the first line > if (!$HTTP_POST_VARS) { exit();} > > if it's NOT then why say elseif, it's else, it's either one or the > other...that's one thing. > > so lets change it to this: > if (!$HTTP_POST_VARS) { > exit(); > } else { > if (!$Age) { > echo "Please enter your age.<br>\n"; > } > > if (!$Email) { > echo "Please enter your email.<br>\n"; > } > > if (!$State) { > echo "Please enter your Location.<br>\n"; > } > > (MARK) > } else ( RIGHT HERE YOU DID NOT OPEN THE REST OF THE ELSE ) > echo "Thanks for your submission."; > > ( RIGHT HERE YOU DID NOT CLSE THEN END OF THE CONDITION ) > > > so the last lines replacing after (MARK) should look like this > > } else { > echo "Thanks for your submission."; > } > > > As you can see keeping the code in this format makes it a lot easier to > see what is being exectued within the condition, allows you to see the > open & closes of the brackets, and should have easily let you see you > were missing something. > > > Hope that explains it.... >
attached mail follows:
Yes, I see what you mean... In showing why the last section didn't work, I messed up the actual overall logic of the code. I should have noticed that...nice catch....
so for clarification where it says (MARK) should be echo "Thanks for your submission."; }
Thanks...
Jack Sasportas wrote:
> Yes, I see what you mean...
> In showing why the last section didn't work, I messed up the actual overall
> logic of the code.
> I should have noticed that...nice catch....
>
> so for clarification where it says (MARK) should be
> echo "Thanks for your submission.";
> }
>
> Thanks...
>
> Richard Baskett wrote:
>
> > Just curious but that last else you told him to put in... what is that
> > referring to? There is already an else statement, you can't have another.
> > Unless you're putting the else statement after the if (!$State) which you
> > would need to subtract the "}" before the else, but this would give you
> > undesired results since this is just an else for the !$State statement.
> >
> > I could be missing what you were getting at.. it's definitely possible :)
> >
> > Rick
> >
> > > First you should manage your code nicer so that it is easier to read
> > > and troubleshoot. Go through this to find my notes...
> > >
> > > if (!$HTTP_POST_VARS) { exit();}
> > > elseif ($HTTP_POST_VARS) {
> > > if (!$Age) { echo "Please enter your age.<br>\n";
> > > } if
> > >
> > > Why would you use elseif above ? you are asking the full question in
> > > the first line
> > > if (!$HTTP_POST_VARS) { exit();}
> > >
> > > if it's NOT then why say elseif, it's else, it's either one or the
> > > other...that's one thing.
> > >
> > > so lets change it to this:
> > > if (!$HTTP_POST_VARS) {
> > > exit();
> > > } else {
> > > if (!$Age) {
> > > echo "Please enter your age.<br>\n";
> > > }
> > >
> > > if (!$Email) {
> > > echo "Please enter your email.<br>\n";
> > > }
> > >
> > > if (!$State) {
> > > echo "Please enter your Location.<br>\n";
> > > }
> > >
> > > (MARK)
> > > } else ( RIGHT HERE YOU DID NOT OPEN THE REST OF THE ELSE )
> > > echo "Thanks for your submission.";
> > >
> > > ( RIGHT HERE YOU DID NOT CLSE THEN END OF THE CONDITION )
> > >
> > >
> > > so the last lines replacing after (MARK) should look like this
> > >
> > > } else {
> > > echo "Thanks for your submission.";
> > > }
> > >
> > >
> > > As you can see keeping the code in this format makes it a lot easier to
> > > see what is being exectued within the condition, allows you to see the
> > > open & closes of the brackets, and should have easily let you see you
> > > were missing something.
> > >
> > >
> > > Hope that explains it....
> > >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> > For additional commands, e-mail: php-general-help
lists.php.net
> > To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
> --
> ___________________________________________________________
> Jack Sasportas
> Innovative Internet Solutions
> Phone 305.665.2500
> Fax 305.665.2551
> www.innovativeinternet.com
> www.web56.net
-- ___________________________________________________________ Jack Sasportas Innovative Internet Solutions Phone 305.665.2500 Fax 305.665.2551 www.innovativeinternet.com www.web56.net
attached mail follows:
Okay... so this is sorta off topic... but the form is generated by a script =>
Anyway, for some reason, when I fill in a form on my site and press enter, it doesn't actually submit the form and do the processing like it is supposed to... it should be throwing some information into the database. Instead, it seems to just be reloading the page.
Source is below... if anybody has any idea, I would appreciate... I imagine I'm just doing something stupid wrong.
Thanks, Ben
--- SOURCE --- <?php
include_once("../include/definitions.inc"); include_once("../include/functions.inc");
// Check to make sure they're allowed to be here session_start(); check_access($session_data);
// They haven't clicked anything, so show the form if(!$submit) { ?> <html> <head> <title>Add Genre</title> <link rel="stylesheet" href="<?php echo $STYLESHEET; ?>" type="text/css"> <script language="javascript">
function verify() { if(document.forms[0].name.value=="") { alert("The name field cannot be blank!"); return false; }
return true; // fallthrough } </script> </head> <body> <center> <h1>Add Genre</h1> <hr> <form method="post" action="addgenre.php" onSubmit="return verify()">
<table>
<tr> <td>Name: </td> <td><input type="text" name="name" size="20" maxlength="50"></td> </tr>
<tr> <td><input type="submit" name="submit" value="Add Genre"></td> <td><input type="reset"></td> </tr>
</table>
</form> <?php include "../include/footer.php"; ?> </body> </html>
<?php } else {
setup_db_connection('w') or die("Could not connect to database!");
//Stick it in $query = "INSERT INTO genres (name) VALUES ('$name');"; mysql_query($query); header("Location: genres.php"); } ?>
attached mail follows:
Try using this INSERT statement:
$query = "INSERT INTO genres (name) VALUES ('$name')";
I subtracted one of the ";", I dont think you need it when running a query from php. Let's see.. what else.. hmm..
actually that's all I can see. Hopefully that does it. If not I hope someone else answers :)
Rick
> Okay... so this is sorta off topic... but the form is generated by a > script => > > Anyway, for some reason, when I fill in a form on my site and press enter, > it doesn't actually submit the form and do the processing like it is > supposed to... it should be throwing some information into the database. > Instead, it seems to just be reloading the page. > > Source is below... if anybody has any idea, I would appreciate... I > imagine I'm just doing something stupid wrong. > > Thanks, > Ben > > --- SOURCE --- > <?php > > include_once("../include/definitions.inc"); > include_once("../include/functions.inc"); > > // Check to make sure they're allowed to be here > session_start(); > check_access($session_data); > > // They haven't clicked anything, so show the form > if(!$submit) > { ?> > <html> > <head> > <title>Add Genre</title> > <link rel="stylesheet" href="<?php echo $STYLESHEET; ?>" type="text/css"> > <script language="javascript"> > > function verify() > { > if(document.forms[0].name.value=="") > { > alert("The name field cannot be blank!"); > return false; > } > > return true; // fallthrough > } > </script> > </head> > <body> > <center> > <h1>Add Genre</h1> > <hr> > <form method="post" action="addgenre.php" onSubmit="return verify()"> > > <table> > > <tr> > <td>Name: </td> > <td><input type="text" name="name" size="20" maxlength="50"></td> > </tr> > > <tr> > <td><input type="submit" name="submit" value="Add Genre"></td> > <td><input type="reset"></td> > </tr> > > </table> > > </form> > <?php include "../include/footer.php"; ?> > </body> > </html> > > <?php } else { > > setup_db_connection('w') or die("Could not connect to database!"); > > //Stick it in > $query = "INSERT INTO genres (name) VALUES ('$name');"; > mysql_query($query); > header("Location: genres.php"); > } > ?>
attached mail follows:
Perhaps a little clarification... I'm very sorry I wasn't clear in the first place! =>
The page works fine if I click on submit with the mouse. I'm curious why it doesn't when the user presses their 'Enter' key while the text field is focused.
They will be entering piles of info, just trying to make it more convenient =>
Thanks again, Ben
-----Original Message-----
From: Richard Baskett [mailto:rickbaskett
home.com]
Sent: Friday, August 03, 2001 5:31 PM
To: Benjamin Bleything; php-general
lists.php.net
Subject: Re: [PHP] weird behavior with a form
Try using this INSERT statement:
$query = "INSERT INTO genres (name) VALUES ('$name')";
I subtracted one of the ";", I dont think you need it when running a query from php. Let's see.. what else.. hmm..
actually that's all I can see. Hopefully that does it. If not I hope someone else answers :)
Rick
> Okay... so this is sorta off topic... but the form is generated by a > script => > > Anyway, for some reason, when I fill in a form on my site and press enter, > it doesn't actually submit the form and do the processing like it is > supposed to... it should be throwing some information into the database. > Instead, it seems to just be reloading the page. > > Source is below... if anybody has any idea, I would appreciate... I > imagine I'm just doing something stupid wrong. > > Thanks, > Ben > > --- SOURCE --- > <?php > > include_once("../include/definitions.inc"); > include_once("../include/functions.inc"); > > // Check to make sure they're allowed to be here > session_start(); > check_access($session_data); > > // They haven't clicked anything, so show the form > if(!$submit) > { ?> > <html> > <head> > <title>Add Genre</title> > <link rel="stylesheet" href="<?php echo $STYLESHEET; ?>" type="text/css"> > <script language="javascript"> > > function verify() > { > if(document.forms[0].name.value=="") > { > alert("The name field cannot be blank!"); > return false; > } > > return true; // fallthrough > } > </script> > </head> > <body> > <center> > <h1>Add Genre</h1> > <hr> > <form method="post" action="addgenre.php" onSubmit="return verify()"> > > <table> > > <tr> > <td>Name: </td> > <td><input type="text" name="name" size="20" maxlength="50"></td> > </tr> > > <tr> > <td><input type="submit" name="submit" value="Add Genre"></td> > <td><input type="reset"></td> > </tr> > > </table> > > </form> > <?php include "../include/footer.php"; ?> > </body> > </html> > > <?php } else { > > setup_db_connection('w') or die("Could not connect to database!"); > > //Stick it in > $query = "INSERT INTO genres (name) VALUES ('$name');"; > mysql_query($query); > header("Location: genres.php"); > } > ?>
attached mail follows:
On Fri, 3 Aug 2001, Benjamin Bleything wrote:
>Date: Fri, 3 Aug 2001 17:05:54 -0700 (PDT)
>From: Benjamin Bleything <bleythib
ucs.orst.edu>
>To: php-general
lists.php.net
>Subject: [PHP] weird behavior with a form
>
>Okay... so this is sorta off topic... but the form is generated by a
>script =>
>
>Anyway, for some reason, when I fill in a form on my site and press enter,
>it doesn't actually submit the form and do the processing like it is
>supposed to... it should be throwing some information into the database.
>Instead, it seems to just be reloading the page.
>
>Source is below... if anybody has any idea, I would appreciate... I
>imagine I'm just doing something stupid wrong.
>
Does $submit get unset in any of your include files? Does it get set at all? Can you acess $submit through $GLOBALS[$submit]?
--- SOURCE --- ><?php > >include_once("../include/definitions.inc"); >include_once("../include/functions.inc"); > >// Check to make sure they're allowed to be here >session_start(); >check_access($session_data); > >// They haven't clicked anything, so show the form >if(!$submit) >{ ?> ><html> ><head> ><title>Add Genre</title> ><link rel="stylesheet" href="<?php echo $STYLESHEET; ?>" type="text/css"> ><script language="javascript"> > >function verify() >{ > if(document.forms[0].name.value=="") > { > alert("The name field cannot be blank!"); > return false; > } > > return true; // fallthrough >} ></script> ></head> ><body> ><center> ><h1>Add Genre</h1> ><hr> ><form method="post" action="addgenre.php" onSubmit="return verify()"> > ><table> > ><tr> > <td>Name: </td> > <td><input type="text" name="name" size="20" maxlength="50"></td> ></tr> > ><tr> > <td><input type="submit" name="submit" value="Add Genre"></td> > <td><input type="reset"></td> ></tr> > ></table> > ></form> ><?php include "../include/footer.php"; ?> ></body> ></html> > ><?php } else { > > setup_db_connection('w') or die("Could not connect to database!"); > > //Stick it in > $query = "INSERT INTO genres (name) VALUES ('$name');"; > mysql_query($query); > header("Location: genres.php"); >} >?> > > >
attached mail follows:
Ahh I see, ok yeah what Queen said is basically where the problem lies. I had this problem on one of my scripts. If you just hit enter without using the mouse to submit a form the buttons value does not get added onto the form. What I did to remedy this was included a hidden field and then do your checking on that field.
Thanks for the clarification :)
Rick
> Perhaps a little clarification... I'm very sorry I wasn't clear in the
> first place! =>
>
> The page works fine if I click on submit with the mouse. I'm curious
> why it doesn't when the user presses their 'Enter' key while the text
> field is focused.
>
> They will be entering piles of info, just trying to make it more
> convenient =>
>
> Thanks again,
> Ben
>
> -----Original Message-----
> From: Richard Baskett [mailto:rickbaskett
home.com]
> Sent: Friday, August 03, 2001 5:31 PM
> To: Benjamin Bleything; php-general
lists.php.net
> Subject: Re: [PHP] weird behavior with a form
>
> Try using this INSERT statement:
>
> $query = "INSERT INTO genres (name) VALUES ('$name')";
>
> I subtracted one of the ";", I dont think you need it when running a
> query
> from php. Let's see.. what else.. hmm..
>
> actually that's all I can see. Hopefully that does it. If not I hope
> someone else answers :)
>
> Rick
>
>> Okay... so this is sorta off topic... but the form is generated by a
>> script =>
>>
>> Anyway, for some reason, when I fill in a form on my site and press
> enter,
>> it doesn't actually submit the form and do the processing like it is
>> supposed to... it should be throwing some information into the
> database.
>> Instead, it seems to just be reloading the page.
>>
>> Source is below... if anybody has any idea, I would appreciate... I
>> imagine I'm just doing something stupid wrong.
>>
>> Thanks,
>> Ben
>>
>> --- SOURCE ---
>> <?php
>>
>> include_once("../include/definitions.inc");
>> include_once("../include/functions.inc");
>>
>> // Check to make sure they're allowed to be here
>> session_start();
>> check_access($session_data);
>>
>> // They haven't clicked anything, so show the form
>> if(!$submit)
>> { ?>
>> <html>
>> <head>
>> <title>Add Genre</title>
>> <link rel="stylesheet" href="<?php echo $STYLESHEET; ?>"
> type="text/css">
>> <script language="javascript">
>>
>> function verify()
>> {
>> if(document.forms[0].name.value=="")
>> {
>> alert("The name field cannot be blank!");
>> return false;
>> }
>>
>> return true; // fallthrough
>> }
>> </script>
>> </head>
>> <body>
>> <center>
>> <h1>Add Genre</h1>
>> <hr>
>> <form method="post" action="addgenre.php" onSubmit="return verify()">
>>
>> <table>
>>
>> <tr>
>> <td>Name: </td>
>> <td><input type="text" name="name" size="20" maxlength="50"></td>
>> </tr>
>>
>> <tr>
>> <td><input type="submit" name="submit" value="Add Genre"></td>
>> <td><input type="reset"></td>
>> </tr>
>>
>> </table>
>>
>> </form>
>> <?php include "../include/footer.php"; ?>
>> </body>
>> </html>
>>
>> <?php } else {
>>
>> setup_db_connection('w') or die("Could not connect to database!");
>>
>> //Stick it in
>> $query = "INSERT INTO genres (name) VALUES ('$name');";
>> mysql_query($query);
>> header("Location: genres.php");
>> }
>> ?>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
Submit should get set when you click the submit button... it is not used anywhere else...
Again, it works when you click the button, just not when you press enter...
=> I'm going to try what Richard just suggested, and I'll get back to you.
Ben
-----Original Message-----
From: Queen [mailto:queen
simos.dhs.org]
Sent: Friday, August 03, 2001 5:31 PM
To: Benjamin Bleything
Cc: php-general
lists.php.net
Subject: Re: [PHP] weird behavior with a form
On Fri, 3 Aug 2001, Benjamin Bleything wrote:
>Date: Fri, 3 Aug 2001 17:05:54 -0700 (PDT)
>From: Benjamin Bleything <bleythib
ucs.orst.edu>
>To: php-general
lists.php.net
>Subject: [PHP] weird behavior with a form
>
>Okay... so this is sorta off topic... but the form is generated by a
>script =>
>
>Anyway, for some reason, when I fill in a form on my site and press
enter,
>it doesn't actually submit the form and do the processing like it is
>supposed to... it should be throwing some information into the
database.
>Instead, it seems to just be reloading the page.
>
>Source is below... if anybody has any idea, I would appreciate... I
>imagine I'm just doing something stupid wrong.
>
Does $submit get unset in any of your include files? Does it get set at all? Can you acess $submit through $GLOBALS[$submit]?
--- SOURCE --- ><?php > >include_once("../include/definitions.inc"); >include_once("../include/functions.inc"); > >// Check to make sure they're allowed to be here >session_start(); >check_access($session_data); > >// They haven't clicked anything, so show the form >if(!$submit) >{ ?> ><html> ><head> ><title>Add Genre</title> ><link rel="stylesheet" href="<?php echo $STYLESHEET; ?>" type="text/css"> ><script language="javascript"> > >function verify() >{ > if(document.forms[0].name.value=="") > { > alert("The name field cannot be blank!"); > return false; > } > > return true; // fallthrough >} ></script> ></head> ><body> ><center> ><h1>Add Genre</h1> ><hr> ><form method="post" action="addgenre.php" onSubmit="return verify()"> > ><table> > ><tr> > <td>Name: </td> > <td><input type="text" name="name" size="20" maxlength="50"></td> ></tr> > ><tr> > <td><input type="submit" name="submit" value="Add Genre"></td> > <td><input type="reset"></td> ></tr> > ></table> > ></form> ><?php include "../include/footer.php"; ?> ></body> ></html> > ><?php } else { > > setup_db_connection('w') or die("Could not connect to database!"); > > //Stick it in > $query = "INSERT INTO genres (name) VALUES ('$name');"; > mysql_query($query); > header("Location: genres.php"); >} >?> > > >
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
Whacky. It works now =>
Thanks! Ben
-----Original Message-----
From: Richard Baskett [mailto:rickbaskett
home.com]
Sent: Friday, August 03, 2001 5:45 PM
To: Ben Bleything; php-general
lists.php.net
Subject: Re: [PHP] weird behavior with a form
Ahh I see, ok yeah what Queen said is basically where the problem lies. I had this problem on one of my scripts. If you just hit enter without using the mouse to submit a form the buttons value does not get added onto the form. What I did to remedy this was included a hidden field and then do your checking on that field.
Thanks for the clarification :)
Rick
> Perhaps a little clarification... I'm very sorry I wasn't clear in the
> first place! =>
>
> The page works fine if I click on submit with the mouse. I'm curious
> why it doesn't when the user presses their 'Enter' key while the text
> field is focused.
>
> They will be entering piles of info, just trying to make it more
> convenient =>
>
> Thanks again,
> Ben
>
> -----Original Message-----
> From: Richard Baskett [mailto:rickbaskett
home.com]
> Sent: Friday, August 03, 2001 5:31 PM
> To: Benjamin Bleything; php-general
lists.php.net
> Subject: Re: [PHP] weird behavior with a form
>
> Try using this INSERT statement:
>
> $query = "INSERT INTO genres (name) VALUES ('$name')";
>
> I subtracted one of the ";", I dont think you need it when running a
> query
> from php. Let's see.. what else.. hmm..
>
> actually that's all I can see. Hopefully that does it. If not I hope
> someone else answers :)
>
> Rick
>
>> Okay... so this is sorta off topic... but the form is generated by a
>> script =>
>>
>> Anyway, for some reason, when I fill in a form on my site and press
> enter,
>> it doesn't actually submit the form and do the processing like it is
>> supposed to... it should be throwing some information into the
> database.
>> Instead, it seems to just be reloading the page.
>>
>> Source is below... if anybody has any idea, I would appreciate... I
>> imagine I'm just doing something stupid wrong.
>>
>> Thanks,
>> Ben
>>
>> --- SOURCE ---
>> <?php
>>
>> include_once("../include/definitions.inc");
>> include_once("../include/functions.inc");
>>
>> // Check to make sure they're allowed to be here
>> session_start();
>> check_access($session_data);
>>
>> // They haven't clicked anything, so show the form
>> if(!$submit)
>> { ?>
>> <html>
>> <head>
>> <title>Add Genre</title>
>> <link rel="stylesheet" href="<?php echo $STYLESHEET; ?>"
> type="text/css">
>> <script language="javascript">
>>
>> function verify()
>> {
>> if(document.forms[0].name.value=="")
>> {
>> alert("The name field cannot be blank!");
>> return false;
>> }
>>
>> return true; // fallthrough
>> }
>> </script>
>> </head>
>> <body>
>> <center>
>> <h1>Add Genre</h1>
>> <hr>
>> <form method="post" action="addgenre.php" onSubmit="return verify()">
>>
>> <table>
>>
>> <tr>
>> <td>Name: </td>
>> <td><input type="text" name="name" size="20" maxlength="50"></td>
>> </tr>
>>
>> <tr>
>> <td><input type="submit" name="submit" value="Add Genre"></td>
>> <td><input type="reset"></td>
>> </tr>
>>
>> </table>
>>
>> </form>
>> <?php include "../include/footer.php"; ?>
>> </body>
>> </html>
>>
>> <?php } else {
>>
>> setup_db_connection('w') or die("Could not connect to database!");
>>
>> //Stick it in
>> $query = "INSERT INTO genres (name) VALUES ('$name');";
>> mysql_query($query);
>> header("Location: genres.php");
>> }
>> ?>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail:
php-list-admin
lists.php.net
>
attached mail follows:
Hey all,
I have a server with Apache running on it, and it currently uses PHP3 (installed with the OS). I am trying to upgrade to PHP4, but from the php.net documentation it appears that I have to reinstall Apache in order to have access to the PHP4 apache modules, something I would NOT like to do. Is there any way around this?
- Matt
attached mail follows:
Hello everyone,
Need some help. I installed phpMyAdmin on this new server and cannot get it to work. I've installed this tool many times, so i'm pretty comfortable with the installation process. However, I've never ran into the errors I am getting today.
The server is Apache+PHP 4.0.6
Error 1) When I first installed phpMyAdmin, I got the following error:
"... magic_quotes_gpc is not enabled. phpMyAdmin needs this to work..."
Action: I had my ISP turned on Magic Quotes in my PHP.ini file. Now, phpinfo() shows the following settings:
magic_quotes_gpc On magic_quotes_runtime On magic_quotes_sybase On
error 2)
The above seetings solve the 'error' issues. However, phpMyAdmin now shows a blank page when I try to access it.
What can cause this ? Does it have anything to do with magic_quotes being turned on? ...that's what it requested in the first place.
Am I missing something?
Please help.
-John
__________John Monfort_________________ _+-----------------------------------+_ P E P I E D E S I G N S www.pepiedesigns.com "The world is waiting, are you ready?" -+___________________________________+-
On Fri, 3 Aug 2001, Jack Sasportas wrote:
> Yes, I see what you mean...
> In showing why the last section didn't work, I messed up the actual
> overall
> logic of the code.
> I should have noticed that...nice catch....
>
> so for clarification where it says (MARK) should be
> echo "Thanks for your submission.";
> }
>
> Thanks...
>
> Jack Sasportas wrote:
>
> > Yes, I see what you mean...
> > In showing why the last section didn't work, I messed up the actual overall
> > logic of the code.
> > I should have noticed that...nice catch....
> >
> > so for clarification where it says (MARK) should be
> > echo "Thanks for your submission.";
> > }
> >
> > Thanks...
> >
> > Richard Baskett wrote:
> >
> > > Just curious but that last else you told him to put in... what is that
> > > referring to? There is already an else statement, you can't have another.
> > > Unless you're putting the else statement after the if (!$State) which you
> > > would need to subtract the "}" before the else, but this would give you
> > > undesired results since this is just an else for the !$State statement.
> > >
> > > I could be missing what you were getting at.. it's definitely possible :)
> > >
> > > Rick
> > >
> > > > First you should manage your code nicer so that it is easier to read
> > > > and troubleshoot. Go through this to find my notes...
> > > >
> > > > if (!$HTTP_POST_VARS) { exit();}
> > > > elseif ($HTTP_POST_VARS) {
> > > > if (!$Age) { echo "Please enter your age.<br>\n";
> > > > } if
> > > >
> > > > Why would you use elseif above ? you are asking the full question in
> > > > the first line
> > > > if (!$HTTP_POST_VARS) { exit();}
> > > >
> > > > if it's NOT then why say elseif, it's else, it's either one or the
> > > > other...that's one thing.
> > > >
> > > > so lets change it to this:
> > > > if (!$HTTP_POST_VARS) {
> > > > exit();
> > > > } else {
> > > > if (!$Age) {
> > > > echo "Please enter your age.<br>\n";
> > > > }
> > > >
> > > > if (!$Email) {
> > > > echo "Please enter your email.<br>\n";
> > > > }
> > > >
> > > > if (!$State) {
> > > > echo "Please enter your Location.<br>\n";
> > > > }
> > > >
> > > > (MARK)
> > > > } else ( RIGHT HERE YOU DID NOT OPEN THE REST OF THE ELSE )
> > > > echo "Thanks for your submission.";
> > > >
> > > > ( RIGHT HERE YOU DID NOT CLSE THEN END OF THE CONDITION )
> > > >
> > > >
> > > > so the last lines replacing after (MARK) should look like this
> > > >
> > > > } else {
> > > > echo "Thanks for your submission.";
> > > > }
> > > >
> > > >
> > > > As you can see keeping the code in this format makes it a lot easier to
> > > > see what is being exectued within the condition, allows you to see the
> > > > open & closes of the brackets, and should have easily let you see you
> > > > were missing something.
> > > >
> > > >
> > > > Hope that explains it....
> > > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> > > For additional commands, e-mail: php-general-help
lists.php.net
> > > To contact the list administrators, e-mail: php-list-admin
lists.php.net
> >
> > --
> > ___________________________________________________________
> > Jack Sasportas
> > Innovative Internet Solutions
> > Phone 305.665.2500
> > Fax 305.665.2551
> > www.innovativeinternet.com
> > www.web56.net
>
> --
> ___________________________________________________________
> Jack Sasportas
> Innovative Internet Solutions
> Phone 305.665.2500
> Fax 305.665.2551
> www.innovativeinternet.com
> www.web56.net
>
>
attached mail follows:
Sadly, after many days of alternative development for this problem, it seems that my problem is with my Apace setup, and not my scripts at all. I'm sill not sure if PHP will do this, because after giving up I rewrote the program in Perl. After I encountered the exact same problem with Perl, it finally dawned on me that it might be Apache. Not knowing how to configure Apache properly, I tried the Perl script out on an IIS installation, where it works fine. Why I'm here, anybody know how to configure Apache to do this? I can't find the problem.
Thanks,
Keith Jeffery
jeff2619
uidaho.edu
"Keith Jeffery" <jeff2619
uidaho.edu> wrote in message
news:20010801143214.28955.qmail
pb1.pair.com...
> Hello,
> I'm writing some PHP scripts that will only be used over our local
> Windows NT/2000 network. I've written a directory browser in PHP, but
that
> only sees the server's local directories/files whereas I would also like
to
> be able to see shared network directories. Since the PHP directory
> functions don't allow network connections (i.e. //harp/graphics/) I
decided
> that a good workaround would be to write a C++ program that listed the
> directories and files (like dir or ls if you're on Unix, and I can't get
dir
> to work through a PHP exec command), and then I would parse the output in
> PHP. I've since written two different C++ programs to do this, one using
> findfirst and findnext, and other using opendir and readdir. They both
work
> by specifying the directory to be listed after the program (i.e.
> "listFiles.exe d:/" or "listFiles.exe //harp/graphics/"). Both of these
> programs work just as expected from the command prompt, working with both
> directories local to the server and those on a shared network drive.
> However, both of these programs fail using any PHP system command (exec,
> passthru, system) when specifying a network drive as the arguement,
although
> both work when a server's local directory is given. For some reason it
can
> no longer read the network drive when run through PHP. I've double and
> triple checked the arguements passed, and they command issused is exactly
> that given at the command prompt. I've even tried changing the current
> working directory in the C++ program and to no avail. Does anybody have
any
> insight, or perhaps another route down which to travel? I will happily
> provide PHP and/or C++ code for what I'm doing.
>
> Thank you,
> Keith Jeffery
> jeff2619
uidaho.edu
>
>
attached mail follows:
There is a nice library that handles this called pcltar at http://phpconcept.free.fr/index.en.php3
on 8/2/01 11:37 PM, Eduarko Kokubo wrote:
> I'm still trying to compress an entire directory on a linux server to be > decompressed probably in windows client. I'm trying to use exec command and > tar (compressor for linux), but I don't know how to do it. Can anybody > pleeeaase help me? > > > I know I should test these, but sending a message is easier. :) > If a connect the server using ftp_connect and ftp_login, when I try to create > a directory using mkdir or ftp_mkdir or a file using fopen, will they belong > to me or to nobody??? >
attached mail follows:
I have a file written by C whit a c-style struct like this:
struct BACACHE { char author[300][100]; int top; time_t uptime; time_t touchtime; int busystate; };
is there any way to get these data into PHP with certain variable type ?
I've tried to use " unpack() " function, but I found that unpack() can't unpack a char array ( I mean string) , it breaks string into characters.... please help me...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]