|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help_at_lists.php.net
Date: Thu Oct 17 2002 - 08:07:26 CDT
php-general Digest 17 Oct 2002 13:07:26 -0000 Issue 1649
Topics (messages 120262 through 120317):
Re: to use switch or not to use switch
120262 by: Maxim Maletsky
fopen error
120263 by: Alfonso Ballesteros
120301 by: Marek Kilimajer
120312 by: Alfonso Ballesteros
Re: Problem with fputs/fgets
120264 by: Paul Nicholson
120266 by: Jason Young
120269 by: Paul Nicholson
Re: Need help with HTTP-Authentication
120265 by: David P Lenk
Re: Want to exclude first 10 records from table
120267 by: Manisha
Re: $_SESSION
120268 by: Paul Nicholson
why can't i do this?
120270 by: Peter Houchin
120271 by: Keith Vance
120272 by: Smith, Benjamin
120274 by: Peter Houchin
120276 by: Peter Houchin
Problem with setcookie and IE6.0.2800.1106
120273 by: John Nichel
120275 by: Timothy Hitchens
120277 by: Chris Shiflett
120278 by: Timothy Hitchens
120279 by: John Nichel
120280 by: John Nichel
120292 by: John Nichel
MySQL GMT --> Local time
120281 by: Jason
120283 by: dwalker
120285 by: Smith, Benjamin
120287 by: Jason
120310 by: 1LT John W. Holmes
xml
120282 by: sonjaya
Re: class variable shared by all objects
120284 by: BAROILLER Pierre-Emmanuel
Re: Postgres-Transaction-user_ignore_abort-Connection stop by the client
120286 by: Yasuo Ohgaki
Weight function.
120288 by: Steve Jackson
120293 by: Jason Wong
120294 by: Steve Jackson
120298 by: Jason Wong
120302 by: Steve Jackson
how to setup mysql logging from php scripts
120289 by: Petre Agenbag
120300 by: David Robley
Re: file upload and php (Not a begginer question!)
120290 by: Robert Sedlacek
Re: Blank PHP pages...
120291 by: René Moonen
Re: People who searched this also searched this!
120295 by: Krzysztof Dziekiewicz
Re: weird IE cookie problem
120296 by: Krzysztof Dziekiewicz
xml parsing
120297 by: Michael Ransburg
120311 by: Geoff Hankerson
Is this a bad thing to do? (Unix permissions)
120299 by: Gwydion Elderwyn
120303 by: Marek Kilimajer
E-Commerce interfacing...
120304 by: Noodle Snacks
120307 by: Jon Haworth
Calendar System
120305 by: Joran
120306 by: Jon Haworth
Get the string in between two other strings
120308 by: Cameron Cooke
120309 by: Noodle Snacks
120315 by: Cameron Cooke
120317 by: John S. Huggins
Which one? Firebird or mysql for php
120313 by: A3-Mail Proxy Handler
Re: browser back-button problem
120314 by: marcel.britsch
Downloads
120316 by: Shaun
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
sorry, strlen(), not sizeof().
-- Maxim Maletsky maximphp.net
On Thu, 17 Oct 2002 03:03:13 +0200 Maxim Maletsky <maxim
php.net> wrote:
> > the answer can be as simple as: > > <? > $k = sizeof($field); > > if(...) > $file = 'this'; > elseif(...) > $file = 'that'; > > // etc ... > > include($file); > ?> > -- > Maxim Maletsky > maxim
php.net > > > On Wed, 16 Oct 2002 20:39:50 -0400 "John W. Holmes" <holmes072000
charter.net> wrote: > > > Sounds like a good time for a switch to me... > > > > ---John Holmes... > > > > > -----Original Message----- > > > From: Peter Houchin [mailto:php
vfsa.com.au] > > > Sent: Wednesday, October 16, 2002 8:19 PM > > > To: php_gen > > > Subject: [PHP] to use switch or not to use switch > > > > > > howdy > > > > > > am just courious to see what approach others would take given this > > > senario. > > > > > > I have a form which for the most part is basic to follow but I have > > one > > > field where people can enter any value up to 100k in now what has to > > > happen > > > is if they enter anything that equals 20k or lower is taken care of by > > one > > > script, if it is greater than 20k but less than or equal to 50k it is > > > handled by another script and if it is greater than 50k but equal to > > or > > > lower than 100k by another script and if it's greater than 100k > > another > > > script is run. > > > > > > if any one has any suggestions on different approaches to this i'd > > like to > > > hear it as I am looking for something relitively easy to code and and > > easy > > > for some one else to come in and change things if required down the > > track. > > > > > > Cheers > > > > > > Peter > > > "the only dumb question is the one that wasn't asked" > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
Hello
I'm a newcomer to PHP and I wish to know how to get the contents of a file located in an URL if the parameter allow_url_fopen is "no value" in the php.ini file.
Does this parameter, if is "on", affect the security of the server?
Thanks in advance
Alfonso
attached mail follows:
if allow_url_fopen is not on, you can still use fsockopen(), and no it doesn't affect security, if you don't open files based on unchecked user input.
Alfonso Ballesteros wrote:
>Hello > >I'm a newcomer to PHP and I wish to know how to get the contents of a file >located in an URL if the parameter allow_url_fopen is "no value" in the >php.ini file. > >Does this parameter, if is "on", affect the security of the server? > >Thanks in advance > >Alfonso > > > > >
attached mail follows:
I'm still stuck with this...
Using fsockopen() I'm not able to open the remote file.
I use
$file = "http://www.xxx.xxx/file.txt"; $fp = fsockopen($file, 80);
and $fp returns nothing...
Any idea?
Alfonso
"Marek Kilimajer" <kilimajer
webglobe.sk> escribió en el mensaje
news:3DAE87AE.1000307
webglobe.sk...
> if allow_url_fopen is not on, you can still use fsockopen(), and no it
> doesn't affect security, if you don't open files based on unchecked user
> input.
>
> Alfonso Ballesteros wrote:
>
> >Hello
> >
> >I'm a newcomer to PHP and I wish to know how to get the contents of a
file
> >located in an URL if the parameter allow_url_fopen is "no value" in the
> >php.ini file.
> >
> >Does this parameter, if is "on", affect the security of the server?
> >
> >Thanks in advance
> >
> >Alfonso
> >
> >
> >
> >
> >
>
attached mail follows:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hey, I saw that you fixed this but have you ever thought of using the imap_* functions for this? It'd be a lot easier and it does work on pop3 servers. ~Paul
On Wednesday 16 October 2002 05:02 pm, Jason Young wrote: > I'm in the process of writing a very very simple web-based email client, > just for my personal use, so I can perm-delete all the spam that comes > in through the day on my home account before i get home. > > > On the very first connect, its great.. connects, does a 'uidl' which > lists all the mail ID's (the 'else' part of the if statement below) > > The problem lies where I click the generated link and attempt to read a > message, the browser load just hangs (despite the set_time_limit()) and > when I cancel it, the server tells me there's another connection active. > > I have an fputs($pop, "QUIT\r\n); as well as an fclose($pop); .. > Shouldn't this be sufficient to make sure the connection is closed > before my visit to trying to read a message? Or is that not the problem? > > I'm thinking its something with the actual ($action == "read") code.. > but... what would it be? > > Thanks for all help! > -Jason > > Code---- > > <? > if (isset($_GET['action'])) > $action = $_GET['action']; > if (isset($_GET['msg'])) > $msg = $_GET['msg']; > > $pop = fsockopen("pop.server", 110, $errno, $errstr, 300); > > fgets($pop,255); > > fputs($pop,"USER name\r\n"); > fgets($pop,255); > > fputs($pop,"PASS word\r\n"); > $status = fgets($pop,255); > > if (substr($status, 0, 4) == "-ERR") { > echo $status; > exit(); > } > > if ($action == "read") { > set_time_limit(10); > $cmd = "top $msg 10"; > fputs($pop, $cmd); > $themsg = fgets($pop); > echo $themsg; > } else { > fputs($pop,"uidl\r\n"); // Get list of messages > $list = fgets($pop,255)."<br>"; > $list = substr($list, 4, strpos($list, " ", 3)); > for ($i = 1; $i <= $list; $i++) { > $curr = fgets($pop); > echo "<a href=\"?action=read&msg=".substr($curr, 0, strpos($curr, " > "))."\">$curr</a><br>"; > } > echo "<br>$list messages"; > } > > fputs($pop,"QUIT\r\n"); > echo fgets($pop); > > fclose($pop); > ?>
- --
~Paul Nicholson
Design Specialist
WebPower Design
"The web....the way you want it!"
paul
webpowerdesign.net
"It said uses Windows 98 or better, so I loaded Linux!" Registered Linux User #183202 using Register Linux System # 81891 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org
iD8DBQE9rgbwDyXNIUN3+UQRAuO3AJ9zntAWZ6RkOC2LHQDSEVlirN1CegCfZatW JGjOasC8q+s56CcF1j9Odok= =49DU -----END PGP SIGNATURE-----
attached mail follows:
Oh.. I had no idea.. I suppose I will be looking that up then ;-)
Thanks for the heads up! -Jason
Paul Nicholson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hey,
> I saw that you fixed this but have you ever thought of using the imap_*
> functions for this? It'd be a lot easier and it does work on pop3 servers.
> ~Paul
>
> On Wednesday 16 October 2002 05:02 pm, Jason Young wrote:
>
>>I'm in the process of writing a very very simple web-based email client,
>>just for my personal use, so I can perm-delete all the spam that comes
>>in through the day on my home account before i get home.
>>
>>
>>On the very first connect, its great.. connects, does a 'uidl' which
>>lists all the mail ID's (the 'else' part of the if statement below)
>>
>>The problem lies where I click the generated link and attempt to read a
>>message, the browser load just hangs (despite the set_time_limit()) and
>>when I cancel it, the server tells me there's another connection active.
>>
>>I have an fputs($pop, "QUIT\r\n); as well as an fclose($pop); ..
>>Shouldn't this be sufficient to make sure the connection is closed
>>before my visit to trying to read a message? Or is that not the problem?
>>
>>I'm thinking its something with the actual ($action == "read") code..
>>but... what would it be?
>>
>>Thanks for all help!
>>-Jason
>>
>>Code----
>>
>><?
>>if (isset($_GET['action']))
>> $action = $_GET['action'];
>>if (isset($_GET['msg']))
>> $msg = $_GET['msg'];
>>
>>$pop = fsockopen("pop.server", 110, $errno, $errstr, 300);
>>
>>fgets($pop,255);
>>
>>fputs($pop,"USER name\r\n");
>>fgets($pop,255);
>>
>>fputs($pop,"PASS word\r\n");
>>$status = fgets($pop,255);
>>
>>if (substr($status, 0, 4) == "-ERR") {
>> echo $status;
>> exit();
>>}
>>
>>if ($action == "read") {
>> set_time_limit(10);
>> $cmd = "top $msg 10";
>> fputs($pop, $cmd);
>> $themsg = fgets($pop);
>> echo $themsg;
>>} else {
>> fputs($pop,"uidl\r\n"); // Get list of messages
>> $list = fgets($pop,255)."<br>";
>> $list = substr($list, 4, strpos($list, " ", 3));
>> for ($i = 1; $i <= $list; $i++) {
>> $curr = fgets($pop);
>> echo "<a href=\"?action=read&msg=".substr($curr, 0, strpos($curr, "
>>"))."\">$curr</a><br>";
>> }
>> echo "<br>$list messages";
>>}
>>
>>fputs($pop,"QUIT\r\n");
>>echo fgets($pop);
>>
>>fclose($pop);
>>?>
>
>
> - --
> ~Paul Nicholson
> Design Specialist
WebPower Design
> "The web....the way you want it!"
> paul
webpowerdesign.net
>
> "It said uses Windows 98 or better, so I loaded Linux!"
> Registered Linux User #183202 using Register Linux System # 81891
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.6 (GNU/Linux)
> Comment: For info see http://www.gnupg.org
>
> iD8DBQE9rgbwDyXNIUN3+UQRAuO3AJ9zntAWZ6RkOC2LHQDSEVlirN1CegCfZatW
> JGjOasC8q+s56CcF1j9Odok=
> =49DU
> -----END PGP SIGNATURE-----
attached mail follows:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Glad I could help...I did something like what you're doing and I used the imap functions. If you're conecting to a Redhat pop3 server you have to add a special param to the connect function...let me know if you need the command and I'll look it up. ~Paul
On Wednesday 16 October 2002 09:55 pm, Jason Young wrote:
> Oh.. I had no idea.. I suppose I will be looking that up then ;-)
>
> Thanks for the heads up!
> -Jason
>
> Paul Nicholson wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > Hey,
> > I saw that you fixed this but have you ever thought of using the imap_*
> > functions for this? It'd be a lot easier and it does work on pop3
> > servers. ~Paul
> >
> > On Wednesday 16 October 2002 05:02 pm, Jason Young wrote:
> >>I'm in the process of writing a very very simple web-based email client,
> >>just for my personal use, so I can perm-delete all the spam that comes
> >>in through the day on my home account before i get home.
> >>
> >>
> >>On the very first connect, its great.. connects, does a 'uidl' which
> >>lists all the mail ID's (the 'else' part of the if statement below)
> >>
> >>The problem lies where I click the generated link and attempt to read a
> >>message, the browser load just hangs (despite the set_time_limit()) and
> >>when I cancel it, the server tells me there's another connection active.
> >>
> >>I have an fputs($pop, "QUIT\r\n); as well as an fclose($pop); ..
> >>Shouldn't this be sufficient to make sure the connection is closed
> >>before my visit to trying to read a message? Or is that not the problem?
> >>
> >>I'm thinking its something with the actual ($action == "read") code..
> >>but... what would it be?
> >>
> >>Thanks for all help!
> >>-Jason
> >>
> >>Code----
> >>
> >><?
> >>if (isset($_GET['action']))
> >> $action = $_GET['action'];
> >>if (isset($_GET['msg']))
> >> $msg = $_GET['msg'];
> >>
> >>$pop = fsockopen("pop.server", 110, $errno, $errstr, 300);
> >>
> >>fgets($pop,255);
> >>
> >>fputs($pop,"USER name\r\n");
> >>fgets($pop,255);
> >>
> >>fputs($pop,"PASS word\r\n");
> >>$status = fgets($pop,255);
> >>
> >>if (substr($status, 0, 4) == "-ERR") {
> >> echo $status;
> >> exit();
> >>}
> >>
> >>if ($action == "read") {
> >> set_time_limit(10);
> >> $cmd = "top $msg 10";
> >> fputs($pop, $cmd);
> >> $themsg = fgets($pop);
> >> echo $themsg;
> >>} else {
> >> fputs($pop,"uidl\r\n"); // Get list of messages
> >> $list = fgets($pop,255)."<br>";
> >> $list = substr($list, 4, strpos($list, " ", 3));
> >> for ($i = 1; $i <= $list; $i++) {
> >> $curr = fgets($pop);
> >> echo "<a href=\"?action=read&msg=".substr($curr, 0, strpos($curr, "
> >>"))."\">$curr</a><br>";
> >> }
> >> echo "<br>$list messages";
> >>}
> >>
> >>fputs($pop,"QUIT\r\n");
> >>echo fgets($pop);
> >>
> >>fclose($pop);
> >>?>
> >
> > - --
> > ~Paul Nicholson
> > Design Specialist
WebPower Design
> > "The web....the way you want it!"
> > paul
webpowerdesign.net
> >
> > "It said uses Windows 98 or better, so I loaded Linux!"
> > Registered Linux User #183202 using Register Linux System # 81891
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.0.6 (GNU/Linux)
> > Comment: For info see http://www.gnupg.org
> >
> > iD8DBQE9rgbwDyXNIUN3+UQRAuO3AJ9zntAWZ6RkOC2LHQDSEVlirN1CegCfZatW
> > JGjOasC8q+s56CcF1j9Odok=
> > =49DU
> > -----END PGP SIGNATURE-----
- --
~Paul Nicholson
Design Specialist
WebPower Design
"The web....the way you want it!"
paul
webpowerdesign.net
"It said uses Windows 98 or better, so I loaded Linux!" Registered Linux User #183202 using Register Linux System # 81891 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org
iD8DBQE9rhzODyXNIUN3+UQRAvAeAKCILeHYDOA5wxUDKQlAiTgmFjNJzACgmzda Rbsm8Jgse4zTQ5f8O/tt91E= =w42i -----END PGP SIGNATURE-----
attached mail follows:
Http authentication is probly not what you would want to use. Especially if you want to program in timeouts, you would be better off using session based login variables. Cookies are even better with an encrypted pasword that has a windows of time that you have to goto other pages to renew.
Why HTTP auth?
Is it mandatory?
I know this hasnt been any help, sorry!
"Davy Obdam" <info
davyobdam.com> wrote in message
news:001901c2747e$fa0184a0$9600000a
davy...
> Hi People,.
>
> I have a problem with HTTP-Authentication, i have 2 users in my
> database, and i want both to be able to login. However it works, but
> only the first user is able to login. I Use a MySQL 3.23.xx database,
> PHP 4.2.3 and Apache 2.0.40. Can anyone help me with this, any help
> would be greatly apreciated. Thanks already;-)Maybe some examples?? ;-)
>
> Best regards,
>
> Davy Obdam,
> mailto:info
davyobdam.com
>
>
>
>
attached mail follows:
Thanks to all who responded to my qry, yes it worked well as per my requirements
regards Manisha
attached mail follows:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hey, Try: - ----------------- foreach ($_SESSION as $k => $v) { if(($k != 'errmsg') && ($k != 'errcount')) { unset($_SESSION[$k]); } } - ----------------- HTH! ~Paul
On Wednesday 16 October 2002 04:04 am, Paonarong Buachaiyo wrote:
> Please, I' also have some question about $_SESSION.
>
> Simple, how can we earse all $SESSION variable except one or two variables.
>
> Beacuse i want to show some error message in my login form when login
> failed. i want to destroy all other $_SESSION variable (about 10) except
> $_SESSION['errmsg'] and $_SESSION['errcount'].
>
> Any way to do it except
>
> unset($_SESSION['xx1']);
> unset($_SESSION['xx2']);
> unset($_SESSION['xx3']);
> .
> unset($_SESSION['xx10']);
>
> Please,
> Pao
>
> "John W. Holmes" <holmes072000
charter.net> wrote in message
> news:000501c274a4$ed28ae40$7c02a8c0
coconut...
>
> > > Hi All,
> > > still trying to update old code. Am I using $_SESSION properly?
> > >
> > > <snip>
> > > if (mysql_num_rows($res) ==1){
> > > /* If correct start session*/
> > > session_start();
> > > $_SESSION['SESSION_UNAME'];
> > > $SESSION_UNAME = $user;
> > >
> > > header("Location: welcome.php");
> > > mysql_free_result ($res);
> > > </snip>
> >
> > Nope. Just use $_SESSION['SESSION_UNAME'] = $user;
> >
> > You can treat $_SESSION just as you would any other array.
> >
> > $_SESSION['something'] = "whatever";
> >
> > etc... Then, on any page with session_start(), you have the whole
> > session array available to you, no matter what page the variable was
> > initially created on.
> >
> > FYI: use unset($_SESSION['SESSION_UNAME']); to erase a session variable.
> >
> > ---John Holmes...
- --
~Paul Nicholson
Design Specialist
WebPower Design
"The web....the way you want it!"
paul
webpowerdesign.net
"It said uses Windows 98 or better, so I loaded Linux!" Registered Linux User #183202 using Register Linux System # 81891 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org
iD8DBQE9rhvkDyXNIUN3+UQRAivwAKCcBNJ1hfZU7WFfGaCythFfPPpZOQCePte1 3xJtk0cmbfr1g6wOQnqOYMk= =jou+ -----END PGP SIGNATURE-----
attached mail follows:
howdy
can some one please tell me why i can't do this
elseif ($_POST['cost'] <=49999 && >=20001){...}
but i can do this
elseif ($_POST['cost'] <=49999 && $_POST['cost'] >=20001){...}
Cheers
Peter "the only dumb question is the one that wasn't asked"
attached mail follows:
Because that's not the way PHP works. You aren't comparing anything on the second half of the elseif statement.
Keith Vance Vance Consulting LLC www.vanceconsulting.net (206) 355-2399
Try U.M.A. at http://uma.sourceforge.net/
On Thu, 17 Oct 2002, Peter Houchin wrote:
> howdy > > can some one please tell me why i can't do this > > elseif ($_POST['cost'] <=49999 && >=20001){...} > > but i can do this > > elseif ($_POST['cost'] <=49999 && $_POST['cost'] >=20001){...} > > > > Cheers > > Peter > "the only dumb question is the one that wasn't asked" > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >
attached mail follows:
Because the first example is not correct syntax?
I wasn't aware that the first element in a comparison could ever be left out, is it that way in other languages?
-----Original Message-----
From: Peter Houchin [mailto:php
vfsa.com.au]
Sent: Thursday, 17 October 2002 2:15 PM
To: php_gen
Subject: [PHP] why can't i do this?
howdy
can some one please tell me why i can't do this
elseif ($_POST['cost'] <=49999 && >=20001){...}
but i can do this
elseif ($_POST['cost'] <=49999 && $_POST['cost'] >=20001){...}
Cheers
Peter "the only dumb question is the one that wasn't asked"
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
ok thanks .... just would have thought it would have known to compare it with out it having to be there first ... as in
if $_POST['cost'] is <=49999 AND >=200001
but i'll live with the fact it doesn't read it like i do :)
Cheers
> -----Original Message-----
> From: Keith Vance [mailto:listman
vanceconsulting.net]
> Sent: Thursday, 17 October 2002 2:12 PM
> To: Peter Houchin
> Cc: php_gen
> Subject: Re: [PHP] why can't i do this?
>
>
> Because that's not the way PHP works. You aren't comparing anything on the
> second half of the elseif statement.
>
> Keith Vance
> Vance Consulting LLC
> www.vanceconsulting.net
> (206) 355-2399
>
> Try U.M.A. at http://uma.sourceforge.net/
>
>
> On Thu, 17 Oct 2002, Peter Houchin wrote:
>
> > howdy
> >
> > can some one please tell me why i can't do this
> >
> > elseif ($_POST['cost'] <=49999 && >=20001){...}
> >
> > but i can do this
> >
> > elseif ($_POST['cost'] <=49999 && $_POST['cost'] >=20001){...}
> >
> >
> >
> > Cheers
> >
> > Peter
> > "the only dumb question is the one that wasn't asked"
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>
>
>
attached mail follows:
opps that should read if $_POST['cost'] is <=49999 AND it is >=200001 then ...
>
> ok thanks .... just would have thought it would have known to compare it
> with out it having to be there first ... as in
>
> if $_POST['cost'] is <=49999 AND >=200001
>
> but i'll live with the fact it doesn't read it like i do :)
>
> Cheers
>
> > -----Original Message-----
> > From: Keith Vance [mailto:listman
vanceconsulting.net]
> > Sent: Thursday, 17 October 2002 2:12 PM
> > To: Peter Houchin
> > Cc: php_gen
> > Subject: Re: [PHP] why can't i do this?
> >
> >
> > Because that's not the way PHP works. You aren't comparing
> anything on the
> > second half of the elseif statement.
> >
> > Keith Vance
> > Vance Consulting LLC
> > www.vanceconsulting.net
> > (206) 355-2399
> >
> > Try U.M.A. at http://uma.sourceforge.net/
> >
> >
> > On Thu, 17 Oct 2002, Peter Houchin wrote:
> >
> > > howdy
> > >
> > > can some one please tell me why i can't do this
> > >
> > > elseif ($_POST['cost'] <=49999 && >=20001){...}
> > >
> > > but i can do this
> > >
> > > elseif ($_POST['cost'] <=49999 && $_POST['cost'] >=20001){...}
> > >
> > >
> > >
> > > Cheers
> > >
> > > Peter
> > > "the only dumb question is the one that wasn't asked"
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > >
> >
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
attached mail follows:
Hi guys and gals. I'm having a problem with setting a cookie on IE 6. I'm running RedHat 7, Apache 1.3.26 and php 4.2.3. The cookie sets fine in all other browsers (IE5, Netscape 4 and up, Opera, Mozilla, etc.) but on IE 6, not even my session cookie sets. I've tried all of these....
setcookie ( "$name", "$cookie_data", $date, "/", "by-tor_v70", 0 ); setcookie ( "$name", "$cookie_data", $date, "/", "by-tor_v70" ); setcookie ( "$name", "$cookie_data", $date, "/" ); setcookie ( "$name", "$cookie_data", $date ); setcookie ( "$name", "$cookie_data" );
I've also replaced $date with time() and time()+3600. $date is set to the standard set forth on Netscape's site.
Any ideas?
thanks, John Nichel
attached mail follows:
Arr.. Microsoft and their attempt to get security and privacy to their clients.. have a look in the ->view -> privacy report... this will give you a starting point...
John Nichel wrote: > Hi guys and gals. I'm having a problem with setting a cookie on IE 6. > I'm running RedHat 7, Apache 1.3.26 and php 4.2.3. The cookie sets fine > in all other browsers (IE5, Netscape 4 and up, Opera, Mozilla, etc.) but > on IE 6, not even my session cookie sets. I've tried all of these.... > > setcookie ( "$name", "$cookie_data", $date, "/", "by-tor_v70", 0 ); > setcookie ( "$name", "$cookie_data", $date, "/", "by-tor_v70" ); > setcookie ( "$name", "$cookie_data", $date, "/" ); > setcookie ( "$name", "$cookie_data", $date ); > setcookie ( "$name", "$cookie_data" ); > > I've also replaced $date with time() and time()+3600. > $date is set to the standard set forth on Netscape's site. > > Any ideas? > > thanks, > John Nichel > >
-- Timothy Hitchens (HiTCHO) Web Application Analyst and Developer e-mail: timhitcho.com.au mobile: 0419 521 440
------------------------------------------------- HiTCHO Group - ABN: 85 816 540 110 Web Site: http://www.hitcho.com.au/ Snail Mail: PO Box 101 Arana Hills QLD 4054 Telephone: 07 3351 0951 - Facsimile: 07 3351 0952
IMPORTANT: This email may be the view of the individual and not that of the organisation. The contents of this electronic mail (including attachments) may be privileged and commercially confidential.
Any unauthorised use of the contents is expressly prohibited. If you have received this document in error, please advise us by telephone immediately and then delete the document.
attached mail follows:
John,
Can you see if this works:
header("Set-Cookie: foo=bar");
If not, then check the configuration for IE6. I seem to recall hearing that cookies are disabled by default for sites that are not P3P compliant? Or, perhaps that was for third-party cookies only. At any rate, I seem to recall some significant change with IE6 in regards to cookies, so maybe you're experiencing that. My example above will give you the simplest test case for setting a cookie.
Good luck, and happy hacking.
Chris
John Nichel wrote:
> Hi guys and gals. I'm having a problem with setting a cookie on IE 6. > I'm running RedHat 7, Apache 1.3.26 and php 4.2.3. The cookie sets > fine in all other browsers (IE5, Netscape 4 and up, Opera, Mozilla, > etc.) but on IE 6, not even my session cookie sets. I've tried all of > these.... > > setcookie ( "$name", "$cookie_data", $date, "/", "by-tor_v70", 0 ); > setcookie ( "$name", "$cookie_data", $date, "/", "by-tor_v70" ); > setcookie ( "$name", "$cookie_data", $date, "/" ); > setcookie ( "$name", "$cookie_data", $date ); > setcookie ( "$name", "$cookie_data" ); > > I've also replaced $date with time() and time()+3600. > $date is set to the standard set forth on Netscape's site.
attached mail follows:
As per my earlier commments about seeing the privacy report this will answer all your questions regarding cookies.. also you can allways telnet to the host eg..
telnet {host} 80 get /{page.html} http/1.0 host: {yourdomain.com.au} {enter} {ctrl d}
You should then see the header information as well that should include your cookie informaiton if not you have even a bigger problem.
Timothy Hitchens (HiTCHO)
tim
hitcho.com.au
Chris Shiflett wrote: > John, > > Can you see if this works: > > header("Set-Cookie: foo=bar"); > > If not, then check the configuration for IE6. I seem to recall hearing > that cookies are disabled by default for sites that are not P3P > compliant? Or, perhaps that was for third-party cookies only. At any > rate, I seem to recall some significant change with IE6 in regards to > cookies, so maybe you're experiencing that. My example above will give > you the simplest test case for setting a cookie. > > Good luck, and happy hacking. > > Chris > > John Nichel wrote: > >> Hi guys and gals. I'm having a problem with setting a cookie on IE 6. >> I'm running RedHat 7, Apache 1.3.26 and php 4.2.3. The cookie sets >> fine in all other browsers (IE5, Netscape 4 and up, Opera, Mozilla, >> etc.) but on IE 6, not even my session cookie sets. I've tried all of >> these.... >> >> setcookie ( "$name", "$cookie_data", $date, "/", "by-tor_v70", 0 ); >> setcookie ( "$name", "$cookie_data", $date, "/", "by-tor_v70" ); >> setcookie ( "$name", "$cookie_data", $date, "/" ); >> setcookie ( "$name", "$cookie_data", $date ); >> setcookie ( "$name", "$cookie_data" ); >> >> I've also replaced $date with time() and time()+3600. >> $date is set to the standard set forth on Netscape's site. > > > >
-- Timothy Hitchens (HiTCHO) Web Application Analyst and Developer e-mail: timhitcho.com.au mobile: 0419 521 440
------------------------------------------------- HiTCHO Group - ABN: 85 816 540 110 Web Site: http://www.hitcho.com.au/ Snail Mail: PO Box 101 Arana Hills QLD 4054 Telephone: 07 3351 0951 - Facsimile: 07 3351 0952
IMPORTANT: This email may be the view of the individual and not that of the organisation. The contents of this electronic mail (including attachments) may be privileged and commercially confidential.
Any unauthorised use of the contents is expressly prohibited. If you have received this document in error, please advise us by telephone immediately and then delete the document.
attached mail follows:
Chris,
Nope, that didn't work either. I set IE6 to accept all cookies, no matter what, but still no go. Has anyone been able to set a cookie in IE6?
Chris Shiflett wrote: > John, > > Can you see if this works: > > header("Set-Cookie: foo=bar"); > > If not, then check the configuration for IE6. I seem to recall hearing > that cookies are disabled by default for sites that are not P3P > compliant? Or, perhaps that was for third-party cookies only. At any > rate, I seem to recall some significant change with IE6 in regards to > cookies, so maybe you're experiencing that. My example above will give > you the simplest test case for setting a cookie. > > Good luck, and happy hacking. > > Chris > > John Nichel wrote: > >> Hi guys and gals. I'm having a problem with setting a cookie on IE 6. >> I'm running RedHat 7, Apache 1.3.26 and php 4.2.3. The cookie sets >> fine in all other browsers (IE5, Netscape 4 and up, Opera, Mozilla, >> etc.) but on IE 6, not even my session cookie sets. I've tried all of >> these.... >> >> setcookie ( "$name", "$cookie_data", $date, "/", "by-tor_v70", 0 ); >> setcookie ( "$name", "$cookie_data", $date, "/", "by-tor_v70" ); >> setcookie ( "$name", "$cookie_data", $date, "/" ); >> setcookie ( "$name", "$cookie_data", $date ); >> setcookie ( "$name", "$cookie_data" ); >> >> I've also replaced $date with time() and time()+3600. >> $date is set to the standard set forth on Netscape's site. > > > >
attached mail follows:
Timothy,
The headers are coming across fine. I looked in the privacy report, and told IE to accept all cookies from my domain, but it still isn't registering them. If it wasn't for the fact that I've had over 100,000 page views by IE6 this month, I wouldn't give it a second glance. Catering to MS products is really getting old. :)
Timothy Hitchens wrote:
> As per my earlier commments about seeing the privacy report this will
> answer all your questions regarding cookies.. also you can allways
> telnet to the host eg..
>
> telnet {host} 80
> get /{page.html} http/1.0
> host: {yourdomain.com.au}
> {enter}
> {ctrl d}
>
> You should then see the header information as well that should include
> your cookie informaiton if not you have even a bigger problem.
>
>
> Timothy Hitchens (HiTCHO)
> tim
hitcho.com.au
>
>
>
> Chris Shiflett wrote:
>
>> John,
>>
>> Can you see if this works:
>>
>> header("Set-Cookie: foo=bar");
>>
>> If not, then check the configuration for IE6. I seem to recall hearing
>> that cookies are disabled by default for sites that are not P3P
>> compliant? Or, perhaps that was for third-party cookies only. At any
>> rate, I seem to recall some significant change with IE6 in regards to
>> cookies, so maybe you're experiencing that. My example above will give
>> you the simplest test case for setting a cookie.
>>
>> Good luck, and happy hacking.
>>
>> Chris
>>
>> John Nichel wrote:
>>
>>> Hi guys and gals. I'm having a problem with setting a cookie on IE
>>> 6. I'm running RedHat 7, Apache 1.3.26 and php 4.2.3. The cookie
>>> sets fine in all other browsers (IE5, Netscape 4 and up, Opera,
>>> Mozilla, etc.) but on IE 6, not even my session cookie sets. I've
>>> tried all of these....
>>>
>>> setcookie ( "$name", "$cookie_data", $date, "/", "by-tor_v70", 0 );
>>> setcookie ( "$name", "$cookie_data", $date, "/", "by-tor_v70" );
>>> setcookie ( "$name", "$cookie_data", $date, "/" );
>>> setcookie ( "$name", "$cookie_data", $date );
>>> setcookie ( "$name", "$cookie_data" );
>>>
>>> I've also replaced $date with time() and time()+3600.
>>> $date is set to the standard set forth on Netscape's site.
>>
>>
>>
>>
>>
>
attached mail follows:
It seems that the problem is with IE, and characters in the domain name. This is a beta site (of one of my existing sites), and I have the virtual host name set as "by-tor_v70". I tried setting the cookie on another virtual host running on the same box, and it worked. So, I removed the underscore from the name, and the cookie worked fine. Live and learn, eh? IE6 != underscores. Thanks for the help guys.
Timothy Hitchens wrote:
> This will work for you I use this for tracking activity and is set to last
> for 3 months.
>
>
> setcookie("cookieName", $value, mktime() + 7725000,'/',
> '.yourdomain.com.au',0);
>
>
>
>
> Timothy Hitchens (HiTCHO)
> tim
hitcho.com.au
>
>
>
>
> John Nichel wrote:
>
>> Timothy,
>>
>> The headers are coming across fine. I looked in the privacy report,
>> and told IE to accept all cookies from my domain, but it still isn't
>> registering them. If it wasn't for the fact that I've had over 100,000
>> page views by IE6 this month, I wouldn't give it a second glance.
>> Catering to MS products is really getting old. :)
>>
>> Timothy Hitchens wrote:
>>
>>> As per my earlier commments about seeing the privacy report this will
>>> answer all your questions regarding cookies.. also you can allways
>>> telnet to the host eg..
>>>
>>> telnet {host} 80
>>> get /{page.html} http/1.0
>>> host: {yourdomain.com.au}
>>> {enter}
>>> {ctrl d}
>>>
>>> You should then see the header information as well that should
>>> include your cookie informaiton if not you have even a bigger problem.
>>>
>>>
>>> Timothy Hitchens (HiTCHO)
>>> tim
hitcho.com.au
>>>
>>>
>>>
>>> Chris Shiflett wrote:
>>>
>>>> John,
>>>>
>>>> Can you see if this works:
>>>>
>>>> header("Set-Cookie: foo=bar");
>>>>
>>>> If not, then check the configuration for IE6. I seem to recall
>>>> hearing that cookies are disabled by default for sites that are not
>>>> P3P compliant? Or, perhaps that was for third-party cookies only. At
>>>> any rate, I seem to recall some significant change with IE6 in
>>>> regards to cookies, so maybe you're experiencing that. My example
>>>> above will give you the simplest test case for setting a cookie.
>>>>
>>>> Good luck, and happy hacking.
>>>>
>>>> Chris
>>>>
>>>> John Nichel wrote:
>>>>
>>>>> Hi guys and gals. I'm having a problem with setting a cookie on IE
>>>>> 6. I'm running RedHat 7, Apache 1.3.26 and php 4.2.3. The cookie
>>>>> sets fine in all other browsers (IE5, Netscape 4 and up, Opera,
>>>>> Mozilla, etc.) but on IE 6, not even my session cookie sets. I've
>>>>> tried all of these....
>>>>>
>>>>> setcookie ( "$name", "$cookie_data", $date, "/", "by-tor_v70", 0 );
>>>>> setcookie ( "$name", "$cookie_data", $date, "/", "by-tor_v70" );
>>>>> setcookie ( "$name", "$cookie_data", $date, "/" );
>>>>> setcookie ( "$name", "$cookie_data", $date );
>>>>> setcookie ( "$name", "$cookie_data" );
>>>>>
>>>>> I've also replaced $date with time() and time()+3600.
>>>>> $date is set to the standard set forth on Netscape's site.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>>
>
attached mail follows:
My logging application is feeding a MySQL database with data records that are time stamped with GMT time. I would like to query the database for records matching local time(eg. all records created on oct 17,2002 local time). I would prefer if the records could be formated in local time when returned from MySQL. What is the best way to do this.
Jason
attached mail follows:
Try something like:
<?php echo oMySQLTimeStamp( $GetCustHistInfo->Fields("AccountActivationDate"), 'l, F jS Y H:i:s') ?>
THIS E-MAIL MESSAGE AND ALL ATTACHMENTS TRANSMITTED HEREWITH ARE TRADE SECRET AND/OR CONFIDENTIAL INFORMATION INTENDED ONLY FOR THE VIEWING AND USE OF ADDRESSEE. IF THE READER OF THIS MESSAGE IS NOT THE INTENDED RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY REVIEW, USE, COMMUNICATION, DISSEMINATION, DISTRIBUTION OR COPYING OF THIS COMMUNICATION IS PROHIBITED. IF YOU HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE NOTIFY THE SENDER IMMEDIATELY BY TELEPHONE OR ELECTRONIC MAIL, AND DELETE THIS MESSAGE AND ALL COPIES AND BACKUPS THEREOF. THANK YOU FOR YOUR COOPERATION.
-----Original Message-----
From: Jason <jason
frontiertech.ca>
To: php_gen <php-general
lists.php.net>
Date: Thursday, October 17, 2002 12:26 AM
Subject: [PHP] MySQL GMT --> Local time
> >My logging application is feeding a MySQL database with data records >that are time stamped with GMT time. I would like to query the database >for records matching local time(eg. all records created on oct >17,2002 local time). I would prefer if the records could be formated >in local time when returned from MySQL. What is the best way to do this. > >Jason > > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > > >
attached mail follows:
Local to the client or local to the server?
-----Original Message-----
From: Jason [mailto:jason
frontiertech.ca]
Sent: Thursday, 17 October 2002 3:26 PM
To: php_gen
Subject: [PHP] MySQL GMT --> Local time
My logging application is feeding a MySQL database with data records that are time stamped with GMT time. I would like to query the database for records matching local time(eg. all records created on oct 17,2002 local time). I would prefer if the records could be formated in local time when returned from MySQL. What is the best way to do this.
Jason
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
To the server.
On Thu, 17 Oct 2002, Smith, Benjamin wrote:
> Local to the client or local to the server?
>
> -----Original Message-----
> From: Jason [mailto:jason
frontiertech.ca]
> Sent: Thursday, 17 October 2002 3:26 PM
> To: php_gen
> Subject: [PHP] MySQL GMT --> Local time
>
>
>
> My logging application is feeding a MySQL database with data records
> that are time stamped with GMT time. I would like to query the database
> for records matching local time(eg. all records created on oct
> 17,2002 local time). I would prefer if the records could be formated
> in local time when returned from MySQL. What is the best way to do this.
>
> Jason
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
> My logging application is feeding a MySQL database with data records > that are time stamped with GMT time. I would like to query the database > for records matching local time(eg. all records created on oct > 17,2002 local time). I would prefer if the records could be formated > in local time when returned from MySQL. What is the best way to do this.
I don't know if there is an automatic way to do it, but if you know you are 5 hours ahead of GMT for example, and you want all records for Oct 17, 2002 GMT+5, then you could do this:
SELECT * FROM your_table WHERE TO_DAYS(datetime_column + INTERVAL 5 HOUR) = TO_DAYS(20021017)
You can use DATE_FORMAT() in your query to reformat the MySQL timestamp, or use UNIX_TIMESTAMP() to retrieve a unix timestamp instead and format it in PHP. With the above query, the "5" and actual date "20021017" can be PHP variables, to make it more flexible.
---John Holmes...
attached mail follows:
how to install apache with xml ?
attached mail follows:
You can use this function : get_object_vars to retreive vars from a class..
Here is the example from phpdoc :
<?php
class Point2D {
var $x, $y;
var $name;
function Point2D($x, $y) {
$this->x = $x;
$this->y = $y;
}
function setName($name) {
$this->name = $name;
}
function ReadPoint() {
return array("x" -> $this->x,
"y" -> $this->y,
"name" -> $this->name);
}
}
$p1 = new Point2D(1.233, 3.445);
print_r(get_object_vars($p1));
// "$nom" is declard but undefined
// Array
// (
// [x] -> 1.233
// [y] -> 3.445
// )
$p1->setName("point #1");
print_r(get_object_vars($p1));
// Array
// (
// [x] -> 1.233
// [y] -> 3.445
// [name] -> point #1
// )
?>"Christophe Barbe" <christophe.barbe
ufies.org> a écrit dans le message de
news: 20021016202143.GA5600
cattlegrid.net...
> I guess the answer is obvious but can't find it in the manual.
>
> Is it possible to have a variable in a class that is shared by all
> instances. I thought 'static' would do it but apparently not.
>
> Christophe
>
> --
> Christophe Barbé <christophe.barbe
ufies.org>
> GnuPG FingerPrint: E0F6 FADF 2A5C F072 6AF8 F67A 8F45 2F1E D72C B41E
>
> Dogs believe they are human. Cats believe they are God.
attached mail follows:
Max Buvry wrote: > My script php follows this steps : > > ignore_user_abort(0|1) > Compute the key -> v > BEGIN WORK > UPDATE the first bank account with v (credit) > sleep(300)
Make sure you have long enough timeout limit.
> UPDATE the second bank account with v+1 (debit) > COMMIT WORK
It works for me. (at least with CVS version)
If there is uncommitted transaction, pgsql module rollback automatically.
BTW, if you have too long timeout limit, your site became weaker for DoS attack.
-- Yasuo Ohgaki
attached mail follows:
Hi all. Wondering if anyone can shed some light!
I have a problem whereby I need to define the weight of a selection of items in a shopping cart in order to calculate a shipping cost. Basically I have 5 products (at the moment) which are of set weights. What I want to do is add up the amount of items in the cart and multiply by weight then determine what the shipping weight is. Once that is determined I can calculate the shipping cost. My problem is arrays. I dunno what I'm doing with them! I can return the weight of one item and multiply that by the amount of items in the cart but need to figure out how do then do it again for any more items and add them to the first calculation. Here is my code:
function calculate_weight($items)
{
global $weight;
$conn = db_connect();
$query = "select weight from products
where catid = $catid";
$result =
mysql_query($query);
$weight = ($result*$items);
return $weight;
}
Where $items is the number of items in the cart. $catid is the category the products are in but maybe I need to use a different identifier. I have another identifier called $itemCode which defines the actual item which would probably be more reasonable?
Thoughts? Regards,
Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
stephen.jackson
violasystems.com
Mobile +358 50 343 5159
attached mail follows:
On Thursday 17 October 2002 14:34, Steve Jackson wrote:
> Hi all.
> Wondering if anyone can shed some light!
>
> I have a problem whereby I need to define the weight of a selection of
> items in a shopping cart in order to calculate a shipping cost.
> Basically I have 5 products (at the moment) which are of set weights.
> What I want to do is add up the amount of items in the cart and multiply
> by weight then determine what the shipping weight is. Once that is
> determined I can calculate the shipping cost. My problem is arrays. I
> dunno what I'm doing with them! I can return the weight of one item and
> multiply that by the amount of items in the cart but need to figure out
> how do then do it again for any more items and add them to the first
> calculation. Here is my code:
>
> function calculate_weight($items)
> {
> global $weight;
> $conn = db_connect();
> $query = "select weight from products
> where catid = $catid";
> $result =
mysql_query($query);
> $weight = ($result*$items);
> return $weight;
> }
>
> Where $items is the number of items in the cart. $catid is the category
> the products are in but maybe I need to use a different identifier. I
> have another identifier called $itemCode which defines the actual item
> which would probably be more reasonable?
Your code as it stands does not do anything meaningful.
1) mysql_query() returns a resource_id -- which you assigned to $result.
2) You need to pass $result into one of these functions to actually get the data resulting from your query -- mysql_fetch_row(), mysql_fetch_array(), mysql_fetch_object(), mysql_result().
Try to get this part working then post your question again!
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* Absence makes the heart grow fonder. -- Sextus Aurelius */
attached mail follows:
Thanks. I have just this minute got it working. Basically the same function I used for determining price of the cart items could be used for determining weight. All I needed to do was assign my DB with a field called weight and call that instead of price from the DB so my calculate weight function looks like this.
function calculate_weight($cart) { // sum total weight for all items in shopping cart global $weight; $weight = 0.0; if(is_array($cart)) { $conn = db_connect(); foreach($cart as $ItemCode => $qty) { $query = "select weight from products where ItemCode='$ItemCode'"; $result = mysql_query($query); if ($result) { $item_weight = mysql_result($result, 0, "weight"); $weight +=$item_weight*$qty; } } } return $weight; }
By making $weight a global variable I then call that in my shipping function and set it's parameters:
function calculate_shipping_cost($weight) { //shipping costs calc. less than 10KG is 15 more than 10KG currently 20. global $shipping; if ($weight <= "10000") $shipping = "15"; else $shipping = "20"; return $shipping;
}
I still don't fully understand why this works but am happy it does!
attached mail follows:
On Thursday 17 October 2002 15:52, Steve Jackson wrote: > Thanks. > I have just this minute got it working. > Basically the same function I used for determining price of the cart > items could be used for determining weight. All I needed to do was > assign my DB with a field called weight and call that instead of price > from the DB so my calculate weight function looks like this. > > function calculate_weight($cart) > { > // sum total weight for all items in shopping cart > global $weight; > $weight = 0.0; > if(is_array($cart)) > { > $conn = db_connect(); > foreach($cart as $ItemCode => $qty) > { > $query = "select weight from products where ItemCode='$ItemCode'"; > $result = mysql_query($query); > if ($result) > { > $item_weight = mysql_result($result, 0, "weight"); > $weight +=$item_weight*$qty; > } > } > } > return $weight;
See below
> } > > By making $weight a global variable I then call that in my shipping > function and set it's parameters:
By making $weight a global variable there is no need for "return $weight;" inside your function. And same for "return $shipping;" below.
> function calculate_shipping_cost($weight) > { > //shipping costs calc. less than 10KG is 15 more than 10KG currently > 20. > > global $shipping; > if ($weight <= "10000") > $shipping = "15"; > else > $shipping = "20"; > return $shipping; > > } > > I still don't fully understand why this works but am happy it does!
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* The solution of problems is the most characteristic and peculiar sort of voluntary thinking. -- William James */
attached mail follows:
I'm using both variables called in another page. Taking globals off causes weight not to be calculated in the shipping cost?
Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
stephen.jackson
violasystems.com
Mobile +358 50 343 5159
> -----Original Message-----
> From: Jason Wong [mailto:php-general
gremlins.com.hk]
> Sent: 17. lokakuuta 2002 12:39
> To: php-general
lists.php.net
> Subject: Re: [PHP] Weight function.
>
>
> On Thursday 17 October 2002 15:52, Steve Jackson wrote:
> > Thanks.
> > I have just this minute got it working.
> > Basically the same function I used for determining price of
> the cart
> > items could be used for determining weight. All I needed to do was
> > assign my DB with a field called weight and call that
> instead of price
> > from the DB so my calculate weight function looks like this.
> >
> > function calculate_weight($cart)
> > {
> > // sum total weight for all items in shopping cart
> > global $weight;
> > $weight = 0.0;
> > if(is_array($cart))
> > {
> > $conn = db_connect();
> > foreach($cart as $ItemCode => $qty)
> > {
> > $query = "select weight from products where
> ItemCode='$ItemCode'";
> > $result = mysql_query($query);
> > if ($result)
> > {
> > $item_weight = mysql_result($result, 0, "weight");
> > $weight +=$item_weight*$qty;
> > }
> > }
> > }
> > return $weight;
>
> See below
>
> > }
> >
> > By making $weight a global variable I then call that in my shipping
> > function and set it's parameters:
>
> By making $weight a global variable there is no need for
> "return $weight;"
> inside your function. And same for "return $shipping;" below.
>
>
> > function calculate_shipping_cost($weight)
> > {
> > //shipping costs calc. less than 10KG is 15 more than
> 10KG currently
> > 20.
> >
> > global $shipping;
> > if ($weight <= "10000")
> > $shipping = "15";
> > else
> > $shipping = "20";
> > return $shipping;
> >
> > }
> >
> > I still don't fully understand why this works but am happy it does!
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications
> Development *
>
> /*
> The solution of problems is the most characteristic and
> peculiar sort of voluntary thinking.
> -- William James
> */
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Hi I need to be able to see logs of all mysql queries from php scripts on my server. I have a multitude of virtual hosts on my RedHat server, with many mysql db's, and would like to be able to see what queries are done against the db's from which scripts. The reason being is that I suspect that some of the scripts on some domains are causing problems, for example infinite loop db queries etc. Yesterday again I had mysql freeze up completely on the server, and the only "interaction" with mysql are from php scripts on the various domains, so looking at the mysql.log file gives no help.
Ideally I would like to see something like the following logged:
time || path/to/script.php || sql_query || mysql_error
or ANYthing that will help me to determine what went wrong. At the moment I can merely blame the gremlins, and I don't know if it is a poorly written script causing this or not, so I can't do anything about the situation... ANY suggestions or methods being used by ppl out there are also welcome.
Thanks alot.
attached mail follows:
In article <1034836283.1253.23.camel
dell>, internet
vsa.co.za says...
> Hi
> I need to be able to see logs of all mysql queries from php scripts on
> my server.
> I have a multitude of virtual hosts on my RedHat server, with many mysql
> db's, and would like to be able to see what queries are done against the
> db's from which scripts. The reason being is that I suspect that some of
> the scripts on some domains are causing problems, for example infinite
> loop db queries etc. Yesterday again I had mysql freeze up completely on
> the server, and the only "interaction" with mysql are from php scripts
> on the various domains, so looking at the mysql.log file gives no help.
>
> Ideally I would like to see something like the following logged:
>
> time || path/to/script.php || sql_query || mysql_error
>
> or ANYthing that will help me to determine what went wrong.
> At the moment I can merely blame the gremlins, and I don't know if it is
> a poorly written script causing this or not, so I can't do anything
> about the situation...
> ANY suggestions or methods being used by ppl out there are also welcome.
>
> Thanks alot.
Mysql has its own logging procedure - search the mysql site for any of the following topics:
The MySQL Log Files
MySQL has several different log files that can help you find out what's going on inside mysqld:
Log file Description The error log Problems encountering starting, running or stopping mysqld. The isam log Logs all changes to the ISAM tables. Used only for debugging the isam code. The query log Established connections and executed queries. The update log Deprecated: Stores all statements that changes data The binary log Stores all statements that changes something. Used also for replication The slow log Stores all queries that took more than long_query_time to execute or didn't use indexes. All logs can be found in the mysqld data directory. You can force mysqld to reopen the log files (or in some cases switch to a new log) by executing FLUSH LOGS. See FLUSH.
Error log The Error Log Query log The General Query Log Update log The Update Log Binary log The Binary Update Log Slow query log The Slow Query Log Log file maintenance Log File Maintenance
Sorry about the crappy copy/paste, but that's what comes out of the .hlp file.
-- David Robley Temporary Kiwi!Quod subigo farinam
attached mail follows:
Baroiller Pierre-Emmanuel schrieb
> Does anyone know how to by-pass this ( with java or other tools )?????
FTP?
greetings Robert
-- Die deutsche Sprache sollte sanft und ehrfurchtsvoll zu den toten Sprachen abgelegt werden, denn nur die Toten haben die Zeit, diese Sprache zu lernen. (Mark Twain, amerikan. Schriftsteller, 1835-1910)
attached mail follows:
I had the same thing just two days ago. This is what happend:
I have some code using include files in this way:
1 <?php 2 3 // some php code 4 include("xlib.inc"); 5 // some php code 6 7 ?>
The include file looks like
1 <?php 2 // some code 3 ?>
The problem was in line 3 of the include file. If there is a line feed behind ?> , the code does not work -> gives a blank page just like yours. Removing that linefeed solved my problem.
I did not yet figure out why this happend. It has someting to do with html headers being send. The line feed behind ?> is considered HTML output, so headers are send at that point. Somehow the rest of the PHP-code gets lost.
Anyway... with a little luck this could be of any help to you.
Good luck
René
Angel Gabriel wrote:
>... I've got PHP working, on my server, I know this because I used that
>small PHP script that shows all the variables, and that worked fine. The
>problem seems to be that every other script shows me a blank pages. I'm
>using redhat 7.3, and I installed PHP, MySQL and Apache from RPM's and they
>are all up2date - I have no idea what I could have missed. Has anyone else
>encountered a similar problem, and if so, how did you remedy it? I have
>followed the install instructions to the letter, and I can't seem to find
>what the problem is. Any suggestions, hints or tips, greatfully recieved!
>Thanks in advance.
>
>***
>Not everyone is touched by an Angel......and those that are, never forget
>the experience.
>***
>If you want guest list for bare club
>nights.....http://raw-talent.hopto.org/mailman/clubnights
>***
>Can you sing, dance, MC, DJ, do you have talent?Send an email to
>sign-me
raw-talent.hopto.org
>***
>
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.404 / Virus Database: 228 - Release Date: 10/15/2002
>
>
>
>
>
attached mail follows:
> Hi guys,
> Does anybody have a working example of doing the lists of 'People who > searched this also searched this!' that I see on Amazon and other > websites.
That is a very complex problem. It is not for PHP. PHP may only insert queries and get results and another system computers all data. Such system is based on statistic or artificial neuron nets. For example the company "Net Perceptions" makes such systems as NetP based on statistic but they are not very fast. If you would like to buy their system you would have to sell some good cars.
-- Krzysztof Dziekiewicz
attached mail follows:
> Is the time set properly on your machine? Double check both the time AND > the timezone. I went nuts trying to fix a similar problem once just to > find out that someone had changed the timezone on the PC for a test and > then forgot to put it back.
It is very easy to check. Set $expires = 0; It makes a session cookie independed from time set. If you set a session cookie you will know you have problem with time set.
attached mail follows:
Hi!
I understand that it's easily possible to parse xml documents with php. But what about changing them? With other xml parsers, I have the xml document in a structure (usually a tree or an array) and when I change something in the structure I can later "write out" the structure again into a xml file and get a changed xml file that way. Is this possible easily with PHP too?
Thanks Mike
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.394 / Virus Database: 224 - Release Date: 03.10.2002
attached mail follows:
Change xml into a different type of xml sounds like a job for the xslt functions. Works like a charm
Michael Ransburg wrote:
>Hi! > >I understand that it's easily possible to parse xml documents with php. >But what about changing them? With other xml parsers, I have the xml >document in a structure (usually a tree or an array) and when I change >something in the structure I can later "write out" the structure again >into a xml file and get a changed xml file that way. Is this possible >easily with PHP too? > >Thanks >Mike > >--- >Outgoing mail is certified Virus Free. >Checked by AVG anti-virus system (http://www.grisoft.com). >Version: 6.0.394 / Virus Database: 224 - Release Date: 03.10.2002 > > > >
attached mail follows:
As part of my new site I have created a php-driven guestbook. The guestbook entries are stored in a file called guestbook.txt.
I found that in order to get the script to write to the file, I had to set the directory permissions for the guestbook directory and the guestbook.txt file to -rw-rw-rw- ... is that a bad thing to do? Does it expose me to any hacking problems? If so, what should I have done?
Bear in mind I'm using a 3rd-party host and I work in Windows, so please don't blind me with science ;)
Thanks, Gwydion
attached mail follows:
Yes it does expose you, and you can't do much about it, unless your provider has taken some precausions (like safe mode), which it should
Gwydion Elderwyn wrote:
>As part of my new site I have created a php-driven guestbook. The guestbook >entries are stored in a file called guestbook.txt. > >I found that in order to get the script to write to the file, I had to set >the directory permissions for the guestbook directory and the guestbook.txt >file to -rw-rw-rw- ... is that a bad thing to do? Does it expose me to >any hacking problems? If so, what should I have done? > >Bear in mind I'm using a 3rd-party host and I work in Windows, so please >don't blind me with science ;) > >Thanks, >Gwydion > > > > >
attached mail follows:
What is a good service to process credit card numbers for an E-Commerce site?
To be specific I mean an easy interface with a PHP based system (maybe even sample code) eg works well with curl... and second any personal recommendations...
-- JJ Harrison lizner2002yahoo.com.au
attached mail follows:
Hi JJ,
> What is a good service to process credit card numbers > for an E-Commerce site?
I have a client using http://worldpay.com/, but it might be a bit basic for your needs. You hand your customers off to them, they take care of the secure servers, cc validation, payment collection etc etc, and then pass them back to you.
We've had no problems with it so far, but I'm not sure if it's exactly what you're after.
Cheers Jon
attached mail follows:
Hi! Im new to PHP programming and need some help, I want to put an event calendar on my site... Functions I would like: Customizeable, so i can make it fit my design
Calendar view: A small month view on the side with clickabel days to view the event for that day.
Event view: Date, time, event
Admin site with login: Add events
I would like this to run with a mySql database.
Is there anyone her who happens to have a script like this?? Anyone wants to make it?? Or anyone got a link for one that maches my request??
Please help...
Joran Sorbo :: Norway
attached mail follows:
Hi Joran,
> Im new to PHP programming and need some help, > I want to put an event calendar on my site... [snip] > anyone got a link for one that maches my request??
If you can't find something at http://sourceforge.net/ that at least gets you pointed in the right direction, I will print out all the code I've written this week and eat it.
The first promising one that turned up on my extremely cursory search was http://sourceforge.net/projects/webcalendar/
You could also investigate the results from http://google.com/search?q=php+calendar
Cheers Jon
attached mail follows:
Hi,
I need a function to get a string in between two other strings. So you would give the function the string to search and then you pass the first string and last string, and the function will return the string in between.
Does anyone have this, or know how to do it. I tried but could not get it to work.
Thanks for your help
Cameron Cooke Toucan Resolve Ltd.
attached mail follows:
"Cameron Cooke" <cameron
toucanresolve.co.uk> wrote in message
news:20021017110141.26610.qmail
pb1.pair.com...
> Hi,
>
> I need a function to get a string in between two other strings. So you
would
> give the function the string to search and then you pass the first string
> and last string, and the function will return the string in between.
>
> Does anyone have this, or know how to do it. I tried but could not get it
to
> work.
will substr() - http://au.php.net/manual/en/function.substr.php suit your needs?
if not check out:
http://au.php.net/manual/en/ref.regex.php
and
http://au.php.net/manual/en/ref.pcre.php
attached mail follows:
I have looked at these, and they make no sense to me. I tried the substr function, but it all went a bit pear shaped.
Cameron
"Noodle Snacks" <webmaster
tececo.com> wrote in message
news:20021017112721.37399.qmail
pb1.pair.com...
>
> "Cameron Cooke" <cameron
toucanresolve.co.uk> wrote in message
> news:20021017110141.26610.qmail
pb1.pair.com...
> > Hi,
> >
> > I need a function to get a string in between two other strings. So you
> would
> > give the function the string to search and then you pass the first
string
> > and last string, and the function will return the string in between.
> >
> > Does anyone have this, or know how to do it. I tried but could not get
it
> to
> > work.
>
> will substr() - http://au.php.net/manual/en/function.substr.php suit your
> needs?
>
> if not check out:
>
> http://au.php.net/manual/en/ref.regex.php
>
> and
>
> http://au.php.net/manual/en/ref.pcre.php
>
>
attached mail follows:
On Thu, 17 Oct 2002, Cameron Cooke wrote:
>-I have looked at these, and they make no sense to me. I tried the substr >-function, but it all went a bit pear shaped.
Try something like this, you can deal with the linewraps ;)
Reference: http://au.php.net/manual/en/function.strpos.php http://au.php.net/manual/en/function.substr.php http://au.php.net/manual/en/function.strlen.php
<?
$haystackText = "Oh yeah, this is The text before, during, and The text after";
$firstString = "The text before";
$secondString = "The text after";
$positionFirstString = strpos($haystackText, $firstString); print("<p>First Position = $positionFirstString</p>");
$positionSecondString = strpos($haystackText, $secondString); print("<p>Second Position = $positionSecondString</p>");
if ( $positionFirstString < $positionSecondString ) { $firstLength = strlen($firstString); $diffBetweenStringPositions = $positionSecondString - $positionFirstString - $firstLength; $resultText = substr($haystackText,$positionFirstString+$firstLength,$diffBetweenStringPositions); } else { $secondLength = strlen($secondString); $diffBetweenStringPositions = $positionFirstString - $positionSecondString - $secondLength; $resultText = substr($haystackText,$positionSecondString+$secondLength,$diffBetweenStringPositions); }
print("<p>$haystackText<br>$resultText</p>");
?>
>-
>-Cameron
>-
>-
>-"Noodle Snacks" <webmaster
tececo.com> wrote in message
>-news:20021017112721.37399.qmail
pb1.pair.com...
>->
>-> "Cameron Cooke" <cameron
toucanresolve.co.uk> wrote in message
>-> news:20021017110141.26610.qmail
pb1.pair.com...
>-> > Hi,
>-> >
>-> > I need a function to get a string in between two other strings. So you
>-> would
>-> > give the function the string to search and then you pass the first
>-string
>-> > and last string, and the function will return the string in between.
>-> >
>-> > Does anyone have this, or know how to do it. I tried but could not get
>-it
>-> to
>-> > work.
>->
>-> will substr() - http://au.php.net/manual/en/function.substr.php suit your
>-> needs?
>->
>-> if not check out:
>->
>-> http://au.php.net/manual/en/ref.regex.php
>->
>-> and
>->
>-> http://au.php.net/manual/en/ref.pcre.php
>->
>->
>-
>-
>-
>---
>-PHP General Mailing List (http://www.php.net/)
>-To unsubscribe, visit: http://www.php.net/unsub.php
>-
**************************************
John Huggins VANet
jhuggins
va.net
http://www.va.net/
**************************************
attached mail follows:
Hi,
I am working on a project which has plenty Gigabytes of data. I heard something about firebird. Is it much better than mysql? Can anybody compare the odds of both of them? Is it easy to use firebird from php? Thanx...
attached mail follows:
thanks a lot for this answer, it was really helpful. unfortunately the problem is not solved entirely: if the browser back-button is hit, the actions are not executed twice, but still the old data is displayed. what I did: I put my code in tow seperat files: 1: display the file and refert to the second file, if submitted 2: do delete, do new. here the checksum is evaluted, so these actions are only executed if they have not been executed before. works fine. thanks. BUT if the browser back-button is used, the browser jumps back to the the (old) #1 files with their contents to this time, meaning you dont see the actual contents, but older ones. moreover, if now any action is called, it is not executed, instead the #2 refers directly back to #1 (as checksums are not identical) and displays again. this time the actual content. although no errors can happen anymore, I find this a little confusing for the user. what can be done to either force the #1 to be executed again on browser back or show some "expired" message?
thanks in advance marcel
"Jonathan Sharp" <js-lists
sharpmedia.net> schrieb im Newsbeitrag
news:3DADB109.2060105
sharpmedia.net...
> Take an md5 of the entire file contents and store that in your form that
> get's displayed. Then test if it matches the file when you go to make
> the changes. Every time you change the file the md5 will change. See
> below...
>
> -js
>
> Sample script:
> <?
> $file = file('/your/text/file.txt');
>
> if ( $_POST['doSomething'] )
> {
> // Make sure it's the same file:
> if ( md5( implode('', $theFile) ) = $_POST['checksum'] )
> {
> // Code to change the file (add/delete etc)
> }
> else
> {
> echo "File has been changed, aborting modifications.";
> }
> }
> else
> {
> // Just show the file
> ?>
> <form...>
> <input type="hidden" name="checksum" value="<?=md5( implode('',
> $theFile))?>">
> <input type="submit" name="doSomething" value="Do something">
> </form>
> <?
> }
> ?>
>
> marcel wrote:
> > hi there
> > I am kind of a newbie to php
> > so probably I am doing it all the wrong way - if - please tell me
> >
> > ok heres my problem:
> > the script:
> > I have a user-group-administration script (php4), that loads data from
> > a textfile and then eables the admin to delete or create new
user-passwords.
> > the script retreives the text data from the text-file and displays the
> > entrys.
> > to every entry there is a delete-button, that sends the number of the
entry.
> > and there are formfields and a new-button that sends the new data.
> > the script that is called is the same script as the one that does the
> > displaying,
> > e.g. depending on the sent variables the script delets or creates an
entry
> > then displays the new data.
> >
> > the problem:
> > if someone uses the back-button of his browser, the data is transferred
> > again ( at
> > the moment I do it with POST out of the form), and the actions are
executed
> > again.
> > e.g. when the user created a new entry, verytime he hits the back-button
> > will create
> > a new - similar - entry.
> >
> > How can I prevent this?
> > I saw several forms, that displayed this: "form is expired" thing, if
you
> > used the back-button (?).
> >
> >
> > thanks a lot
> > marcel
> >
> >
> >
>
>
>
attached mail follows:
Hi ,
I know that php allows uploading , but does it support downloading.
I want users to be able to download from my site , how do i go to work.
Please send me sample of code if possible.
Thanks Shaun
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]