php-general Digest 31 Mar 2002 04:55:00 -0000 Issue 1258

Topics (messages 90792 through 90856):

Re: Not a valid MySQL resource?
        90792 by: Rasmus Lerdorf
        90794 by: Brian Waskiewicz
        90796 by: Jason Wong
        90854 by: Brian Waskiewicz

PHP 4.2.ORC1 - SID gets deleted
        90793 by: Carsten Saathoff

Re: Some Problems that Newman has with PHP since reinstall.
        90795 by: Jason Wong
        90803 by: Philip J. Newman

Re: Has anyone written such a function?
        90797 by: Hugh Bothwell

Re: changing the color from black to blue on an image. Help on imagecolorset.
        90798 by: Hugh Bothwell

Re: problems trying to use PHP to choose CSS
        90799 by: Hugh Bothwell

Re: Nead Help With A Php Script
        90800 by: Hugh Bothwell
        90802 by: Hugh Bothwell
        90811 by: Rasmus Lerdorf

Re: php configs in the apache config file?
        90801 by: Robert Montgomery
        90812 by: Rasmus Lerdorf

Any easy way to go from MySQL Dates to PHP dates?
        90804 by: David Johansen
        90806 by: Jason Wong

Re: Image manipulation with PHP on RHLinux 7.1
        90805 by: Dale & Lora Marshall
        90814 by: Rasmus Lerdorf

Tracking impressions
        90807 by: David Duong
        90847 by: Miguel Cruz

time question
        90808 by: anders nawroth
        90809 by: J. Scott Johnson

Php.ini
        90810 by: Chris Kay
        90817 by: Jason Sheets

register_globals
        90813 by: Liam
        90855 by: Jason Wong

Re: Why?
        90815 by: Michael Kimsal

ZaireWeb
        90816 by: Liam

For Loop going too long
        90818 by: David Johansen
        90833 by: Lars Torben Wilson
        90837 by: Demitrious S. Kelly

$HTTP_USER_AGENT
        90819 by: Sean Kennedy
        90820 by: eric.coleman.zaireweb.com
        90821 by: Sean Kennedy
        90824 by: eric.coleman.zaireweb.com

BUG in recursion
        90822 by: Uros Gruber
        90823 by: David Johansen
        90825 by: Lars Torben Wilson
        90826 by: Uros Gruber
        90832 by: Lars Torben Wilson
        90835 by: Uros Gruber

Pulling data into an array and sorting
        90827 by: rdkurth.starband.net
        90829 by: Demitrious S. Kelly
        90834 by: rdkurth.starband.net
        90838 by: Demitrious S. Kelly

Disabling the Back Button?
        90828 by: David Johansen
        90830 by: Demitrious S. Kelly
        90844 by: Hugh Bothwell

Another ?
        90831 by: Sean Kennedy
        90836 by: eric.coleman.zaireweb.com

A way to use WWW-Autorization
        90839 by: Alberto Wagner

mail() function.
        90840 by: Birtch, James
        90853 by: Tyler Longren

Undefined variables
        90841 by: Ernesto
        90842 by: Lars Torben Wilson
        90843 by: Shane Wright
        90845 by: Lars Torben Wilson
        90846 by: Shane Wright

Sql results
        90848 by: Alberto Wagner
        90856 by: Jason Wong

MySQL Connection Error - mysql_select_db
        90849 by: Patrick Hartnett
        90851 by: Alberto Wagner
        90852 by: Tyler Longren

Re: ASP vs PHP
        90850 by: John Lim

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message ---
Always always always check your queries for errors before trying to use
the result set.

ie.

  $result = mysql_query($sql) or die(mysql_error());

(assuming you want a query failure to be a fatal error)

-Rasmus

On Sat, 30 Mar 2002, Brian Waskiewicz wrote:

> Can anyone tell me what is causing the following error:
>
> Warning: Supplied argument is not a valid MySQL result resource in
> /ip/sums/www/test/admin/mailing_list.phtml on line 123
>
> The page will work fine one time, then I'll come back later and get the
> error.  I won't change anything, but the page will work later on anyway.  I
> know there's nothing wrong with the database server, and the query should
> return results.
>
> Thanks.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
My page works fine from other computers - it just doesn't work from mine.  I
think it could be that the page is caching and IE6 isn't getting a new copy.
How can I prevent it frlom caching? I've tried clearing my history, but I
still get the error.

Thanks.

"Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Always always always check your queries for errors before trying to use
> the result set.
>
> ie.
>
>   $result = mysql_query($sql) or die(mysql_error());
>
> (assuming you want a query failure to be a fatal error)
>
> -Rasmus
>
> On Sat, 30 Mar 2002, Brian Waskiewicz wrote:
>
> > Can anyone tell me what is causing the following error:
> >
> > Warning: Supplied argument is not a valid MySQL result resource in
> > /ip/sums/www/test/admin/mailing_list.phtml on line 123
> >
> > The page will work fine one time, then I'll come back later and get the
> > error.  I won't change anything, but the page will work later on anyway.
I
> > know there's nothing wrong with the database server, and the query
should
> > return results.
> >
> > Thanks.
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>


--- End Message ---
--- Begin Message ---
On Sunday 31 March 2002 02:02, Brian Waskiewicz wrote:
> My page works fine from other computers - it just doesn't work from mine. 
> I think it could be that the page is caching and IE6 isn't getting a new
> copy. How can I prevent it frlom caching? I've tried clearing my history,
> but I still get the error.
>
> Thanks.
>
> "Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> > Always always always check your queries for errors before trying to use
> > the result set.
> >
> > ie.
> >
> >   $result = mysql_query($sql) or die(mysql_error());
> >
> > (assuming you want a query failure to be a fatal error)

Hmmm, Rasmus has given you some very good advice. Please follow it. No point 
speculating on how to correct the problem if you don't know what the problem 
is. 



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

/*
The trouble with computers is that they do what you tell them, not what
you want.
                -- D. Cohen
*/
--- End Message ---
--- Begin Message ---
I set it up so that I check the query for errors, and there are none.  It is
pretty random - sometimes the page works, and sometimes it doesn't, for no
apparent reason.  I haven't changed anything on the database side.

Thanks.

"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> On Sunday 31 March 2002 02:02, Brian Waskiewicz wrote:
> > My page works fine from other computers - it just doesn't work from
mine.
> > I think it could be that the page is caching and IE6 isn't getting a new
> > copy. How can I prevent it frlom caching? I've tried clearing my
history,
> > but I still get the error.
> >
> > Thanks.
> >
> > "Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >
> > > Always always always check your queries for errors before trying to
use
> > > the result set.
> > >
> > > ie.
> > >
> > >   $result = mysql_query($sql) or die(mysql_error());
> > >
> > > (assuming you want a query failure to be a fatal error)
>
> Hmmm, Rasmus has given you some very good advice. Please follow it. No
point
> speculating on how to correct the problem if you don't know what the
problem
> is.
>
>
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
>
> /*
> The trouble with computers is that they do what you tell them, not what
> you want.
> -- D. Cohen
> */


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

I'm not sure where to post this, neither if I should report this as a
bug, because I'm not sure if it is one at all.

I installed php 4.2 ORC1 lately and encountered a strange session
problem. The following script reproduces this problem:

<?php

session_start();

echo "<a href='{$_SERVER['PHP_SELF']}?".SID."'>Link</a>";

echo '<br><br>'. SID."<br><br>";

echo session_id();

?>

As you can see, the script starts a session and then generates a link to
itself. When I call this script the first time, the session gets created
as expected. Also the link is generated correctly, if I block the
session cookie. But when I click on that link, SID is empty on the
following page (that's the same script again, of course), although the
session still exists. So the output gives me an empty SID, but a correct
session id. The same script does work with 4.1.2.

Does any explanantion for this behaviour exist? Or is it a bug?
trans-sid is disabled and not even compiled in. But that shouldn't be a
problem I think, because SID is the alternative to trans-sid.

Can anybody confirm this behaviour? Or should I submit a bug report?

Greetings

Carsten

-- 
Carsten Saathoff          ...powered by Linux              ICQ #52558095
                          
                The gods are great, I am the greatest! 
                             (Borknagar)
--- End Message ---
--- Begin Message ---
On Saturday 30 March 2002 14:26, Philip J. Newman wrote:
> Hi People,
> I just installed PHP again, and am having some problems with a few things.
> When Posting to a form, veriables do not travel across the pages.  I have
> checked the PHP.INI for something but nothing seems to change this.

Is it vanity that prompts you include your name in every post you send?

If you're using PHP > 4.0.6 then the default behaviour regarding GET, POST & 
COOKIES vars has changed. Either refer to them through $_POST[] or (not 
recommended) set 

register_globals = on 

in php.ini

> ... ALSO ...
>
> My redirect scripts have stoped responding.
> Any Ideas??

No.
--- End Message ---
--- Begin Message ---
Still didn't work, found the problem thoe. it was a file I never put into my
system32 folder (o;  Thanks for your help.s

----- Original Message -----
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 31, 2002 6:10 AM
Subject: Re: [PHP] Some Problems that Newman has with PHP since reinstall.


> On Saturday 30 March 2002 14:26, Philip J. Newman wrote:
> > Hi People,
> > I just installed PHP again, and am having some problems with a few
things.
> > When Posting to a form, veriables do not travel across the pages.  I
have
> > checked the PHP.INI for something but nothing seems to change this.
>
> Is it vanity that prompts you include your name in every post you send?
>
> If you're using PHP > 4.0.6 then the default behaviour regarding GET, POST
&
> COOKIES vars has changed. Either refer to them through $_POST[] or (not
> recommended) set
>
> register_globals = on
>
> in php.ini
>
> > ... ALSO ...
> >
> > My redirect scripts have stoped responding.
> > Any Ideas??
>
> No.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>



--- End Message ---
--- Begin Message ---
(shrug) convert to unixtime, subtract, and reformat

In fact, you could do the conversion and subtraction in your SQL query,
returning just 'elapsed seconds since date', and reformat from there.

> I need a function that will get a date in the past and return how much
> time has passed since that date till now.
> The input to the function is a MySQL DATETIME format and the output
> should be something like :
>
> 2 Years, 36 Days, 7 hours , 25 minutes
>
> I would write it but I'm pretty sure it has been done.



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

"Andy" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi there,
>
> I would like to change the color on a png file from black
> to blue. This png file is transparent and contains only a
> spot which is black. It is needed to stay transparent
> because I am gonna merge it later on with a jpeg.

... why are you trying to do this in PHP?  Why not use
Photoshop to edit the original .png graphic?


--- End Message ---
--- Begin Message ---
> I am trying this method: Register a global variable ($CSS) using a FORM.
> [snip]
> I wonder if I am not doing something stupid/overlooking something obvious,
> but I am very new @ PHP so that is possible.
>
> // in my global PHP file
>
> // Now what I am trying to do here is set a default that should ONLY be
> // used if the $CSS variable is NOT already set
>
> if (!isset($CSS))
> {
> // if it is not set, then and only then set it and define it
> session_start();
> session_register("CSS");
> $CSS="global";
> }


1.  session_start() should called every time,
    ie not inside a conditional clause.

2.  I'm not sure that giving the form-return value
    and the session value the same name is a good idea.

3.  I think a lot of the double-quotes in your echoed
    text were screwing things up.


Try something like:

<?php        // HEADER
    session_start();

    // new session?  set default value
    if (!session_is_registered("CSS")) {
        session_register("CSS");
        $CSS = "global";
    }

    // setting changed by form?  update session value
    if (isset($newCSS))
        $CSS = $newCSS;
?>


<!-- USAGE -->
    <link type='text/css' rel='stylesheet' href='/global/css/<?php echo
$CSS; ?>.css' />


<!-- FOOTER -->
    <p>Choose style:
    <form method='post'>        <!-- default action is get-to-self -->
        <select name='newCSS'>
            <option value='default' selected>Default</option>
            <option value='smaller'>Smaller</option>
            <option value='tamecolors'>Tamer Colors</option>
            <option value='print'>Print</option>
        </select>
        <input alt='Set Style' type='submit' name='Set Style' value='Set
Style' />
    </form>
    </p>
    <p>Current style is: <strong><?php echo $CSS; ?></strong></p>




--- End Message ---
--- Begin Message ---
> I need a php script that checks if the there is a
> cookie set with the users username and if not it
> brings you to an other page and telling you that
> you are not loged in!


(a)  Don't cross-post all over.


(b)  Cookies 'automagically' become global variables, so
    a simple version is

    if(!isset($username)) {
        header("Location: http://www.mysite.com/login.php";);
        exit;
    }


(c)  Obviously, this won't prevent someone from
    faking a username via the querystring, so you have to
    specify that it's a cookie:

    if(!isset($_COOKIE["username"])) {
        header("Location: http://www.mysite.com/login.php";);
        exit;
    }


(d)  Doesn't work?  What do you mean, doesn't work?
    OK, if you are using pre-4.1.0, it won't work
    (you would have to look in $HTTP_COOKIE_VARS[]
    instead)  BUT note that there are known security
    flaws so you should be running 4.1.2 anyway.


(e)  It's kind of irrelevant anyway - because unless you
    are really always positively certain your users are
    cookiefied, you should be using sessions, in which case
    what you really want is

    session_start();

    if(!session_is_registered("username")) "])) {
        header("Location: http://www.mysite.com/login.php";);
        exit;
    }



--- End Message ---
--- Begin Message ---
Aaargh!   typo...

>     if(!session_is_registered("username")) "])) {

should be

    if(!session_is_registered("username")) {


--- End Message ---
--- Begin Message ---
> (c)  Obviously, this won't prevent someone from
>     faking a username via the querystring, so you have to
>     specify that it's a cookie:
>
>     if(!isset($_COOKIE["username"])) {
>         header("Location: http://www.mysite.com/login.php";);
>         exit;
>     }

Note that nothing prevents users from faking a username via their own
cookie either.

-Rasmus

--- End Message ---
--- Begin Message ---
OK, I've figured it out.  Apparantly when setting php
vars in an apache config file, you HAVE to use the
form
"php_admin_value" as opposed to just "php_value". 
Some of the php documentation is vague or even
misleading, such as this example from the online docs,
which does not use the form php_admin_value but is
obviously used in the apache config file:

<IfModule mod_php4.c>
   php_value include_path ".:/usr/local/lib/php"
   php_flag safe_mode on
</IfModule>

Also, the docs say:

php_value name value

     This sets the value of the specified variable.

php_admin_value name value

     This sets the value of the specified variable.
"Admin" configuration settings can only be set from
within the main Apache configuration files, and not
from .htaccess files.

So it makes it sound as if you CAN use the php_value
form in the apache config, but that it is
over-rideable
via htaccess files... However it doesnt work, at least
with the 4.1.2...  Maybe the functionality has been
changed recently, for security reasons.  I figure if
you go to the trouble to set a value in apache for
a particular virtualhost, you dont want to allow it to
be overridden via htaccess, which isnt possible when
they force you to use the php_admin_value form. I
actually prefer it that way, the docs just need
updating!

Thanks for the responses.

Rob


--- bvr <[EMAIL PROTECTED]> wrote:
> It doesn't work with CGI installations of PHP.
> 
> bvr.
> 
> Robert Montgomery wrote:
> 
> >Supposedly, in your apache httpd.conf file you can
> >specify php config values.  I'm trying to shore up
> >security on a new box by setting the following 
> >within <VirtualHost> tags:
> >
> >php_value open_basedir /path/to/virtualhost/
> >
> >However, it doesnt work.  If I set the values in
> the
> >php.ini file, it DOES work...  What am I missing??
> >Are there any restrictions to setting these php
> values
> >in an httpd.conf file?  The doc's dont really
> mention
> >anything...  I'm baffled!
> >
> >I'm running apache_1.3.23 + php-4.1.2 on a linux
> box.
> >
> >Thanks,
> >Rob
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Yahoo! Greetings - send holiday greetings for
> Easter, Passover
> >http://greetings.yahoo.com/
> >
> 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - send holiday greetings for Easter, Passover
http://greetings.yahoo.com/
--- End Message ---
--- Begin Message ---
> OK, I've figured it out.  Apparantly when setting php
> vars in an apache config file, you HAVE to use the
> form
> "php_admin_value" as opposed to just "php_value".
> Some of the php documentation is vague or even
> misleading, such as this example from the online docs,
> which does not use the form php_admin_value but is
> obviously used in the apache config file:
>
> <IfModule mod_php4.c>
>    php_value include_path ".:/usr/local/lib/php"
>    php_flag safe_mode on
> </IfModule>
>
> Also, the docs say:
>
> php_value name value
>
>      This sets the value of the specified variable.
>
> php_admin_value name value
>
>      This sets the value of the specified variable.
> "Admin" configuration settings can only be set from
> within the main Apache configuration files, and not
> from .htaccess files.
>
> So it makes it sound as if you CAN use the php_value
> form in the apache config, but that it is
> over-rideable
> via htaccess files... However it doesnt work, at least
> with the 4.1.2...

Sure it works.  It depends on the directive.  Obviously safe_mode is not
something that can be overridden by users in a .htaccess file, so
safe_mode is set via php_admin_flag whereas something like include_path is
not an admin value and is set via php_value.


> Maybe the functionality has been changed recently, for security reasons.
> I figure if you go to the trouble to set a value in apache for a
> particular virtualhost, you dont want to allow it to be overridden via
> htaccess, which isnt possible when they force you to use the
> php_admin_value form. I actually prefer it that way, the docs just need
> updating!

No, the docs are actually correct.  None admin flags can be overridden in
.htaccess files assuming you enable it via the appropriate AlloveOverride
Options.  If you don't set "Options" on AllowOverride then none of this
stuff can be overridden in the .htaccess files.

-Rasmus

--- End Message ---
--- Begin Message ---
I was just wondering if there's any way to work with dates returned from a
MySQL query in PHP. Right now I do all of different stuff in my MySQL query
but it's really cumbersome, so I would like to be able to do it all with
PHP. Is there any way to do that? Thanks,
Dave

Here's my MySQL query:

$result = mysql_query("SELECT *, WEEKDAY(time0_name) AS day,
DATE_FORMAT(time0_name,'%m/%d/%y') AS print_date, DATE_FORMAT(time0_name,
'%l:%i %p') AS begin_time0, DATE_FORMAT(DATE_ADD(time0_name, INTERVAL 2
HOUR), '%l:%i %p') AS end_time0, DATE_FORMAT(time1_name, '%l:%i %p') AS
begin_time1, DATE_FORMAT(DATE_ADD(time1_name, INTERVAL 2 HOUR), '%l:%i %p')
AS end_time1, DATE_FORMAT(time2_name, '%l:%i %p') AS begin_time2,
DATE_FORMAT(DATE_ADD(time2_name, INTERVAL 2 HOUR), '%l:%i %p') AS end_time2,
DATE_FORMAT(time3_name, '%l:%i %p') AS begin_time3,
DATE_FORMAT(DATE_ADD(time3_name, INTERVAL 2 HOUR), '%l:%i %p') AS end_time3,
DATE_FORMAT(time4_name, '%l:%i %p') AS begin_time4,
DATE_FORMAT(DATE_ADD(time4_name, INTERVAL 2 HOUR), '%l:%i %p') AS end_time4,
DATE_FORMAT(time5_name, '%l:%i %p') AS begin_time5,
DATE_FORMAT(DATE_ADD(time5_name, INTERVAL 2 HOUR), '%l:%i %p') AS end_time5
FROM pickup_times",$dbh);

I could do it a lot easier if in PHP I think, so I was just wondering if
anyone could point me to a thing that talked about converting MySQL DATETIME
to PHP date stuff.


--- End Message ---
--- Begin Message ---
On Sunday 31 March 2002 04:04, David Johansen wrote:
> I was just wondering if there's any way to work with dates returned from a
> MySQL query in PHP. Right now I do all of different stuff in my MySQL query
> but it's really cumbersome, so I would like to be able to do it all with
> PHP. Is there any way to do that? Thanks,
> Dave

>
> Here's my MySQL query:

In MySQL return the date through a UNIX_TIMESTAMP() then in PHP you can 
manipulate any which way you want.


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

/*
Those aren't WINOS -- that's my JUGGLER, my AERIALIST, my SWORD
SWALLOWER, and my LATEX NOVELTY SUPPLIER!!
*/
--- End Message ---
--- Begin Message ---

Ok, I've been looking at the image functions, and found that I needed
to recompile PHP with exif support and load GD and other functions.
I've done all of that and now I get the following:

Source: /home/jamboimages/images/uploads/alamoarea_97_round_sm.jpg
600 : /images/patches/1997/1997R15.jpg
300 : /images/patches/1997/1997R15_sm.jpg
Width = 600
Height = 580
Fatal error: Call to undefined function: exif_imagetype() in
/home/jamboimages/admin/review_patches.php on line 69

The partial code in my webpage is (code borrowed from the PHP site, and 
modified).
Any help is appreciated.  If you want to see the phpinfo, go to:

http://dreamer.propagation.net/phpinfo.php


Here's the code...

/* resize_to_file resizes a picture and writes it to the harddisk
  *
  * $sourcefile = the filename of the picture that is going to be resized
  * $six_file   = File name of the 600-pixel-wide file
  * $three_file = File name of the 300-pixel wide file
  */

function resize_to_file ($sourcefile, $six_file, $three_file) {

print "Source: $sourcefile<BR>";
print "600 : $six_file<BR>";
print "300 : $three_file<BR>";

    $picsize = getimagesize("$sourcefile");

    $width  = $picsize[0];
    $height = $picsize[1];
print "Width = $width<BR>";
print "Height = $height<BR>";

    $image_type = exif_imagetype("$sourcefile");
print "Image: $image_type<BR>";

    ... more code here to resize the image file ...
    ... and write it to a new location on disk  ...

}




-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Dale & Lora Marshall                    Internet Marketing Services
http://lonestar.texas.net/~marshal1     http://www.internet-ms.com
[EMAIL PROTECTED]                [EMAIL PROTECTED]
                                         [EMAIL PROTECTED]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--- End Message ---
--- Begin Message ---
exif_imagetype() is new function only available in PHP 4.2 (not released
yet) and above.  Use GetImageSize() for now.

-Rasmus

On Sat, 30 Mar 2002, Dale & Lora Marshall wrote:

>
> Ok, I've been looking at the image functions, and found that I needed
> to recompile PHP with exif support and load GD and other functions.
> I've done all of that and now I get the following:
>
> Source: /home/jamboimages/images/uploads/alamoarea_97_round_sm.jpg
> 600 : /images/patches/1997/1997R15.jpg
> 300 : /images/patches/1997/1997R15_sm.jpg
> Width = 600
> Height = 580
> Fatal error: Call to undefined function: exif_imagetype() in
> /home/jamboimages/admin/review_patches.php on line 69
>
> The partial code in my webpage is (code borrowed from the PHP site, and
> modified).
> Any help is appreciated.  If you want to see the phpinfo, go to:
>
> http://dreamer.propagation.net/phpinfo.php
>
>
> Here's the code...
>
> /* resize_to_file resizes a picture and writes it to the harddisk
>   *
>   * $sourcefile = the filename of the picture that is going to be resized
>   * $six_file   = File name of the 600-pixel-wide file
>   * $three_file = File name of the 300-pixel wide file
>   */
>
> function resize_to_file ($sourcefile, $six_file, $three_file) {
>
> print "Source: $sourcefile<BR>";
> print "600 : $six_file<BR>";
> print "300 : $three_file<BR>";
>
>     $picsize = getimagesize("$sourcefile");
>
>     $width  = $picsize[0];
>     $height = $picsize[1];
> print "Width = $width<BR>";
> print "Height = $height<BR>";
>
>     $image_type = exif_imagetype("$sourcefile");
> print "Image: $image_type<BR>";
>
>     ... more code here to resize the image file ...
>     ... and write it to a new location on disk  ...
>
> }
>
>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Dale & Lora Marshall                    Internet Marketing Services
> http://lonestar.texas.net/~marshal1     http://www.internet-ms.com
> [EMAIL PROTECTED]                [EMAIL PROTECTED]
>                                          [EMAIL PROTECTED]
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Hello, I need a script that can track impressions through PHP.

I know you load a php script from <IMG> tags than some how the image is
loaded or redirected.

Is their a way I can record impressions and environment variables like IP,
Browser, referrer, etc.


--- End Message ---
--- Begin Message ---
On Sat, 30 Mar 2002, David Duong wrote:
> Hello, I need a script that can track impressions through PHP.
> 
> I know you load a php script from <IMG> tags than some how the image is
> loaded or redirected.
> 
> Is their a way I can record impressions and environment variables like IP,
> Browser, referrer, etc.

Sure, it's all available to your PHP script.

counter.php:

<?
  header('Content-Type: image/gif');
  readfile('/path/to/my/graphic.gif');
  // now save $HTTP_USER_AGENT, $REMOTE_ADDR, etc., in your database
?>

And just insert this on your page:

  <img src="counter.php/anything.gif">

It doesn't matter what you put for "anything.gif" as long as it looks like 
an image file.

miguel

--- End Message ---
--- Begin Message ---
How do I get the current time() for Central European Time
(= GMT +01:00).
I want it to work wherever the server stands.
How can I get the difference between server time
and GMT, for instance?

A. Nawroth


--- End Message ---
--- Begin Message ---
Why wouldn't you use gmdate: 

http://www.php.net/manual/en/function.gmdate.php

and then increment it yourself by an offset?

Scott

-----Original Message-----
From: anders nawroth [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 30, 2002 5:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP] time question


How do I get the current time() for Central European Time
(= GMT +01:00).
I want it to work wherever the server stands.
How can I get the difference between server time
and GMT, for instance?

A. Nawroth



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


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

Question I have is,

Is it possible to specify a php.ini in each virtual host?
That way allowing each website to run a different configuration.

Cause I have a website that I want to use
Session_set_save_handler = user but I want another website to use the
default php
Files handle. 

Also for things like session auto start ect....

Just a thought that it would make it easier.

Thanks in advance.

-------
Chris Kay, Eleet Internet Services
[EMAIL PROTECTED]
-------

--- End Message ---
--- Begin Message ---
Look at chapter 3 of the PHP manual, it covers specifying PHP configuration
in your http.conf or .htaccess files, you can do this per virtual host, per
directory or however else you want to do it.

Jason

"Chris Kay" <[EMAIL PROTECTED]> wrote in message
000001c1d83c$9c334e50$8b6712cb@iceberg">news:000001c1d83c$9c334e50$8b6712cb@iceberg...
>
> Question I have is,
>
> Is it possible to specify a php.ini in each virtual host?
> That way allowing each website to run a different configuration.
>
> Cause I have a website that I want to use
> Session_set_save_handler = user but I want another website to use the
> default php
> Files handle.
>
> Also for things like session auto start ect....
>
> Just a thought that it would make it easier.
>
> Thanks in advance.
>
> -------
> Chris Kay, Eleet Internet Services
> [EMAIL PROTECTED]
> -------
>


--- End Message ---
--- Begin Message ---
31/03/2002 9:05:53 AM

Hi all,
I'm running a webhosting service and I'm looking at security issues.

at the moment I have register_globals set to "on"
Is there any reason I should turn it off?

What are the security risks of having them on?

Cheers,
Liam


--- End Message ---
--- Begin Message ---
On Sunday 31 March 2002 17:05, Liam wrote:
> 31/03/2002 9:05:53 AM
>
> Hi all,
> I'm running a webhosting service and I'm looking at security issues.
>
> at the moment I have register_globals set to "on"
> Is there any reason I should turn it off?
>
> What are the security risks of having them on?

Manual > Security


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

/*
The more they over-think the plumbing the easier it is to stop up the drain.
*/
--- End Message ---
--- Begin Message ---
Alberto Wagner wrote:
> Why everyone uses $foo or $foobar as examples?
> 
> 
> 

Why not?  They are relatively benign words that are simply to
type and aren't terribly language centric.

$moo and $moocow would work just as well, or $asdf or $qwerty
or others.

As far as I know, they have no specific connotation,
but they've been used as placement holder names since
at least the early 80's when I started programming.



Michael Kimsal
http://www.phphelpdesk.com
PHP support when you need it
734-480-9961

--- End Message ---
--- Begin Message ---
31/03/2002 9:26:46 AM

You tool!
Stop spying on my emails!


--- End Message ---
--- Begin Message ---
I have a question about something weird that I've noticed Here's some code
that I have that loads up

   $sql = "SELECT * FROM pickup_times WHERE DAYOFMONTH(time0_name) =
$dayofmonth";

   $result = mysql_query($sql, $dbh);
   $day = mysql_fetch_array($result);
   for ($i=0; $i<sizeof($day); $i++)
      echo "I: $i Result: $day[$i]<br>";

When I do this it prints out 2 times the number of columns that I actually
have plus 1. All of the ones past the actual number of columns are just
empty, but is there something that I'm doing wrong? Thanks,
Dave


--- End Message ---
--- Begin Message ---
On Sat, 2002-03-30 at 15:40, David Johansen wrote:
> I have a question about something weird that I've noticed Here's some code
> that I have that loads up
> 
>    $sql = "SELECT * FROM pickup_times WHERE DAYOFMONTH(time0_name) =
> $dayofmonth";
> 
>    $result = mysql_query($sql, $dbh);
>    $day = mysql_fetch_array($result);
>    for ($i=0; $i<sizeof($day); $i++)
>       echo "I: $i Result: $day[$i]<br>";
> 
> When I do this it prints out 2 times the number of columns that I actually
> have plus 1. All of the ones past the actual number of columns are just
> empty, but is there something that I'm doing wrong? Thanks,
> Dave

Yup. ;) Give http://www.php.net/mysql_fetch_array a thorough beating.
The function returns the results both in associatively-indexed elements
and in indexed ones, so you get each one twice. Try the following and it
should become clearer:


$result = mysql_query($sql, $dbh);
// Try both of the following lines and notice the difference.
//$day = mysql_fetch_array($result);
$day = mysql_fetch_array($result, MYSQL_ASSOC);
foreach ($day as $colname => $value) {
    echo "Column name: $colname; Value: $value\n";
}


Cheers!

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

--- End Message ---
--- Begin Message ---
Try a foreach... it works well...

-----Original Message-----
From: Lars Torben Wilson [mailto:[EMAIL PROTECTED]] On Behalf Of Lars
Torben Wilson
Sent: Saturday, March 30, 2002 4:38 PM
To: David Johansen
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] For Loop going too long

On Sat, 2002-03-30 at 15:40, David Johansen wrote:
> I have a question about something weird that I've noticed Here's some
code
> that I have that loads up
> 
>    $sql = "SELECT * FROM pickup_times WHERE DAYOFMONTH(time0_name) =
> $dayofmonth";
> 
>    $result = mysql_query($sql, $dbh);
>    $day = mysql_fetch_array($result);
>    for ($i=0; $i<sizeof($day); $i++)
>       echo "I: $i Result: $day[$i]<br>";
> 
> When I do this it prints out 2 times the number of columns that I
actually
> have plus 1. All of the ones past the actual number of columns are
just
> empty, but is there something that I'm doing wrong? Thanks,
> Dave

Yup. ;) Give http://www.php.net/mysql_fetch_array a thorough beating.
The function returns the results both in associatively-indexed elements
and in indexed ones, so you get each one twice. Try the following and it
should become clearer:


$result = mysql_query($sql, $dbh);
// Try both of the following lines and notice the difference.
//$day = mysql_fetch_array($result);
$day = mysql_fetch_array($result, MYSQL_ASSOC);
foreach ($day as $colname => $value) {
    echo "Column name: $colname; Value: $value\n";
}


Cheers!

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


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




--- End Message ---
--- Begin Message ---
Hello,

Im making a small php script, but I need to know how to do something.

My problem is: I have a script thats like this:

<?php
if ($HTTP_USER_AGENT == "WHAT GOES HERE FOR IE AND NS?") {
           echo "You have Internet Explorer";
} else {
           echo "You have Netscape";
}
?>

Do you know what I mean? Thanks,

-Sean
Kennedy

--- End Message ---
--- Begin Message ---
Why not echo $HTTP_USER_AGENT and find out?

----- Original Message ----- 
From: "Sean Kennedy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 30, 2002 11:43 AM
Subject: [PHP] $HTTP_USER_AGENT


> Hello,
> 
> Im making a small php script, but I need to know how to do something.
> 
> My problem is: I have a script thats like this:
> 
> <?php
> if ($HTTP_USER_AGENT == "WHAT GOES HERE FOR IE AND NS?") {
>            echo "You have Internet Explorer";
> } else {
>            echo "You have Netscape";
> }
> ?>
> 
> Do you know what I mean? Thanks,
> 
> -Sean
> Kennedy
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

--- End Message ---
--- Begin Message ---
It prints out Mozilla/4.74 [en]C-CCK-MCD NS4xx/Winxx/EZN (Win95; U). Which part 
of that do i use?

Thanks,
-Sean
Kennedy

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

if( eregi("NS", $HTTP_USER_AGENT) )
{
     echo('You are using Netscape!');
}
elseif( eregi('IE', $HTTP_USER_AGENT) )
{
     echo('Your using IE');
}
else
{
     echo('No Clue what the hell your using');
}
----- Original Message -----
From: "Sean Kennedy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 30, 2002 11:52 AM
Subject: [PHP] RE: RE: $HTTP_USER_AGENT


> It prints out Mozilla/4.74 [en]C-CCK-MCD NS4xx/Winxx/EZN (Win95; U). Which
part
> of that do i use?
>
> Thanks,
> -Sean
> Kennedy
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

--- End Message ---
--- Begin Message ---
Hi!

This is a code

function Test()
{
    static $count = 0;

    $count++;
    echo $count;
    if ($count < 10) {
        Test ();
    }
    echo "j";
}
test();

Output is

12345678910jjjjjjjjjj

Why is there 10 j at the and. If this would work it can be
only one. If $count is grater than 10 it does not call itself
but end. Is this maybe a bug or what.
  

-- 
lp,
 Uros                          mailto:[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
No it's right. Because $count will equal 10 and it'll print it out, the test
will fail and then it'll trace the recursion back and print the j's. It
would be a bug if it printed an 11, but it's right the way it is.
Dave

"Uros Gruber" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi!
>
> This is a code
>
> function Test()
> {
>     static $count = 0;
>
>     $count++;
>     echo $count;
>     if ($count < 10) {
>         Test ();
>     }
>     echo "j";
> }
> test();
>
> Output is
>
> 12345678910jjjjjjjjjj
>
> Why is there 10 j at the and. If this would work it can be
> only one. If $count is grater than 10 it does not call itself
> but end. Is this maybe a bug or what.
>
>
> --
> lp,
>  Uros                          mailto:[EMAIL PROTECTED]
>


--- End Message ---
--- Begin Message ---
On Sat, 2002-03-30 at 15:59, Uros Gruber wrote:
> Hi!
> 
> This is a code
> 
> function Test()
> {
>     static $count = 0;
> 
>     $count++;
>     echo $count;
>     if ($count < 10) {
>         Test ();
>     }
>     echo "j";
> }
> test();
> 
> Output is
> 
> 12345678910jjjjjjjjjj
> 
> Why is there 10 j at the and. If this would work it can be
> only one. If $count is grater than 10 it does not call itself
> but end. Is this maybe a bug or what.

No, there should be 10 of them, since every time Test() returns,
the function carries on executing. If you only want one 'j'
printed then put a return statement after the call to Test():

function Test()
{
    static $count = 0;
    
    $count++;
    echo $count;
    if ($count < 10) {
        Test();
        return;
    }
    echo "j";
}
Test();


Cheers!

Torben


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

--- End Message ---
--- Begin Message ---
Hi!

This I simply don't understand why this code executes that
way. So there is only inportant to put return after recursive
call and it works like i wan't. I sometimes write small C
programs and I don't remeber that code like this have to work
that way.... Hm.



-- 
bye,
 Uros                            mailto:[EMAIL PROTECTED]


Sunday, March 31, 2002, 1:10:30 AM, you wrote:

LTW> On Sat, 2002-03-30 at 15:59, Uros Gruber wrote:
>> Hi!
>> 
>> This is a code
>> 
>> function Test()
>> {
>>     static $count = 0;
>> 
>>     $count++;
>>     echo $count;
>>     if ($count < 10) {
>>         Test ();
>>     }
>>     echo "j";
>> }
>> test();
>> 
>> Output is
>> 
>> 12345678910jjjjjjjjjj
>> 
>> Why is there 10 j at the and. If this would work it can be
>> only one. If $count is grater than 10 it does not call itself
>> but end. Is this maybe a bug or what.

LTW> No, there should be 10 of them, since every time Test() returns,
LTW> the function carries on executing. If you only want one 'j'
LTW> printed then put a return statement after the call to Test():

LTW> function Test()
LTW> {
LTW>     static $count = 0;
    
LTW>     $count++;
LTW>     echo $count;
LTW>     if ($count < 10) {
LTW>         Test();
LTW>         return;
LTW>     }
LTW>     echo "j";
LTW> }
LTW> Test();


LTW> Cheers!

LTW> Torben


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

--- End Message ---
--- Begin Message ---
On Sat, 2002-03-30 at 16:16, Uros Gruber wrote:
> Hi!
> 
> This I simply don't understand why this code executes that
> way. So there is only inportant to put return after recursive
> call and it works like i wan't. I sometimes write small C
> programs and I don't remeber that code like this have to work
> that way.... Hm.

Well, that's how it's supposed to work. Look at it like this:

1: function test() {
2:    static $count = 0;
3:    $count++;
4:    echo $count;
5:    if ($count < 10) {
6:        test();
7:    }
8:    echo 'j';
9: }


So the first thing that happens is you call test(). It executes
its lines in order, including function calls. When it hits the
call to test() on line 6, it calls test(), waits for it to 
return, and then continues on to line 8, echoing 'j'. 

This happens every time through, so when you get up to $i == 10, you
have 10 test()s stacked up, each of them waiting on line 6 for the
function call to test() to return. As each test() call returns,
execution continues on to line 8, echos j, then returns.

I'm in a hurry so I don't have too much time to make this much 
clearer (and my brain is not so good today anyway). If this still
doesn't make sense then Google gives a zillion hits for 'introduction
to recursion'.


Hope this helps,

Torben

> -- 
> bye,
>  Uros                            mailto:[EMAIL PROTECTED]
> 
> 
> Sunday, March 31, 2002, 1:10:30 AM, you wrote:
> 
> LTW> On Sat, 2002-03-30 at 15:59, Uros Gruber wrote:
> >> Hi!
> >> 
> >> This is a code
> >> 
> >> function Test()
> >> {
> >>     static $count = 0;
> >> 
> >>     $count++;
> >>     echo $count;
> >>     if ($count < 10) {
> >>         Test ();
> >>     }
> >>     echo "j";
> >> }
> >> test();
> >> 
> >> Output is
> >> 
> >> 12345678910jjjjjjjjjj
> >> 
> >> Why is there 10 j at the and. If this would work it can be
> >> only one. If $count is grater than 10 it does not call itself
> >> but end. Is this maybe a bug or what.
> 
> LTW> No, there should be 10 of them, since every time Test() returns,
> LTW> the function carries on executing. If you only want one 'j'
> LTW> printed then put a return statement after the call to Test():
> 
> LTW> function Test()
> LTW> {
> LTW>     static $count = 0;
>     
> LTW>     $count++;
> LTW>     echo $count;
> LTW>     if ($count < 10) {
> LTW>         Test();
> LTW>         return;
> LTW>     }
> LTW>     echo "j";
> LTW> }
> LTW> Test();
> 
> 
> LTW> Cheers!
> 
> LTW> Torben
> 
> 
> LTW> -- 
> LTW>  Torben Wilson <[EMAIL PROTECTED]>
> LTW>  http://www.thebuttlesschaps.com
> LTW>  http://www.hybrid17.com
> LTW>  http://www.inflatableeye.com
> LTW>  +1.604.709.0506
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506

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

Ok, no I understand why. So this explains why every function
must have return. But how can i program for example one
recursion or where to put return so that test would not be
waiting for return but at the end of this recursion i would
like to do something with that $count for example.

Hmm i wrote this very strange i hope you understand.

I tell it simpler.

I would like something is executed x many times (for such
long if sentence is true) and thene do sometnihg else and
continue with program, not looping here.

-- 
tia,
 Uros                            mailto:[EMAIL PROTECTED]


Sunday, March 31, 2002, 1:34:20 AM, you wrote:

LTW> On Sat, 2002-03-30 at 16:16, Uros Gruber wrote:
>> Hi!
>> 
>> This I simply don't understand why this code executes that
>> way. So there is only inportant to put return after recursive
>> call and it works like i wan't. I sometimes write small C
>> programs and I don't remeber that code like this have to work
>> that way.... Hm.

LTW> Well, that's how it's supposed to work. Look at it like this:

LTW> 1: function test() {
LTW> 2:    static $count = 0;
LTW> 3:    $count++;
LTW> 4:    echo $count;
LTW> 5:    if ($count < 10) {
LTW> 6:        test();
LTW> 7:    }
LTW> 8:    echo 'j';
LTW> 9: }


LTW> So the first thing that happens is you call test(). It executes
LTW> its lines in order, including function calls. When it hits the
LTW> call to test() on line 6, it calls test(), waits for it to 
LTW> return, and then continues on to line 8, echoing 'j'. 

LTW> This happens every time through, so when you get up to $i == 10, you
LTW> have 10 test()s stacked up, each of them waiting on line 6 for the
LTW> function call to test() to return. As each test() call returns,
LTW> execution continues on to line 8, echos j, then returns.

LTW> I'm in a hurry so I don't have too much time to make this much 
LTW> clearer (and my brain is not so good today anyway). If this still
LTW> doesn't make sense then Google gives a zillion hits for 'introduction
LTW> to recursion'.


LTW> Hope this helps,

LTW> Torben

>> -- 
>> bye,
>>  Uros                            mailto:[EMAIL PROTECTED]
>> 
>> 
>> Sunday, March 31, 2002, 1:10:30 AM, you wrote:
>> 
>> LTW> On Sat, 2002-03-30 at 15:59, Uros Gruber wrote:
>> >> Hi!
>> >> 
>> >> This is a code
>> >> 
>> >> function Test()
>> >> {
>> >>     static $count = 0;
>> >> 
>> >>     $count++;
>> >>     echo $count;
>> >>     if ($count < 10) {
>> >>         Test ();
>> >>     }
>> >>     echo "j";
>> >> }
>> >> test();
>> >> 
>> >> Output is
>> >> 
>> >> 12345678910jjjjjjjjjj
>> >> 
>> >> Why is there 10 j at the and. If this would work it can be
>> >> only one. If $count is grater than 10 it does not call itself
>> >> but end. Is this maybe a bug or what.
>> 
>> LTW> No, there should be 10 of them, since every time Test() returns,
>> LTW> the function carries on executing. If you only want one 'j'
>> LTW> printed then put a return statement after the call to Test():
>> 
>> LTW> function Test()
>> LTW> {
>> LTW>     static $count = 0;
>>     
>> LTW>     $count++;
>> LTW>     echo $count;
>> LTW>     if ($count < 10) {
>> LTW>         Test();
>> LTW>         return;
>> LTW>     }
>> LTW>     echo "j";
>> LTW> }
>> LTW> Test();
>> 
>> 
>> LTW> Cheers!
>> 
>> LTW> Torben
>> 
>> 
>> LTW> -- 
>> LTW>  Torben Wilson <[EMAIL PROTECTED]>
>> LTW>  http://www.thebuttlesschaps.com
>> LTW>  http://www.hybrid17.com
>> LTW>  http://www.inflatableeye.com
>> LTW>  +1.604.709.0506
>> 
>> 
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
>> 

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

I need to pull data into and array from a mysql database and then sort
that data according to one of the fields and then print it to the
screen.

Hear is an example of the data in the database

username     Pnumber     sec2 sec3 sec4 sec5 sec6
 Gary      123.345.122    YES  YES   NO  YES  YES
 Fred      123.345.123    YES  YES   NO  YES  YES
 Jone      123.345.124    YES  YES   YES  NO  YES
 Tom       123.345.124    YES  YES   NO  YES  YES
 Frank     123.345.123    YES  YES   NO  YES  YES

 If you will notice the Pnumber for some are the same and some are
 different. I what to be able to sort on this number and then when they
 are printed they would be printed according to this number in groups

  

-- 
Best regards,
 rdkurth                          mailto:[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Run a while loop on your data and pull it into an array....

Heres an example (though this pulls from a text file the idea is the
same...) Hope this helps...

<?php
 // READING THE DATA
function read_data($datafile) {
        $data=file($datafile);
        foreach ( $data as $line ) {
                $temp=explode(':', $line);
                $cp=$temp[4];
                $return[$cp][]=$line;
        }
        if ( is_array($return) ) {
                return($return);
        } else {
                return("NULL");
        }
}
?>

<?php
 // USING THE DATA              
        $hosts=read_data('./hosts.dat');
        if ( $hosts != 'NULL' ) {
                $count=0;
                foreach ( $hosts as $host ) {
                        $temp=explode(':', $host[0]);
                        $hostss.=str_replace("%%COMPANY%%",
decode($company=$temp[4]),$template_company_begin);
                        foreach ( $host as $hst ) {
                                $temp=explode(':', $hst);
                                $h_names[]=$temp[0];
                                $hostss.=str_replace("%%DISPLAY%%",
display_host($hst, $count),
$template_company_mid);
                                $count++;
                        }
                        $hostss.=$template_company_end;
                }
        } else { 
                $hosts="No Hosts In Database...<br>";
        }
?>


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, March 30, 2002 4:22 PM
To: php
Subject: [PHP] Pulling data into an array and sorting


I need to pull data into and array from a mysql database and then sort
that data according to one of the fields and then print it to the
screen.

Hear is an example of the data in the database

username     Pnumber     sec2 sec3 sec4 sec5 sec6
 Gary      123.345.122    YES  YES   NO  YES  YES
 Fred      123.345.123    YES  YES   NO  YES  YES
 Jone      123.345.124    YES  YES   YES  NO  YES
 Tom       123.345.124    YES  YES   NO  YES  YES
 Frank     123.345.123    YES  YES   NO  YES  YES

 If you will notice the Pnumber for some are the same and some are
 different. I what to be able to sort on this number and then when they
 are printed they would be printed according to this number in groups

  

-- 
Best regards,
 rdkurth                          mailto:[EMAIL PROTECTED]


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




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

Thank you for the response to my question unfortunately your answer just
confused me even more.

Saturday, March 30, 2002, 4:25:40 PM, you wrote:

DSK> Run a while loop on your data and pull it into an array....

DSK> Heres an example (though this pulls from a text file the idea is the
DSK> same...) Hope this helps...

DSK> <?php
DSK>  // READING THE DATA
DSK> function read_data($datafile) {
DSK>         $data=file($datafile);
DSK>         foreach ( $data as $line ) {
DSK>                 $temp=explode(':', $line);
DSK>                 $cp=$temp[4];
DSK>                 $return[$cp][]=$line;
DSK>         }
DSK>         if ( is_array($return) ) {
DSK>                 return($return);
DSK>         } else {
DSK>                 return("NULL");
DSK>         }
DSK> }
?>>

DSK> <?php
DSK>  // USING THE DATA              
DSK>         $hosts=read_data('./hosts.dat');
DSK>         if ( $hosts != 'NULL' ) {
DSK>                 $count=0;
DSK>                 foreach ( $hosts as $host ) {
DSK>                         $temp=explode(':', $host[0]);
DSK>                         $hostss.=str_replace("%%COMPANY%%",
DSK> decode($company=$temp[4]),$template_company_begin);
DSK>                         foreach ( $host as $hst ) {
DSK>                                 $temp=explode(':', $hst);
DSK>                                 $h_names[]=$temp[0];
DSK>                                 $hostss.=str_replace("%%DISPLAY%%",
DSK> display_host($hst, $count),
DSK> $template_company_mid);
DSK>                                 $count++;
DSK>                         }
DSK>                         $hostss.=$template_company_end;
DSK>                 }
DSK>         } else { 
DSK>                 $hosts="No Hosts In Database...<br>";
DSK>         }
?>>


DSK> -----Original Message-----
DSK> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
DSK> Sent: Saturday, March 30, 2002 4:22 PM
DSK> To: php
DSK> Subject: [PHP] Pulling data into an array and sorting


DSK> I need to pull data into and array from a mysql database and then sort
DSK> that data according to one of the fields and then print it to the
DSK> screen.

DSK> Hear is an example of the data in the database

DSK> username     Pnumber     sec2 sec3 sec4 sec5 sec6
DSK>  Gary      123.345.122    YES  YES   NO  YES  YES
DSK>  Fred      123.345.123    YES  YES   NO  YES  YES
DSK>  Jone      123.345.124    YES  YES   YES  NO  YES
DSK>  Tom       123.345.124    YES  YES   NO  YES  YES
DSK>  Frank     123.345.123    YES  YES   NO  YES  YES

DSK>  If you will notice the Pnumber for some are the same and some are
DSK>  different. I what to be able to sort on this number and then when they
DSK>  are printed they would be printed according to this number in groups

  




-- 
Best regards,
 rdkurth                            mailto:[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Take a look at this:

<?php

        $result = mysql_query();
        while ( $data = mysql_fetch_array($result) ) {
                $pnumber=$data["Pnumber"];
                $ourdata[$pnumber][]=$data;
        }

        echo "<pre>";
        foreach ( $ourdata as $data ) {
                foreach ( $data as $array ) {
                        echo "Username: ".$array[0]."<br>";
                        echo "Pnumber:  ".$array[1]."<br>";
                        echo "sec2:     ".$array[2]."<br>";
                        echo "sec3:     ".$array[3]."<br>";
                        echo "sec4:     ".$array[4]."<br>";
                        echo "sec5:     ".$array[5]."<br>";
                        echo "sec5:     ".$array[6]."<br>";
                        echo "<hr>";
                }
        }
        echo "</pre>";
?>

        

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, March 30, 2002 4:49 PM
To: php-general
Subject: Re[2]: [PHP] Pulling data into an array and sorting


Thank you for the response to my question unfortunately your answer just
confused me even more.

Saturday, March 30, 2002, 4:25:40 PM, you wrote:

DSK> Run a while loop on your data and pull it into an array....

DSK> Heres an example (though this pulls from a text file the idea is
the
DSK> same...) Hope this helps...

DSK> <?php
DSK>  // READING THE DATA
DSK> function read_data($datafile) {
DSK>         $data=file($datafile);
DSK>         foreach ( $data as $line ) {
DSK>                 $temp=explode(':', $line);
DSK>                 $cp=$temp[4];
DSK>                 $return[$cp][]=$line;
DSK>         }
DSK>         if ( is_array($return) ) {
DSK>                 return($return);
DSK>         } else {
DSK>                 return("NULL");
DSK>         }
DSK> }
?>>

DSK> <?php
DSK>  // USING THE DATA              
DSK>         $hosts=read_data('./hosts.dat');
DSK>         if ( $hosts != 'NULL' ) {
DSK>                 $count=0;
DSK>                 foreach ( $hosts as $host ) {
DSK>                         $temp=explode(':', $host[0]);
DSK>                         $hostss.=str_replace("%%COMPANY%%",
DSK> decode($company=$temp[4]),$template_company_begin);
DSK>                         foreach ( $host as $hst ) {
DSK>                                 $temp=explode(':', $hst);
DSK>                                 $h_names[]=$temp[0];
DSK>                                 $hostss.=str_replace("%%DISPLAY%%",
DSK> display_host($hst, $count),
DSK> $template_company_mid);
DSK>                                 $count++;
DSK>                         }
DSK>                         $hostss.=$template_company_end;
DSK>                 }
DSK>         } else { 
DSK>                 $hosts="No Hosts In Database...<br>";
DSK>         }
?>>


DSK> -----Original Message-----
DSK> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
DSK> Sent: Saturday, March 30, 2002 4:22 PM
DSK> To: php
DSK> Subject: [PHP] Pulling data into an array and sorting


DSK> I need to pull data into and array from a mysql database and then
sort
DSK> that data according to one of the fields and then print it to the
DSK> screen.

DSK> Hear is an example of the data in the database

DSK> username     Pnumber     sec2 sec3 sec4 sec5 sec6
DSK>  Gary      123.345.122    YES  YES   NO  YES  YES
DSK>  Fred      123.345.123    YES  YES   NO  YES  YES
DSK>  Jone      123.345.124    YES  YES   YES  NO  YES
DSK>  Tom       123.345.124    YES  YES   NO  YES  YES
DSK>  Frank     123.345.123    YES  YES   NO  YES  YES

DSK>  If you will notice the Pnumber for some are the same and some are
DSK>  different. I what to be able to sort on this number and then when
they
DSK>  are printed they would be printed according to this number in
groups

  




-- 
Best regards,
 rdkurth                            mailto:[EMAIL PROTECTED]


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




--- End Message ---
--- Begin Message ---
OK, I basically just want to make it so that the user can't go back once
they're done with an application form that I'm working on. I don't case if
they go back in the middle and my page handles that just fine, but I want
them to not be able to go back when they're all done. Is there some way that
I can do this? Thanks,
Dave


--- End Message ---
--- Begin Message ---
You could use sessions for the script... store a variable in the session
when the page has been completed and make sure the script does not
execute if the current session has the appropriate variable...

-----Original Message-----
From: David Johansen [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, March 30, 2002 4:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Disabling the Back Button?

OK, I basically just want to make it so that the user can't go back once
they're done with an application form that I'm working on. I don't case
if
they go back in the middle and my page handles that just fine, but I
want
them to not be able to go back when they're all done. Is there some way
that
I can do this? Thanks,
Dave



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




--- End Message ---
--- Begin Message ---
You're asking the wrong question.

'Disabling the back button' changes the expected behaviour
of the browser and as such is an *EVIL* thing to do, roughly
on par with driving the wrong way down one-way streets or
spray-painting your neighbor's cat.

What you want is to 'prevent the user from accessing or
resubmitting the form after it has been submitted', and
the question is the answer: when the form is submitted set
a flag; check the flag before showing a page or accepting
a submission.


"David Johansen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> OK, I basically just want to make it so that the user can't go back once
> they're done with an application form that I'm working on. I don't case if
> they go back in the middle and my page handles that just fine, but I want
> them to not be able to go back when they're all done. Is there some way
that
> I can do this? Thanks,


--- End Message ---
--- Begin Message ---
Hello,

Whats the HTTP_USER_AGENT for opera?
Thanks,

-Sean
Kennedy

--- End Message ---
--- Begin Message ---
Probably Opera

----- Original Message ----- 
From: "Sean Kennedy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 30, 2002 12:28 PM
Subject: [PHP] Another ?


> Hello,
> 
> Whats the HTTP_USER_AGENT for opera?
> Thanks,
> 
> -Sean
> Kennedy
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

--- End Message ---
--- Begin Message ---
I need a good autorizating script that works in any browser an apache server....

Alberto
Tkz




--- End Message ---
--- Begin Message ---
When I email using this function, the email which is received has the following 
content at the top of it...

From: [EMAIL PROTECTED]
Return-Path: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
X-OriginalArrivalTime: 31 Mar 2002 01:14:57.0786 (UTC) FILETIME=[790BEDA0:01C1D851]

Any ideas on how to get rid of it??


"Were not satisfied until you are"
James Birtch
Compaq Canada OTTAWA Consumer Advisory Support

*       Email - [EMAIL PROTECTED]
*       Voice - (613) 721-3050 x 4516
*       Fax - (613) 721-3070



--- End Message ---
--- Begin Message ---
Actually, that type of stuff is at the top of all e-mails.  You'd always see
it if you set your e-mail client to show you the headers.  So, it may be
something with your e-mail client.  Can you provide the code you're using to
send the e-mail?  The mail() part would suffice.

Tyler Longren
Captain Jack Communications
[EMAIL PROTECTED]
www.captainjack.com

----- Original Message -----
From: "Birtch, James" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 30, 2002 7:16 PM
Subject: [PHP] mail() function.


When I email using this function, the email which is received has the
following content at the top of it...

From: [EMAIL PROTECTED]
Return-Path: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
X-OriginalArrivalTime: 31 Mar 2002 01:14:57.0786 (UTC)
FILETIME=[790BEDA0:01C1D851]

Any ideas on how to get rid of it??


"Were not satisfied until you are"
James Birtch
Compaq Canada OTTAWA Consumer Advisory Support

* Email - [EMAIL PROTECTED]
* Voice - (613) 721-3050 x 4516
* Fax - (613) 721-3070




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


--- End Message ---
--- Begin Message ---
Hi, newbie here.

I was erroneously using "error_reporting=E_ALL ~E_NOTICE" on my debug
server.
Now, I changed it to "error_reporting=E_ALL" and I can see lots of warnings
about using undefined variables.
So, if I don't want to see warnings all over the place, I have to check
every variable with isset() before I use it.
Is it necesary that I do this all the time? Why can't I trust on the
"emptiness" of uninitialized variables?
I'm using "register_globals=Off", so there should be no problem with that.

I know it's a good practice to declare and initialize all variables, but I
need my scripts to run as fast as they can (and I'm too lazy to check every
variable before I use it, too :-)

So... do I have any choice?

Regards,
Ernesto



--- End Message ---
--- Begin Message ---
On Sat, 2002-03-30 at 17:30, Ernesto wrote:
> Hi, newbie here.
> 
> I was erroneously using "error_reporting=E_ALL ~E_NOTICE" on my debug
> server.
> Now, I changed it to "error_reporting=E_ALL" and I can see lots of warnings
> about using undefined variables.
> So, if I don't want to see warnings all over the place, I have to check
> every variable with isset() before I use it.
> Is it necesary that I do this all the time? Why can't I trust on the
> "emptiness" of uninitialized variables?
> I'm using "register_globals=Off", so there should be no problem with that.
> 
> I know it's a good practice to declare and initialize all variables, but I
> need my scripts to run as fast as they can (and I'm too lazy to check every
> variable before I use it, too :-)
> 
> So... do I have any choice?
> 
> Regards,
> Ernesto

Not really. You either have to init your variables or turn off notices
in error_reporting() (or otherwise suppress them; i.e. display_errors =
off).



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

--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> Not really. You either have to init your variables or turn off notices
> in error_reporting() (or otherwise suppress them; i.e. display_errors =
> off).

initialising them with safe defaults is the thing to do - the point of the 
error is to warn about uninitialised variables (which, if register_globals is 
on, could be used by an attacker to make your scripts to bad things...)

- --
Shane
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8pmm85DXg6dCMBrQRAl0PAJ9W6iBFtaYtXBKnvmtfKPPVJzHWyACfRg91
6IXouixJwNAsLJDhvYyhnSs=
=DBej
-----END PGP SIGNATURE-----

--- End Message ---
--- Begin Message ---
On Sat, 2002-03-30 at 17:43, Shane Wright wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> > Not really. You either have to init your variables or turn off notices
> > in error_reporting() (or otherwise suppress them; i.e. display_errors =
> > off).
> 
> initialising them with safe defaults is the thing to do - the point of the 
> error is to warn about uninitialised variables (which, if register_globals is 
> on, could be used by an attacker to make your scripts to bad things...)
> 
> - --
> Shane

Yes, this is my standard suggestion as well, but since Ernesto seemed
to be aware of the issues I decided not to press the point. 


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

--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


sorry, didnt get that that was your prefered method - didnt mean to step on 
your toes :)

S

On Sunday 31 March 2002 2:50 am, Lars Torben Wilson wrote:
> On Sat, 2002-03-30 at 17:43, Shane Wright wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > > Not really. You either have to init your variables or turn off notices
> > > in error_reporting() (or otherwise suppress them; i.e. display_errors =
> > > off).
> >
> > initialising them with safe defaults is the thing to do - the point of
> > the error is to warn about uninitialised variables (which, if
> > register_globals is on, could be used by an attacker to make your scripts
> > to bad things...)
> >
> > - --
> > Shane
>
> Yes, this is my standard suggestion as well, but since Ernesto seemed
> to be aware of the issues I decided not to press the point.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8pm4K5DXg6dCMBrQRAsTLAJ9377x/gjRKbHrfcSYW11BKUgotgACfQmTw
x2rcCdMlPbAaPg8zAey7L/8=
=WVbB
-----END PGP SIGNATURE-----

--- End Message ---
--- Begin Message ---
$Sql_Query_Login Returns an empty mysql array like:

$Sql_Query_Login = Mysql_Query("SELECT Nome FROM users WHERE User = 'Anyone'")

There isn't a user if name Anyone...

Why

If (!$Sql_Query_Login) {
   Echo "Ninguem";
}

Is returning False?



--- End Message ---
--- Begin Message ---
On Sunday 31 March 2002 07:29, Alberto Wagner wrote:
> $Sql_Query_Login Returns an empty mysql array like:
>
> $Sql_Query_Login = Mysql_Query("SELECT Nome FROM users WHERE User =
> 'Anyone'")
>
> There isn't a user if name Anyone...
>
> Why
>
> If (!$Sql_Query_Login) {
>    Echo "Ninguem";
> }
>
> Is returning False?

mysql_query() returns a resource id, which is a *pointer* to the results and 
not the actual results themselves.

To get at the actual results you need to follow up with one of:

mysql_fetch_array()
mysql_fetch_row()
mysql_fetch_assoc()

See manual for details and examples.

Also you should put some error-checking in your code as per the examples in 
the manual.


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

/*
Bennett's Laws of Horticulture:
        (1) Houses are for people to live in.
        (2) Gardens are for plants to live in.
        (3) There is no such thing as a houseplant.
*/
--- End Message ---
--- Begin Message ---
here is a function used to authenticate users against mysql database.  
Problem is, I am not connecting for some reason.  I have the db variables:
$db_host
$db_user
$db_pass
$db_name

They are populated from an include ("x.php") in the beginning of the php 
section.  It is getting past the connect statement, but it is not selecting 
the proper database, and gives a:

"Error in query: No Database Selected"

in the error trap below (die).  Any ideas what is wrong?  Am I missing some 
syntax, or what?
Thanks.

Patrick

######################################

function authenticate($user, $pass)
{

        // check login and password
        // connect and execute query
        $connection = mysql_connect($db_host, $db_user, $db_pass) or die ("Unable 
to connect!");
        $query = "SELECT id from users WHERE username = '$user' AND password = 
PASSWORD('$pass')";
        mysql_select_db($db_name);
        //mysql_select_db("devweb"); <--what it should be, from file
        $result = mysql_query($query, $connection) or die ("Error in query: " . 
mysql_error());

        // if row exists -> user/pass combination is correct
        if (mysql_num_rows($result) == 1)
        {
                return 1;
        }
        // user/pass combination is wrong
        else
        {
                return 0;
        }
}

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.

--- End Message ---
--- Begin Message ---
31/03/2002 01:02:04, "Patrick Hartnett" <[EMAIL PROTECTED]> wrote:

You Need to use the command
Mysql_Select_Db("$db_name") Or Die("Unable to connect!");

after connect with mysql

I use something like this:

mysql_connect($db_host, $db_user, $db_pass) or die ("Unable to connect!");
Mysql_Select_Db("$db_name") Or Die("Unable to connect!");

I don't use a $connection like var.


>here is a function used to authenticate users against mysql database.  
>Problem is, I am not connecting for some reason.  I have the db variables:
>$db_host
>$db_user
>$db_pass
>$db_name
>
>They are populated from an include ("x.php") in the beginning of the php 
>section.  It is getting past the connect statement, but it is not selecting 
>the proper database, and gives a:
>
>"Error in query: No Database Selected"
>
>in the error trap below (die).  Any ideas what is wrong?  Am I missing some 
>syntax, or what?
>Thanks.
>
>Patrick
>
>######################################
>
>function authenticate($user, $pass)
>{
>
>       // check login and password
>       // connect and execute query
>       $connection = mysql_connect($db_host, $db_user, $db_pass) or die ("Unable 
>to connect!");
>       $query = "SELECT id from users WHERE username = '$user' AND password = 
>PASSWORD('$pass')";
>       mysql_select_db($db_name);
>       //mysql_select_db("devweb"); <--what it should be, from file
>       $result = mysql_query($query, $connection) or die ("Error in query: " . 
>mysql_error());
>
>       // if row exists -> user/pass combination is correct
>       if (mysql_num_rows($result) == 1)
>       {
>               return 1;
>       }
>       // user/pass combination is wrong
>       else
>       {
>               return 0;
>       }
>}
>
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
>
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>




--- End Message ---
--- Begin Message ---
I don't think those variables are readable in the function.  Not totally
sure though.

Tyler Longren
Captain Jack Communications
[EMAIL PROTECTED]
www.captainjack.com

----- Original Message -----
From: "Patrick Hartnett" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 30, 2002 10:02 PM
Subject: [PHP] MySQL Connection Error - mysql_select_db


> here is a function used to authenticate users against mysql database.
> Problem is, I am not connecting for some reason.  I have the db variables:
> $db_host
> $db_user
> $db_pass
> $db_name
>
> They are populated from an include ("x.php") in the beginning of the php
> section.  It is getting past the connect statement, but it is not
selecting
> the proper database, and gives a:
>
> "Error in query: No Database Selected"
>
> in the error trap below (die).  Any ideas what is wrong?  Am I missing
some
> syntax, or what?
> Thanks.
>
> Patrick
>
> ######################################
>
> function authenticate($user, $pass)
> {
>
> // check login and password
> // connect and execute query
> $connection = mysql_connect($db_host, $db_user, $db_pass) or die ("Unable
> to connect!");
> $query = "SELECT id from users WHERE username = '$user' AND password =
> PASSWORD('$pass')";
> mysql_select_db($db_name);
> //mysql_select_db("devweb"); <--what it should be, from file
> $result = mysql_query($query, $connection) or die ("Error in query: " .
> mysql_error());
>
> // if row exists -> user/pass combination is correct
> if (mysql_num_rows($result) == 1)
> {
> return 1;
> }
> // user/pass combination is wrong
> else
> {
> return 0;
> }
> }
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at
http://explorer.msn.com/intl.asp.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Hello Ciro,

For database access and automatic generation of forms, see
http://phplens.com/
You can create search/edit/new record forms automatically through the web
user
interface with little coding. It also has a low level PHP interface for
deep coding. This is a commercial product, developed by our company.

Regards, John

Ciro Martins <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> Hi!
>
>
> I've been programming in PHP for long. But one question that always is
> coming to my mind is to know if there exists some kind of tools (like
> for SP. It exists a tool called ASPWebTools for wich it is possible to
> develop applications written in ASP and connecting with DB like SQL
> Server in an automatic way) that can help in the development of
> applications using PHP and databases. For instance, that could allow to
> develop automatically forms to connect to databases using PHP.
>
> Does anyone know any related application or tools.
> Because in ASP with that tool is more easy to develop code.
>
> Thanks in advance
>
> Ciro Martins
>


--- End Message ---

Reply via email to