|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help_at_lists.php.net
Date: Mon Jan 27 2003 - 15:32:08 CST
php-general Digest 27 Jan 2003 21:32:08 -0000 Issue 1848
Topics (messages 133229 through 133301):
Re: Adjusting Indexed Field After Deleting Entry
133229 by: Jon Haworth
133230 by: Jon Haworth
133236 by: John W. Holmes
Update row problems
133231 by: Steve Jackson
133232 by: Tim Ward
133235 by: Steve Jackson
133238 by: Tim Ward
133240 by: Steve Jackson
Strip_Tags
php 4.3
133233 by: George E. Papadakis
133262 by: Philip Olson
Re: SSH change password!
133234 by: David T-G
Re: CRON?
133237 by: David T-G
Re: Transition Page?
133239 by: David T-G
Re: converting a Recorset into an XML string
133241 by: Octavio Herrera
133242 by: Octavio Herrera
Re: Files PHP in tmp ?
133243 by: nico
133247 by: nico
target for ftp_ssl_connect
133244 by: Markus Boettger
slides
133245 by: Ornella Fasolo
133246 by: Sterling Hughes
apache webprotect logout
133248 by: Tommy Jensehaugen
133249 by: Matt Schroebel
133250 by: Chris Shiflett
IFRAMES & PHP
133251 by: Greg
133253 by: Chris Shiflett
133258 by: Greg
133263 by: Sean Burlington
133264 by: John W. Holmes
133266 by: Greg
133267 by: Chris Boget
133268 by: John W. Holmes
133270 by: Greg
133271 by: Sean Burlington
133273 by: Jon Haworth
133275 by: adrian murphy.2020tourism.com
133278 by: Greg
question about GD and colors
133252 by: Jean-François Marseaut
133254 by: Philipp
133259 by: adrian murphy.2020tourism.com
133272 by: Philipp
IE 'Back' Button problem + SELECT dropdowns
133255 by: Andre Dubuc
133256 by: John W. Holmes
133257 by: Andre Dubuc
133265 by: John W. Holmes
133279 by: Andre Dubuc
Question about SSL/php globals
133260 by: Wei Weng
133261 by: Philip Olson
133269 by: Wei Weng
Do php extension need to be thread-safe?
133274 by: Joshua Moore-Oliva
Simple Solution To Login And Upload
133276 by: Randum Ian
133277 by: John W. Holmes
Found a PHP bug!!!!!!!!!
133280 by: Scott Fletcher
133281 by: Jason Wong
133282 by: Johnson, Kirk
133283 by: Scott Fletcher
133284 by: Chris Shiflett
133285 by: Cal Evans
133286 by: Chris Hayes
133287 by: Scott Fletcher
133288 by: Scott Fletcher
133290 by: Scott Fletcher
133291 by: Scott Fletcher
133292 by: Ray Hunter
133293 by: John W. Holmes
133294 by: Leif K-Brooks
133295 by: John W. Holmes
133297 by: Cal Evans
133298 by: Scott Fletcher
133299 by: Scott Fletcher
133300 by: Scott Fletcher
133301 by: Scott Fletcher
phpMyAdmin for Microsoft SQL
133289 by: Joshua E Minnie
Help with Filesize
133296 by: Rodrigo Corrêa
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:
Hi,
> I originally had a link #1, #2, and #3. I obviously deleted them.
> I was wondering if there is a way to use PHP/MySQL to get the indexed
numbers to re-assign so that the first link
you see is always #1 the second link you see is always #2 and so on?
Thanks in advance,
Roger
PS
The original script was not mine, it came from a 'php how to' article at
web monkey, I did some modifications to fit what I needed. We don't
want anyone thinking that I'm taking credit for their knowledge ;-)
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php_____________________________________________________________________ This e-mail has been scanned for viruses by the WorldCom Internet Managed Scanning Service - powered by MessageLabs. For further information visit http://www.worldcom.com
attached mail follows:
Hi,
> I originally had a link #1, #2, and #3. I obviously deleted them. > I was wondering if there is a way to use PHP/MySQL to get the > indexed numbers to re-assign so that the first link you see is > always #1 the second link you see is always #2 and so on?
(apologies for previous incomplete message - pressed Ctrl+Enter by mistake :-)
If these are the primary keys in your database, you can reset the auto_increment with this query:
ALTER TABLE tablename AUTO_INCREMENT = 1;
Or set it to whatever you like:
ALTER TABLE tablename AUTO_INCREMENT = 23;
Cheers Jon
attached mail follows:
> > I originally had a link #1, #2, and #3. I obviously deleted them. > > I was wondering if there is a way to use PHP/MySQL to get the indexed > numbers to re-assign so that the first link > you see is always #1 the second link you see is always #2 and so on?
Keep your own count variable when you output your links, don't rely on the auto_increment column in your database. The auto_increment number is only there as a unique identifier for each row, not to keep count for you. If you have problems with gaps in your auto_increment column then the script is not written correctly.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
attached mail follows:
Hi all,
I've been playing with this for a few hours now (over the course of a couple of days) and it's getting frustrating!
All I want to do is to be able to make one row in the database set the order that my categories appear on my website. Now I can do this fine simply by using ORDER_BY but I want to have my users be able to update the order through an admin page like so:
------------------------------------- Catid | catname | catdesc | catorder | 1 name desc 1 2 name desc 2 3 name desc 3 4 name desc 4 ______________________________________
Basically I have a form which takes data from the table above and displays catname (just echoed) and catorder in a text form field. When I submit the form I want to update catorder with whatever number the user puts in the field.
Currently my code updates only one of the category order numbers. So my form code:
<form action="eshop_processcatorder.php" method="post"> </td></tr> <? while ($array = mysql_fetch_array($mysql)) { echo "<tr><td width='150'><span class='adminisoleipa'>"; echo "{$array["catname"]}"; echo "</td><td><input type='text' size='2' name='catorder[{$array["catid"]}]' value='{$array["catorder"]}'>"; echo "</span></td></tr>"; } ?> <tr><td><br> <input type="submit" name="Submit" value="Submit" class="nappi"> </form>
That does everything I need it to do.
However what am I doing wrong when I try to process it using this code?
foreach($_POST["catorder"] as $catid => $catorder)
{
$query = "update categories set catorder=$catorder where
catid=$catid";
}
$result = mysql_query($query) or die("Query failure: "
.mysql_error());
if (!$result)
{
echo "<table width='100%' border='0' cellspacing='0'
cellpadding='0' align='center' bgcolor='#629D39'>";
echo "<tr><td><img
src='images/admin_orders_administrate.gif'></td></tr>";
echo "<tr><td> </td></tr>";
echo "<tr><td><span class='adminisoleipa'>Could not change
details: please <a href='mailto:stephen.jackson
violasystems.com'>click
here</a> to email the administrator<br><br></span>";
echo "</td>";
echo "</tr>";
echo "</table>";
}
else
{
echo "<table width='100%' border='0' cellspacing='0'
cellpadding='0' align='center' bgcolor='#629D39'>";
echo "<tr><td><img
src='images/admin_orders_administrate.gif'></td></tr>";
echo "<tr><td> </td></tr>";
echo "<tr><td><span class='adminisoleipa'>The category page has
had the order in which categories appear changed.<br><br></span>";
echo "</td>";
echo "</tr>";
echo "</table>";
}
Any help appraciated. Kind regards,
Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
stephen.jackson
violasystems.com
Mobile +358 50 343 5159
attached mail follows:
your query needs to be inside the foreach loop so that it runs for every item, at the moment it just runs after you've scanned through all the items so just does the last one.
Tim Ward
http://www.chessish.com
mailto:timward
chessish.com
----- Original Message -----
From: Steve Jackson <stephen.jackson
violasystems.com>
To: PHP General <php-general
lists.php.net>
Sent: Monday, January 27, 2003 11:46 AM
Subject: [PHP] Update row problems
> Hi all,
>
> I've been playing with this for a few hours now (over the course of a
> couple of days) and it's getting frustrating!
>
> All I want to do is to be able to make one row in the database set the
> order that my categories appear on my website. Now I can do this fine
> simply by using ORDER_BY but I want to have my users be able to update
> the order through an admin page like so:
>
> -------------------------------------
> Catid | catname | catdesc | catorder |
> 1 name desc 1
> 2 name desc 2
> 3 name desc 3
> 4 name desc 4
> ______________________________________
>
> Basically I have a form which takes data from the table above and
> displays catname (just echoed) and catorder in a text form field. When I
> submit the form I want to update catorder with whatever number the user
> puts in the field.
>
> Currently my code updates only one of the category order numbers.
> So my form code:
>
> <form action="eshop_processcatorder.php" method="post">
> </td></tr>
> <?
> while ($array = mysql_fetch_array($mysql))
> {
> echo "<tr><td width='150'><span class='adminisoleipa'>";
> echo "{$array["catname"]}";
> echo "</td><td><input type='text' size='2'
> name='catorder[{$array["catid"]}]' value='{$array["catorder"]}'>";
> echo "</span></td></tr>";
> }
> ?>
> <tr><td><br>
> <input type="submit" name="Submit" value="Submit" class="nappi">
> </form>
>
> That does everything I need it to do.
>
> However what am I doing wrong when I try to process it using this code?
>
> foreach($_POST["catorder"] as $catid => $catorder)
> {
> $query = "update categories set catorder=$catorder where
> catid=$catid";
> }
> $result = mysql_query($query) or die("Query failure: "
> .mysql_error());
> if (!$result)
> {
> echo "<table width='100%' border='0' cellspacing='0'
> cellpadding='0' align='center' bgcolor='#629D39'>";
> echo "<tr><td><img
> src='images/admin_orders_administrate.gif'></td></tr>";
> echo "<tr><td> </td></tr>";
> echo "<tr><td><span class='adminisoleipa'>Could not change
> details: please <a href='mailto:stephen.jackson
violasystems.com'>click
> here</a> to email the administrator<br><br></span>";
> echo "</td>";
> echo "</tr>";
> echo "</table>";
> }
> else
> {
> echo "<table width='100%' border='0' cellspacing='0'
> cellpadding='0' align='center' bgcolor='#629D39'>";
> echo "<tr><td><img
> src='images/admin_orders_administrate.gif'></td></tr>";
> echo "<tr><td> </td></tr>";
> echo "<tr><td><span class='adminisoleipa'>The category page has
> had the order in which categories appear changed.<br><br></span>";
> echo "</td>";
> echo "</tr>";
> echo "</table>";
> }
>
> Any help appraciated.
> Kind regards,
>
> Steve Jackson
> Web Developer
> Viola Systems Ltd.
> http://www.violasystems.com
> stephen.jackson
violasystems.com
> Mobile +358 50 343 5159
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
I'm processing on a different page so what would I use instead of $_POST? print_r($_POST) Didn't display anything or diagnose anything.
Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
stephen.jackson
violasystems.com
Mobile +358 50 343 5159
> -----Original Message-----
> From: Tim Ward [mailto:timward
chessish.com]
> Sent: 27. tammikuuta 2003 14:57
> To: Steve Jackson
> Subject: Re: [PHP] Update row problems
>
>
> sounds like $_POST[""catorder"] isn't an array - if
> you're posting to the same page you need to wrap
> the processing in something to test if the form has
> been posted (e.g. is_array($_POST[""catorder"])),
> or maybe you're using an older versionof PHP where
> $_POST isn't available -try using print_r($_POST)
> for diagnostics.
>
> Tim Ward
> http://www.chessish.com
> mailto:timward
chessish.com
> ----- Original Message -----
> From: Steve Jackson <stephen.jackson
violasystems.com>
> To: 'Tim Ward' <timward
chessish.com>
> Sent: Monday, January 27, 2003 12:52 PM
> Subject: RE: [PHP] Update row problems
>
>
> > Ok,
> >
> > I put the query in the loop and now I get this error?
> >
> > foreach($_POST["catorder"] as $catid => $catorder)
> > {
> > $query = "update categories set catorder=$catorder where
> > catid=$catid";
> > $result = mysql_query($query) or die("Query failure: "
> > .mysql_error());
> > }
> >
> > Warning: Invalid argument supplied for foreach()
> > in
> /home/stephenj/public_html/viola/eadmin/eshop_processcatorder.php on
> > line 27
> >
> > Is it a $_POST problem? Using PHP 4.06
> >
> > Steve Jackson
> > Web Developer
> > Viola Systems Ltd.
> > http://www.violasystems.com
> > stephen.jackson
violasystems.com
> > Mobile +358 50 343 5159
> >
> >
> >
> >
> >
> > > -----Original Message-----
> > > From: Tim Ward [mailto:timward
chessish.com]
> > > Sent: 27. tammikuuta 2003 14:11
> > > To: PHP General; Steve Jackson
> > > Subject: Re: [PHP] Update row problems
> > >
> > >
> > > your query needs to be inside the foreach loop
> > > so that it runs for every item, at the moment it
> > > just runs after you've scanned through all the items
> > > so just does the last one.
> > >
> > > Tim Ward
> > > http://www.chessish.com
> > > mailto:timward
chessish.com
> > > ----- Original Message -----
> > > From: Steve Jackson <stephen.jackson
violasystems.com>
> > > To: PHP General <php-general
lists.php.net>
> > > Sent: Monday, January 27, 2003 11:46 AM
> > > Subject: [PHP] Update row problems
> > >
> > >
> > > > Hi all,
> > > >
> > > > I've been playing with this for a few hours now (over the
> > > course of a
> > > > couple of days) and it's getting frustrating!
> > > >
> > > > All I want to do is to be able to make one row in the
> > > database set the
> > > > order that my categories appear on my website. Now I can do
> > > this fine
> > > > simply by using ORDER_BY but I want to have my users be
> > > able to update
> > > > the order through an admin page like so:
> > > >
> > > > -------------------------------------
> > > > Catid | catname | catdesc | catorder |
> > > > 1 name desc 1
> > > > 2 name desc 2
> > > > 3 name desc 3
> > > > 4 name desc 4
> > > > ______________________________________
> > > >
> > > > Basically I have a form which takes data from the table
> above and
> > > > displays catname (just echoed) and catorder in a text form
> > > field. When
> > > > I submit the form I want to update catorder with whatever
> > > number the
> > > > user puts in the field.
> > > >
> > > > Currently my code updates only one of the category order
> > > numbers. So
> > > > my form code:
> > > >
> > > > <form action="eshop_processcatorder.php" method="post">
> </td></tr>
> > > > <? while ($array = mysql_fetch_array($mysql))
> > > > {
> > > > echo "<tr><td width='150'><span class='adminisoleipa'>";
> > > > echo "{$array["catname"]}";
> > > > echo "</td><td><input type='text' size='2'
> > > > name='catorder[{$array["catid"]}]'
> value='{$array["catorder"]}'>";
> > > > echo "</span></td></tr>";
> > > > }
> > > > ?>
> > > > <tr><td><br>
> > > > <input type="submit" name="Submit" value="Submit" class="nappi">
> > > > </form>
> > > >
> > > > That does everything I need it to do.
> > > >
> > > > However what am I doing wrong when I try to process it
> using this
> > > > code?
> > > >
> > > > foreach($_POST["catorder"] as $catid => $catorder)
> > > > {
> > > > $query = "update categories set catorder=$catorder where
> > > > catid=$catid"; }
> > > > $result = mysql_query($query) or die("Query failure: "
> > > > .mysql_error());
> > > > if (!$result)
> > > > {
> > > > echo "<table width='100%' border='0' cellspacing='0'
> > > > cellpadding='0' align='center' bgcolor='#629D39'>";
> > > > echo "<tr><td><img
> > > > src='images/admin_orders_administrate.gif'></td></tr>";
> > > > echo "<tr><td> </td></tr>";
> > > > echo "<tr><td><span class='adminisoleipa'>Could not change
> > > > details: please <a
> > > href='mailto:stephen.jackson
violasystems.com'>click
> > > > here</a> to email the administrator<br><br></span>";
> > > > echo "</td>";
> > > > echo "</tr>";
> > > > echo "</table>";
> > > > }
> > > > else
> > > > {
> > > > echo "<table width='100%' border='0' cellspacing='0'
> > > > cellpadding='0' align='center' bgcolor='#629D39'>"; echo
> > > > "<tr><td><img
> > > > src='images/admin_orders_administrate.gif'></td></tr>";
> > > > echo "<tr><td> </td></tr>";
> > > > echo "<tr><td><span class='adminisoleipa'>The category page has
> > > > had the order in which categories appear
> changed.<br><br></span>";
> > > > echo "</td>"; echo "</tr>";
> > > > echo "</table>";
> > > > }
> > > >
> > > > Any help appraciated.
> > > > Kind regards,
> > > >
> > > > Steve Jackson
> > > > Web Developer
> > > > Viola Systems Ltd.
> > > > http://www.violasystems.com stephen.jackson
violasystems.com
> > > > Mobile +358 50 343 5159
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
>
attached mail follows:
what version of PHP? try $HTTP_POST_VARS instead.
Tim Ward
http://www.chessish.com
mailto:timward
chessish.com
----- Original Message -----
From: Steve Jackson <stephen.jackson
violasystems.com>
To: PHP General <php-general
lists.php.net>
Sent: Monday, January 27, 2003 1:14 PM
Subject: RE: [PHP] Update row problems
> I'm processing on a different page so what would I use instead of
> $_POST?
> print_r($_POST)
> Didn't display anything or diagnose anything.
>
> Steve Jackson
> Web Developer
> Viola Systems Ltd.
> http://www.violasystems.com
> stephen.jackson
violasystems.com
> Mobile +358 50 343 5159
>
>
>
>
>
> > -----Original Message-----
> > From: Tim Ward [mailto:timward
chessish.com]
> > Sent: 27. tammikuuta 2003 14:57
> > To: Steve Jackson
> > Subject: Re: [PHP] Update row problems
> >
> >
> > sounds like $_POST[""catorder"] isn't an array - if
> > you're posting to the same page you need to wrap
> > the processing in something to test if the form has
> > been posted (e.g. is_array($_POST[""catorder"])),
> > or maybe you're using an older versionof PHP where
> > $_POST isn't available -try using print_r($_POST)
> > for diagnostics.
> >
> > Tim Ward
> > http://www.chessish.com
> > mailto:timward
chessish.com
> > ----- Original Message -----
> > From: Steve Jackson <stephen.jackson
violasystems.com>
> > To: 'Tim Ward' <timward
chessish.com>
> > Sent: Monday, January 27, 2003 12:52 PM
> > Subject: RE: [PHP] Update row problems
> >
> >
> > > Ok,
> > >
> > > I put the query in the loop and now I get this error?
> > >
> > > foreach($_POST["catorder"] as $catid => $catorder)
> > > {
> > > $query = "update categories set catorder=$catorder where
> > > catid=$catid";
> > > $result = mysql_query($query) or die("Query failure: "
> > > .mysql_error());
> > > }
> > >
> > > Warning: Invalid argument supplied for foreach()
> > > in
> > /home/stephenj/public_html/viola/eadmin/eshop_processcatorder.php on
> > > line 27
> > >
> > > Is it a $_POST problem? Using PHP 4.06
> > >
> > > Steve Jackson
> > > Web Developer
> > > Viola Systems Ltd.
> > > http://www.violasystems.com
> > > stephen.jackson
violasystems.com
> > > Mobile +358 50 343 5159
> > >
> > >
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Tim Ward [mailto:timward
chessish.com]
> > > > Sent: 27. tammikuuta 2003 14:11
> > > > To: PHP General; Steve Jackson
> > > > Subject: Re: [PHP] Update row problems
> > > >
> > > >
> > > > your query needs to be inside the foreach loop
> > > > so that it runs for every item, at the moment it
> > > > just runs after you've scanned through all the items
> > > > so just does the last one.
> > > >
> > > > Tim Ward
> > > > http://www.chessish.com
> > > > mailto:timward
chessish.com
> > > > ----- Original Message -----
> > > > From: Steve Jackson <stephen.jackson
violasystems.com>
> > > > To: PHP General <php-general
lists.php.net>
> > > > Sent: Monday, January 27, 2003 11:46 AM
> > > > Subject: [PHP] Update row problems
> > > >
> > > >
> > > > > Hi all,
> > > > >
> > > > > I've been playing with this for a few hours now (over the
> > > > course of a
> > > > > couple of days) and it's getting frustrating!
> > > > >
> > > > > All I want to do is to be able to make one row in the
> > > > database set the
> > > > > order that my categories appear on my website. Now I can do
> > > > this fine
> > > > > simply by using ORDER_BY but I want to have my users be
> > > > able to update
> > > > > the order through an admin page like so:
> > > > >
> > > > > -------------------------------------
> > > > > Catid | catname | catdesc | catorder |
> > > > > 1 name desc 1
> > > > > 2 name desc 2
> > > > > 3 name desc 3
> > > > > 4 name desc 4
> > > > > ______________________________________
> > > > >
> > > > > Basically I have a form which takes data from the table
> > above and
> > > > > displays catname (just echoed) and catorder in a text form
> > > > field. When
> > > > > I submit the form I want to update catorder with whatever
> > > > number the
> > > > > user puts in the field.
> > > > >
> > > > > Currently my code updates only one of the category order
> > > > numbers. So
> > > > > my form code:
> > > > >
> > > > > <form action="eshop_processcatorder.php" method="post">
> > </td></tr>
> > > > > <? while ($array = mysql_fetch_array($mysql))
> > > > > {
> > > > > echo "<tr><td width='150'><span class='adminisoleipa'>";
> > > > > echo "{$array["catname"]}";
> > > > > echo "</td><td><input type='text' size='2'
> > > > > name='catorder[{$array["catid"]}]'
> > value='{$array["catorder"]}'>";
> > > > > echo "</span></td></tr>";
> > > > > }
> > > > > ?>
> > > > > <tr><td><br>
> > > > > <input type="submit" name="Submit" value="Submit" class="nappi">
> > > > > </form>
> > > > >
> > > > > That does everything I need it to do.
> > > > >
> > > > > However what am I doing wrong when I try to process it
> > using this
> > > > > code?
> > > > >
> > > > > foreach($_POST["catorder"] as $catid => $catorder)
> > > > > {
> > > > > $query = "update categories set catorder=$catorder where
> > > > > catid=$catid"; }
> > > > > $result = mysql_query($query) or die("Query failure: "
> > > > > .mysql_error());
> > > > > if (!$result)
> > > > > {
> > > > > echo "<table width='100%' border='0' cellspacing='0'
> > > > > cellpadding='0' align='center' bgcolor='#629D39'>";
> > > > > echo "<tr><td><img
> > > > > src='images/admin_orders_administrate.gif'></td></tr>";
> > > > > echo "<tr><td> </td></tr>";
> > > > > echo "<tr><td><span class='adminisoleipa'>Could not change
> > > > > details: please <a
> > > > href='mailto:stephen.jackson
violasystems.com'>click
> > > > > here</a> to email the administrator<br><br></span>";
> > > > > echo "</td>";
> > > > > echo "</tr>";
> > > > > echo "</table>";
> > > > > }
> > > > > else
> > > > > {
> > > > > echo "<table width='100%' border='0' cellspacing='0'
> > > > > cellpadding='0' align='center' bgcolor='#629D39'>"; echo
> > > > > "<tr><td><img
> > > > > src='images/admin_orders_administrate.gif'></td></tr>";
> > > > > echo "<tr><td> </td></tr>";
> > > > > echo "<tr><td><span class='adminisoleipa'>The category page has
> > > > > had the order in which categories appear
> > changed.<br><br></span>";
> > > > > echo "</td>"; echo "</tr>";
> > > > > echo "</table>";
> > > > > }
> > > > >
> > > > > Any help appraciated.
> > > > > Kind regards,
> > > > >
> > > > > Steve Jackson
> > > > > Web Developer
> > > > > Viola Systems Ltd.
> > > > > http://www.violasystems.com stephen.jackson
violasystems.com
> > > > > Mobile +358 50 343 5159
> > > > >
> > > > >
> > > > > --
> > > > > PHP General Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > >
> > >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Thanks. That was the problem. Im using 4.0.6 so it's a bit out of date. Cheers,
Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
stephen.jackson
violasystems.com
Mobile +358 50 343 5159
> -----Original Message-----
> From: Tim Ward [mailto:timward
chessish.com]
> Sent: 27. tammikuuta 2003 15:32
> To: PHP General; Steve Jackson
> Subject: Re: [PHP] Update row problems
>
>
> what version of PHP? try $HTTP_POST_VARS instead.
>
> Tim Ward
> http://www.chessish.com
> mailto:timward
chessish.com
> ----- Original Message -----
> From: Steve Jackson <stephen.jackson
violasystems.com>
> To: PHP General <php-general
lists.php.net>
> Sent: Monday, January 27, 2003 1:14 PM
> Subject: RE: [PHP] Update row problems
>
>
> > I'm processing on a different page so what would I use instead of
> > $_POST?
> > print_r($_POST)
> > Didn't display anything or diagnose anything.
> >
> > Steve Jackson
> > Web Developer
> > Viola Systems Ltd.
> > http://www.violasystems.com
> > stephen.jackson
violasystems.com
> > Mobile +358 50 343 5159
> >
> >
> >
> >
> >
> > > -----Original Message-----
> > > From: Tim Ward [mailto:timward
chessish.com]
> > > Sent: 27. tammikuuta 2003 14:57
> > > To: Steve Jackson
> > > Subject: Re: [PHP] Update row problems
> > >
> > >
> > > sounds like $_POST[""catorder"] isn't an array - if
> > > you're posting to the same page you need to wrap
> > > the processing in something to test if the form has
> > > been posted (e.g. is_array($_POST[""catorder"])),
> > > or maybe you're using an older versionof PHP where
> > > $_POST isn't available -try using print_r($_POST)
> > > for diagnostics.
> > >
> > > Tim Ward
> > > http://www.chessish.com
> > > mailto:timward
chessish.com
> > > ----- Original Message -----
> > > From: Steve Jackson <stephen.jackson
violasystems.com>
> > > To: 'Tim Ward' <timward
chessish.com>
> > > Sent: Monday, January 27, 2003 12:52 PM
> > > Subject: RE: [PHP] Update row problems
> > >
> > >
> > > > Ok,
> > > >
> > > > I put the query in the loop and now I get this error?
> > > >
> > > > foreach($_POST["catorder"] as $catid => $catorder)
> > > > {
> > > > $query = "update categories set catorder=$catorder where
> > > > catid=$catid"; $result = mysql_query($query) or die("Query
> > > > failure: " .mysql_error());
> > > > }
> > > >
> > > > Warning: Invalid argument supplied for foreach()
> > > > in
> > >
> /home/stephenj/public_html/viola/eadmin/eshop_processcatorder.php on
> > > > line 27
> > > >
> > > > Is it a $_POST problem? Using PHP 4.06
> > > >
> > > > Steve Jackson
> > > > Web Developer
> > > > Viola Systems Ltd.
> > > > http://www.violasystems.com stephen.jackson
violasystems.com
> > > > Mobile +358 50 343 5159
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Tim Ward [mailto:timward
chessish.com]
> > > > > Sent: 27. tammikuuta 2003 14:11
> > > > > To: PHP General; Steve Jackson
> > > > > Subject: Re: [PHP] Update row problems
> > > > >
> > > > >
> > > > > your query needs to be inside the foreach loop
> > > > > so that it runs for every item, at the moment it
> > > > > just runs after you've scanned through all the items
> > > > > so just does the last one.
> > > > >
> > > > > Tim Ward
> > > > > http://www.chessish.com
> > > > > mailto:timward
chessish.com
> > > > > ----- Original Message -----
> > > > > From: Steve Jackson <stephen.jackson
violasystems.com>
> > > > > To: PHP General <php-general
lists.php.net>
> > > > > Sent: Monday, January 27, 2003 11:46 AM
> > > > > Subject: [PHP] Update row problems
> > > > >
> > > > >
> > > > > > Hi all,
> > > > > >
> > > > > > I've been playing with this for a few hours now (over the
> > > > > course of a
> > > > > > couple of days) and it's getting frustrating!
> > > > > >
> > > > > > All I want to do is to be able to make one row in the
> > > > > database set the
> > > > > > order that my categories appear on my website. Now I can do
> > > > > this fine
> > > > > > simply by using ORDER_BY but I want to have my users be
> > > > > able to update
> > > > > > the order through an admin page like so:
> > > > > >
> > > > > > -------------------------------------
> > > > > > Catid | catname | catdesc | catorder |
> > > > > > 1 name desc 1
> > > > > > 2 name desc 2
> > > > > > 3 name desc 3
> > > > > > 4 name desc 4
> > > > > > ______________________________________
> > > > > >
> > > > > > Basically I have a form which takes data from the table
> > > above and
> > > > > > displays catname (just echoed) and catorder in a text form
> > > > > field. When
> > > > > > I submit the form I want to update catorder with whatever
> > > > > number the
> > > > > > user puts in the field.
> > > > > >
> > > > > > Currently my code updates only one of the category order
> > > > > numbers. So
> > > > > > my form code:
> > > > > >
> > > > > > <form action="eshop_processcatorder.php" method="post">
> > > </td></tr>
> > > > > > <? while ($array = mysql_fetch_array($mysql))
> > > > > > {
> > > > > > echo "<tr><td width='150'><span
> class='adminisoleipa'>"; echo
> > > > > > "{$array["catname"]}"; echo "</td><td><input type='text'
> > > > > > size='2' name='catorder[{$array["catid"]}]'
> > > value='{$array["catorder"]}'>";
> > > > > > echo "</span></td></tr>";
> > > > > > }
> > > > > > ?>
> > > > > > <tr><td><br>
> > > > > > <input type="submit" name="Submit" value="Submit"
> > > > > > class="nappi"> </form>
> > > > > >
> > > > > > That does everything I need it to do.
> > > > > >
> > > > > > However what am I doing wrong when I try to process it
> > > using this
> > > > > > code?
> > > > > >
> > > > > > foreach($_POST["catorder"] as $catid => $catorder)
> > > > > > {
> > > > > > $query = "update categories set catorder=$catorder where
> > > > > > catid=$catid"; }
> > > > > > $result = mysql_query($query) or die("Query failure: "
> > > > > > .mysql_error());
> > > > > > if (!$result)
> > > > > > {
> > > > > > echo "<table width='100%' border='0' cellspacing='0'
> > > > > > cellpadding='0' align='center' bgcolor='#629D39'>";
> > > > > > echo "<tr><td><img
> > > > > > src='images/admin_orders_administrate.gif'></td></tr>";
> > > > > > echo "<tr><td> </td></tr>";
> > > > > > echo "<tr><td><span class='adminisoleipa'>Could not change
> > > > > > details: please <a
> > > > > href='mailto:stephen.jackson
violasystems.com'>click
> > > > > > here</a> to email the administrator<br><br></span>"; echo
> > > > > > "</td>"; echo "</tr>";
> > > > > > echo "</table>";
> > > > > > }
> > > > > > else
> > > > > > {
> > > > > > echo "<table width='100%' border='0' cellspacing='0'
> > > > > > cellpadding='0' align='center' bgcolor='#629D39'>"; echo
> > > > > > "<tr><td><img
> > > > > > src='images/admin_orders_administrate.gif'></td></tr>";
> > > > > > echo "<tr><td> </td></tr>";
> > > > > > echo "<tr><td><span class='adminisoleipa'>The
> category page has
> > > > > > had the order in which categories appear
> > > changed.<br><br></span>";
> > > > > > echo "</td>"; echo "</tr>";
> > > > > > echo "</table>";
> > > > > > }
> > > > > >
> > > > > > Any help appraciated.
> > > > > > Kind regards,
> > > > > >
> > > > > > Steve Jackson
> > > > > > Web Developer
> > > > > > Viola Systems Ltd.
> > > > > > http://www.violasystems.com
> stephen.jackson
violasystems.com
> > > > > > Mobile +358 50 343 5159
> > > > > >
> > > > > >
> > > > > > --
> > > > > > PHP General Mailing List (http://www.php.net/)
> > > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > PHP General Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > >
> > > >
> > > >
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
attached mail follows:
Hello,
Has anyone noticed strange behaviour in strap_tags
php 4.3?
We did upgrade to the latest snap yet the problem remains. For some reason
strip_tags acts weird..
-- georgep
attached mail follows:
On Mon, 27 Jan 2003, George E. Papadakis wrote:
> Hello,
>
> Has anyone noticed strange behaviour in strap_tags
php 4.3?
> We did upgrade to the latest snap yet the problem remains. For some reason
> strip_tags acts weird..
Please be specific with a short self-contained example that demonstrates your definition of "weird"
Regards, Philip
attached mail follows:
Mantas --
...and then Mantas Kriauciunas said... % ... % And what I need this script for, is, not everyone knows how to use ssh % and I don't want to give access to 50 users that can run their % processes, my server will freeze. That's why I need to change it somehow
Either your users plan to run major, major processes or your server is an old 486 with 16M of slow RAM... 50 users isn't a problem.
If your users have real accounts, let them change their own passwords and then deal with them using the server. If they don't have real accounts, then maintain your own password list or whatever authentication you wish within apache. If you're executing system programs on their behalf, set up your web server to run subprocesses as the user rather than all as the apache user -- and then one of those subprocesses could be 'passwd'.
HTH & HAND
:-D
-- David T-G * There is too much animal courage in (play) davidtgjustpickone.org * society and not sufficient moral courage. (work) davidtgwork
justpickone.org -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD)
iD8DBQE+NSznGb7uCXufRwARAsLTAJ9jSYLO3T7yzCr6dhbgB1RmNt0hqgCfciIy TWTihidzvmcUZYiAOvqIT4A= =++Sv -----END PGP SIGNATURE-----
attached mail follows:
Nicole, et al --
BellSouth, eh? I'm in Atlanta :-)
...and then Nicole said... % % Thanks. But I would think if you can run cron jobs as certain users, you % could create cron jobs for those users only. I mean, if you can do it with % CPanel or these other Control Panels, then why not? It wouldn't have to run
The reason you could do it in a control panel is that the panel process is running with special privs -- perhaps even in a separate httpd that is running as root. The way it's set up on my server is that httpd runs on port 80 and admind runs on port 88, and admind is allowed to do certain things as root *and* requires authentication before you can even get the first page of data out of it.
% as root? I have a good bit to learn about linux. I am new to getting around % in ssh. % % I am learning from the command line now. It doesn't seem too bad yet. Not % sure.
Give it all you've got and grow to love it. It's the only way to go. GUIs are for sissies. <ducks and runs>
In all "seriousity", though, the command line is incredibly powerful. I highly recommend it.
% % Thanks!
HTH & HAND
:-D
-- David T-G * There is too much animal courage in (play) davidtgjustpickone.org * society and not sufficient moral courage. (work) davidtgwork
justpickone.org -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD)
iD8DBQE+NTJ1Gb7uCXufRwARAqVVAJkBSkZZ9dxruYgGVT53b53GYe2/2gCgq6Dp Es0MFz9lZUOxigUNtn9dY1s= =dWJM -----END PGP SIGNATURE-----
attached mail follows:
Lee --
...and then Lee Herron said... % % >> I'm interested in how most would create a transition page.. % > % > One thing you might consider is using flush() to output % > what you have so far to the browser rather than sending % % The problem I'm having is that the uploading of the file takes time, and the
Ah; you're waiting for the browser to send rather than for the server to send.
I'm no expert, but I don't think there's a way to do this directly. Ideas that occur to me:
- It wouldn't work for everyone since some (such as I :-) have javascript turned off, but you could first change the page on the click and then actually submit the form and start the upload.
- You might send the just file name to upload back, get a new page containing the "please wait", and let that page request the file by name. This doesn't sound great; if you can do that, what's to keep you from getting any file you want from a surfer's computer? Maybe you can, but I'd be moderately surprised, which means I'd be moderately surprised if this approach works -- but it's worth evaluating.
HTH & HAND
:-D
-- David T-G * There is too much animal courage in (play) davidtgjustpickone.org * society and not sufficient moral courage. (work) davidtgwork
justpickone.org -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD)
iD8DBQE+NTWsGb7uCXufRwARAlW8AJ4g7FwbiHdG2F3rkdsV3TZQCj6OFwCgmiWi Kkcn6Ce6IankG9GFV/nnFTY= =Is5M -----END PGP SIGNATURE-----
attached mail follows:
Thank you Sean ,
your comment was useful for me, I was having that problem and what I was doing is changing every record in my database that have an & or ' on it
Thank you again
attached mail follows:
Sean, could you please send me how do you will do the function to convert a recordset into an XML string?
Thank You
OCTAVIO HERRERA
attached mail follows:
No , it's not sessions, it's files with php545382
and into these files , there are piece of html of my sites
Nico
"Max Tappenden" <qtpiewebster
hotmail.com> wrote in message
news:20030127072215.4833.qmail
pb1.pair.com...
> Are they things like
> php45a45s879a787g54a21s3a12g3a21s31a3a?
> If so, yup i know the feeling
> 297,548,197 of them using up 128GB of storage on my HD!
> Don't worry
> They're just sessions
> Oh and don't worry
> Unless your site is a huge wooper with 500,000 - 1,000-,000 users loggin
in
> a day, you won't get huge amounts lol
> "Nico" <nico
belcenter.com> wrote in message
> news:20030124113025.22249.qmail
pb1.pair.com...
> >
> > Hello,
> >
> > I've a lot of files named phpxxxx in my tmp folders ..
> >
> > What's these files ?
> >
> > Nico
> >
> >
>
>
attached mail follows:
It's include files.
Ex : in index.php i call index2.php , the content of index2.php 'll be written in /tmp
Nico
"Max Tappenden" <qtpiewebster
hotmail.com> wrote in message
news:20030127072215.4833.qmail
pb1.pair.com...
> Are they things like
> php45a45s879a787g54a21s3a12g3a21s31a3a?
> If so, yup i know the feeling
> 297,548,197 of them using up 128GB of storage on my HD!
> Don't worry
> They're just sessions
> Oh and don't worry
> Unless your site is a huge wooper with 500,000 - 1,000-,000 users loggin
in
> a day, you won't get huge amounts lol
> "Nico" <nico
belcenter.com> wrote in message
> news:20030124113025.22249.qmail
pb1.pair.com...
> >
> > Hello,
> >
> > I've a lot of files named phpxxxx in my tmp folders ..
> >
> > What's these files ?
> >
> > Nico
> >
> >
>
>
attached mail follows:
Hello,
I would like to make use of the function ftp_ssl_connect. Can anyone tell me an appropriate server for this function?
WU-FTP with ssl-support does not exist anymore (I read); the openssl.9.6.g port 22 (of the default config) does not seem to work.
Which server-deamon is the right one? Or must I use "cURL" ??
Thanks in advance
Markus
attached mail follows:
Hallo, does anybody knows where can I find a set of presentation sildes of the PHP language base(or PHP toghether with mysql)? . May be coming from any tutorial or previous course. Thank you very much
Ornella
attached mail follows:
On Mon, 2003-01-27 at 10:20, Ornella Fasolo wrote: > Hallo, > does anybody knows where can I find a set of presentation > sildes of the PHP language base(or PHP toghether with mysql)? . > May be coming from any tutorial or previous course. > Thank you very much >
> Ornella
--
"The computer programmer is a creator of universes for which he
alone is responsible. Universes of virtually unlimited complexity
can be created in the form of computer programs."
- Joseph Weizenbaum
attached mail follows:
Hi! I have protected a folder on my apache server with a username and password. When I browse to this folder I get a popup to type my name and password in( automatic popup by internet explorer or something ). My question is, how do I log out? I tried to destroy the session, but it didn't help.
Thanks Tommy Jensehaugen
attached mail follows:
> -----Original Message-----
> From: Tommy Jensehaugen [mailto:tommy
jensehaugen.com]
> Sent: Monday, January 27, 2003 10:32 AM
> To: php-general
lists.php.net
> Subject: [PHP] apache webprotect logout
>
> When I browse to this folder I get a popup to type my name
> and password
> in( automatic popup by internet explorer or something ).
> My question is, how do I log out?
You can't. There is no way to log out of http authentication other then closing the browser.
attached mail follows:
--- Tommy Jensehaugen <tommy
jensehaugen.com> wrote:
> I have protected a folder on my apache server with a
> username and password. When I browse to this folder
> I get a popup to type my name and password in(
> automatic popup by internet explorer or something ).
> My question is, how do I log out? I tried to destroy
> the session, but it didn't help.
Probably because there is no session. It sounds like you are talking about HTTP basic authentication. This form of authentication requires the browser to authenticate itself with every single request. Thus, there is no idea of being "logged in", because this does not require any state management.
However, browsers will try to be helpful and re-send the same authentication credentials, so that you don't get prompted every time for a username and password. This is what makes it seem as if you are logged in.
Some people do things such as change the realm whenever they want to make it seem as if the user is logged out. You will only be able to do this type of thing with PHP (as opposed to letting your Web server handle it). I think the user notes on HTTP authentication have many suggestions that might help you out:
http://www.php.net/manual/en/features.http-auth.php
Chris
attached mail follows:
Hi, I have a form with an IFRAME nested in it. When the form is submitted, I can't get the values of the checkboxes in the IFRAME, is there any way to do this? Thanks! -Greg
attached mail follows:
--- Greg <gregchagnon
hotmail.com> wrote:
> Hi, I have a form with an IFRAME nested in it. When
> the form is submitted, I can't get the values of the
> checkboxes in the IFRAME, is there any way to do
> this?
Well, I think (I could be wrong) you're looking at this wrong.
Forms submit to resources identified by URLs. You specify this with the action attribute of the form tag. There is no idea of frames here.
If you mean that the resource that your iframe loads does not have access to the form variables, then change your action attribute to that resource, and then it will.
Chris
attached mail follows:
Here's the basic layout of my html page, this isn't the real html, just the basic idea.
<html> <form action="test.php" method="post"> <input type="text" name="test1">
<iframe src = iframetest.php></iframe>
<input type="button" label="Submit"> </form> </html>
Now inside iframetest.php I have a few check boxes that I want test.php to be able to access. Is there any way to do this? Thanks!!
"Chris Shiflett" <shiflett
php.net> wrote in message
news:20030127161720.34512.qmail
web14305.mail.yahoo.com...
> --- Greg <gregchagnon
hotmail.com> wrote:
> > Hi, I have a form with an IFRAME nested in it. When
> > the form is submitted, I can't get the values of the
> > checkboxes in the IFRAME, is there any way to do
> > this?
>
> Well, I think (I could be wrong) you're looking at this
> wrong.
>
> Forms submit to resources identified by URLs. You specify
> this with the action attribute of the form tag. There is no
> idea of frames here.
>
> If you mean that the resource that your iframe loads does
> not have access to the form variables, then change your
> action attribute to that resource, and then it will.
>
> Chris
attached mail follows:
Greg wrote: > Here's the basic layout of my html page, this isn't the real html, just the > basic idea. > > <html> > <form action="test.php" method="post"> > <input type="text" name="test1"> > > <iframe src = iframetest.php></iframe> > > <input type="button" label="Submit"> > </form> > </html> > > Now inside iframetest.php I have a few check boxes that I want test.php to > be able to access. Is there any way to do this? > Thanks!! > >
not directly ..
the form does not 'contain' the iframe - in fact the iframe is a different page ...
so form elements within the iframe page will not be a part of the form submission process
you /might/ be able to do something with javascript inter-frame communication - but I doubt you would want to (and the iframe doesn't sound like a valid page which could cause problems)
what would probably make more sense would be to make the 'html' page include iframetest.php'
html.php ----------
<html> <form action="test.php" method="post"> <input type="text" name="test1">
<?php include("/path/iframetest.php"); ?>
<input type="button" label="Submit"> </form> </html>
-----------------
then you form elements will be properly contained within the form
--Sean
attached mail follows:
> Here's the basic layout of my html page, this isn't the real html, just > the > basic idea. > > <html> > <form action="test.php" method="post"> > <input type="text" name="test1"> > > <iframe src = iframetest.php></iframe> > > <input type="button" label="Submit"> > </form> > </html> > > Now inside iframetest.php I have a few check boxes that I want test.php to > be able to access. Is there any way to do this?
If you set a hidden form element in iframetest.php, does it show up when you do a print_r($_POST) in test.php ?
It's probably an HTML thing. I don't know how iframes are interpreted, but it's probably not really a part of your form, even though it looks like it is when you view it.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
attached mail follows:
Unfortunatly, that gets rid of the reason I have the iframe in there to begin with. I need a scrollable iframe with a set of buttons that perform certain actions at the top, that have to always be at the top. -Greg
"Sean Burlington" <sean
uncertainty.org.uk> wrote in message
news:3E356875.20605
uncertainty.org.uk...
> Greg wrote:
> > Here's the basic layout of my html page, this isn't the real html, just
the
> > basic idea.
> >
> > <html>
> > <form action="test.php" method="post">
> > <input type="text" name="test1">
> >
> > <iframe src = iframetest.php></iframe>
> >
> > <input type="button" label="Submit">
> > </form>
> > </html>
> >
> > Now inside iframetest.php I have a few check boxes that I want test.php
to
> > be able to access. Is there any way to do this?
> > Thanks!!
> >
> >
>
> not directly ..
>
> the form does not 'contain' the iframe - in fact the iframe is a
> different page ...
>
> so form elements within the iframe page will not be a part of the form
> submission process
>
> you /might/ be able to do something with javascript inter-frame
> communication - but I doubt you would want to (and the iframe doesn't
> sound like a valid page which could cause problems)
>
> what would probably make more sense would be to make the 'html' page
> include iframetest.php'
>
> html.php
> ----------
>
> <html>
> <form action="test.php" method="post">
> <input type="text" name="test1">
>
> <?php include("/path/iframetest.php"); ?>
>
> <input type="button" label="Submit">
> </form>
> </html>
>
> -----------------
>
> then you form elements will be properly contained within the form
>
> --
>
> Sean
>
attached mail follows:
> It's probably an HTML thing. I don't know how iframes are interpreted, > but it's probably not really a part of your form, even though it looks > like it is when you view it.
The contents of an IFRAME, by definition, is a totally different document. It behaves for all intents and purposes as a normal frame except that it appears inline. You may or may not be able to access the contents via the DOM of the document it is part of - I've never tried. But in any case, it will not be posted as part of the form.
Chris
attached mail follows:
> Unfortunatly, that gets rid of the reason I have the iframe in there to > begin with. I need a scrollable iframe with a set of buttons that perform > certain actions at the top, that have to always be at the top. > -Greg
Then put the entire <form> into the iframe.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
attached mail follows:
But the buttons are outside of the iframe, so that no matter how large the frame gets, the buttons are always in the same place :/ -Greg
"John W. Holmes" <holmes072000
charter.net> wrote in message
news:000501c2c629$f98c8590$7c02a8c0
coconut...
> > Unfortunatly, that gets rid of the reason I have the iframe in there
> to
> > begin with. I need a scrollable iframe with a set of buttons that
> perform
> > certain actions at the top, that have to always be at the top.
> > -Greg
>
> Then put the entire <form> into the iframe.
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
>
attached mail follows:
Greg wrote: > Unfortunatly, that gets rid of the reason I have the iframe in there to > begin with. I need a scrollable iframe with a set of buttons that perform > certain actions at the top, that have to always be at the top. > -Greg > >
in that case you either need to try getting some javascript to pass the info between frames - or see if there is some style sheet wizadry (fixed size divs, visible area, clipping ...???) that will produce the same effect on an acceptable proportion of browsers
> "Sean Burlington" <sean
uncertainty.org
.uk> wrote in message
> news:3E356875.20605
uncertainty.org.uk...
>
>>Greg wrote:
>>
>>>Here's the basic layout of my html page, this isn't the real html, just
>
> the
>
>>>basic idea.
>>>
>>><html>
>>><form action="test.php" method="post">
>>><input type="text" name="test1">
>>>
>>><iframe src = iframetest.php></iframe>
>>>
>>><input type="button" label="Submit">
>>></form>
>>></html>
>>>
>>>Now inside iframetest.php I have a few check boxes that I want test.php
>
> to
>
>>>be able to access. Is there any way to do this?
>>>Thanks!!
>>>
>>>
>>
>>not directly ..
>>
>> the form does not 'contain' the iframe - in fact the iframe is a
>>different page ...
>>
>>so form elements within the iframe page will not be a part of the form
>>submission process
>>
>>you /might/ be able to do something with javascript inter-frame
>>communication - but I doubt you would want to (and the iframe doesn't
>>sound like a valid page which could cause problems)
>>
>>what would probably make more sense would be to make the 'html' page
>>include iframetest.php'
>>
>>html.php
>>----------
>>
>><html>
>><form action="test.php" method="post">
>><input type="text" name="test1">
>>
>><?php include("/path/iframetest.php"); ?>
>>
>> <input type="button" label="Submit">
>> </form>
>> </html>
>>
>>-----------------
>>
>>then you form elements will be properly contained within the form
>>
>>--
>>
>>Sean
>>
>
>
>
>
attached mail follows:
Hi Greg,
> But the buttons are outside of the iframe, so that no matter how > large the frame gets, the buttons are always in the same place :/
So stick an image of the button outside the <iframe>, wrap it in an <a>, and use the onclick handler to call a javascript function that submits the form. Of course, this will break for anyone who doesn't have javascript enabled (some estimates put this as high as 20%, but it depends on your audience).
Alternatively, put your form inside a <div> with a fixed height and width, and the overflow property set to "scroll" or "auto". This should behave in much the same way as your <iframe>, but with everything on the same page. Again, this will break for some users (those whose browsers *cough*NN4*cough* don't support fixed positioning and overflow), but at least it degrades more gracefully than the scripted solution.
Thirdly, if you provide a link to a sample page, someone might be able to come up with a way to rework your form so you can avoid all this entirely :-)
Cheers Jon
attached mail follows:
hmm.. it'll get real ugly with javascript,but this works with newer browsers. ...iframe has a name ...main page has a hidden form field with id checkbox in the iframe has id also
iframe.php <html> <head> <script> function submit_form(){
if(frames["myiframe"].document.getElementById("one").checked == true){//see if the checkbox in iframe is checked // if it is checked assign it's value to the hidden field in this page document.getElementById("one_copy").value = frames["myiframe"].document.getElementById("one").value; } document.form1.submit(); } </script> </head>
<body> <?php if($_POST['test1']){ echo $_POST['test1'] . '<br />' . $_POST['one_copy']; } ?> <form name="form1" action="iframe.php" method="post"> <input type="text" name="test1"><br>
<iframe name ="myiframe" src = iframetest.htm></iframe><br> <input type="hidden" id="one_copy" name="one_copy" value=""> <input type="button" value="sub" onclick="submit_form()"> </form> </body> </html>
iframetest.htm <html> <body> <form> <input type="checkbox" id="one" name="one" value="hello"> </form> </body> </html>
----- Original Message -----
From: "John W. Holmes" <holmes072000
charter.net>
To: "'Greg'" <gregchagnon
hotmail.com>; <php-general
lists.php.net>
Sent: Monday, January 27, 2003 5:31 PM
Subject: RE: [PHP] IFRAMES & PHP
> > Unfortunatly, that gets rid of the reason I have the iframe in there > to > > begin with. I need a scrollable iframe with a set of buttons that > perform > > certain actions at the top, that have to always be at the top. > > -Greg > > Then put the entire <form> into the iframe. > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
Thank you guys for all the help, I'll try a few of these things, if not I'll just redesign the page. -Greg
"Adrian Murphy
2020tourism.Com" <adrian.murphy
2020tourism.com> wrote in
message news:00e001c2c631$b402e160$1a8f43d9
ADE2...
> hmm.. it'll get real ugly with javascript,but this works with newer
> browsers.
> ...iframe has a name
> ...main page has a hidden form field with id checkbox in the iframe has
id
> also
>
> iframe.php
> <html>
> <head>
> <script>
> function submit_form(){
>
> if(frames["myiframe"].document.getElementById("one").checked ==
true){//see
> if the checkbox in iframe is checked
> // if it is checked assign it's value to the hidden field in this page
> document.getElementById("one_copy").value =
> frames["myiframe"].document.getElementById("one").value;
> }
> document.form1.submit();
> }
> </script>
> </head>
>
> <body>
> <?php
> if($_POST['test1']){
> echo $_POST['test1'] . '<br />' . $_POST['one_copy'];
> }
> ?>
> <form name="form1" action="iframe.php" method="post">
> <input type="text" name="test1"><br>
>
> <iframe name ="myiframe" src = iframetest.htm></iframe><br>
> <input type="hidden" id="one_copy" name="one_copy" value="">
> <input type="button" value="sub" onclick="submit_form()">
> </form>
> </body>
> </html>
>
>
> iframetest.htm
> <html>
> <body>
> <form>
> <input type="checkbox" id="one" name="one" value="hello">
> </form>
> </body>
> </html>
>
>
>
> ----- Original Message -----
> From: "John W. Holmes" <holmes072000
charter.net>
> To: "'Greg'" <gregchagnon
hotmail.com>; <php-general
lists.php.net>
> Sent: Monday, January 27, 2003 5:31 PM
> Subject: RE: [PHP] IFRAMES & PHP
>
>
> > > Unfortunatly, that gets rid of the reason I have the iframe in there
> > to
> > > begin with. I need a scrollable iframe with a set of buttons that
> > perform
> > > certain actions at the top, that have to always be at the top.
> > > -Greg
> >
> > Then put the entire <form> into the iframe.
> >
> > ---John W. Holmes...
> >
> > PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> > today. http://www.phparch.com/
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
attached mail follows:
With this script under, I get resized image in only 16 colors. with an old version of gd, I got 16 million colors images. Has someone a response ?
<?PHP /******************* file [string] -> filename jpg w [int] -> width ********************/
header("Content-type: image/png");
$file = urldecode($file); $file = "../".$file;
$infofile = getimagesize($file); $long = $infofile[1]; $haut = $infofile[0]; $type = $infofile[2];
if ($long<$w) $w=$long;
$ratio = $haut / $w; $h = $long / $ratio;
if ($h>$w) { $h = $w; $ratio = $long / $w; $w = $haut / $ratio; }
$h = (int)$h;
$dst_img = ImageCreate($w, $h); $background_color = ImageColorAllocate ($dst_img, 0, 0, 0);
switch ($type) { case 1 : $src_img=ImageCreateFromGif($file); break; case 2 : $src_img=ImageCreateFromJpeg($file); break; case 3 : $src_img=ImageCreateFromPng($file); break; case 6 : $src_img=imagecreatefromwbmp($file); break; default : ImagePng($dst_img);
}
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $w, $h, ImageSX($src_img), ImageSY($src_img)); imagepng($dst_img);
attached mail follows:
Hi experienced the same problem with the new bundled version of GD.
regards, philipp
----- Original Message -----
From: "Jean-François Marseaut" <jfmarseaut
studyssimo.be>
To: <php-general
lists.php.net>
Sent: Monday, January 27, 2003 5:15 PM
Subject: [PHP] question about GD and colors
> With this script under, I get resized image in only 16 colors. with an old > version of gd, I got 16 million colors images. Has someone a response ? > > > <?PHP > /******************* > file [string] -> filename jpg > w [int] -> width > ********************/ > > header("Content-type: image/png"); > > $file = urldecode($file); > $file = "../".$file; > > $infofile = getimagesize($file); > $long = $infofile[1]; > $haut = $infofile[0]; > $type = $infofile[2]; > > if ($long<$w) $w=$long; > > > $ratio = $haut / $w; > $h = $long / $ratio; > > if ($h>$w) > { > $h = $w; > $ratio = $long / $w; > $w = $haut / $ratio; > } > > > $h = (int)$h; > > $dst_img = ImageCreate($w, $h); > $background_color = ImageColorAllocate ($dst_img, 0, 0, 0); > > switch ($type) > { > case 1 : > $src_img=ImageCreateFromGif($file); > break; > case 2 : > $src_img=ImageCreateFromJpeg($file); > break; > case 3 : > $src_img=ImageCreateFromPng($file); > break; > case 6 : > $src_img=imagecreatefromwbmp($file); > break; > default : > ImagePng($dst_img); > > } > > imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $w, $h, > ImageSX($src_img), ImageSY($src_img)); > imagepng($dst_img); > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
try imagecreatetruecolor() instead of imagecreate()
----- Original Message -----
From: "Philipp" <kernel
cyberraum.de>
To: "Jean-François Marseaut" <jfmarseaut
studyssimo.be>;
<php-general
lists.php.net>
Sent: Monday, January 27, 2003 4:21 PM
Subject: Re: [PHP] question about GD and colors
> Hi experienced the same problem with the new
> bundled version of GD.
>
> regards,
> philipp
>
>
> ----- Original Message -----
> From: "Jean-François Marseaut" <jfmarseaut
studyssimo.be>
> To: <php-general
lists.php.net>
> Sent: Monday, January 27, 2003 5:15 PM
> Subject: [PHP] question about GD and colors
>
>
> > With this script under, I get resized image in only 16 colors. with an
old
> > version of gd, I got 16 million colors images. Has someone a response ?
> >
> >
> > <?PHP
> > /*******************
> > file [string] -> filename jpg
> > w [int] -> width
> > ********************/
> >
> > header("Content-type: image/png");
> >
> > $file = urldecode($file);
> > $file = "../".$file;
> >
> > $infofile = getimagesize($file);
> > $long = $infofile[1];
> > $haut = $infofile[0];
> > $type = $infofile[2];
> >
> > if ($long<$w) $w=$long;
> >
> >
> > $ratio = $haut / $w;
> > $h = $long / $ratio;
> >
> > if ($h>$w)
> > {
> > $h = $w;
> > $ratio = $long / $w;
> > $w = $haut / $ratio;
> > }
> >
> >
> > $h = (int)$h;
> >
> > $dst_img = ImageCreate($w, $h);
> > $background_color = ImageColorAllocate ($dst_img, 0, 0, 0);
> >
> > switch ($type)
> > {
> > case 1 :
> > $src_img=ImageCreateFromGif($file);
> > break;
> > case 2 :
> > $src_img=ImageCreateFromJpeg($file);
> > break;
> > case 3 :
> > $src_img=ImageCreateFromPng($file);
> > break;
> > case 6 :
> > $src_img=imagecreatefromwbmp($file);
> > break;
> > default :
> > ImagePng($dst_img);
> >
> > }
> >
> > imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $w, $h,
> > ImageSX($src_img), ImageSY($src_img));
> > imagepng($dst_img);
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Hi Adrian,
thank you very much, that solved my problem.
Regards, Philipp
----- Original Message -----
From: "adrian murphy
2020tourism.com" <adrian.murphy
2020tourism.com>
To: "Philipp" <kernel
cyberraum.de>; "Jean-François Marseaut"
<jfmarseaut
studyssimo.be>; <php-general
lists.php.net>
Sent: Monday, January 27, 2003 6:10 PM
Subject: Re: [PHP] question about GD and colors
> try imagecreatetruecolor() instead of imagecreate()
>
> ----- Original Message -----
> From: "Philipp" <kernel
cyberraum.de>
> To: "Jean-François Marseaut" <jfmarseaut
studyssimo.be>;
> <php-general
lists.php.net>
> Sent: Monday, January 27, 2003 4:21 PM
> Subject: Re: [PHP] question about GD and colors
>
>
> > Hi experienced the same problem with the new
> > bundled version of GD.
> >
> > regards,
> > philipp
> >
> >
> > ----- Original Message -----
> > From: "Jean-François Marseaut" <jfmarseaut
studyssimo.be>
> > To: <php-general
lists.php.net>
> > Sent: Monday, January 27, 2003 5:15 PM
> > Subject: [PHP] question about GD and colors
> >
> >
> > > With this script under, I get resized image in only 16 colors. with an
> old
> > > version of gd, I got 16 million colors images. Has someone a response
?
> > >
> > >
> > > <?PHP
> > > /*******************
> > > file [string] -> filename jpg
> > > w [int] -> width
> > > ********************/
> > >
> > > header("Content-type: image/png");
> > >
> > > $file = urldecode($file);
> > > $file = "../".$file;
> > >
> > > $infofile = getimagesize($file);
> > > $long = $infofile[1];
> > > $haut = $infofile[0];
> > > $type = $infofile[2];
> > >
> > > if ($long<$w) $w=$long;
> > >
> > >
> > > $ratio = $haut / $w;
> > > $h = $long / $ratio;
> > >
> > > if ($h>$w)
> > > {
> > > $h = $w;
> > > $ratio = $long / $w;
> > > $w = $haut / $ratio;
> > > }
> > >
> > >
> > > $h = (int)$h;
> > >
> > > $dst_img = ImageCreate($w, $h);
> > > $background_color = ImageColorAllocate ($dst_img, 0, 0, 0);
> > >
> > > switch ($type)
> > > {
> > > case 1 :
> > > $src_img=ImageCreateFromGif($file);
> > > break;
> > > case 2 :
> > > $src_img=ImageCreateFromJpeg($file);
> > > break;
> > > case 3 :
> > > $src_img=ImageCreateFromPng($file);
> > > break;
> > > case 6 :
> > > $src_img=imagecreatefromwbmp($file);
> > > break;
> > > default :
> > > ImagePng($dst_img);
> > >
> > > }
> > >
> > > imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $w, $h,
> > > ImageSX($src_img), ImageSY($src_img));
> > > imagepng($dst_img);
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
attached mail follows:
Hi,
I've managed to get Windows IE to pick up on most of my $_SESSION variables once a user clicks the 'Back' button using the following code in the base form:
'value=<?php if(!empty($_SESSION['rfname'])) echo $_SESSION['rfname']; ?>'
However, when I try this approach for a muliple SELECT dropdown box that is loaded by a 'require' statement, it doesn't pass the info. I've tried to isolate the individual components:
<?php require("dobdod.fdd");
if(!empty($_PST['bday'])) echo $_POST['bday']; if(!empty($_POST['bmonth'])) echo $_POST['bmonth']; if(!empty($_POST['birth'])) echo $_POST['birth'];
if(!empty($_POST['dday'])) echo $_POST['dday']; if(!empty($_POST['dmonth'])) echo $_POST['dmonth']; if(!empty($_POST['death'])) echo $_POST['death']; ?>
Btw, the base form calls another form, which displays an error message. Once the 'Back' button is clicked, the base form reappears. [I've also tried putting a <?php . . . ?> around each if(!empty . . .); statement above with same result.]
Any ideas what I'm doing wrong? I've been at this one for a couple of weeks, and nothing seems top work. Is it possible to pass the info back to the base form?
Tia, Andre
attached mail follows:
> I've managed to get Windows IE to pick up on most of my $_SESSION variables > once a user clicks the 'Back' button using the following code in the base > form: > > 'value=<?php if(!empty($_SESSION['rfname'])) echo $_SESSION['rfname']; ?>' > > However, when I try this approach for a muliple SELECT dropdown box that is > loaded by a 'require' statement, it doesn't pass the info. I've tried to > isolate the individual components: > > <?php require("dobdod.fdd"); > > if(!empty($_PST['bday'])) echo $_POST['bday']; > if(!empty($_POST['bmonth'])) echo $_POST['bmonth']; > if(!empty($_POST['birth'])) echo $_POST['birth']; > > if(!empty($_POST['dday'])) echo $_POST['dday']; > if(!empty($_POST['dmonth'])) echo $_POST['dmonth']; > if(!empty($_POST['death'])) echo $_POST['death']; > ?> > > Btw, the base form calls another form, which displays an error message. Once > the 'Back' button is clicked, the base form reappears. [I've also tried > putting a <?php . . . ?> around each if(!empty . . .); statement above with > same result.] > > Any ideas what I'm doing wrong? I've been at this one for a couple of weeks, > and nothing seems top work. Is it possible to pass the info back to the base > form?
SELECT boxes work differently from text boxes. To set a select box to a certain value, you need to put SELECTED into the option tag, like:
<option value="some_value" SELECTED>Text Value</option>
So, you need to create some loop or test to see where you should put the SELECTED. For short lists, doing something like:
<option value="some_value" <? if(isset($_SESSION['select']) && $_SESSION['select'] == 'some_value') { echo " SELECTED"; }?>>Text Value</option>
For larger lists, it's easier to put the values into an array and make a function that loops through and test each value for where to put the SELECTED text.
Hope that helps.
---John Holmes...
attached mail follows:
On Monday 27 January 2003 11:46 am, 1LT John W. Holmes wrote: > > I've managed to get Windows IE to pick up on most of my $_SESSION > > variables > > > once a user clicks the 'Back' button using the following code in the base > > form: > > > > 'value=<?php if(!empty($_SESSION['rfname'])) echo $_SESSION['rfname']; > > ?>' > > > > However, when I try this approach for a muliple SELECT dropdown box that > > is > > > loaded by a 'require' statement, it doesn't pass the info. I've tried to > > isolate the individual components: > > > > <?php require("dobdod.fdd"); > > > > if(!empty($_PST['bday'])) echo $_POST['bday']; > > if(!empty($_POST['bmonth'])) echo $_POST['bmonth']; > > if(!empty($_POST['birth'])) echo $_POST['birth']; > > > > if(!empty($_POST['dday'])) echo $_POST['dday']; > > if(!empty($_POST['dmonth'])) echo $_POST['dmonth']; > > if(!empty($_POST['death'])) echo $_POST['death']; > > ?> > > > > Btw, the base form calls another form, which displays an error message. > > Once > > > the 'Back' button is clicked, the base form reappears. [I've also tried > > putting a <?php . . . ?> around each if(!empty . . .); statement above > > with > > > same result.] > > > > Any ideas what I'm doing wrong? I've been at this one for a couple of > > weeks, > > > and nothing seems top work. Is it possible to pass the info back to the > > base > > > form? > > SELECT boxes work differently from text boxes. To set a select box to a > certain value, you need to put SELECTED into the option tag, like: > > <option value="some_value" SELECTED>Text Value</option> > > So, you need to create some loop or test to see where you should put the > SELECTED. For short lists, doing something like: > > <option value="some_value" <? if(isset($_SESSION['select']) && > $_SESSION['select'] == 'some_value') { echo " SELECTED"; }?>>Text > Value</option> > > For larger lists, it's easier to put the values into an array and make a > function that loops through and test each value for where to put the > SELECTED text. > > Hope that helps. > > ---John Holmes...
Thanks John,
Great to get your excellent advice again. I've been off-list for a few months.
Never thought of doing the extra coding IN the require file! That's probably why it didn't work.
I tried to pick up the values from $_POST (as above). In Linux, it works: (i.e. I can pick them up, display them, and manipulate them using the code above), but in IE something like $_POST['bday'] never shows up. Any idea why there's such a difference between OS behavior?
Tia, Andre
attached mail follows:
> I tried to pick up the values from $_POST (as above). In Linux, it works: > (i.e. I can pick them up, display them, and manipulate them using the code > above), but in IE something like $_POST['bday'] never shows up. Any idea > why > there's such a difference between OS behavior?
No. $_POST['bday'] should always show up, regardless of OS, if the scripts and PHP version are the same. Double check your logic.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
attached mail follows:
Thanks John,
I sort of thought that it should work. Will do as you suggest.
Regards, Andre
On Monday 27 January 2003 12:28 pm, John W. Holmes wrote: > > I tried to pick up the values from $_POST (as above). In Linux, it > > works: > > (i.e. I can pick them up, display them, and manipulate them using the > > code > > > above), but in IE something like $_POST['bday'] never shows up. Any > > idea > > > why > > there's such a difference between OS behavior? > > No. $_POST['bday'] should always show up, regardless of OS, if the > scripts and PHP version are the same. Double check your logic. > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/
attached mail follows:
Is there any environment/Global variable in PHP that indicates whether the server port you connect to is SSL port?
Thanks!
Wei
attached mail follows:
On Mon, 27 Jan 2003, Wei Weng wrote:
> Is there any environment/Global variable in PHP that indicates whether the > server port you connect to is SSL port?
$_SERVER['HTTPS']
Regards, Philip
attached mail follows:
Thanks for the prompt reply!
One more question, do you know how PHP implements this variable? In other words, how does PHP detect whether the connection is SSLed or not? (Specific to apache)
Thanks!
Wei
----- Original Message -----
From: "Philip Olson" <philip
cornado.com>
To: "Wei Weng" <wweng
kencast.com>
Cc: <php-general
lists.php.net>
Sent: Monday, January 27, 2003 12:19 PM
Subject: Re: [PHP] Question about SSL/php globals
> > On Mon, 27 Jan 2003, Wei Weng wrote: > > > Is there any environment/Global variable in PHP that indicates whether the > > server port you connect to is SSL port? > > $_SERVER['HTTPS'] > > Regards, > Philip > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
Do php extension need to be thread-safe? I am running php on apache2. I would guess that since it's compiled in as a module, it would need to be thread-safe correct?
Josh.
attached mail follows:
Hi guys, I am looking for a very simple login script that logs a person in with a unique login username/password and then logs them into a very basic control panel where they can upload image files and delete them. Can anybody help me out that would be much appreciated.
Cheers, Ian.
attached mail follows:
> Hi guys, I am looking for a very simple login script that logs a person > in with a unique login username/password and then logs them into a very > basic control panel where they can upload image files and delete them. > Can anybody help me out that would be much appreciated.
www.hotscripts.com www.sourceforge.net www.phpclasses.org
Unless you want to send me a very simple check to write it for you?? :)
---John Holmes...
attached mail follows:
Found a PHP bug, I'm using PHP version 4.2.3. I have been struggling with why PHP code failed to work with the month is August or September, so I have been playing around it and found the problem. I recently wrote a demo script for you all to play around with. Let me know which PHP version does this bug not affected you.... I'm going to file a PHP bug at http://bug.php.net...... I'll let you know where PHP bug # is it. To tell you the truth, I don't know how to search for existing bug on this one if there is any because I don't know if it is an if-statement issue or if it is something else.... Feel free to submit a patch if you know how.
Let me know what you found and post it here...
--clip-- <? //Sample Code..... ================================================== $VARIABLE[0] = "2002-01"; $VARIABLE[1] = "2002-02"; $VARIABLE[2] = "2002-03"; $VARIABLE[3] = "2002-04"; $VARIABLE[4] = "2002-05"; $VARIABLE[5] = "2002-06"; $VARIABLE[6] = "2002-07"; $VARIABLE[7] = "2002-08"; $VARIABLE[8] = "2002-09"; $VARIABLE[9] = "2002-10"; $VARIABLE[10] = "2002-11"; $VARIABLE[11] = "2002-12";
//Loop Code to check the variable.... =============================== for ($x=0;$x<12;$x++) { $month = substr($VARIABLE[$x],5,2);
echo "The # of month is ".$x."<br>";
if ($month == 01) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 02) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 03) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 04) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 05) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 06) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 07) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 08) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 09) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 10) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 11) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 12) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; }
echo "<br>"; }
//Strange Workaround to 08 and 09 =================================== echo "Strange Workaround to the Problem!!<br><br>";
$month = substr($VARIABLE[7],5,2); echo "The # of month is 08<br>"; if (trim($month) == 8) { echo "It's working!!!<br>"; }
$month = substr($VARIABLE[8],5,2); echo "The # of month is 09<br>"; if (trim($month) == 9) { echo "It's working!!!<br>"; }
//Testing (Should this be working or not??) ========================= echo "<br><br>"; $month = substr($VARIABLE[0],5,2); echo "The # of month is 1<br>"; if (trim($month) == 1) { //With "1" as an integer... echo "It's working!!!<br>"; }
echo "<br>"; $month = substr($VARIABLE[0],5,2); echo "The # of month is 01<br>"; if (trim($month) == 01) { //With "01" as an integer echo "It's working!!!<br>"; }
echo "<br>"; $month = substr($VARIABLE[0],5,2); echo "The # of month is 1<br>"; if (trim($month) == "1") { //With "1" as an integer... echo "It's working!!!<br>"; }
echo "<br>"; $month = substr($VARIABLE[0],5,2); echo "The # of month is 01<br>"; if (trim($month) == "01") { //With "01" as an integer echo "It's working!!!<br>"; } ?> --clip--
attached mail follows:
On Tuesday 28 January 2003 03:56, Scott Fletcher wrote: > Found a PHP bug, I'm using PHP version 4.2.3. I have been struggling with > why PHP code failed to work with the month is August or September, so I > have been playing around it and found the problem. I recently wrote a demo > script for you all to play around with. Let me know which PHP version does > this bug not affected you.... I'm going to file a PHP bug at > http://bug.php.net...... I'll let you know where PHP bug # is it. To tell > you the truth, I don't know how to search for existing bug on this one if > there is any because I don't know if it is an if-statement issue or if it > is something else.... Feel free to submit a patch if you know how. > > Let me know what you found and post it here... > > --clip--
[snip]
> if ($month == 01) { echo "It's a Match!!<br>"; } else { echo "It's > not a Match!!<br>"; } > if ($month == 02) { echo "It's a Match!!<br>"; } else { echo "It's > not a Match!!<br>"; } > if ($month == 03) { echo "It's a Match!!<br>"; } else { echo "It's > not a Match!!<br>"; } > if ($month == 04) { echo "It's a Match!!<br>"; } else { echo "It's > not a Match!!<br>"; } > if ($month == 05) { echo "It's a Match!!<br>"; } else { echo "It's > not a Match!!<br>"; } > if ($month == 06) { echo "It's a Match!!<br>"; } else { echo "It's > not a Match!!<br>"; } > if ($month == 07) { echo "It's a Match!!<br>"; } else { echo "It's > not a Match!!<br>"; } > if ($month == 08) { echo "It's a Match!!<br>"; } else { echo "It's > not a Match!!<br>"; } > if ($month == 09) { echo "It's a Match!!<br>"; } else { echo "It's > not a Match!!<br>"; }
Have a look at the manual > Types > Integers
-- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* I'm having a BIG BANG THEORY!! */
attached mail follows:
> -----Original Message-----
> From: Scott Fletcher [mailto:scott
abcoa.com]
>
> Found a PHP bug, I'm using PHP version 4.2.3. I have been
> struggling with
> why PHP code failed to work with the month is August or
> September
I stumbled into this one a short while ago myself. It is not a bug, but a feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP interprets them as octal numbers (because of the leading 0). However, 08 and 09 are invalid octal numbers, so PHP converts them to zero.
The fixes are numerous: - remove the leading zero; - add zero to them before passing (addition forces a type conversion to int); - force a type conversion to integer using (int); - quote them (when PHP converts a string to an integer, it removes the leading zero);
Kirk
attached mail follows:
I don't see why a string wouldn't work when I use "08" (string) and match it against the integer 8, or 08.
"Kirk Johnson" <kjohnson
zootweb.com> wrote in message
news:B11731D518B5D61183C700A0C98BE0D9FFBE5D
chef...
>
> > -----Original Message-----
> > From: Scott Fletcher [mailto:scott
abcoa.com]
> >
> > Found a PHP bug, I'm using PHP version 4.2.3. I have been
> > struggling with
> > why PHP code failed to work with the month is August or
> > September
>
> I stumbled into this one a short while ago myself. It is not a bug, but a
> feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP interprets
> them as octal numbers (because of the leading 0). However, 08 and 09 are
> invalid octal numbers, so PHP converts them to zero.
>
> The fixes are numerous:
> - remove the leading zero;
> - add zero to them before passing (addition forces a type conversion to
> int);
> - force a type conversion to integer using (int);
> - quote them (when PHP converts a string to an integer, it removes the
> leading zero);
>
> Kirk
attached mail follows:
--- Scott Fletcher <scott
abcoa.com> wrote:
> Found a PHP bug
...
> if ($month == 01)
I guess you mean:
if ($month == '01')
If so, this is not a bug. Otherwise, please explain what you think is wrong.
Chris
attached mail follows:
Scott,
Because "8" != 8. "8" (and "08") is a string with the numerals representing the number eight. It is not the number eight. (think back to basic math, the difference between a number and a numeral)
PHP does some conversions for you automatically but that just saves you from yourself. (Personally, I wish it wouldn't. People have more trouble *because* of the automatic conversions than they would if they had to do the converting themselves.)
To keep from running into this simply do the conversions yourself before you do comparisons.
intval("08")==8
=C=
* * Cal Evans * Stay plugged into your audience. * http://www.christianperformer.com *
-----Original Message-----
From: Scott Fletcher [mailto:scott
abcoa.com]
Sent: Monday, January 27, 2003 2:14 PM
To: php-general
lists.php.net
Subject: Re: [PHP] Found a PHP bug!!!!!!!!!
I don't see why a string wouldn't work when I use "08" (string) and match it against the integer 8, or 08.
"Kirk Johnson" <kjohnson
zootweb.com> wrote in message
news:B11731D518B5D61183C700A0C98BE0D9FFBE5D
chef...
>
> > -----Original Message-----
> > From: Scott Fletcher [mailto:scott
abcoa.com]
> >
> > Found a PHP bug, I'm using PHP version 4.2.3. I have been
> > struggling with
> > why PHP code failed to work with the month is August or
> > September
>
> I stumbled into this one a short while ago myself. It is not a bug, but a
> feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP interprets
> them as octal numbers (because of the leading 0). However, 08 and 09 are
> invalid octal numbers, so PHP converts them to zero.
>
> The fixes are numerous:
> - remove the leading zero;
> - add zero to them before passing (addition forces a type conversion to
> int);
> - force a type conversion to integer using (int);
> - quote them (when PHP converts a string to an integer, it removes the
> leading zero);
>
> Kirk
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
>Re: [PHP] Found a PHP bug!!!!!!!!! uh oh...
>I don't see why a string wouldn't work when I use "08" (string) and match it >against the integer 8, or 08.
They're just different types. Normally PHP is veeery flexible with types, like javascript, but it just can't be flexible for you here because it needs to choose the most logic to the entire pool of programmers, and then "08" = a string 8 = a decimal integer 08 = by definition an impossible octal integer, so 0.
Since you cannot tell PHP that $var is of a certain type like in [other] programming languages, for example you want it to be treated as an integer, PHP will handle it as what seems to be the most logic.
You can try to use intval (does not alter a variable, only the value as it is used in a calculation or an if() statement) or settype (alters the variable).
>"Kirk Johnson" <kjohnson
zootweb.com> wrote in message
>news:B11731D518B5D61183C700A0C98BE0D9FFBE5D
chef...
> >
> > > -----Original Message-----
> > > From: Scott Fletcher [mailto:scott
abcoa.com]
> > >
> > > Found a PHP bug, I'm using PHP version 4.2.3. I have been
> > > struggling with
> > > why PHP code failed to work with the month is August or
> > > September
> >
> > I stumbled into this one a short while ago myself. It is not a bug, but a
> > feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP interprets
> > them as octal numbers (because of the leading 0). However, 08 and 09 are
> > invalid octal numbers, so PHP converts them to zero.
> >
> > The fixes are numerous:
> > - remove the leading zero;
> > - add zero to them before passing (addition forces a type conversion to
> > int);
> > - force a type conversion to integer using (int);
> > - quote them (when PHP converts a string to an integer, it removes the
> > leading zero);
> >
> > Kirk
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I'm referring to '08' and '09' that don't work....
"Chris Shiflett" <shiflett
php.net> wrote in message
news:20030127202202.46876.qmail
web14306.mail.yahoo.com...
> --- Scott Fletcher <scott
abcoa.com> wrote:
> > Found a PHP bug
> ...
> > if ($month == 01)
>
> I guess you mean:
>
> if ($month == '01')
>
> If so, this is not a bug. Otherwise, please explain what
> you think is wrong.
>
> Chris
attached mail follows:
I do know that integer, string, double, float, etc.... are different.. I have been using hte appropriate method like in javascript and c programming, like converting it to integer and so on.... But when I start using PHP, I find no such document of it and I have been using it for 3 years without a problem. I asked people is there such a thing as converting it by using the function and they told me there is no such a thing and that it is done automatically... Now my time is a little bit wasted. So, I will correct the problem with the php script...
I recently looked up on the manual as Jason Wong instructed me to. I havne't found the answer since the document is a little bit mixed up.
Okay, I'm going back to my old way as I did in javascript and c programming. So for php, it would be
floatval() for float... strval() for string.... settype() for whatever...... intval() for integer....
Um, what about double???
Thanks, Scott F.
"Chris Hayes" <chayes
antenna.nl> wrote in message
news:5.1.1.6.0.20030127211703.014c47f8
pop4.antenna.nl...
>
> >Re: [PHP] Found a PHP bug!!!!!!!!!
> uh oh...
>
>
> >I don't see why a string wouldn't work when I use "08" (string) and match
it
> >against the integer 8, or 08.
>
> They're just different types. Normally PHP is veeery flexible with
> types, like javascript, but it just can't be flexible for you here
because
> it needs to choose the most logic to the entire pool of programmers, and
then
> "08" = a string
> 8 = a decimal integer
> 08 = by definition an impossible octal integer, so 0.
>
> Since you cannot tell PHP that $var is of a certain type like in [other]
> programming languages, for example you want it to be treated as an
integer,
> PHP will handle it as what seems to be the most logic.
>
>
> You can try to use intval (does not alter a variable, only the value as it
> is used in a calculation or an if() statement) or settype (alters the
> variable).
>
>
>
> >"Kirk Johnson" <kjohnson
zootweb.com> wrote in message
> >news:B11731D518B5D61183C700A0C98BE0D9FFBE5D
chef...
> > >
> > > > -----Original Message-----
> > > > From: Scott Fletcher [mailto:scott
abcoa.com]
> > > >
> > > > Found a PHP bug, I'm using PHP version 4.2.3. I have been
> > > > struggling with
> > > > why PHP code failed to work with the month is August or
> > > > September
> > >
> > > I stumbled into this one a short while ago myself. It is not a bug,
but a
> > > feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP
interprets
> > > them as octal numbers (because of the leading 0). However, 08 and 09
are
> > > invalid octal numbers, so PHP converts them to zero.
> > >
> > > The fixes are numerous:
> > > - remove the leading zero;
> > > - add zero to them before passing (addition forces a type conversion
to
> > > int);
> > > - force a type conversion to integer using (int);
> > > - quote them (when PHP converts a string to an integer, it removes
the
> > > leading zero);
> > >
> > > Kirk
> >
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Whoop! FOund it, it is doubleval()...
What does settype() do exactly????
"Scott Fletcher" <scott
abcoa.com> wrote in message
news:20030127203843.29862.qmail
pb1.pair.com...
> I do know that integer, string, double, float, etc.... are different.. I
> have been using hte appropriate method like in javascript and c
programming,
> like converting it to integer and so on.... But when I start using PHP, I
> find no such document of it and I have been using it for 3 years without a
> problem. I asked people is there such a thing as converting it by using
the
> function and they told me there is no such a thing and that it is done
> automatically... Now my time is a little bit wasted. So, I will correct
> the problem with the php script...
>
> I recently looked up on the manual as Jason Wong instructed me to. I
> havne't found the answer since the document is a little bit mixed up.
>
> Okay, I'm going back to my old way as I did in javascript and c
programming.
> So for php, it would be
>
> floatval() for float...
> strval() for string....
> settype() for whatever......
> intval() for integer....
>
> Um, what about double???
>
> Thanks,
> Scott F.
>
> "Chris Hayes" <chayes
antenna.nl> wrote in message
> news:5.1.1.6.0.20030127211703.014c47f8
pop4.antenna.nl...
> >
> > >Re: [PHP] Found a PHP bug!!!!!!!!!
> > uh oh...
> >
> >
> > >I don't see why a string wouldn't work when I use "08" (string) and
match
> it
> > >against the integer 8, or 08.
> >
> > They're just different types. Normally PHP is veeery flexible with
> > types, like javascript, but it just can't be flexible for you here
> because
> > it needs to choose the most logic to the entire pool of programmers, and
> then
> > "08" = a string
> > 8 = a decimal integer
> > 08 = by definition an impossible octal integer, so 0.
> >
> > Since you cannot tell PHP that $var is of a certain type like in [other]
> > programming languages, for example you want it to be treated as an
> integer,
> > PHP will handle it as what seems to be the most logic.
> >
> >
> > You can try to use intval (does not alter a variable, only the value as
it
> > is used in a calculation or an if() statement) or settype (alters the
> > variable).
> >
> >
> >
> > >"Kirk Johnson" <kjohnson
zootweb.com> wrote in message
> > >news:B11731D518B5D61183C700A0C98BE0D9FFBE5D
chef...
> > > >
> > > > > -----Original Message-----
> > > > > From: Scott Fletcher [mailto:scott
abcoa.com]
> > > > >
> > > > > Found a PHP bug, I'm using PHP version 4.2.3. I have been
> > > > > struggling with
> > > > > why PHP code failed to work with the month is August or
> > > > > September
> > > >
> > > > I stumbled into this one a short while ago myself. It is not a bug,
> but a
> > > > feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP
> interprets
> > > > them as octal numbers (because of the leading 0). However, 08 and 09
> are
> > > > invalid octal numbers, so PHP converts them to zero.
> > > >
> > > > The fixes are numerous:
> > > > - remove the leading zero;
> > > > - add zero to them before passing (addition forces a type
conversion
> to
> > > > int);
> > > > - force a type conversion to integer using (int);
> > > > - quote them (when PHP converts a string to an integer, it removes
> the
> > > > leading zero);
> > > >
> > > > Kirk
> > >
> > >
> > >
> > >--
> > >PHP General Mailing List (http://www.php.net/)
> > >To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
attached mail follows:
I would need to use intval() to solve this problem....
"Scott Fletcher" <scott
abcoa.com> wrote in message
news:20030127203003.23873.qmail
pb1.pair.com...
> I'm referring to '08' and '09' that don't work....
>
> "Chris Shiflett" <shiflett
php.net> wrote in message
> news:20030127202202.46876.qmail
web14306.mail.yahoo.com...
> > --- Scott Fletcher <scott
abcoa.com> wrote:
> > > Found a PHP bug
> > ...
> > > if ($month == 01)
> >
> > I guess you mean:
> >
> > if ($month == '01')
> >
> > If so, this is not a bug. Otherwise, please explain what
> > you think is wrong.
> >
> > Chris
>
>
attached mail follows:
U might want to do a type cast to integer from string...
http://www.php.net/manual/en/language.types.type-juggling.php
On Mon, 2003-01-27 at 13:47, Scott Fletcher wrote:
> I would need to use intval() to solve this problem....
>
> "Scott Fletcher" <scott
abcoa.com> wrote in message
> news:20030127203003.23873.qmail
pb1.pair.com...
> > I'm referring to '08' and '09' that don't work....
> >
> > "Chris Shiflett" <shiflett
php.net> wrote in message
> > news:20030127202202.46876.qmail
web14306.mail.yahoo.com...
> > > --- Scott Fletcher <scott
abcoa.com> wrote:
> > > > Found a PHP bug
> > > ...
> > > > if ($month == 01)
> > >
> > > I guess you mean:
> > >
> > > if ($month == '01')
> > >
> > > If so, this is not a bug. Otherwise, please explain what
> > > you think is wrong.
> > >
> > > Chris
> >
> >
attached mail follows:
> Because "8" != 8. "8" (and "08") is a string with the numerals representing > the number eight. It is not the number eight. (think back to basic math, the > difference between a number and a numeral)
Actually, "08" is equal to 8 in PHP. PHP will convert the string to an integer and the two will compare as equal.
> PHP does some conversions for you automatically but that just saves you from > yourself. (Personally, I wish it wouldn't. People have more trouble > *because* of the automatic conversions than they would if they had to do the > converting themselves.)
Someone already posted why the problem was happening, because the numbers were being converted to invalid octal numbers and being set to zero.
Run this bit of code for an example:
echo "<br>" . ((01 == 1) ? "Match" : "No Match"); echo "<br>" . ((02 == 2) ? "Match" : "No Match"); echo "<br>" . ((03 == 3) ? "Match" : "No Match"); echo "<br>" . ((04 == 4) ? "Match" : "No Match"); echo "<br>" . ((05 == 5) ? "Match" : "No Match"); echo "<br>" . ((06 == 6) ? "Match" : "No Match"); echo "<br>" . ((07 == 7) ? "Match" : "No Match"); echo "<br>" . ((08 == 8) ? "Match" : "No Match"); echo "<br>" . ((09 == 9) ? "Match" : "No Match");
The last two won't match because 08 and 09 are invalid octal numbers, like Kirk Johnson already said.
So "08" != 08 and 8 != 08, for example.
---John Holmes...
attached mail follows:
No, it's floatval. Doubleval is an alias left over from hwen floats were called doubles...
Scott Fletcher wrote:
>Whoop! FOund it, it is doubleval()...
>
>
>What does settype() do exactly????
>
>
>"Scott Fletcher" <scott
abcoa.com> wrote in message
>news:20030127203843.29862.qmail
pb1.pair.com...
>
>
>>I do know that integer, string, double, float, etc.... are different.. I
>>have been using hte appropriate method like in javascript and c
>>
>>
>programming,
>
>
>>like converting it to integer and so on.... But when I start using PHP, I
>>find no such document of it and I have been using it for 3 years without a
>>problem. I asked people is there such a thing as converting it by using
>>
>>
>the
>
>
>>function and they told me there is no such a thing and that it is done
>>automatically... Now my time is a little bit wasted. So, I will correct
>>the problem with the php script...
>>
>>I recently looked up on the manual as Jason Wong instructed me to. I
>>havne't found the answer since the document is a little bit mixed up.
>>
>>Okay, I'm going back to my old way as I did in javascript and c
>>
>>
>programming.
>
>
>>So for php, it would be
>>
>>floatval() for float...
>>strval() for string....
>>settype() for whatever......
>>intval() for integer....
>>
>>Um, what about double???
>>
>>Thanks,
>> Scott F.
>>
>>"Chris Hayes" <chayes
antenna.nl> wrote in message
>>news:5.1.1.6.0.20030127211703.014c47f8
pop4.antenna.nl...
>>
>>
>>> >Re: [PHP] Found a PHP bug!!!!!!!!!
>>>uh oh...
>>>
>>>
>>>
>>>
>>>>I don't see why a string wouldn't work when I use "08" (string) and
>>>>
>>>>
>match
>
>
>>it
>>
>>
>>>>against the integer 8, or 08.
>>>>
>>>>
>>>They're just different types. Normally PHP is veeery flexible with
>>>types, like javascript, but it just can't be flexible for you here
>>>
>>>
>>because
>>
>>
>>>it needs to choose the most logic to the entire pool of programmers, and
>>>
>>>
>>then
>>
>>
>>>"08" = a string
>>> 8 = a decimal integer
>>> 08 = by definition an impossible octal integer, so 0.
>>>
>>>Since you cannot tell PHP that $var is of a certain type like in [other]
>>>programming languages, for example you want it to be treated as an
>>>
>>>
>>integer,
>>
>>
>>>PHP will handle it as what seems to be the most logic.
>>>
>>>
>>>You can try to use intval (does not alter a variable, only the value as
>>>
>>>
>it
>
>
>>>is used in a calculation or an if() statement) or settype (alters the
>>>variable).
>>>
>>>
>>>
>>>
>>>
>>>>"Kirk Johnson" <kjohnson
zootweb.com> wrote in message
>>>>news:B11731D518B5D61183C700A0C98BE0D9FFBE5D
chef...
>>>>
>>>>
>>>>>>-----Original Message-----
>>>>>>From: Scott Fletcher [mailto:scott
abcoa.com]
>>>>>>
>>>>>>Found a PHP bug, I'm using PHP version 4.2.3. I have been
>>>>>>struggling with
>>>>>>why PHP code failed to work with the month is August or
>>>>>>September
>>>>>>
>>>>>>
>>>>>I stumbled into this one a short while ago myself. It is not a bug,
>>>>>
>>>>>
>>but a
>>
>>
>>>>>feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP
>>>>>
>>>>>
>>interprets
>>
>>
>>>>>them as octal numbers (because of the leading 0). However, 08 and 09
>>>>>
>>>>>
>>are
>>
>>
>>>>>invalid octal numbers, so PHP converts them to zero.
>>>>>
>>>>>The fixes are numerous:
>>>>> - remove the leading zero;
>>>>> - add zero to them before passing (addition forces a type
>>>>>
>>>>>
>conversion
>
>
>>to
>>
>>
>>>>>int);
>>>>> - force a type conversion to integer using (int);
>>>>> - quote them (when PHP converts a string to an integer, it removes
>>>>>
>>>>>
>>the
>>
>>
>>>>>leading zero);
>>>>>
>>>>>Kirk
>>>>>
>>>>>
>>>>
>>>>--
>>>>PHP General Mailing List (http://www.php.net/)
>>>>To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>>
>>>
>>>
>>
>>
>
>
>
>
>
-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
attached mail follows:
Even doing a type cast won't make a difference for the original problem. Even if you cast "08" to an integer and compare it to 08 (invalid octal number), it'll still fail.
The original solution was the best, remove the leading zero from the comparisons and let PHP handle the type casting.
---John Holmes...
----- Original Message -----
From: "Ray Hunter" <ray
php.net>
To: "Scott Fletcher" <scott
abcoa.com>
Cc: <php-general
lists.php.net>
Sent: Monday, January 27, 2003 3:45 PM
Subject: Re: [PHP] Found a PHP bug!!!!!!!!!
> U might want to do a type cast to integer from string...
>
> http://www.php.net/manual/en/language.types.type-juggling.php
>
>
> On Mon, 2003-01-27 at 13:47, Scott Fletcher wrote:
> > I would need to use intval() to solve this problem....
> >
> > "Scott Fletcher" <scott
abcoa.com> wrote in message
> > news:20030127203003.23873.qmail
pb1.pair.com...
> > > I'm referring to '08' and '09' that don't work....
> > >
> > > "Chris Shiflett" <shiflett
php.net> wrote in message
> > > news:20030127202202.46876.qmail
web14306.mail.yahoo.com...
> > > > --- Scott Fletcher <scott
abcoa.com> wrote:
> > > > > Found a PHP bug
> > > > ...
> > > > > if ($month == 01)
> > > >
> > > > I guess you mean:
> > > >
> > > > if ($month == '01')
> > > >
> > > > If so, this is not a bug. Otherwise, please explain what
> > > > you think is wrong.
> > > >
> > > > Chris
> > >
> > >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
John.
> Actually, "08" is equal to 8 in PHP. PHP will convert the string to an >integer and the two will compare as equal.
No they are not equal. Yes, PHP will do the conversion so that they are equal. That does not refute the fact that logically '08' != 8.
> Someone already posted why the problem was happening, because the numbers > were being converted to invalid octal numbers and being set to zero.
I understand the problem at hand. (and did when I posted) However, if Scott had been doing the conversions manually, he would never have run across this problem. It is a bad idea to rely on the language (whatever the language) to do automatic variable conversions.
=C=
attached mail follows:
Yea, it's too bad that not many people know about it. I first asked and they told me it is done automatically. That was 3 years ago. I never had a problem for 3 years until now. So, I'm going back to the old way as I did in Javascript and C programming. I first started PHP 3 years ago, so it's no wonder why there's all the confusion when I was just an innocent victim. :-)
"Cal Evans" <cal
calevans.com> wrote in message
news:FLEGKEMHDIDDEJOGHHNFKEOFJLAA.cal
calevans.com...
> John.
>
> > Actually, "08" is equal to 8 in PHP. PHP will convert the string to an
> >integer and the two will compare as equal.
>
> No they are not equal. Yes, PHP will do the conversion so that they are
> equal. That does not refute the fact that logically '08' != 8.
>
>
> > Someone already posted why the problem was happening, because the
numbers
> > were being converted to invalid octal numbers and being set to zero.
>
> I understand the problem at hand. (and did when I posted) However, if
Scott
> had been doing the conversions manually, he would never have run across
this
> problem. It is a bad idea to rely on the language (whatever the language)
> to do automatic variable conversions.
>
> =C=
>
attached mail follows:
Double and Float are not exactly the same thing.
Double is ---> 11.123 Float is ------> .00238823993
"Leif K-Brooks" <eurleif
buyer-brokerage.com> wrote in message
news:3E359A94.7070406
buyer-brokerage.com...
> No, it's floatval. Doubleval is an alias left over from hwen floats
> were called doubles...
>
> Scott Fletcher wrote:
>
> >Whoop! FOund it, it is doubleval()...
> >
> >
> >What does settype() do exactly????
> >
> >
> >"Scott Fletcher" <scott
abcoa.com> wrote in message
> >news:20030127203843.29862.qmail
pb1.pair.com...
> >
> >
> >>I do know that integer, string, double, float, etc.... are different..
I
> >>have been using hte appropriate method like in javascript and c
> >>
> >>
> >programming,
> >
> >
> >>like converting it to integer and so on.... But when I start using PHP,
I
> >>find no such document of it and I have been using it for 3 years without
a
> >>problem. I asked people is there such a thing as converting it by using
> >>
> >>
> >the
> >
> >
> >>function and they told me there is no such a thing and that it is done
> >>automatically... Now my time is a little bit wasted. So, I will
correct
> >>the problem with the php script...
> >>
> >>I recently looked up on the manual as Jason Wong instructed me to. I
> >>havne't found the answer since the document is a little bit mixed up.
> >>
> >>Okay, I'm going back to my old way as I did in javascript and c
> >>
> >>
> >programming.
> >
> >
> >>So for php, it would be
> >>
> >>floatval() for float...
> >>strval() for string....
> >>settype() for whatever......
> >>intval() for integer....
> >>
> >>Um, what about double???
> >>
> >>Thanks,
> >> Scott F.
> >>
> >>"Chris Hayes" <chayes
antenna.nl> wrote in message
> >>news:5.1.1.6.0.20030127211703.014c47f8
pop4.antenna.nl...
> >>
> >>
> >>> >Re: [PHP] Found a PHP bug!!!!!!!!!
> >>>uh oh...
> >>>
> >>>
> >>>
> >>>
> >>>>I don't see why a string wouldn't work when I use "08" (string) and
> >>>>
> >>>>
> >match
> >
> >
> >>it
> >>
> >>
> >>>>against the integer 8, or 08.
> >>>>
> >>>>
> >>>They're just different types. Normally PHP is veeery flexible with
> >>>types, like javascript, but it just can't be flexible for you here
> >>>
> >>>
> >>because
> >>
> >>
> >>>it needs to choose the most logic to the entire pool of programmers,
and
> >>>
> >>>
> >>then
> >>
> >>
> >>>"08" = a string
> >>> 8 = a decimal integer
> >>> 08 = by definition an impossible octal integer, so 0.
> >>>
> >>>Since you cannot tell PHP that $var is of a certain type like in
[other]
> >>>programming languages, for example you want it to be treated as an
> >>>
> >>>
> >>integer,
> >>
> >>
> >>>PHP will handle it as what seems to be the most logic.
> >>>
> >>>
> >>>You can try to use intval (does not alter a variable, only the value as
> >>>
> >>>
> >it
> >
> >
> >>>is used in a calculation or an if() statement) or settype (alters the
> >>>variable).
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>"Kirk Johnson" <kjohnson
zootweb.com> wrote in message
> >>>>news:B11731D518B5D61183C700A0C98BE0D9FFBE5D
chef...
> >>>>
> >>>>
> >>>>>>-----Original Message-----
> >>>>>>From: Scott Fletcher [mailto:scott
abcoa.com]
> >>>>>>
> >>>>>>Found a PHP bug, I'm using PHP version 4.2.3. I have been
> >>>>>>struggling with
> >>>>>>why PHP code failed to work with the month is August or
> >>>>>>September
> >>>>>>
> >>>>>>
> >>>>>I stumbled into this one a short while ago myself. It is not a bug,
> >>>>>
> >>>>>
> >>but a
> >>
> >>
> >>>>>feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP
> >>>>>
> >>>>>
> >>interprets
> >>
> >>
> >>>>>them as octal numbers (because of the leading 0). However, 08 and 09
> >>>>>
> >>>>>
> >>are
> >>
> >>
> >>>>>invalid octal numbers, so PHP converts them to zero.
> >>>>>
> >>>>>The fixes are numerous:
> >>>>> - remove the leading zero;
> >>>>> - add zero to them before passing (addition forces a type
> >>>>>
> >>>>>
> >conversion
> >
> >
> >>to
> >>
> >>
> >>>>>int);
> >>>>> - force a type conversion to integer using (int);
> >>>>> - quote them (when PHP converts a string to an integer, it removes
> >>>>>
> >>>>>
> >>the
> >>
> >>
> >>>>>leading zero);
> >>>>>
> >>>>>Kirk
> >>>>>
> >>>>>
> >>>>
> >>>>--
> >>>>PHP General Mailing List (http://www.php.net/)
> >>>>To unsubscribe, visit: http://www.php.net/unsub.php
> >>>>
> >>>>
> >>>
> >>>
> >>
> >>
> >
> >
> >
> >
> >
>
> --
> The above message is encrypted with double rot13 encoding. Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
>
>
>
attached mail follows:
Aw nut!!! The intval() doesn't work...... I had enough, I'm going to do what Kirk Johnson recommend. That one work better.....
"Scott Fletcher" <scott
abcoa.com> wrote in message
news:20030127210418.64057.qmail
pb1.pair.com...
> Yea, it's too bad that not many people know about it. I first asked and
> they told me it is done automatically. That was 3 years ago. I never had
a
> problem for 3 years until now. So, I'm going back to the old way as I did
> in Javascript and C programming. I first started PHP 3 years ago, so it's
> no wonder why there's all the confusion when I was just an innocent
victim.
> :-)
>
> "Cal Evans" <cal
calevans.com> wrote in message
> news:FLEGKEMHDIDDEJOGHHNFKEOFJLAA.cal
calevans.com...
> > John.
> >
> > > Actually, "08" is equal to 8 in PHP. PHP will convert the string to an
> > >integer and the two will compare as equal.
> >
> > No they are not equal. Yes, PHP will do the conversion so that they are
> > equal. That does not refute the fact that logically '08' != 8.
> >
> >
> > > Someone already posted why the problem was happening, because the
> numbers
> > > were being converted to invalid octal numbers and being set to zero.
> >
> > I understand the problem at hand. (and did when I posted) However, if
> Scott
> > had been doing the conversions manually, he would never have run across
> this
> > problem. It is a bad idea to rely on the language (whatever the
language)
> > to do automatic variable conversions.
> >
> > =C=
> >
>
>
attached mail follows:
Another workaround to this problem is as an addition to Kirk Johnson's suggestion....
--clip--
$month = "08";
if (trim($month) == 8) {
echo "You got it!!!";
}
--clip--
"Scott Fletcher" <scott
abcoa.com> wrote in message
news:20030127212734.83374.qmail
pb1.pair.com...
> Aw nut!!! The intval() doesn't work...... I had enough, I'm going to do
> what Kirk Johnson recommend. That one work better.....
>
> "Scott Fletcher" <scott
abcoa.com> wrote in message
> news:20030127210418.64057.qmail
pb1.pair.com...
> > Yea, it's too bad that not many people know about it. I first asked and
> > they told me it is done automatically. That was 3 years ago. I never
had
> a
> > problem for 3 years until now. So, I'm going back to the old way as I
did
> > in Javascript and C programming. I first started PHP 3 years ago, so
it's
> > no wonder why there's all the confusion when I was just an innocent
> victim.
> > :-)
> >
> > "Cal Evans" <cal
calevans.com> wrote in message
> > news:FLEGKEMHDIDDEJOGHHNFKEOFJLAA.cal
calevans.com...
> > > John.
> > >
> > > > Actually, "08" is equal to 8 in PHP. PHP will convert the string to
an
> > > >integer and the two will compare as equal.
> > >
> > > No they are not equal. Yes, PHP will do the conversion so that they
are
> > > equal. That does not refute the fact that logically '08' != 8.
> > >
> > >
> > > > Someone already posted why the problem was happening, because the
> > numbers
> > > > were being converted to invalid octal numbers and being set to zero.
> > >
> > > I understand the problem at hand. (and did when I posted) However, if
> > Scott
> > > had been doing the conversions manually, he would never have run
across
> > this
> > > problem. It is a bad idea to rely on the language (whatever the
> language)
> > > to do automatic variable conversions.
> > >
> > > =C=
> > >
> >
> >
>
>
attached mail follows:
Hey all,
Does any body know of anything similar to phpMyAdmin for MS SQL? I have been doing some googling and haven't come across anything that would help me out. I have also checked out www.sourceforge.net and can't seem to come across anything either. I am looking for something that will be easy enough for my client to utilize to update/manipulate a database, rather than having me re-create the wheel so-to-speak.
-- Joshua Minnie Advantage Computer Services, LLC Senior Project Manager joshacsurf.net www.advantagecomputerservices.com Tel: 269.276.9690 Fax : 269.342.8750
attached mail follows:
How do i use the function filesize, because i´m using like:
I just want associate the variable $body with a html file
$file_name = 'c:/templates/resp_rep_efetiva_contrato.php'; $fd = fopen($file_name,"r"); line 27 $size = filesize($file_name); / Dá erro aqui $body = fread($fd, $size); $mail = mail($address, $subject, $body, $header); it keeps saind that:
Warning: stat failed for c://templates/resp_rep_efetiva_contrato.php (errno=2 - No such file or directory) in line 27
but, the file exists because the fopen function works ok, I don´t known what to do
Thanks in advance
--------------------------------------------------------------------------------
Equipe Pratic Sistemas
Rodrigo Corrêa
Fone: (14) 441-1700
suporte
praticsistemas.com.br
rodrigo
praticsistemas.com.br
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]