php-windows Digest 26 Jul 2002 04:20:22 -0000 Issue 1258

Topics (messages 14939 through 14958):

Date conversion
        14939 by: Kit Kerbel
        14945 by: Kit Kerbel
        14948 by: Dash McElroy
        14952 by: Scott Carr

mssql on linux
        14940 by: Nicola Delbono

Re: reading input from a magnetic stripe and then parsing it to a MySQL database for 
querry?
        14941 by: Brian Huff

Re: Include Issues Windoes 2000
        14942 by: Dash McElroy
        14944 by: Luis Ferro

Authenticating users. Help!
        14943 by: Tudor, Frank

Brain Twister
        14946 by: R.S. Herhuth
        14947 by: Asendorf, John
        14950 by: Jason Soza
        14953 by: Asendorf, John

Mixing GD graphics and HTML/PHP
        14949 by: Aron Pilhofer

Re: Mixing GD graphics and HTML/PHP ANSWERED
        14951 by: Aron Pilhofer

pretty simple-but i can't figure it out
        14954 by: Tim Blackwell
        14955 by: Scott Carr
        14956 by: Peter

Next GD headache
        14957 by: Aron Pilhofer

php+window98+apache+sybase client
        14958 by: cckinkin

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 ---
I would like to convert 2002-04-02 00:00:00  to the format,
04-02-2002....or m/d/Y

How would I do this?

Thanx in advance,
Kit



_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

--- End Message ---
--- Begin Message ---
I'm pulling the "2002-04-02 00:00:00" from a database(mssql).  It reads 
04/02/2002 in the database table, but when you pull the value out with php, 
it converts it to 2002-04-02 00:00:00.  Then I am trying to compare it with 
7/11/2002 to see if it is > or <.  It's not comparing properly. Not sure 
what to do.  Seems kinda like a stupid sticking point.

Kit


----Original Message Follows----
From: Dash McElroy <[EMAIL PROTECTED]>
To: 'Kit Kerbel' <[EMAIL PROTECTED]>
Subject: RE: [PHP-WIN] Date conversion
Date: Thu, 25 Jul 2002 10:02:03 -0700

How is the string 2002-04-02 00:00:00 entered? Is that generated by a
database, a PHP function, or user input on a website?

The mktime(); function can probably help you, but take a look at it's funky
paramaters. When you're done with mktime();, pass it to date(); with the
paramaters you want (i.e. date(mdy, mktime(blah blah blah));

Good luck!

-Dash

-----Original Message-----
From: Kit Kerbel [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 25, 2002 8:44 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Date conversion


I would like to convert 2002-04-02 00:00:00  to the format,
04-02-2002....or m/d/Y

How would I do this?

Thanx in advance,
Kit



_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


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




_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

--- End Message ---
--- Begin Message ---
Well... you could cut the string down like:

  $string = substr("$string", 0, 9);

then explode them into an array like follows:

  $array = explode("-", "$string");

and then...

  $dbdate = date("m/d/Y", mktime(0,0,0,$array[1],$array[2],$array[0]));

then do your compare.

OR - you could just compare the two mktime calls (i.e. the mktime call above
and then compare it with a mktime call with the current (or user specified)
date).

PHEW!

Good luck!

-Dash

-----Original Message-----
From: Kit Kerbel [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, July 25, 2002 12:05 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] Date conversion


I'm pulling the "2002-04-02 00:00:00" from a database(mssql).  It reads 
04/02/2002 in the database table, but when you pull the value out with php, 
it converts it to 2002-04-02 00:00:00.  Then I am trying to compare it with 
7/11/2002 to see if it is > or <.  It's not comparing properly. Not sure 
what to do.  Seems kinda like a stupid sticking point.

Kit


----Original Message Follows----
From: Dash McElroy <[EMAIL PROTECTED]>
To: 'Kit Kerbel' <[EMAIL PROTECTED]>
Subject: RE: [PHP-WIN] Date conversion
Date: Thu, 25 Jul 2002 10:02:03 -0700

How is the string 2002-04-02 00:00:00 entered? Is that generated by a
database, a PHP function, or user input on a website?

The mktime(); function can probably help you, but take a look at it's funky
paramaters. When you're done with mktime();, pass it to date(); with the
paramaters you want (i.e. date(mdy, mktime(blah blah blah));

Good luck!

-Dash

-----Original Message-----
From: Kit Kerbel [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 25, 2002 8:44 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Date conversion


I would like to convert 2002-04-02 00:00:00  to the format,
04-02-2002....or m/d/Y

How would I do this?

Thanx in advance,
Kit



_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


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




_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
You can use strtotime function.  It'll take any textual rep of a date and
convert it to Unix Timestamp.  Then your checks will be int based.

You can then use Date() to format it back to your liking, etc.
-- 
Scott Carr
OpenOffice.org
Documentation Maintainer
http://documentation.openoffice.org/


Quoting Dash McElroy <[EMAIL PROTECTED]>:

> Well... you could cut the string down like:
> 
>   $string = substr("$string", 0, 9);
> 
> then explode them into an array like follows:
> 
>   $array = explode("-", "$string");
> 
> and then...
> 
>   $dbdate = date("m/d/Y", mktime(0,0,0,$array[1],$array[2],$array[0]));
> 
> then do your compare.
> 
> OR - you could just compare the two mktime calls (i.e. the mktime call above
> and then compare it with a mktime call with the current (or user specified)
> date).
> 
> PHEW!
> 
> Good luck!
> 
> -Dash
> 
> -----Original Message-----
> From: Kit Kerbel [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, July 25, 2002 12:05 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] Date conversion
> 
> 
> I'm pulling the "2002-04-02 00:00:00" from a database(mssql).  It reads 
> 04/02/2002 in the database table, but when you pull the value out with php, 
> it converts it to 2002-04-02 00:00:00.  Then I am trying to compare it with 
> 7/11/2002 to see if it is > or <.  It's not comparing properly. Not sure 
> what to do.  Seems kinda like a stupid sticking point.
> 
> Kit
> 
> 
> ----Original Message Follows----
> From: Dash McElroy <[EMAIL PROTECTED]>
> To: 'Kit Kerbel' <[EMAIL PROTECTED]>
> Subject: RE: [PHP-WIN] Date conversion
> Date: Thu, 25 Jul 2002 10:02:03 -0700
> 
> How is the string 2002-04-02 00:00:00 entered? Is that generated by a
> database, a PHP function, or user input on a website?
> 
> The mktime(); function can probably help you, but take a look at it's funky
> paramaters. When you're done with mktime();, pass it to date(); with the
> paramaters you want (i.e. date(mdy, mktime(blah blah blah));
> 
> Good luck!
> 
> -Dash
> 
> -----Original Message-----
> From: Kit Kerbel [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 25, 2002 8:44 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Date conversion
> 
> 
> I would like to convert 2002-04-02 00:00:00  to the format,
> 04-02-2002....or m/d/Y
> 
> How would I do this?
> 
> Thanx in advance,
> Kit
> 
> 
> 
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
> 
> 
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> 
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
> 
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
--- End Message ---
--- Begin Message ---
hello,

any trouble connecting to MSSQL server from linux to win?

I Run php on linux with freeTDS e unixODBC
but there are alot lot of troubles.

Every now and then I have to close and reopen connections because 
in pages with many queries, every qry need a new connection-..


Can't do any nested query also..

Any help is gold..



Nicola Delbono
///////////////////////////////////////////
Il notiziario dei notiziari
http://www.notiziarioweb.it/
///////////////////////////////////////////

www.smscitta.com | www.musicalbox.it
www.filosofo.it | www.bollicine.com

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

The card reader should have some driver documentation on how to access 
the data... you'd most likely have to write this in C++.  If you're 
lucky, the manufacturers may have a command-line interface program to 
get at the data, or some dlls... so you might be able to get away with 
VB or Java... but not PHP.  Wrong tool for this job.

If you really want security, store a public-private key pair on the 
card.  Write the client program to read and send the public key to the 
server.  Dont worry, you can send it cleartext... Then on the server 
side, use this public key and a large random number to encrypt it.  Send 
the cyphertext back to the client.

If the client is who he says he is, he should be able to decrypt the 
text, and send back to you the original random number.  If the number 
sent back aint the right one, he's a liar.  Bingo!  Pretty good 
authentication over clear text channels, and you never have to show 
anybody your private key.  You can still use IPSec and SSH if you're 
really paranoid, tho...

-- 

Brian 'Bex' Huff
[EMAIL PROTECTED]
Phone: 952-903-2023
Fax: 952-829-5424


--- End Message ---
--- Begin Message ---
2 things:

1. Your webserver should be running as IUSR_something which as far as I
know, may have no network access, or permissions by default. There was a
like topic discussed recently on this list. I don't use IIS (YAY!) so I'm
not really sure. Check your permissions. Then double check them.

2. Try using forward slashes instead of backslashes. PHP and other cross
platform software don't take kindly to Windows' "standard" of backslashes.
If you're dead set on backslashes, use them twice (i.e. \\ for \ and \\\\
for \\).

Good luck!

-----Original Message-----
From: Chris Schmidt [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, July 25, 2002 8:25 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Include Issues Windoes 2000


I have two server

FS = File Server
WS = Web server

WS is IIS and is conecting to a share on FS.
So the path to the PHP files is
\\FS\iisweb\phpfiles\

So if i call test.php and that is located at http://WS/client/test.php
and config is at http:\\WS\phpfiles\config.php

test.php has this as a line:
include("\\FS\iisweb\phpfiles\config.php")
or
include("..\phpfiles\config.php")
I get  that a file can not be found

Does PHP for windows work with Shares?



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I doubt... (i've no reason to believe that it doesn't work, but if it 
doesn't i would assume it to be a bug in windows 
filesystem->networksystem layer)...

Anyway, the better way is to create a distributed file system and/or map 
the share as if it was a directory in one of the WS machine...

That way, PHP doesn't need to know where are the files, it assumes that 
they are reachable directly...

Cheers...
Luis Ferro

Chris Schmidt wrote:

>I have two server
>
>FS = File Server
>WS = Web server
>
>WS is IIS and is conecting to a share on FS.
>So the path to the PHP files is
>\\FS\iisweb\phpfiles\
>
>So if i call test.php and that is located at http://WS/client/test.php
>and config is at http:\\WS\phpfiles\config.php
>
>test.php has this as a line:
>include("\\FS\iisweb\phpfiles\config.php")
>or
>include("..\phpfiles\config.php")
>I get  that a file can not be found
>
>Does PHP for windows work with Shares?
>
>
>
>  
>



--- End Message ---
--- Begin Message ---
I am trying set up a server like pop-up window (something you would see
when logging into an intranet site) for users to authenticate to my site.  I
have had no success.  All I get is the pop-up window returning over and over
again.  Like it is not even looking at the code. Please help.  This seems
like standard stuff floating around various php sits so why it doesn't work
is a mystery.

Here is my code.

<?
if (!isset($PHP_AUTH_USER)) {
                
        header('WWW-Authenticate: Basic realm="My Private
Stuff"');
        header('HTTP/1.0 401 Unauthorized');
        echo 'Authorization Required.';
        exit;

} else {

        $connection = mysql_connect("localhost", "dude", "pass")
                or die ("Couldn't connect to server.");
                
        $db = mysql_select_db("scis", $connection)
                or die ("Couldn't select database.");

        $sql = "SELECT userid
                FROM regiuser
                WHERE userid='$PHP_AUTH_USER' and password='$PHP_AUTH_PW'";

        $result = mysql_query($sql)
                or die("Couldn't execute query.");

        $num = mysql_numrows($result);

        if ($num == 1) {

                echo "<P>You are valid!<br>";
                echo "Your userid is $PHP_AUTH_USER<br>";
                echo "Your password is $PHP_AUTH_PW</p>";

        } else if ($num == 0)  {

                echo "You are not authorized!";

        }

}

?>
--- End Message ---
--- Begin Message ---

I have a series of offices (11 at the present time).  Each office has a
CITY STATE ZIPCODE and a MILEAGE.  What I need to do is to sort them by
mileage which is dynamically calculated earlier in the script.  I need
the offices to be stored in an array and sorted by the MILEAGE after
which I will return them in the order that they have been sorted.

How can I do this?

Ron
--- End Message ---
--- Begin Message ---
http://www.php.net/manual/en/function.asort.php

http://www.php.net/manual/en/ref.array.php

Is the information (non-mileage) going to be stored in a database?




---------------------
John Asendorf - [EMAIL PROTECTED]
Web Applications Developer
http://www.lcounty.com - NEW FEATURES ADDED DAILY!
Licking County, Ohio, USA
740-349-3631
Nullum magnum ingenium sine mixtura dementiae fuit


> -----Original Message-----
> From: R.S. Herhuth [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 25, 2002 3:10 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Brain Twister
> 
> 
> 
> I have a series of offices (11 at the present time).  Each 
> office has a
> CITY STATE ZIPCODE and a MILEAGE.  What I need to do is to 
> sort them by
> mileage which is dynamically calculated earlier in the script.  I need
> the offices to be stored in an array and sorted by the MILEAGE after
> which I will return them in the order that they have been sorted.
> 
> How can I do this?
> 
> Ron
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
--- End Message ---
--- Begin Message ---
Maybe use sort(), asort(), or array_multisort()? I'm sure one of them 
would do what you're looking for.

asort()
http://www.php.net/manual/en/function.asort.php

sort()
http://www.php.net/manual/en/function.sort.php

array_multisort()
http://www.php.net/manual/en/function.array-multisort.php

Jason Soza

----- Original Message -----
From: "R.S. Herhuth" <[EMAIL PROTECTED]>
Date: Thursday, July 25, 2002 11:09 am
Subject: [PHP-WIN] Brain Twister

> 
> I have a series of offices (11 at the present time).  Each office 
> has a
> CITY STATE ZIPCODE and a MILEAGE.  What I need to do is to sort 
> them by
> mileage which is dynamically calculated earlier in the script.  I need
> the offices to be stored in an array and sorted by the MILEAGE after
> which I will return them in the order that they have been sorted.
> 
> How can I do this?
> 
> Ron
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
Try this:
-----------

$mi_boston = 645; //would be a calculation I guess
$mi_ny = 886; //would be a calculation I guess
$mi_chicago = 423; //would be a calculation I guess
$mi_la = 1087; //would be a calculation I guess


$arr_places = array(
                '0' => array(
        'City' => 'Boston',
                'State' => 'Massachusett' ,
                'ZipCode' => '11111' ,
        'mileage' => $mi_boston ,
                ),
                '1' => array(
        'City' => 'New York',
                'State' => 'New York' ,
                'ZipCode' => '11221',
        'mileage' => $mi_ny ,
                ),
        '2' => array(
        'City' => 'Chicago',
                'State' => 'Illinois' ,
                'ZipCode' => '33333',
        'mileage' => $mi_chicago ,
                ),
        '3' => array(
        'City' => 'Los Angeles',
                'State' => 'California' ,
                'ZipCode' => '99999',
        'mileage' => $mi_la ,
                ),
);

//echo AS IS - just shows what it looks like before the mileage sort
while ( list($key, $val) = each($arr_places) ) {
        echo "<p>$val[mileage] - $val[City], $val[State]
$val[ZipCode]</p>\n";
}

reset ( $arr_places );

echo "\n<p>&nbsp;</p>\n\n"

//echo with a multisort

//(Make the sort array out of the "mileage"
while ( list($key, $val) = each($arr_places) ) {
        $sortarray[] = $val[mileage];
}

reset ( $arr_places ); //probably not necessary but we'll do it anyway

//sort ascending numerically by the "mileage" $sortarray
array_multisort($arr_places,SORT_ASC,SORT_NUMERIC,$sortarray);


while ( list($key, $val) = each($arr_places) ) {
        echo "<p>$val[mileage] - $val[City], $val[State]
$val[ZipCode]</p>\n";
}


Have fun... John

---------------------
John Asendorf - [EMAIL PROTECTED]
Web Applications Developer
http://www.lcounty.com - NEW FEATURES ADDED DAILY!
Licking County, Ohio, USA
740-349-3631
Nullum magnum ingenium sine mixtura dementiae fuit


> -----Original Message-----
> From: R.S. Herhuth [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 25, 2002 3:19 PM
> To: Asendorf, John
> Subject: Re: [PHP-WIN] Brain Twister
> 
> 
> no, it is strictly read only..
> 
> I read that but I was having trouble visualizing how to put the info
> into an array and sorting on just the distance.
> 
> Ron
> 
> "Asendorf, John" wrote:
> > 
> > http://www.php.net/manual/en/function.asort.php
> > 
> > http://www.php.net/manual/en/ref.array.php
> > 
> > Is the information (non-mileage) going to be stored in a database?
> > 
> > ---------------------
> > John Asendorf - [EMAIL PROTECTED]
> > Web Applications Developer
> > http://www.lcounty.com - NEW FEATURES ADDED DAILY!
> > Licking County, Ohio, USA
> > 740-349-3631
> > Nullum magnum ingenium sine mixtura dementiae fuit
> > 
> > > -----Original Message-----
> > > From: R.S. Herhuth [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, July 25, 2002 3:10 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP-WIN] Brain Twister
> > >
> > >
> > >
> > > I have a series of offices (11 at the present time).  Each
> > > office has a
> > > CITY STATE ZIPCODE and a MILEAGE.  What I need to do is to
> > > sort them by
> > > mileage which is dynamically calculated earlier in the 
> script.  I need
> > > the offices to be stored in an array and sorted by the 
> MILEAGE after
> > > which I will return them in the order that they have been sorted.
> > >
> > > How can I do this?
> > >
> > > Ron
> > >
> > > --
> > > PHP Windows Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> 
--- End Message ---
--- Begin Message ---
I'd like to insert a dynamic grahic (bar chart) into an existing page, but I
keep getting tripped up on the header issue. Is there any workaround that
does not involve frames, which would be a pretty klunky solution IMHO.

Thanks in advance.


--- End Message ---
--- Begin Message ---
Duh, duh, duh. One of those days.

Thanks guys for pointing out the (what should have been) obvious. :)



"Aron Pilhofer" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'd like to insert a dynamic grahic (bar chart) into an existing page, but
I
> keep getting tripped up on the header issue. Is there any workaround that
> does not involve frames, which would be a pretty klunky solution IMHO.
>
> Thanks in advance.
>
>


--- End Message ---
--- Begin Message ---
how do you make a link using PHP it's very simple in html and javascript,
but i can't seem to figure out how to make a simple link?

i'm making a news site and would like to have enormous articles have a nice
little more...... link at the bottom of the first portion of the article.

any help would be much appreciated,

thanks,

tim


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

echo "<a href=\"yourlink\">{Your Text}</a>";

-- 
Scott Carr
OpenOffice.org
Documentation Maintainer
http://documentation.openoffice.org/


Quoting Tim Blackwell <[EMAIL PROTECTED]>:

> how do you make a link using PHP it's very simple in html and javascript,
> but i can't seem to figure out how to make a simple link?
> 
> i'm making a news site and would like to have enormous articles have a nice
> little more...... link at the bottom of the first portion of the article.
> 
> any help would be much appreciated,
> 
> thanks,
> 
> tim
> 
> 
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
--- End Message ---
--- Begin Message ---
You could also make a function to simplify things if you have lots of links

function dolink($href, $text) {
$text = "<A HREF=\"$href\">$text</A>";
return $text;
}

then calling
echo dolink("page1.php","Link to page 1");
would output a link to page1.php with the text Link to page 1



"Tim Blackwell" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> how do you make a link using PHP it's very simple in html and javascript,
> but i can't seem to figure out how to make a simple link?
>
> i'm making a news site and would like to have enormous articles have a
nice
> little more...... link at the bottom of the first portion of the article.
>
> any help would be much appreciated,
>
> thanks,
>
> tim
>
>


--- End Message ---
--- Begin Message ---
Short question: I can't find this in the docs anywhere. Is it possible to
register more than one session variable at a time? If so, what is the
syntax?

Long question: I am trying to generate a bar chart to accompany some figures
I calculate. I have the code to generate the bar chart in a separate page,
and I call the script as an image. So far so good. The thing I can't figure
out is how best to pass variables to the graphic code. I thought about
setting them as globals, but I thought that might be problematic in some
way. The only other idea I had was to set them as session variables -- and
that works, but it strikes me as (i dunno) inelegant???

Suggestions anyone?


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

Dear all, 

I don't know how to set php configure to let php to communicate the sybase server. 

My computer has php4, window98, apache and sybase client. 
I can use the brower to see simple php program. 

However, i cannot connect to sybase. 

Thanks and Regards 
CK Chan

==================================================================
至尊偶像鈴聲選舉:http://sms.sina.com.hk/ringtone/


--- End Message ---

Reply via email to