OSEC

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 29 Jul 2004 22:57:38 -0000 Issue 2906

php-general-digest-helplists.php.net
Date: Thu Jul 29 2004 - 17:57:38 CDT


php-general Digest 29 Jul 2004 22:57:38 -0000 Issue 2906

Topics (messages 192170 through 192253):

Re: VB-->PHP
        192170 by: Jay
        192171 by: Ni Shurong

[HAB] Virtual Host
        192172 by: EE
        192180 by: Jason Wong

Problems with is_dir()
        192173 by: Jay
        192174 by: Ni Shurong
        192175 by: Jay

Re: apache1 + php or apache2 + php
        192176 by: Jay
        192177 by: Ni Shurong
        192209 by: Justin Patrin

Charset Problem
        192178 by: Gerske, Sebastian

Classes, instances and NULL
        192179 by: Oliver Hitz
        192184 by: Mehdi Achour
        192186 by: Oliver Hitz
        192190 by: Michael Sims
        192217 by: Justin Patrin

Re: reading txt file - certain lines
        192181 by: Miroslav Hudak (php/ml)

Automatically run a php page once a day
        192182 by: PHPDiscuss - PHP Newsgroups and mailing lists
        192183 by: Jay Blanchard
        192185 by: John Nichel

Re: Retrieving Stored Values for Dropdown Menu
        192187 by: rush

image field in MSSQL db
        192188 by: Edward Peloke
        192191 by: raditha dissanayake

Need to maintain the integrity of the checkbox
        192189 by: Andrew Reilly
        192192 by: Jay Blanchard
        192193 by: Jay Blanchard
        192194 by: Jason Wong
        192195 by: Andrew Reilly
        192196 by: Jay Blanchard
        192202 by: Andrew Reilly
        192204 by: Jay Blanchard
        192206 by: Jay Blanchard

Conversion of Field Value to Hyperlink
        192197 by: Harlequin
        192198 by: Jay Blanchard
        192205 by: Harlequin
        192207 by: John Nichel
        192210 by: Harlequin
        192220 by: Jason Wong
        192222 by: John Nichel
        192234 by: John Holmes
        192239 by: rogerk.queernet.org
        192241 by: Ashley M. Kirchner
        192242 by: Jay Blanchard
        192243 by: John Nichel
        192244 by: rogerk.queernet.org
        192245 by: Brian Dunning
        192247 by: Matthew Sims
        192250 by: Jason Wong
        192253 by: John Holmes

PHP5 and Webhost
        192199 by: EE

Named anchors, POST failure
        192200 by: Jason
        192208 by: Jay Blanchard
        192213 by: Jason
        192218 by: Jay Blanchard

Re: Browser reload problem
        192201 by: Matthew Sims
        192240 by: Ashley M. Kirchner

Re: list($bar['CompanyCode'], $CompanyDB) = mysql_fetch_row($sth) fails.
        192203 by: Matthew Sims

Re: Conversion of Field Value to Hyperlink OT
        192211 by: Jay Blanchard
        192212 by: Harlequin
        192215 by: Jay Blanchard
        192216 by: raditha dissanayake

Server's clock gone funny, maybe?
        192214 by: Brian Dunning
        192219 by: Jay Blanchard
        192221 by: Brian Dunning
        192224 by: Jay Blanchard
        192225 by: Jason Wong
        192228 by: Ed Lazor
        192229 by: Matthew Sims
        192235 by: Brian Dunning

ordering a list starting at x
        192223 by: php-general.mccullough-net.com
        192226 by: Jay Blanchard
        192231 by: php-general.mccullough-net.com

help with regular expression
        192227 by: Barbara Picci
        192233 by: Michael Sims

Re: Server's clock gone funny, maybe? OT
        192230 by: Jay Blanchard
        192232 by: php-general.mccullough-net.com
        192236 by: Jay Blanchard

Re: Problem with $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW']
        192237 by: Mark Collin

Failed (php-generallists.php.net)
        192238 by: rjs.pdflib.com

Searching and removing
        192246 by: Jonathan Lassoff
        192248 by: Justin Patrin

Variable functions within an object
        192249 by: Julio Sergio Santana

TIFF Images
        192251 by: Stephen Craton
        192252 by: Justin Patrin

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Ni Shurong wrote:

> I did not test it:)
>
> function isValid($strData, $bIncludeAlpha=false, $bIncludeNumber=false)
> {
> switch(true) {
> case $bIncludeAlpha && !$bIncludeNumber:
> $ptr = "/^[a-zA-Z]+/";
> break;
> case !$bIncludeAlpha && $bIncludeNumber:
> $ptr = "/^[0-9]+/";
> break;
> case $bIncludeAlpha && $bIncludeNumber:
> $ptr = "/^[a-zA-Z0-9]+/";
> break;
> }
> return preg_match($ptr, $strData);
> }
>
>
>
> ----
> Ni Shurong <srnigzlinux.org>
>
> MAIL : srnigzlinux.org
> QQ : 412844
> MSN : nsr_xhhotmail.com
> BLOG : http://blog.njmars.com/myhan/

Thanx, seems to work just fine.

Some questions:
Why "true" in the switch()?
Why preg_match instead of ereg?

Regards,
J

attached mail follows:


I am familiar with pcre more then php's POSIX extension :)

and it is said that preg_match() is faster than ereg(), see php manual
for more info :)

function isValid($strData, $bIncludeAlpha=false, $bIncludeNumber=false)
{
     switch(true) {
         case $bIncludeAlpha && !$bIncludeNumber:
             $ptr = "/^[a-zA-Z]+/";
             break;
         case !$bIncludeAlpha && $bIncludeNumber:
             $ptr = "/^[0-9]+/";
             break;
         case $bIncludeAlpha && $bIncludeNumber:
             $ptr = "/^[a-zA-Z0-9]+/";
             break;
         default:
             return false;
     }
     return preg_match($ptr, $strData);
}

please add "default" statement:)

----
Ni Shurong <srnigzlinux.org>

MAIL : srnigzlinux.org
QQ : 412844
MSN : nsr_xhhotmail.com
BLOG : http://blog.njmars.com/myhan/

attached mail follows:


Dears,

How can I make a virtual host. I usually type 127.0.0.1 in my browser to
test my site but I need to work on another site in a different
directory?

I am running Apache, PHP4, Mandrake 10. I am not sure which appache I
am running but when I do 'apachectl graceful' it says "Reloading httpd2"

I hope that I am not running apache2 as it is not recommended to use
apache2 and php in production.

Best Regards

attached mail follows:


On Thursday 29 July 2004 19:16, EE wrote:

This question is OT ...

> How can I make a virtual host. I usually type 127.0.0.1 in my browser to
> test my site but I need to work on another site in a different
> directory?

... check out http://httpd.apache.org/docs/

Also you need to set up some DNS entries so that entering (for example):

  http://www.mytestite.com/

will point to your local webserver. The easiest way to do this is to add
entries in /etc/hosts.

> I am running Apache, PHP4, Mandrake 10. I am not sure which appache I
> am running but when I do 'apachectl graceful' it says "Reloading httpd2"
>
> I hope that I am not running apache2 as it is not recommended to use
> apache2 and php in production.

httpd2 usually signifies Apache 2.X.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Absence makes the heart forget.
*/

attached mail follows:


Hi!

I am trying to list all files and dirs in a directory. But i encountered
some problems with is_dir() function. is_dir tells med that it all is
files when i know for a fact that there is one dir in the directory
("dir1"). Can someone tell me why this don´t work?:

<?php
if ($handle = opendir($_SERVER["DOCUMENT_ROOT"]."/img")) {
        while (false !== ($file = readdir($handle))) {
                        if ($file != "." && $file != "..") {
                            if (is_dir($file)){
                                echo "Dir: ".$file;
                        }
                        else
                        {
                                echo "File: ".$file;
                        }
                        echo "<br />";
                        }
            }
        closedir($handle);
        clearstatcache();
}
?>

Thanx in advance
J

attached mail follows:


you must do it like this:

<?php
if ($handle = opendir($_SERVER["DOCUMENT_ROOT"]."/img")) {
        while (false !== ($file = readdir($handle))) {
                       if ($file != "." && $file != "..") {
+ $path = $_SERVER["DOCUMENT_ROOT"]."/img" . "/" . $file;
! if (is_dir($path)){
                                echo "Dir: ".$file;
                        }
                        else
                        {
                                echo "File: ".$file;
                        }
                        echo "<br />";
                        }
            }
        closedir($handle);
        clearstatcache();
}
?>

----
Ni Shurong <srnigzlinux.org>

MAIL : srnigzlinux.org
QQ : 412844
MSN : nsr_xhhotmail.com
BLOG : http://blog.njmars.com/myhan/

attached mail follows:


Ni Shurong wrote:
> you must do it like this:
>
> <?php
> if ($handle = opendir($_SERVER["DOCUMENT_ROOT"]."/img")) {
> while (false !== ($file = readdir($handle))) {
> if ($file != "." && $file != "..") {
> + $path = $_SERVER["DOCUMENT_ROOT"]."/img" . "/" . $file;
> ! if (is_dir($path)){
> echo "Dir: ".$file;
> }
> else
> {
> echo "File: ".$file;
> }
> echo "<br />";
> }
> }
> closedir($handle);
> clearstatcache();
> }
> ?>
>
>
> ----
> Ni Shurong <srnigzlinux.org>
>
> MAIL : srnigzlinux.org
> QQ : 412844
> MSN : nsr_xhhotmail.com
> BLOG : http://blog.njmars.com/myhan/

You again!

Thanx : )

Please stay in here i might need some more help ; )

Regards,
J

attached mail follows:


Ni Shurong wrote:

> Hi,
>
> I am a newer of this list, nice to meet every body here:)
>
> I am wandering about using apache1 or apache2 with php, and i hope i can
> get some advics here ;)
>
> I use ./configure --help and it says:
> --with-apxs2[=FILE] EXPERIMENTAL: Build shared Apache 2.0 module.
> FILE is the optional
> pathname to the Apache apxs tool; defaults to apxs.
>
>
> and I read these from php manual:
> http://www.php.net/manual/en/install.apache2.php
> it says:
> Warning
> Do not use Apache 2.0 and PHP in a production environment neither on Unix nor on Windows.
>
> I don't konw which version of apache works with php better:)
>
> ----
> Ni Shurong <srnigzlinux.org>
>
> MAIL : srnigzlinux.org
> QQ : 412844
> MSN : nsr_xhhotmail.com
> BLOG : http://blog.njmars.com/myhan/

I thought i try to help you when you been so kind and helped me with my
questions : )

I just can say that i run Apache 2 with ISAPI module loaded on XP and it
performs just fine!

Haven´t tried Apache 2 under Linux, but apache 1.

So my advice....Apache2.

Regards,
J

attached mail follows:


Thank you! ;)

I have build apache1+php5, apache2+php5
but I don't know how to test which one is better :)
They all works fine.

I works under linux, and I need imap extension support ;)

Mayby I will take apache1+php, for contented, aha .. ;)

----
Ni Shurong <srnigzlinux.org>

MAIL : srnigzlinux.org
QQ : 412844
MSN : nsr_xhhotmail.com
BLOG : http://blog.njmars.com/myhan/

attached mail follows:


For more info:
http://www.reversefold.com/tikiwiki/tiki-index.php?page=PHPFAQs#id292342

On Thu, 29 Jul 2004 20:29:46 +0800, Ni Shurong <srnigzlinux.org> wrote:
> Thank you! ;)
>
> I have build apache1+php5, apache2+php5
> but I don't know how to test which one is better :)
> They all works fine.
>
> I works under linux, and I need imap extension support ;)
>
> Mayby I will take apache1+php, for contented, aha .. ;)
>
>
> ----
> Ni Shurong <srnigzlinux.org>
>
> MAIL : srnigzlinux.org
> QQ : 412844
> MSN : nsr_xhhotmail.com
> BLOG : http://blog.njmars.com/myhan/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> !DSPAM:4108eb5b127794670337895!
>
>

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


Dear list,

im running mysql 4.1 and php 4.3.8 and have the following problem with
charset. If i select a row from a table like
SELECT *
FROM ip
WHERE ip
LIKE '127.0.0.1'
LIMIT 0 , 30

i get the error:

 #1267 - Illegal mix of collations (ascii_general_ci,IMPLICIT) and
(latin1_swedish_ci,COERCIBLE) for operation 'like'

the database is completly configured as ascii charset so i need to know how
to i change the charset from swedish (latin1) to ascii in php ?

btw i configured php as --with-mysql/usr/local/mysql

thanks for answers

s gerske

attached mail follows:


Hi all,

I have stumbled across something odd related to classes, instances and
NULL in PHP 4. Apparently, an instance of a class that doesn't contain
any variables is always equal to NULL.

  class MyClass {
    function anyFunction() {
      ...
    }
  }

  $c = new MyClass();
  if ($c == null) {
    print "is \$c really null?";
  }

`is_null($c)' however, returns `false', as one would expect.

As soon as the class contains a variable, the `$c == null' comparison
returns false.

Is there any logical reason why the comparison with the `==' operator
returns `true'? I don't know about the internals of PHP, but I think
this might be related to implementation details (e.g. instances of
classes being associative arrays). However, from an OOP point of view
this behaviour seems rather weird.

I may not be the first to notice this. I couldn't find anything in the
mailing list, if there has already been a discussion about this, just
point me to the right direction.

Thanks
Oliver

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBCPCY4hxFYtsxPogRAgtpAKDLCWOScafzgjPCYLNI3C/1R1pGbQCfa3sG
46tvBqYadYHODoTLyN9gXD4=
=Nild
-----END PGP SIGNATURE-----

attached mail follows:


Hi Oliver, you should test with === instead of ==
   http://php.net/manual/en/language.operators.comparison.php

didou

Oliver Hitz wrote:
> Hi all,
>
> I have stumbled across something odd related to classes, instances and
> NULL in PHP 4. Apparently, an instance of a class that doesn't contain
> any variables is always equal to NULL.
>
> class MyClass {
> function anyFunction() {
> ...
> }
> }
>
> $c = new MyClass();
> if ($c == null) {
> print "is \$c really null?";
> }
>
> `is_null($c)' however, returns `false', as one would expect.
>
> As soon as the class contains a variable, the `$c == null' comparison
> returns false.
>
> Is there any logical reason why the comparison with the `==' operator
> returns `true'? I don't know about the internals of PHP, but I think
> this might be related to implementation details (e.g. instances of
> classes being associative arrays). However, from an OOP point of view
> this behaviour seems rather weird.
>
> I may not be the first to notice this. I couldn't find anything in the
> mailing list, if there has already been a discussion about this, just
> point me to the right direction.
>
> Thanks
> Oliver

attached mail follows:


On 29 Jul 2004, Mehdi Achour wrote:
> Hi Oliver, you should test with === instead of ==
> http://php.net/manual/en/language.operators.comparison.php

Thank you. I know there is a `===' operator, but to me this doesn't make
sense either.

  class A { }
  class B { var $x; }

It is logical that an instance of `A' is not identical to null. However,
why is an instance of `A' equal (`==' operator) to null, an instance of
`B' not? Do objects automatically evaluate to their associative array
representation? Is this intended behaviour?

Thanks
Oliver

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBCPqC4hxFYtsxPogRAkCZAJ951DJLZmOKF3xwC3NcY0qoKHJY2gCghqna
/2BXDUdO05eJpOtafXoxVeI=
=386f
-----END PGP SIGNATURE-----

attached mail follows:


Oliver Hitz wrote:
> Thank you. I know there is a `===' operator, but to me this doesn't
> make sense either.
>
> class A { }
> class B { var $x; }
>
> It is logical that an instance of `A' is not identical to null.
> However, why is an instance of `A' equal (`==' operator) to null, an
> instance of `B' not? Do objects automatically evaluate to their
> associative array representation? Is this intended behaviour?

There are four different types that PHP could be casting the object and null to that
would result in them being equal, namely boolean, integer, float, and array. It's
definitely not casting them to string or object. My guess is the behavior is not
intentional since the documentation for the "NULL" type says that a variable is
equal to null only if it has had the "null" constant assigned to it, it has not had
a value assigned to it at all, or it has been unset(). You'd probably get more
definitive answers on the internals list. Personally I consider the behavior a bug,
so I'd probably file a bug report on it, although I wouldn't expect it to be given a
high priority. :)

attached mail follows:


On Thu, 29 Jul 2004 14:41:57 +0200, Oliver Hitz <olivernet-track.ch> wrote:
> Hi all,
>
> I have stumbled across something odd related to classes, instances and
> NULL in PHP 4. Apparently, an instance of a class that doesn't contain
> any variables is always equal to NULL.
>
> class MyClass {
> function anyFunction() {
> ...
> }
> }
>
> $c = new MyClass();
> if ($c == null) {
> print "is \$c really null?";
> }
>
> `is_null($c)' however, returns `false', as one would expect.
>
> As soon as the class contains a variable, the `$c == null' comparison
> returns false.
>
> Is there any logical reason why the comparison with the `==' operator
> returns `true'? I don't know about the internals of PHP, but I think
> this might be related to implementation details (e.g. instances of
> classes being associative arrays). However, from an OOP point of view
> this behaviour seems rather weird.
>
> I may not be the first to notice this. I couldn't find anything in the
> mailing list, if there has already been a discussion about this, just
> point me to the right direction.
>

Hmmm, I was about to say: "This is expected behavior", but the output
of this script I whipped up doesn't make sense to me:

class A {
}
$a = array(0,
'0',
'',
null,
array(),
new A());

echo '<table>';
foreach($a as $key => $val) {
  foreach($a as $key2 => $val2) {
    if($key != $key2) {
      echo '<tr><td>';
      var_dump($val);
      echo '</td><td>';
      var_dump($val2);
      echo '</td><td>';
      if($val == $val2) {
        echo 'yes';
      } else {
        echo 'no';
      }
      echo '</tr>';
    }
  }
}
echo '</table>';

I would sugest using === for anything critical where you don't
necessarily know the type.

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


Everything is possible :)

And in this case, it seems, that lines are delimited by <br> ... i'm not quite
sure, whether "<br>" can be used in explode as a delimiter, if so, you have no
problem and you just read all the file into variable, $lines = explode('<br>',
$variable) and you have lines in $lines... if "<br>" can not be explode's
parameter, i would use str_replace to replace it with ie. #13 and then explode
it... or use some regular expressions... it depends on how fast you need it... :)

hope this was what you needed... :)

regards,
m.

Dustin Krysak wrote:

> Hi there.. .I am displaying info (on music) from a text file with the
> following code...
>
> <?php
> //open the file handler
> $fp02=fopen("assets/lib/php/itunes/recent.txt","r");
> //Read the track info
> $recent=fgets($fp02);
> //close the file.
> echo "$recent";
> fclose($fp02);
> ?>
>
>
>
> Now the contents of said text file would read something like the following:
>
> <b>Liar</b><br>by <i><b>Sex Pistols</b><i><br><i>"Never Mind The
> Bollocks"</i><br>Played: 2004/07/28, 1:48:29
> PM<br>----------<br><b>Let's Rave On</b><br>by <i><b>The
> Raveonettes</b><i><br><i>"Chain Gang Of Love"</i><br>Played: 2004/07/28,
> 1:46:37 PM<br>----------<br><b>No Remorse</b><br>by
> <i><b>Metallica</b><i><br><i>"Kill 'Em All"</i><br>Played: 2004/07/28,
> 1:40:17 PM<br>----------<br><b>This Is Our Emergency</b><br>by
> <i><b>Pretty Girls Make Graves</b><i><br><i>"The New
> Romance"</i><br>Played: 2004/07/28, 1:36:37
> PM<br>----------<br><b>Freestylin'</b><br>by
> <i><b>Greyboy</b><i><br><i>"Freestylin'"</i><br>Played: 2004/07/28,
> 1:30:25 PM<br>----------<br><b>In My Head</b><br>by <i><b>Naked
> Raygun</b><i><br><i>"Raygun...Naked Raygun (Reissue)"</i><br>Played:
> 2004/07/28, 1:26:37 PM<br>----------<br><b>Lust To Love</b><br>by
> <i><b>The Go-Go's</b><i><br><i>"Return To The Valley Of The
> Go-Go's"</i><br>Played: 2004/07/28, 1:23:13 PM<br>----------<br><b>Kim
> You Bore Me To Death</b><br>by <i><b>Grandaddy</b><i><br><i>"Concrete
> Dunes"</i><br>Played: 2004/07/28, 1:18:37
> PM<br>----------<br><b>Sonderkommando</b><br>by
> <i><b>Gwar</b><i><br><i>"This Toilet Earth"</i><br>Played: 2004/07/28,
> 1:13:49 PM<br>----------<br>
>
> Now what I want to do is read this file, but only say read 5 songs
> worth, then I would place the PHP code in (another table) and display
> the next 5 songs and so on.... This just allows for a more flexible
> layout in the final presentation. the way I am having the text files
> written, there is no way to get it to produce seperate text files -
> otherwise this would be easy to do....
>
> Is this possible?
>
> Thanks in advance!
>
> Dustin
>

--
Miroslav Hudak
developer & designer
http://hudak.info

attached mail follows:


Hello everybody,
Can someone help me saying how i can run a php script automatically once
in a day.

attached mail follows:


[snip]
Hello everybody,
Can someone help me saying how i can run a php script automatically once
in a day.
[/snip]

You don't say what your OS is, but CRON will do it....

attached mail follows:


PHPDiscuss - PHP Newsgroups and mailing lists wrote:
> Hello everybody,
> Can someone help me saying how i can run a php script automatically once
> in a day.
>

man cron

Or if yer one of dem Windows users, there's that task scheduler thingy.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


"Harlequin" <michael.masonarraspeople.co.uk> wrote in message
news:20040728111920.89901.qmailpb1.pair.com...
> Hi all.
>
> I'm trying to retrieve values from a previously selected dropdown menu.
For
> text I simply use value="$Whatever"

here is small example on dynamically cretaing listboxes, and selecting the
items.

http://www.templatetamer.org/index.php?SimpleListboxExample

rush
--
http://www.templatetamer.com/

attached mail follows:


I have never kept my images in the database but instead used the db to hold
the path to the image. I now have to connect to a third party SQL Server db
which holds images with an image data type in the table. How can I pull
this out so it can be diplayed? I simply can't echo out the contents as it
shows the code, not the image.

Thanks,
Eddie

attached mail follows:


Edward Peloke wrote:

>I have never kept my images in the database but instead used the db to hold
>the path to the image.
>
indeed that is the right way to do it.

>I now have to connect to a third party SQL Server db
>which holds images with an image data type in the table. How can I pull
>this out so it can be diplayed?
>
not an expert on MSSQL but....

>I simply can't echo out the contents as it
>shows the code, not the image.
>
>
could be something as simple had not sending the correct header.

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

attached mail follows:


New to the list, thanks in advance.

 

I have created a form that lists the possible sponsorships of various
events. I need to keep the names of the checkbox to identify the specific
event, but the value is a dollar amount that needs to pass thru to the
checkout area function. Without creating an array that would loose the
events names (some events have the same dollar amount), how can I capture
the dollar value(s) checked an pass them to the checkout form?

 

Regards,

 

Techmaniac

attached mail follows:


[snip]
I have created a form that lists the possible sponsorships of various
events. I need to keep the names of the checkbox to identify the
specific
event, but the value is a dollar amount that needs to pass thru to the
checkout area function. Without creating an array that would loose the
events names (some events have the same dollar amount), how can I
capture
the dollar value(s) checked an pass them to the checkout form?
[/snip]

I don't think you explained this well, but I'll take a shot....

<input type="checkbox" name="EventFoo" value="">

When this is passed to processing via a POST event it becomes

$_POST['EventFoo'] (that contains the value entered in the form, like 5
bucks)

So for each event name you will have a like POST array item containing
the value.

Does this help?

attached mail follows:


[snip]
Your right, I didn't explain fully. If I have two events where the
value="$5", then after I have looped thru the array I know they want to
pay
the $5, but not which event that goes to because multiple events are
that
value. What I'm thinking I'll do is make one array and give each event
a #,
then after checking for the selected checkbox, validate which number and
pass thru the event and corresponding dollar amount. Sound like the
best
solution? If not, I hope I have explained a little more precise.
[/snip]

A. Always reply back to the list in case the responder is no longer
available which may leave you hanging.

2. Even though multiple events have the same value ($5) they are listed
in the POST array according to the name the event input was given in the
form. You do not need to do the above unless you have a badly done form.
Why don't you send the code from the portion of the form we are talking
about and we can help better.

attached mail follows:


On Thursday 29 July 2004 22:04, Andrew Reilly wrote:

> I have created a form that lists the possible sponsorships of various
> events. I need to keep the names of the checkbox to identify the specific
> event, but the value is a dollar amount that needs to pass thru to the
> checkout area function. Without creating an array that would loose the
> events names (some events have the same dollar amount), how can I capture
> the dollar value(s) checked an pass them to the checkout form?

Not exactly sure what you're trying to do. However you seem to be wanting to
pass around monetary values via forms. In general this is a VERY BAD idea.
Data submmitted from forms should not be trusted. Instead you should only
link the events to their monetary values (using a back-end lookup table or
whatever) AFTER the form is submitted.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
An infallible method of conciliating a tiger is to allow oneself to be
devoured.
                -- Konrad Adenauer
*/

attached mail follows:


Example of form:
<td height="52" align="left" valign="middle"><input type="checkbox"
name="wbc_Money" value="$5000">
      Power of Money Series ($5000) <img src="images/sold_Out.gif"
border="0">Power
      of Politics ($3500)<br> <input type="checkbox" name="wbc_Wine"
value="$1000">
      Power of Wine &nbsp;&nbsp; <input type="checkbox" name="wbc_Golffall"
value="$3500">
      Power of Golf (Fall) Series ($3500)<br> <input type="checkbox"
name="wbc_Golfspring" value="$3500">
      Power of Golf (Spring) Series ($3500)</td>

So the dollar amounts are the same for three of the four events, but this is
just a snippet of about 20 items. If I take out the dollar amounts, and
just populate an array with what are now the descriptive names, I can assign
dollar amounts in the checkout script. Am I on the right track?

-----Original Message-----

Subject: RE: [PHP] Need to maintain the integrity of the checkbox

[snip]
Your right, I didn't explain fully. If I have two events where the
value="$5", then after I have looped thru the array I know they want to
pay
the $5, but not which event that goes to because multiple events are
that
value. What I'm thinking I'll do is make one array and give each event
a #,
then after checking for the selected checkbox, validate which number and
pass thru the event and corresponding dollar amount. Sound like the
best
solution? If not, I hope I have explained a little more precise.
[/snip]

A. Always reply back to the list in case the responder is no longer
available which may leave you hanging.

2. Even though multiple events have the same value ($5) they are listed
in the POST array according to the name the event input was given in the
form. You do not need to do the above unless you have a badly done form.
Why don't you send the code from the portion of the form we are talking
about and we can help better.

attached mail follows:


[snip]
Example of form:
<input type="checkbox" name="wbc_Money" value="$5000">
<input type="checkbox" name="wbc_Wine" value="$1000">
<input type="checkbox" name="wbc_Golffall" value="$3500">
<input type="checkbox" name="wbc_Golfspring" value="$3500">

So the dollar amounts are the same for three of the four events, but
this is
just a snippet of about 20 items. If I take out the dollar amounts, and
just populate an array with what are now the descriptive names, I can
assign
dollar amounts in the checkout script. Am I on the right track?
[/snip]

Yes you are...each would be available thusly.....(with your names and
current values once the submit button is pressed)

$_POST['wbc_Money']; would be equal to $5000
$_POST['wbc_Wine']; would be equal to $1000
$_POST['wbc_Golffall']; would be equal to $3500
$_POST['wbc_Golfspring']; would be equal to $3500

The $_POST array will be populated for you, you do not need to populate
a seperate array. Try it!

attached mail follows:


So the <?=$_POST['wbc_Event']?> would go in the value or name field of the
checkbox?

-----Original Message-----
From: Jay Blanchard [mailto:jay.blanchardniicommunications.com]
Sent: Thursday, July 29, 2004 10:01 AM
To: Andrew Reilly; php-generallists.php.net
Subject: RE: [PHP] Need to maintain the integrity of the checkbox

[snip]
Example of form:
<input type="checkbox" name="wbc_Money" value="$5000">
<input type="checkbox" name="wbc_Wine" value="$1000">
<input type="checkbox" name="wbc_Golffall" value="$3500">
<input type="checkbox" name="wbc_Golfspring" value="$3500">

So the dollar amounts are the same for three of the four events, but
this is
just a snippet of about 20 items. If I take out the dollar amounts, and
just populate an array with what are now the descriptive names, I can
assign
dollar amounts in the checkout script. Am I on the right track?
[/snip]

Yes you are...each would be available thusly.....(with your names and
current values once the submit button is pressed)

$_POST['wbc_Money']; would be equal to $5000
$_POST['wbc_Wine']; would be equal to $1000
$_POST['wbc_Golffall']; would be equal to $3500
$_POST['wbc_Golfspring']; would be equal to $3500

The $_POST array will be populated for you, you do not need to populate
a seperate array. Try it!

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

attached mail follows:


[snip]
So the <?=$_POST['wbc_Event']?> would go in the value or name field of
the
checkbox?
[/snip]

No, just value=""

attached mail follows:


[snip]
[snip]
So the <?=$_POST['wbc_Event']?> would go in the value or name field of
the
checkbox?
[/snip]

No, just value=""
[/snip]

I should have been more descriptive. When you click the SUBMIT button
the values entered will appear in the $_POST array

A small example

page1.php (the form page)

<?php
/* no php code needed */
?>
<html>
<head><title>POST Test</title></head>
<body>
<form action="page2.php" method="POST">
<input type="text" name="thisVar" value=""><br>
<input type="text" name="thatVar" value=""><br>
<input type="submit" name="action" value="SUBMIT FORM"><br>
</form>
</body>
</html>

page2.php (the processing page)

<?php
/* here are the post array variables we have spoken about */
echo $_POST['thisVar'] . "<br>";
echo $_POST['thatVar'] . "<br>";
?>

attached mail follows:


Afternoon...

I have a table generated by some code that returns certain field values and
drops them into a table. On of these values is ID and I'd like to convert it
to a hyperlink that people can use to go to another page to view further
information about a record. However:

The fields are not individually identified as I use a for statement and I
think I might need to redesign the table but don't know where to start.

Can anyone provide any pointers please...?

--
-----------------------------
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-----------------------------

attached mail follows:


[snip]
I have a table generated by some code that returns certain field values
and
drops them into a table. On of these values is ID and I'd like to
convert it
to a hyperlink that people can use to go to another page to view further
information about a record. However:

The fields are not individually identified as I use a for statement and
I
think I might need to redesign the table but don't know where to start.

Can anyone provide any pointers please...?
[/snip]

RTFM.

If I need a hyperlink I have to code it even in a loop....i.e.

<?php
while($remi = mysql_fetch_object($dbemi)){
        print("<tr>\n");
        print("<td>" . $remi->bellname . "</td>\n");
        print("<td><a href=\"batch.crm.php?bn=" . $remi->niiname . "\">"
. $remi->niiname . "</a> - click for batch report</td>\n");
        print("<td align=\"right\">" . number_format($remi->bellcount,
0, '', ',') . "</td>\n");
        print("<td align=\"right\">" . $remi->statdate . "</td>\n");
        print("</tr>\n");
}
?>

attached mail follows:


RTFM...?

--
-----------------------------
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-----------------------------
"Jay Blanchard" <jay.blanchardniicommunications.com> wrote in message
news:C8F323573C030A448F3E5A2B6FE2070B0430C67Cnemesis...
[snip]
I have a table generated by some code that returns certain field values
and
drops them into a table. On of these values is ID and I'd like to
convert it
to a hyperlink that people can use to go to another page to view further
information about a record. However:

The fields are not individually identified as I use a for statement and
I
think I might need to redesign the table but don't know where to start.

Can anyone provide any pointers please...?
[/snip]

RTFM.

If I need a hyperlink I have to code it even in a loop....i.e.

<?php
while($remi = mysql_fetch_object($dbemi)){
print("<tr>\n");
print("<td>" . $remi->bellname . "</td>\n");
print("<td><a href=\"batch.crm.php?bn=" . $remi->niiname . "\">"
. $remi->niiname . "</a> - click for batch report</td>\n");
print("<td align=\"right\">" . number_format($remi->bellcount,
0, '', ',') . "</td>\n");
print("<td align=\"right\">" . $remi->statdate . "</td>\n");
print("</tr>\n");
}
?>

attached mail follows:


Harlequin wrote:
> RTFM...?
>

AKA : Read The F**king Manual

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


I know.

Just wondered if Jay had the courage of his convictions.

--
-----------------------------
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-----------------------------
"John Nichel" <johnkegworks.com> wrote in message
news:41092B0E.7010602kegworks.com...
> Harlequin wrote:
> > RTFM...?
> >
>
> AKA : Read The F**king Manual
>
> --
> John C. Nichel
> ÜberGeek
> KegWorks.com
> 716.856.9675
> johnkegworks.com

attached mail follows:


On Friday 30 July 2004 01:05, Harlequin wrote:

> "John Nichel" <johnkegworks.com> wrote in message
> news:41092B0E.7010602kegworks.com...
>
> > Harlequin wrote:
> > > RTFM...?
> >
> > AKA : Read The F**king Manual

> I know.
>
> Just wondered if Jay had the courage of his convictions.

Most people who use the term RTFM do not attach any hostile intentions with
it. If you're going to start getting all emotional about being told to RTFM
then you should stay away frm mailing lists, the internet, and computers in
general.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
The trouble with heart disease is that the first symptom is often hard to
deal with: death.
                -- Michael Phelps
*/

attached mail follows:


I always feel so at home on this list.

Now if we could keep John and Chris from being so prim and proper. ;)

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


> From: John Nichel <johnkegworks.com>

> I always feel so at home on this list.
>
> Now if we could keep John and Chris from being so prim and proper. ;)

Yes, sir. I shall try.

---John Holmes...

UCCASS - PHP Survey System
http://www.bigredspark.com/survey.html

attached mail follows:


Quoting Jason Wong <php-generalgremlins.biz>:
> Most people who use the term RTFM do not attach any hostile intentions with
> it. If you're going to start getting all emotional about being told to RTFM
> then you should stay away frm mailing lists, the internet, and computers in
> general.

Well there *are* people whose language standards are quite conservative who find
even the "hidden" use of that Anglo-Saxonism in the acronym offensive -- "RTM"
would be much less so. I don't agree with them, but I totally understand their
point.

attached mail follows:


On Thu, 29 Jul 2004, John Nichel wrote:

> Harlequin wrote:
> > RTFM...?
>
> AKA : Read The F**king Manual

        Why not simply 'Read The Fine Manual', or 'Read The Fantastic
Manual'? Why does it have to contain profanity?

        Just my two cents.

--
L | I haven't lost my mind; it's backed up on tape somewhere.
   +--------------------------------------------------------------------
   Ashley M. Kirchner <mailto:ashleypcraft.com> . 303.442.6410 x130
   IT Director / SysAdmin / WebSmith . 800.441.3873 x130
   Photo Craft Laboratories, Inc. . 3550 Arapahoe Ave. #6
   http://www.pcraft.com ..... . . . Boulder, CO 80303, U.S.A.

attached mail follows:


[snip]
> Harlequin wrote:
> > RTFM...?
>
> AKA : Read The F**king Manual

        Why not simply 'Read The Fine Manual', or 'Read The Fantastic
Manual'? Why does it have to contain profanity?

        Just my two cents.
[/snip]

Because that is what it has always meant.

attached mail follows:


Ashley M. Kirchner wrote:
> On Thu, 29 Jul 2004, John Nichel wrote:
>
>> Harlequin wrote:
>> > RTFM...?
>>
>> AKA : Read The F**king Manual
>
>
> Why not simply 'Read The Fine Manual', or 'Read The Fantastic
> Manual'? Why does it have to contain profanity?
>
> Just my two cents.
>
>

Great thing about an acronym...it can pretty much mean whatever _you_
want it too. Of course where things like RTFM, STFA, et al are
concerned, the majority will know it the *mean and nasty* way. ;)

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


Quoting "Ashley M. Kirchner" <ashleypcraft.com>:

> On Thu, 29 Jul 2004, John Nichel wrote:
>
> > Harlequin wrote:
> > > RTFM...?
> >
> > AKA : Read The F**king Manual
>
> Why not simply 'Read The Fine Manual', or 'Read The Fantastic
> Manual'? Why does it have to contain profanity?

Because that's what it *does* mean. The others are post-facto bowlderizing of
it. If I told someone to FOAD, and tried to explain that it meant "float off
and die," I'd be covering up similarly.

attached mail follows:


>> Most people who use the term RTFM do not attach any hostile
>> intentions with
>> it.

I'm among those who are really pissed off when I see honest questions
being answered with 'RTFM' or 'STFW'. I am relatively new to PHP, but
by no means am I new to programming: like everyone else here, I already
know how to RTFM and STFW. But sometimes I like to get an opinion from
a real person: correct me if I'm wrong; is that not the purpose of a
list??

If you're going to answer with an insulting 'RTFM' or 'STFW' then don't
even post. Your noise is not helpful. Go find a list where everyone
already knows everything so you can masturbate all you want.

Please flame me back channel,

Brian Dunning
http://www.briandunning.com/

attached mail follows:


> On Thu, 29 Jul 2004, John Nichel wrote:
>
>> Harlequin wrote:
>> > RTFM...?
>>
>> AKA : Read The F**king Manual
>
> Why not simply 'Read The Fine Manual', or 'Read The Fantastic
> Manual'? Why does it have to contain profanity?
>
> Just my two cents.

Read the Fscking Manuel

--
--Matthew Sims
--<http://killermookie.org>

attached mail follows:


On Friday 30 July 2004 04:46, Ashley M. Kirchner wrote:

> Why not simply 'Read The Fine Manual', or 'Read The Fantastic
> Manual'? Why does it have to contain profanity?

For all practical purposes:

  RTFM == "read the manual"

If someone finds it offensive then they're either delusional or paranoid or
more likely both!

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
All the simple programs have been written.
*/

attached mail follows:


> > Why not simply 'Read The Fine Manual', or 'Read The Fantastic
> > Manual'? Why does it have to contain profanity?
>
> For all practical purposes:
>
> RTFM == "read the manual"
>
> If someone finds it offensive then they're either delusional or paranoid or
> more likely both!

If I'm offended by the word "wong" what do that make me?

---John Holmes...

UCCASS - PHP Survey System
http://www.bigredspark.com/survey.html

attached mail follows:


Dears,

I have asked my webhost when will they install PHP5, he told me that not
very soon as he assured me that there will be some bugs.

Usually, when do you quys/gals think that php5 will be stable and
webhost will start to upgrade?

attached mail follows:


PHP 4.3.4
MySQL 4.0.2
Apache 2.0.48
RedHat 9.0

I have a form that post some data to a DB. After the post, I send it
back to another page with a named anchor like this:

<a name="comments">Comments</a>

By way of a URL that looks like this:

http://www.domain.com/index.php?mode=view&id=100&#comments
or
http://www.domain.com/index.php?mode=view&id=100#comments

Using Mozilla Firefox .08, .09, Netscape 5+, and Mozilla 1.7 this will
show a blank page. If I use IE, I notice a longer pause since adding the
named anchor, but it will still work.

Any ideas about PHP having issues passing a named anchor?

Thank You.

- Jason

attached mail follows:


[snip]
I have a form that post some data to a DB. After the post, I send it
back to another page with a named anchor like this:

<a name="comments">Comments</a>

By way of a URL that looks like this:

http://www.domain.com/index.php?mode=view&id=100&#comments
or
http://www.domain.com/index.php?mode=view&id=100#comments

Using Mozilla Firefox .08, .09, Netscape 5+, and Mozilla 1.7 this will
show a blank page. If I use IE, I notice a longer pause since adding the

named anchor, but it will still work.

Any ideas about PHP having issues passing a named anchor?
[/snip]

Can we see some code?

attached mail follows:


Sure.

This is my function for posting a comment via the form I mentioned
previously:

[code]
case "post_comment":

// SQL to insert new psot into DB //
$sql = "INSERT INTO table(value1, value2, value3)
        VALUES ('" . $_POST["value1"] . "',
                '" . $_POST["value2"] . "',
                '" . $_POST["value3"] . "')";

$result = mysql_query($sql)
        or die ("inserting_values:".mysql_error());

// Grab the ID so we can refer to it later //
$id = mysql_insert_id();

// Redirect back to comments page //

echo"<script>window.location.href='index.php?mode=view&id=$id&#comments';</script>";

break;
[/code]

- Jason

Jay Blanchard wrote:

> [snip]
> I have a form that post some data to a DB. After the post, I send it
> back to another page with a named anchor like this:
>
> <a name="comments">Comments</a>
>
> By way of a URL that looks like this:
>
> http://www.domain.com/index.php?mode=view&id=100&#comments
> or
> http://www.domain.com/index.php?mode=view&id=100#comments
>
> Using Mozilla Firefox .08, .09, Netscape 5+, and Mozilla 1.7 this will
> show a blank page. If I use IE, I notice a longer pause since adding the
>
> named anchor, but it will still work.
>
> Any ideas about PHP having issues passing a named anchor?
> [/snip]
>
> Can we see some code?

attached mail follows:


[snip]
Sure.

This is my function for posting a comment via the form I mentioned
previously:

[code]
case "post_comment":

// SQL to insert new psot into DB //
$sql = "INSERT INTO table(value1, value2, value3)
        VALUES ('" . $_POST["value1"] . "',
                '" . $_POST["value2"] . "',
                '" . $_POST["value3"] . "')";

$result = mysql_query($sql)
        or die ("inserting_values:".mysql_error());

// Grab the ID so we can refer to it later //
$id = mysql_insert_id();

// Redirect back to comments page //

echo"<script>window.location.href='index.php?mode=view&id=$id&#comments'
;</script>";

break;
[/code]
[/snip]

When you redirect you have to pull the comment from the database for it
to display. Are you doing that?

attached mail follows:


>
> PayPal passes a ton of data back to us when someone's done
> purchasing something. I use some of that information and shove it all
> into a database. Problem is, if someone hits reload on their browser, I
> get the same data re-inserted again. Reload the page four times, and I
> will get four records with the same data inserted. How can I avoid
> this? I'd like to silently either discard the information after it's
> been inserted, or silently prevent it from being re-inserted again.
>
> --
> W | I haven't lost my mind; it's backed up on tape somewhere.
> +--------------------------------------------------------------------
> Ashley M. Kirchner <mailto:ashleypcraft.com> . 303.442.6410 x130

What I usually do is send a header redirect back to the same page. Your DB
injection should occur before any HTML output. At the end of the DB
injection simply add:

header("Location:your_php_page.php");
exit;

This will reload that page and all the $_POST data will be removed. THen
you can hit refresh all you want.

--
--Matthew Sims
--<http://killermookie.org>

attached mail follows:


On Thu, 29 Jul 2004, Skippy wrote:

> ATTENTION: if you receive the PayPal data by POST be sure to redirect
> using "303 See Other", which will "deactivate" the POST and force the
> redirect to use GET. Of course, forwarding any data to the 2nd script
> should be done as GET parameters.

        I stuck phpinfo() in my script that PayPal calls after the
transaction, and I'm getting both _REQUEST[] as well as _POST[] values.
All the values are the same for both variable, but they're there:

        _REQUEST["payment_gross"] = "20.00"
        ... several other _REQUEST variables ...
        _POST["payment_gross"] = "20.00"
        .. some more _POST variables that match the _REQUEST ones above

--
L | I haven't lost my mind; it's backed up on tape somewhere.
   +--------------------------------------------------------------------
   Ashley M. Kirchner <mailto:ashleypcraft.com> . 303.442.6410 x130
   IT Director / SysAdmin / WebSmith . 800.441.3873 x130
   Photo Craft Laboratories, Inc. . 3550 Arapahoe Ave. #6
   http://www.pcraft.com ..... . . . Boulder, CO 80303, U.S.A.

attached mail follows:


> Why does this fail when using an array element, but using a variable will
> work? Why should PHP care what the variable is I'm trying to store into?
>
> list($bar['CompanyCode'], $CompanyDB) = mysql_fetch_row($sth);

Wouldn't it be easier to simply do:

$result = mysql_fetch_row($sth);

And then work with the $result array? If your DB indexes are listed as
CompanyCode and CompanyDB, then use:

$result = mysql_fetch_array($sth);

Then you have your variable names like you want:

$result['CompanyCode'] and $result['CompanyDB']

--
--Matthew Sims
--<http://killermookie.org>

attached mail follows:


[snip]
Just wondered if Jay had the courage of his convictions.
[/snip]

Yes I do...I showed incredible restraint because I could have said STFW
and STFA too. Courage of my convictions indeed, are you new here?

attached mail follows:


Jay

I am new. we all are at something at some point or other in our lives.

If you don't like me fine - just ignore me.

If you want to help, that's fine also.

Just be polite. You don't need to swear to get your point across and don't
need to be aggressive as either method implies a lack of control on your
part and losing control is not what helping is about.

and Jay.

Have a great day :)

--
-----------------------------
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-----------------------------
"Jay Blanchard" <jay.blanchardniicommunications.com> wrote in message
news:C8F323573C030A448F3E5A2B6FE2070B03522798nemesis...
[snip]
Just wondered if Jay had the courage of his convictions.
[/snip]

Yes I do...I showed incredible restraint because I could have said STFW
and STFA too. Courage of my convictions indeed, are you new here?

attached mail follows:


[snip]
I am new. we all are at something at some point or other in our lives.

If you don't like me fine - just ignore me.

If you want to help, that's fine also.

Just be polite. You don't need to swear to get your point across and
don't
need to be aggressive as either method implies a lack of control on your
part and losing control is not what helping is about.

and Jay.

Have a great day :)
[/snip]

Apparently you are not aware of the great history of mailing lists. I
did help you and you will see several use all three acronyms to get
their point across. I didn't swear. My suggestion is that if you don't
like it don't post. Those who provide their quite valuable time here
appreciate when newbies show that they have at least done some research
or work towards the possible solution.

http://catb.org/~esr/faqs/smart-questions.html

And Harlequin, don't be a smartarse.

attached mail follows:


Harlequin wrote:

>Jay
>
>I am new. we all are at something at some point or other in our lives.
>
>
If you are newbie please read the newbie guide for the benefit of new
members before posting.

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

attached mail follows:


I've got a function where I reset an expiration datetime to 3 days in
the future, using:

   update table set expire = NOW()+3000000 where ...

Has always worked great, but today it always sets the field to
0000-00-00 00:00:00. No code was touched. Anyone have a clue? A problem
with the ISP's server clock?

attached mail follows:


[snip]
I've got a function where I reset an expiration datetime to 3 days in
the future, using:

   update table set expire = NOW()+3000000 where ...

Has always worked great, but today it always sets the field to
0000-00-00 00:00:00. No code was touched. Anyone have a clue? A problem
with the ISP's server clock?
[/snip]

Have you asked the ISP?

attached mail follows:


On Jul 29, 2004, at 10:18 AM, Jay Blanchard wrote:

> Have you asked the ISP?

No - that's like asking a black hole, unfortunately - I was hoping
someone here might spot a problem on my end.

- Brian

attached mail follows:


[snip]
> Have you asked the ISP?

No - that's like asking a black hole, unfortunately - I was hoping
someone here might spot a problem on my end.
[/snip]

[smartass mode to full power - nothing personl]
The problem most of us spotted was that there was not information in the
initial post to arrive at any conclusion whatsoever. No code was given,
because that wasn't broken. You gave us a SQL query (which might be
directed at a database list) which offered no possible explanation and
then you asked us about your ISP. Since we all knew instinctively which
ISP it was we figured it might be easier to ask them. They probably have
recompiled Apache, PHP and MySQL...depricating some of your usage.
[/smartass mode]

Please read this now, before you post again...
http://catb.org/~esr/faqs/smart-questions.html

attached mail follows:


On Friday 30 July 2004 01:39, Brian Dunning wrote:
> On Jul 29, 2004, at 10:18 AM, Jay Blanchard wrote:
> > Have you asked the ISP?
>
> No - that's like asking a black hole, unfortunately - I was hoping
> someone here might spot a problem on my end.

1) You're on the wrong list. Try asking on the mailing list of whatever DB
you're using.

2) For date calculations it's generally a good idea to use the the DB's date
calculation functions.

3) There are loads of things you can do yourself to help analyse the problem:
eg what does NOW() show in DB?, what does `date` show in OS (assuming un*x),
what does date() show in PHP?

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
"MSDOS didn't get as bad as it is overnight -- it took over ten years
of careful development."
(By dmegginsaix1.uottawa.ca)
*/

attached mail follows:


Maybe they've upgraded something on the server that's somehow affecting your
code?

Against MySQL 4.0.18

  Query: select NOW()
Results: 2004-07-29 10:48:12

  Query: select NOW()+3000000
Results: 20040732104424

The difference in result data format would lead to the problem you're
experiencing. In other words, you're suddenly trying to store a big number
into a date or date_time field and that doesn't work.

Depending on which version of MySQL you're using, try one of these:

(MySQL 4.1.1 and later)
update table set expire = ADDDATE(CURDATE(), 3) where ...

(older versions)
update table set expire = interval 3 day + CURDATE() where ...

> -----Original Message-----
> I've got a function where I reset an expiration datetime to 3 days in
> the future, using:
>
> update table set expire = NOW()+3000000 where ...
>
> Has always worked great, but today it always sets the field to
> 0000-00-00 00:00:00. No code was touched. Anyone have a clue? A problem
> with the ISP's server clock?

attached mail follows:


>
> [smartass mode to full power - nothing personl]
> [/smartass mode]

Is that W3C HTML 4.01 compliant?

--
--Matthew Sims
--<http://killermookie.org>

attached mail follows:


On Jul 29, 2004, at 10:45 AM, Jay Blanchard wrote:

> Please read this now, before you post again...
> http://catb.org/~esr/faqs/smart-questions.html

Thank you for not trying to be a condescending smartass at all.

attached mail follows:


This is a little bit more involved then the subject would let on. What I have
is a picture page, has nothing to do with an 80's themed kids show starring
Bill Cosby, but what it has to deal with is a search results like page where 5
images will appear with a next and prev link to get to more. However what I
need to do extra is if someone clicks in from a link for a particular picture
I need to display that pic first. So below is my psudocode.

$numresults = mysql_query("SELECT * FROM images WHERE approved = 1");
$numrows = mysql_num_rows($numresults);
if (empty($offset)) {
        $offset=0;
}
// end entry
$sqlquery = "SELECT * FROM images WHERE approved = 1 ORDER BY imageId DESC
limit $offset,$limit";
$result = mysql_query($sqlquery);
while ($search_return = mysql_fetch_array($result)) {
        print the images here
}
//mysql_free_result($result);
print $search_results;
// entry for results
$pages = intval($numrows/$limit);
if ($numrows%$limit) {
$pages++;
}

for ($i=1;$i<=$pages;$i++) {
$newoffset=$limit*($i-1);
print "<a href=\"$PHP_SELF?offset=$newoffset&sc=searchResults\">$i</a> \n";
}

if ($offset>1) {
$prevoffset=$offset-$limit;
print "<a href=\"$PHP_SELF?offset=$prevoffset&sc=searchResults\">$Prev</a>
\n";
}

if ($numrows>($offset+$limit)) {
$nextoffset=$offset+$limit;
print "<a href=\"$PHP_SELF?
offset=$nextoffset&sc=searchResults\">$Next</a><p>\n";
}

Any thoughts?

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/

attached mail follows:


[snip]
Any thoughts?
[/snip]

Several thousand. It must be the heat. Here are some.

Have you tested this? It wasn't explained clearly. The subject of the
thread does not reveal anything inside the post. Have you read
http://catb.org/~esr/faqs/smart-questions.html this? There are no
comments in your code.

attached mail follows:


Okay so I have a list of 20 images, I want to display 5 per page, the code I
have included will do that without any problems, and the code I have included
will setup the Prev, Next and page # links and they will pull up the correct
results. However I need to include some functionality where if I give this
code an image id say 13, that the code with then show 13 as the first one and
go on to 14, 15 to the end, and then start over ending the list at 12. So
that in this example you have 13, 14, 15, 16, 17 on page 1. page 2 would have
the next 5 and so on back to 12.

So I need to order a list starting at x, which in this case = 13, and then
have it loop around and end at 12.

Quoting php-generalmccullough-net.com:

> This is a little bit more involved then the subject would let on. What I
> have
> is a picture page, has nothing to do with an 80's themed kids show starring
>
> Bill Cosby, but what it has to deal with is a search results like page where
> 5
> images will appear with a next and prev link to get to more. However what I
>
> need to do extra is if someone clicks in from a link for a particular
picture
>
> I need to display that pic first. So below is my psudocode.
>
> $numresults = mysql_query("SELECT * FROM images WHERE approved = 1");
> $numrows = mysql_num_rows($numresults);
> if (empty($offset)) {
> $offset=0;
> }
> // end entry
> $sqlquery = "SELECT * FROM images WHERE approved = 1 ORDER BY imageId DESC
> limit $offset,$limit";
> $result = mysql_query($sqlquery);
> while ($search_return = mysql_fetch_array($result)) {
> print the images here
> }
> //mysql_free_result($result);
> print $search_results;
> // entry for results
> $pages = intval($numrows/$limit);
> if ($numrows%$limit) {
> $pages++;
> }
>
> for ($i=1;$i<=$pages;$i++) {
> $newoffset=$limit*($i-1);
> print "<a href=\"$PHP_SELF?offset=$newoffset&sc=searchResults\">$i</a> \n";
>
> }
>
>
> if ($offset>1) {
> $prevoffset=$offset-$limit;
> print "<a href=\"$PHP_SELF?offset=$prevoffset&sc=searchResults\">$Prev</a>
> \n";
> }
>
>
> if ($numrows>($offset+$limit)) {
> $nextoffset=$offset+$limit;
> print "<a href=\"$PHP_SELF?
> offset=$nextoffset&sc=searchResults\">$Next</a><p>\n";
> }
>
> Any thoughts?
>
>
> -------------------------------------------------
> This mail sent through IMP: http://horde.org/imp/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/

attached mail follows:


Hi all,

I'm trying from much days to solve a problem with a regular expression...
I'm going to be crazy!

I've a script that must strip a string when it find the first word
containing at least 4 characters; it must print the content of the
string before that word, that word, a separator and the rest of the
string.

I've tried with ereg whit this script (## is the separator):

ereg( '^([^ ]{4,})(.*)$', $testo, $matches);

$contents = "$matches[1]##$matches[2]\n";

but it is not the right script because if the strin($testo) is "the
thing is" the script doesn't find nothing and doesn't print. For this
example the right content of $contents must be:

$contents = "the thing##is\n";

instead of nothing.
I've tried with thousand of variant of this script but without success.
have you any ideas of the right regular expression?

Thanks in advance.
Bye

Barbara

--

attached mail follows:


Barbara Picci wrote:
> I've a script that must strip a string when it find the first word
> containing at least 4 characters; it must print the content of the
> string before that word, that word, a separator and the rest of the
> string.
>
> I've tried with ereg whit this script (## is the separator):
>
> ereg( '^([^ ]{4,})(.*)$', $testo, $matches);
>
> $contents = "$matches[1]##$matches[2]\n";
>
> but it is not the right script because if the strin($testo) is "the
> thing is" the script doesn't find nothing and doesn't print. For this
> example the right content of $contents must be:
>
> $contents = "the thing##is\n";
>
> instead of nothing.

I'm more comfortable with the PCRE functions:

$string = "the thing is";

if (preg_match('/^(.*?\S{4,})(\s*)(.*)$/', $string, $matches)) {
  $contents = $matches[1].'##'.$matches[3]."\n";
  print_r($contents);
}

prints

the thing##is

Your regex is anchoring its search for the first 4 character "word" to the beginning
of the string, which is probably not what you want.

I'm assuming from your description that you want whitespace that appears after the
first 4 character word to be replaced by the delimiter. Also you didn't specify
what should happen if the four character word happens to appear at the end of the
string. Also keep in mind that there are other word boundaries besides simply
whitespace, so you might want to use the "\w", "\W" metacharaters instead of "\s"
and "\S". See "perldoc perlre" for more details...

HTH

attached mail follows:


[snip]
>
> [smartass mode to full power - nothing personl]
> [/smartass mode]

Is that W3C HTML 4.01 compliant?
[/snip]

Yes, er....maybe. Try XJBML strict

attached mail follows:


Quoting Jay Blanchard <jay.blanchardniicommunications.com>:

> [snip]
> >
> > [smartass mode to full power - nothing personl]
> > [/smartass mode]
>
> Is that W3C HTML 4.01 compliant?
> [/snip]
>
> Yes, er....maybe. Try XJBML strict
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Tag is invalid personl, should be personAl

:)

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/

attached mail follows:


[snip]
> Please read this now, before you post again...
> http://catb.org/~esr/faqs/smart-questions.html

Thank you for not trying to be a condescending smartass at all.
[/snip]

Thank you for noticing! :-)

attached mail follows:


Thanks for pointing me in the right direction.

I managed to kill my existing authorisation credentials by throwing a
401 unauthorised header at IE.

Just in case anybody else is interested here is the basic layout of the
code I used(I did format it but that might have got lost, apologies if
it has):

logout.php
<?
session_start();
$_SESSION=array();
$_SESSION['LoggedOut']='TRUE';
?>

login.php
session_start();
//Start by assuming user is not logged in.
$UserAuthenticated = false;
//Check that user has input login credentials.
if ($_SESSION['LoggedOut']=='TRUE')
{
            header('WWW-Authenticate: Basic realm="www.ninemil.com"');
            header('HTTP/1.1 401 Unauthorized');
        $_SESSION['LoggedOut']='FALSE';
        exit;
}
else if (isset($_SERVER['PHP_AUTH_USER']) &&
isset($_SERVER['PHP_AUTH_PW']))
{
        //Compare login credentials to data in database and see if they are
valid.
        //See if the data check was successful
            $num = mysql_numrows($UserQuery);
            if ($num!=0)
        {
                //Set the session information to be used while logged in here.
                //Make sure code knows that user has been authenticated.
                $UserAuthenticated = true;
            }
}
if (!$UserAuthenticated)
{
        //If user authentication has failed display error page.
            header('WWW-Authenticate: Basic realm="Realm Name"');
            header('HTTP/1.1 401 Unauthorized');
        //redirect to error page
            exit;
}
else
{
        //Redirect to default restricted area page for logged in users
}

"holmes072000charter.net" <holmes072000charter.net> wrote in message
news:3a57qo$4bonrfmxip06a.cluster1.charter.net:
> > From: "Mark Collin" <markardescosolutions.co.uk>
> >
> > Does anybody have any ideas on how I can prevent caching of
> > $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'], or clear them?
>
> You can't clear them; they're sent by the browser. It'll keep resending
> the same values and you're script will authenticate. Only way to get rid of
> it is to close the browser.
>
> You could attempt to force the user to log with a known bad username and
> password by using a link or header redirect.
>
> header('Location: http://username:passwordwww.yourdomain.com');
>
> Your login script should check for these known values and can react
> accordingly. You know they are bad, so you can either present them with
> another dialog to log back in or you can just not send any authentication
> headers and show them a "successfully logged out" page.
>
> ---John Holmes...

attached mail follows:


attached mail follows:


There is a local radio station near me that has a crumby webserver that doesn't
server HTTP requests in a standard way.
So, I wrote a simple PHP script that fetches a playlist I want (with curl) and
serves it properly. I only want to get a table from the resulting HTML file. I
have it stored in a variable. So, my question is how would I go about removing
the garbage I don't want until I hit the <table> tag I want and then remove
everything after the </table> tag at the end?

attached mail follows:


On Thu, 29 Jul 2004 21:37:59 +0000 (UTC), Jonathan Lassoff
<jlassoffgmail.com> wrote:
> There is a local radio station near me that has a crumby webserver that doesn't
> server HTTP requests in a standard way.
> So, I wrote a simple PHP script that fetches a playlist I want (with curl) and
> serves it properly. I only want to get a table from the resulting HTML file. I
> have it stored in a variable. So, my question is how would I go about removing
> the garbage I don't want until I hit the <table> tag I want and then remove
> everything after the </table> tag at the end?
>

Assuming there's only one table in the document....

preg_match('!<table[^>]*>.*</table>!i', $text, $matches);
$table = $matches[0];

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


I need to record the names of functions, and then use them later.
Recently I found the following example within the on-line documentation:
<?php
function foo() {
    echo "In foo()<br />\n";
}

$func = 'foo';
$func(); // This calls foo()

?>

then I supposed that it was easy to extend this concept to objects and
wrote the following case:

<?php

function foo() {
    echo "In foo()<br />\n";
}

class a {
   var $fname;
   function a() {
     $this->fname = 'foo'; // the name of the function
   }

   function execute() { // method to execute the named function
     $this->fname();
     // I also tried here
     // {$this->fname}();
     // ${this->fname}();
     // "$this->fname"();
     // but none of these worked
   }
}

$w = new a;
$w->execute();

?>

And this was the error I got:

X-Powered-By: PHP/4.1.2
Content-type: text/html

<br>
<b>Fatal error</b>: Call to undefined function: fname() in <b>-</b> on
line <b>14</b><br>

I know that this can be solved easily with an intermediate variable:

$temp = $this->fname;
$temp();

but I wonder if there is a more direct method.

attached mail follows:


I'm working on a thumbnail script currently that needs to support multiple
types of files, such as jpeg, bmp, gif, etc. One of the file types I need to
support is a TIFF type image. I was looking through the PHP manual from
"imagecreatfrom..." functions and I couldn't find one for tiff. Is there any
support for TIFF files in PHP or maybe a way to convert a TIFF file for
temporary usage to make a thumbnail?

Thanks,
Stephen Craton
http://www.melchior.us
http://php.melchior.us
http://www.chatness.us

attached mail follows:


On Thu, 29 Jul 2004 17:16:58 -0500, Stephen Craton
<webmastermelchior.us> wrote:
> I'm working on a thumbnail script currently that needs to support multiple
> types of files, such as jpeg, bmp, gif, etc. One of the file types I need to
> support is a TIFF type image. I was looking through the PHP manual from
> "imagecreatfrom..." functions and I couldn't find one for tiff. Is there any
> support for TIFF files in PHP or maybe a way to convert a TIFF file for
> temporary usage to make a thumbnail?
>

GD doesn't support TIFFs (and neither do browsers). Try looking into
ImageMagick.

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--