|
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 18 Sep 2003 04:39:13 -0000 Issue 2303
php-general-digest-help
lists.php.net
Date: Wed Sep 17 2003 - 23:39:13 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 18 Sep 2003 04:39:13 -0000 Issue 2303
Topics (messages 162879 through 162950):
Re: PHP Worldwide Stats
162879 by: Jason Wong
162883 by: Curt Zirzow
162885 by: Chris Blake
162887 by: Chris Blake
Re: Using system
162880 by: Robert Cummings
162884 by: Gal Gur-Arie
162888 by: Gal
162890 by: Jason Wong
Re: ignore_user_abort not working
162881 by: Curt Zirzow
Re: PHP and Palm
162882 by: Mark
Re: How do I do this PERL in PHP?
162886 by: Don Read
Re: Edit a String
162889 by: Mark
Code check please
162891 by: James Johnson
162892 by: James Johnson
162907 by: CPT John W. Holmes
Re: Session data getting lost
162893 by: Rich Gray
162894 by: Rich Gray
162895 by: Jay Blanchard
162902 by: Rich Gray
162903 by: Jay Blanchard
162904 by: Rich Gray
162906 by: Jay Blanchard
162914 by: Rich Gray
162917 by: Curt Zirzow
162918 by: Jay Blanchard
162919 by: Curt Zirzow
162920 by: Curt Zirzow
sdfs
162896 by: Simon
template problems
162897 by: Simon
162898 by: Simon
162900 by: Jay Blanchard
162901 by: Jay Blanchard
value contained within a variable contained within another variable
162899 by: DougD
162909 by: esctoday.com | Wouter van Vliet
Re: webhost --0T-->
162905 by: Ryan A
162922 by: Curt Zirzow
162924 by: Ryan A
162929 by: Curt Zirzow
162931 by: Ryan A
162943 by: David T-G
162944 by: David T-G
162946 by: David T-G
162947 by: Martin Towell
How to use file() function with an "HTTPS:\\www.example.com"
162908 by: Rodrigo Nakahodo
162910 by: Jennifer Goodie
162911 by: Jay Blanchard
php and apache...single sign on
162912 by: Mike Klein
162913 by: Jay Blanchard
CURL - SSL
162915 by: Rodrigo Nakahodo
Re: Japanese on a page
162916 by: Chris W. Parker
multilanguage site: performance question: included file with cases?
162921 by: daniel hahler
162926 by: Curt Zirzow
Basic Framework
162923 by: Lee Herron QCS
Q on Regular Expressions
162925 by: jsWalter
162927 by: Curt Zirzow
162936 by: jsWalter
Feeling a bit brain dead, please help in maths: averages
162928 by: Ryan A
162930 by: Craig Lonsbury
162932 by: Ryan A
162933 by: Curt Zirzow
162935 by: Craig Lonsbury
Need Help With gethostbyname()
162934 by: Dan Anderson
162937 by: DvDmanDT
162939 by: Jennifer Goodie
162940 by: DvDmanDT
162941 by: Evan Nemerson
162945 by: Curt Zirzow
Re: Q on Regular Expressions - solved
162938 by: jsWalter
innodb and persistant connections
162942 by: daniel.electroteque.org
Re: Problem sending HTML formated mail
162948 by: Juan Carlos Borrero
162949 by: Curt Zirzow
MySQL timestamp to desired date function
162950 by: Cesar Aracena
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:
On Wednesday 17 September 2003 22:44, Chris Blake wrote:
> Where can I find stats, if any, on the number of sites using PHP as a
> server side language ?
>
> I been googling around using "PHP global statistics" and other
> combinations but can`t find anything.
www.netcraft.com
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
The adjective is the banana peel of the parts of speech.
-- Clifton Fadiman
*/
attached mail follows:
* Thus wrote Chris Blake (cblake
pbpc.co.za):
> Greetings learned PHP(eople);
>
> Where can I find stats, if any, on the number of sites using PHP as a
> server side language ?
>
> I been googling around using "PHP global statistics" and other
> combinations but can`t find anything.
netcraft.com
>
> Regards
>
> Flame on!
> -- Johnny Storm
Is this an invite :)
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
On Wed, 2003-09-17 at 16:55, Jason Wong wrote:
> On Wednesday 17 September 2003 22:44, Chris Blake wrote:
>
> > Where can I find stats, if any, on the number of sites using PHP as a
> > server side language ?
> >
> > I been googling around using "PHP global statistics" and other
> > combinations but can`t find anything.
>
> www.netcraft.com
>
Thank you Mr. Wong......I was such a dumbass...I coulda just gone to
PHP.net in the first place, the link is on the front page...
--
Chris Blake
Support Consultant
Office : (011) 782-0840
Fax : (011) 782-0841
Mobile : 083 985 0379
Website: http://www.pbpc.co.za
Data, n.:
Computerspeak for "information". Properly pronounced
the way Bostonians pronounce the word for a female child.
attached mail follows:
On Wed, 2003-09-17 at 17:11, Curt Zirzow wrote:
> [snip]
>
> Flame on!
> -- Johnny Storm
>
>
> Is this an invite :)
>
I have no idea who Johnny Storm is...but best he stay away from starting
a flame war on my behalf...I`m a lover, not a fighter....
:)
--
Chris Blake
Support Consultant
Office : (011) 782-0840
Fax : (011) 782-0841
Mobile : 083 985 0379
Website: http://www.pbpc.co.za
Default, n.:
The hardware's, of course.
attached mail follows:
Uros,
Run the command from the shell prompt and check your grep against the
output.
Cheers,
Rob.
On Wed, 2003-09-17 at 10:49, Uros wrote:
> Hello Robert,
>
> I think not
>
> here is my code
>
> #!/usr/local/bin/php -q
> <?php
> $ret = `nslookup -timeout=3 www.myhost.com |grep "Non-existent host/domain"`;
> ?>
>
> I always get automaticaly output. I also try to set implicit_flush to off,
> use ob ob_...
>
> nothing works.
>
> best regards
>
> Wednesday, September 17, 2003, 4:16:10 PM, you wrote:
>
> RC> Backtick style gets you the output...
>
> RC> $passwords = `cat /etc/passwd`;
>
> RC> Cheers,
> RC> Rob.
>
>
> RC> On Wed, 2003-09-17 at 09:55, esctoday.com | Wouter van Vliet wrote:
> >> Don't think there's one function for it .. Though, you may want to try the
> >> output buffers.
> >>
> >> ob_start();
> >> ( .. Exec here ..)
> >> $Var = ob_end_clean();
> >>
> >> ,
> >> Wouter
> >>
> >> -----Original Message-----
> >> From: Uros [mailto:uros.gruber
sir-mag.com]
> >> Sent: Wednesday, September 17, 2003 3:18 PM
> >> To: PHP General list
> >> Subject: [PHP] Using system
> >>
> >> Hello!
> >>
> >> I'm pulling my hair. What is the right syntax to set output of some system
> >> call to variable.
> >>
> >> I tried everything (system, shell_exec,exec) and always get output to
> >> screen.
> >>
> >> Please help.
> >>
> >> PHP version 4.3.3 CLI
> >>
> >> --
> >> Best regards,
> >> Uros
--
.---------------------------------------------.
| Worlds of Carnage - http://www.wocmud.org |
:---------------------------------------------:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the |
| stuff of nightmares grasp for your soul. |
`---------------------------------------------'
attached mail follows:
Hello,
try this:
<?php
$sMyHostname = exec('uname -a 2>&1');
echo "\n".$sMyHostname."\n";
?>
Uros wrote:
> Hello Robert,
>
> I think not
>
> here is my code
>
> #!/usr/local/bin/php -q
> <?php
> $ret = `nslookup -timeout=3 www.myhost.com |grep "Non-existent host/domain"`;
> ?>
>
> I always get automaticaly output. I also try to set implicit_flush to off,
> use ob ob_...
>
> nothing works.
>
> best regards
>
> Wednesday, September 17, 2003, 4:16:10 PM, you wrote:
>
> RC> Backtick style gets you the output...
>
> RC> $passwords = `cat /etc/passwd`;
>
> RC> Cheers,
> RC> Rob.
>
>
> RC> On Wed, 2003-09-17 at 09:55, esctoday.com | Wouter van Vliet wrote:
>
>>>Don't think there's one function for it .. Though, you may want to try the
>>>output buffers.
>>>
>>>ob_start();
>>> ( .. Exec here ..)
>>>$Var = ob_end_clean();
>>>
>>>,
>>>Wouter
>>>
>>>-----Original Message-----
>>>From: Uros [mailto:uros.gruber
sir-mag.com]
>>>Sent: Wednesday, September 17, 2003 3:18 PM
>>>To: PHP General list
>>>Subject: [PHP] Using system
>>>
>>>Hello!
>>>
>>>I'm pulling my hair. What is the right syntax to set output of some system
>>>call to variable.
>>>
>>>I tried everything (system, shell_exec,exec) and always get output to
>>>screen.
>>>
>>>Please help.
>>>
>>>PHP version 4.3.3 CLI
>>>
>>>--
>>>Best regards,
>>> Uros
>>>
>>>--
>>>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:
try this:
<?php
$sMyHostname = exec('uname -a 2>&1');
echo "\n".$sMyHostname."\n";
?>
Uros wrote:
> Hello!
>
> I'm pulling my hair. What is the right syntax to set output of some system
> call to variable.
>
> I tried everything (system, shell_exec,exec) and always get output to
> screen.
>
> Please help.
>
> PHP version 4.3.3 CLI
>
attached mail follows:
On Wednesday 17 September 2003 22:49, Uros wrote:
> I think not
Believe it or not, Robert's answer is correct.
> here is my code
>
> #!/usr/local/bin/php -q
> <?php
> $ret = `nslookup -timeout=3 www.myhost.com |grep "Non-existent
> host/domain"`; ?>
> I always get automaticaly output. I also try to set implicit_flush to off,
> use ob ob_...
*What* exactly is the output that you're getting?
Newer versions of nslookup on Redhat Linux (and Mandrake, and maybe others as
well) will give an *error* recommending that you use dig instead. To prevent
that particular warning from displaying you need the "-sil" option. To
redirect all errors elsewhere you can do something like:
nslookup -timeout=3 www.example.com 2>/dev/null | grep "Non-existent
host/domain"
And on my version of nslookup a non-existent domain gives this error message:
** server can't find www.example.com: NXDOMAIN
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Robert Tappen Morris, Jr., got six months in jail for crashing 10% of the
computers that Bill Gates made $100 million crashing last weekend.
*/
attached mail follows:
* Thus wrote Sid (sidh
hathway.com):
> Sorry, a mistake on my part. The script continues to work, but
> connection_aborted() does not detect if the host disconnected. It is all
> acting very funny. I also kept witing the return from connection_status ()
> to a file and it keeps witing 0 to the file even after the user disconnects.
The only time php knows that the connection is aborted is when you
attempt to output something.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
--- Charles Kline <ckline
rightcode.net> wrote:
> I have a project in mind where I would like to be able to Sync my
> Palm
> with the calendar in my CRM. Anyone have info on doing this?
>
> Thanks,
> Charles
You might want to look into the Horde Project (http://www.horde.org).
There's been on-again-off-again development of a conduit for sync'ing
their apps with a Palm. I'm not sure what the status of the project
is.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
=====
Mark Weinstock
mark_weinstock
yahoo.com
***************************************
You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing.
***************************************
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
attached mail follows:
On 16-Sep-2003 Susan Ator wrote:
> I have a text file with the following format:
>
> <TO> name
> <SUBJECT> stuff
> <MESSAGE>
> message text
> message text
> message text
>
<snip>
If you're sure the format is exactly that, then ...
$pat=array(
'<SUBJECT>',
'<MESSAGE>',
);
$marker='<FOO>';
$data=file_get_contents('dafile.txt');
$msgblks=explode('<TO>', $data);
foreach($msgblks as $blk) {
list($to, $subj, $msg) =
explode($marker,preg_replace($pat, $marker, $blk));
...
do__your_stuff($to, $subj, $msg);
...
}
Regards,
--
Don Read dread
ispwest.com
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.
attached mail follows:
--- Jay Blanchard <jay.blanchard
niicommunications.com> wrote:
> [snip]
> I have addresses stored in my database. I am trying to create a
> page
> that
> generates a letter automatically for the user to print. Given a
> string
> of
> format 'xxxx, xxxxx, xxxxx, xxx' how can I edit it so that the
> comma's
> are
> replaced with line breaks i.e. /n. This will enable me to display
> the
> address correctly at the top of the page.
> [/snip]
>
> http://www.php.net/ereg_replace , or don;t we use the manual?
>
Or the less demanding str_replace()
> Have a pleasant and productive day.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
=====
Mark Weinstock
mark_weinstock
yahoo.com
***************************************
You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing.
***************************************
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
attached mail follows:
Hi,
Can anyone see why this code isn't working....
$SID = $_SESSION['svUserID'];
$AdID = $_GET['AdID'];
// get the campuses assigned
$qCampusID = "SELECT inst_id FROM ads_campuses WHERE ad_id = $AdID";
$CampusIDList = mysql_query($qCampusID, $CCB) or die(mysql_error());
$row_CampusIDList = mysql_fetch_assoc($CampusIDList);
//var_dump($row_CampusIDList);
$tmp = array();
while( $rowData = mysql_fetch_array( $CampusIDList )) {
//print("ROW Data $rowData");
if(!in_array($rowData['inst_id'],$tmp)){
$tmp[] = $rowData['inst_id'];
}
}
//var_dump($tmp);
$cidList = implode( ',', $tmp );
//var_dump($cidList);
If I do a var_dump($row_CampusIDList); I get a value, so I know there's data
to work with. But if I do a var_dump($tmp) and var_dump($cidList), they're
both empty.
This particular value query only has 1 inst_id of 100. Other queries with
one value (99,45, etc) will work.
Very strange...
Thanks,
James
attached mail follows:
Hmm, ok I took out the
$row_CampusIDList = mysql_fetch_assoc($CampusIDList);
and it works.... But how come?
J
-----Original Message-----
From: James Johnson [mailto:james
primedna.net]
Sent: Wednesday, September 17, 2003 9:17 AM
To: php-general
lists.php.net
Subject: [PHP] Code check please
Hi,
Can anyone see why this code isn't working....
$SID = $_SESSION['svUserID'];
$AdID = $_GET['AdID'];
// get the campuses assigned
$qCampusID = "SELECT inst_id FROM ads_campuses WHERE ad_id = $AdID";
$CampusIDList = mysql_query($qCampusID, $CCB) or die(mysql_error());
$row_CampusIDList = mysql_fetch_assoc($CampusIDList);
//var_dump($row_CampusIDList);
$tmp = array();
while( $rowData = mysql_fetch_array( $CampusIDList )) {
//print("ROW Data $rowData");
if(!in_array($rowData['inst_id'],$tmp)){
$tmp[] = $rowData['inst_id'];
}
}
//var_dump($tmp);
$cidList = implode( ',', $tmp );
//var_dump($cidList);
If I do a var_dump($row_CampusIDList); I get a value, so I know there's data
to work with. But if I do a var_dump($tmp) and var_dump($cidList), they're
both empty.
This particular value query only has 1 inst_id of 100. Other queries with
one value (99,45, etc) will work.
Very strange...
Thanks,
James
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
From: "James Johnson" <james
primedna.net>
> Can anyone see why this code isn't working....
>
> $SID = $_SESSION['svUserID'];
> $AdID = $_GET['AdID'];
>
> // get the campuses assigned
> $qCampusID = "SELECT inst_id FROM ads_campuses WHERE ad_id = $AdID";
You say down below that this query only selects one row...
> $CampusIDList = mysql_query($qCampusID, $CCB) or die(mysql_error());
> $row_CampusIDList = mysql_fetch_assoc($CampusIDList);
and this mysql_fetch_assoc() call will return that one row into
$row_CampusIDList.
> //var_dump($row_CampusIDList);
>
> $tmp = array();
> while( $rowData = mysql_fetch_array( $CampusIDList )) {
This while will never execute as there are no more rows to select.
> //print("ROW Data $rowData");
> if(!in_array($rowData['inst_id'],$tmp)){
> $tmp[] = $rowData['inst_id'];
> }
> }
> //var_dump($tmp);
> $cidList = implode( ',', $tmp );
> //var_dump($cidList);
>
> If I do a var_dump($row_CampusIDList); I get a value, so I know there's
data
> to work with. But if I do a var_dump($tmp) and var_dump($cidList), they're
> both empty.
>
> This particular value query only has 1 inst_id of 100. Other queries with
> one value (99,45, etc) will work.
---John Holmes...
attached mail follows:
Chris
Thanks for your answer which I'm sorry to say makes no sense to me given the
code example I supplied ... can you explain to me why you think register
globals being set to on for the Linux server will cause the $_SESSION
superglobal array to lose data? Am I missing something obvious here?
Thx
Rich
> --- Rich Gray <rich
f1central.net> wrote:
> > I'm running v4.2.3 on RedHat v7.0 and am getting some strange
> > behaviour with the $_SESSION superglobal...
> ...
> > It works fine on Win2K albeit v4.3.0 of PHP.
>
> Maybe you have register_globals enabled on your Linux server and
> not on your
> Windows PC? Compare php.ini files before giving it too much thought.
>
> Chris
>
attached mail follows:
Jan
Sorry - no that doesn't help - as you can see from the code snippet I posted
the session_start() is at the very top of the code...
Thx anyway.
Rich
>
> You have to put session_start(); at the VERY TOP of your code.
> even before alle the <html> tags.
> Hope that helps!
>
> Jan
>
> --- Rich Gray <rich
f1central.net> wrote:
> > I'm running v4.2.3 on RedHat v7.0 and am getting some strange
> > behaviour with the $_SESSION superglobal...
> ...
> > It works fine on Win2K albeit v4.3.0 of PHP.
>
> Maybe you have register_globals enabled on your Linux server and
> not on your
> Windows PC? Compare php.ini files before giving it too much thought.
>
> Chris
>
attached mail follows:
[snip]
<?php
session_start();
$test = -1;
.................
[/snip]
I think you need to register test ....
http://us3.php.net/session_register
HTH!
attached mail follows:
Jay
Thanks, but no I don't think so ... session_register() is deprecated ...
Quote PHP manual:
Caution:
If you want your script to work regardless of register_globals, you need to
instead use the $_SESSION array as $_SESSION entries are automatically
registered. If your script uses session_register(), it will not work in
environments where the PHP directive register_globals is disabled.
Cheers
Rich
>
> [snip]
> <?php
> session_start();
> $test = -1;
> .................
>
> [/snip]
>
> I think you need to register test ....
>
> http://us3.php.net/session_register
>
> HTH!
>
attached mail follows:
[snip]
Thanks, but no I don't think so ... session_register() is deprecated ...
[/snip]
Not depricated, just doesn't work when register_globals is off in the
.ini
Have you done a print_r($_SESSION) to see if in fact the $test variable
is contained?
attached mail follows:
Well a functon that doesn't work under certain conditions should be
deprecated IMO ... I haven't used it for a long time now...
To answer your question ... yep I've used print_r() and after the 1st form
submission the entry is set to -1 however at no time do I ever set
$_SESSION['test'] to -1 in my code example ...
Rich
> [snip]
> Thanks, but no I don't think so ... session_register() is deprecated ...
> [/snip]
>
> Not depricated, just doesn't work when register_globals is off in the
> .ini
>
> Have you done a print_r($_SESSION) to see if in fact the $test variable
> is contained?
>
attached mail follows:
[snip]
Well a functon that doesn't work under certain conditions should be
deprecated IMO ... I haven't used it for a long time now...
To answer your question ... yep I've used print_r() and after the 1st
form
submission the entry is set to -1 however at no time do I ever set
$_SESSION['test'] to -1 in my code example ...
[/snip]
Nope, but $test is a GLOBAL variable, and therefore would be set to -1
within $_SESSION as all GLOBALS are, as you pointed out earlier,
registerd with $_SESSION. If $test is within a function it is a PRIVATE
variable, local to the function only, unless declared as a GLOBAL.
attached mail follows:
So your telling me that all variables defined in the global scope are
automatically added to the $_SESSION array...?
Not true I think....
> [snip]
> Well a functon that doesn't work under certain conditions should be
> deprecated IMO ... I haven't used it for a long time now...
>
> To answer your question ... yep I've used print_r() and after the 1st
> form
> submission the entry is set to -1 however at no time do I ever set
> $_SESSION['test'] to -1 in my code example ...
> [/snip]
>
> Nope, but $test is a GLOBAL variable, and therefore would be set to -1
> within $_SESSION as all GLOBALS are, as you pointed out earlier,
> registerd with $_SESSION. If $test is within a function it is a PRIVATE
> variable, local to the function only, unless declared as a GLOBAL.
>
>
attached mail follows:
* Thus wrote Rich Gray (rich
f1central.net):
> Chris
>
> Thanks for your answer which I'm sorry to say makes no sense to me given the
> code example I supplied ... can you explain to me why you think register
> globals being set to on for the Linux server will cause the $_SESSION
> superglobal array to lose data? Am I missing something obvious here?
This makes perfect sense (see below for what makes sense since you
top posted.) This is all explained if you read the session
documentation.
http://php.net/session
<snip for the lazy>
If register_globals is enabled, then the global variables and the
$_SESSION entries will automatically reference the same values
which were registered in the prior session instance.
</snip>
>
> > --- Rich Gray <rich
f1central.net> wrote:
> > > I'm running v4.2.3 on RedHat v7.0 and am getting some strange
> > > behaviour with the $_SESSION superglobal...
> > ...
> > > It works fine on Win2K albeit v4.3.0 of PHP.
> >
> > Maybe you have register_globals enabled on your Linux server and
> > not on your
> > Windows PC? Compare php.ini files before giving it too much thought.
> >
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
[snip]
So your telling me that all variables defined in the global scope are
automatically added to the $_SESSION array...?
Not true I think....
[/snip]
You're right of course. I went back to your original code and stripped
it back some
<?php
session_start();
$test = -1;
echo $_SESSION['test']."\n";
$test = 999;
$_SESSION['test'] = $test;
echo $_SESSION['test']."\n";
?>
The logic is incorrect, when you reload the page $test gets set to -1
before your echo statement. After your echo statement it gets set to
999. On reload it again gets set to -1 before your echo. The second echo
is always right (for what you want). If you comment out $test = -1; both
echos come back correctly. Since you have declared $_SESSION['test']
once and the session is still in effect on the reload the first echo
comes back -1 since that is what the declared variable is now worth.
Make sense?
attached mail follows:
* Thus wrote Rich Gray (rich
f1central.net):
> So your telling me that all variables defined in the global scope are
> automatically added to the $_SESSION array...?
> Not true I think....
>
no. read the documentation, in full.
The soluction to your problem was resolved from the first reply (by
Chris Shiflett), but you rejected it because of it not making sense
to you, which seems to be the problem.
> > [snip]
> > Well a functon that doesn't work under certain conditions should be
> > deprecated IMO ... I haven't used it for a long time now...
> >
> > To answer your question ... yep I've used print_r() and after the 1st
> > form
> > submission the entry is set to -1 however at no time do I ever set
> > $_SESSION['test'] to -1 in my code example ...
> > [/snip]
> >
> > Nope, but $test is a GLOBAL variable, and therefore would be set to -1
> > within $_SESSION as all GLOBALS are, as you pointed out earlier,
> > registerd with $_SESSION. If $test is within a function it is a PRIVATE
> > variable, local to the function only, unless declared as a GLOBAL.
> >
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
* Thus wrote Rich Gray (rich
f1central.net):
> Well a functon that doesn't work under certain conditions should be
> deprecated IMO ... I haven't used it for a long time now...
this makes absolutly no sense. So if I use a function improperly,
it should become deprecated?
session_register() is used in cases where you haver register_globals
on; it is not useed when it is off.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
sdfsdf
attached mail follows:
hi,
I've got this problem when using templates on my localhost. The code works
on my web server which i rent so the code is fine. I have ran php code for
mysql functions and other for testing purposes.
Below is the code i used in index.php.
INDEX.PHP
<?php
switch ($page)
{
default : include "error.txt";
break;
case "screenshots" : include "news.txt";
break;
}
?>
When i type say www.myrentedwebsite.com/index.php?page=main it will display the page main.txt
When i try this on my localhost it displays the error.txt file instead. It doesn't recognize the index.php?>?PAGE=MAIN i think !.
Could anybody help me with this problem because i wanted the localhost for testing purposes.
thank you in advance
attached mail follows:
hi,
I've got this problem when using templates on my localhost. The code works
on my web server which i rent so the code is fine. I have ran php code for
mysql functions and other for testing purposes.
Below is the code i used in index.php.
INDEX.PHP
<?php
switch ($page)
{
default : include "error.txt";
break;
case "screenshots" : include "news.txt";
break;
}
?>
When i type say www.myrentedwebsite.com/index.php?page=main it will display the page main.txt
When i try this on my localhost it displays the error.txt file instead. It doesn't recognize the index.php?>?PAGE=MAIN i think !.
Could anybody help me with this problem because i wanted the localhost for testing purposes.
thank you in advance
attached mail follows:
[snip]
INDEX.PHP
<?php
switch ($page)
{
default : include "error.txt";
break;
case "screenshots" : include "news.txt";
break;
}
?>
When i type say www.myrentedwebsite.com/index.php?page=main it will
display the page main.txt
When i try this on my localhost it displays the error.txt file instead.
It doesn't recognize the index.php?>?PAGE=MAIN i think !.
[/snip]
Try this and report back
<?php
switch ($_GET['page'])
{
default : include "error.txt";
break;
case "screenshots" : include "news.txt";
break;
}
?>
attached mail follows:
[snip]
default : include "error.txt";
break;
case "screenshots" : include "news.txt";
break;
[/snip]
And always put default case last
attached mail follows:
I may be way off track with what I am trying to do, but here is my scenario
and I sure appreciate any insights.
There is a string stored in $kk1_current and I want to pull from the array
the variable name, add the "$" and then retreive the string with the
varialbe $kk1_current. This will allow to echo the contents of each varialbe
contained with the array. Make sense?
$kk1_current = "something";
$data = array ("kk1_current","kk2_current","mk_current");
$temp = "$" . $data[0];
$data_post = strval($temp) . "\n"; // I want, $data_post = whatever
is inside $kk1_current in this example -- strval obviously doesn't work in
the case
echo $data_post;
THANKS!
attached mail follows:
You should be able to do something like this:
$kk1_current = "something";
$data = array ("kk1_current","kk2_current","mk_current");
$data_post = $$data[0]; . "\n"; // I want, $data_post = whatever
is inside $kk1_current in this example -- strval obviously doesn't work in
the case
echo $data_post;
-----Original Message-----
From: DougD [mailto:info
bigfresh.com]
Sent: Wednesday, September 17, 2003 7:18 PM
To: php-general
lists.php.net
Subject: [PHP] value contained within a variable contained within another
variable
I may be way off track with what I am trying to do, but here is my scenario
and I sure appreciate any insights.
There is a string stored in $kk1_current and I want to pull from the array
the variable name, add the "$" and then retreive the string with the
varialbe $kk1_current. This will allow to echo the contents of each varialbe
contained with the array. Make sense?
$kk1_current = "something";
$data = array ("kk1_current","kk2_current","mk_current");
$temp = "$" . $data[0];
$data_post = strval($temp) . "\n"; // I want, $data_post = whatever
is inside $kk1_current in this example -- strval obviously doesn't work in
the case
echo $data_post;
THANKS!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hey David,
Thanks for replying.
% Voteing will be allowed only to clients who register and confirm their
email
% addresses, plus only 1 vote per IP and we will be using cookies...
/*
That would be terrible for anyone behind a firewall. Leave it at once
per email address and just live with the fact that some people have more
than one available.
*/
Let me explain, when the person registers they wont just recive permission
to vote but also other things as a control panel will be created for them to
save their favourite packages from the differient hosts and even compare the
packages side by side...if the cookie fails then i will try for ip and if
the ip fails then it will go only for the username....
/*
In addition, I presume you mean that one can only vote once for a given
web host vs having to pick a single one and vote for it and that's it...
I know of a few directly and should be able to vote on all of them.
*/
Nope, its not that you have limited votes, you can vote for each and every
host on the site...but just one vote per host, dont you think thats fair?
/*
It would be nice if you saved everyone's votes and let users modify them,
*/
Let users modify them? what do you mean? if users can modify a vote whats
the use of a vote?
/*
but that gets into a bit more work on your part. But it would be nice :-)
*/
Now you've gotten me confused :-(
/*
HTH & HAND
*/
Meant to ask you this before...whats HAND?
Cheers,
-Ryan
attached mail follows:
* Thus wrote Ryan A (ryan
coinpass.com):
> Hey David,
> Thanks for replying.
>
>
> % Voteing will be allowed only to clients who register and confirm their
> email
> % addresses, plus only 1 vote per IP and we will be using cookies...
>
> /*
> That would be terrible for anyone behind a firewall. Leave it at once
> per email address and just live with the fact that some people have more
> than one available.
> */
hmm.. whats with the weird quoting style? only david is allowed to
use weird characters :)
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
Hey,
/*
>hmm.. whats with the weird quoting style? only david is allowed to
> use weird characters :)
*/
Whatdayamean? as far as I know he has not copyrighted the right to be weird
ok? there are a lot of weirdos on this list and why should i be left
out????!!!???
:-D
Cheers,
-Ryan
P.S David, No offense meant.
We will slaughter you all! - The Iraqi (Dis)information ministers site
http://MrSahaf.com
> * Thus wrote Ryan A (ryan
coinpass.com):
> > Hey David,
> > Thanks for replying.
> >
> >
> > % Voteing will be allowed only to clients who register and confirm their
> > email
> > % addresses, plus only 1 vote per IP and we will be using cookies...
> >
> > /*
> > That would be terrible for anyone behind a firewall. Leave it at once
> > per email address and just live with the fact that some people have more
> > than one available.
> > */
>
> hmm.. whats with the weird quoting style? only david is allowed to
> use weird characters :)
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
attached mail follows:
* Thus wrote Ryan A (ryan
coinpass.com):
> Hey,
>
> /*
> >hmm.. whats with the weird quoting style? only david is allowed to
> > use weird characters :)
> */
>
> Whatdayamean? as far as I know he has not copyrighted the right to be weird
> ok? there are a lot of weirdos on this list and why should i be left
> out????!!!???
I had created a custom regex for his '%' quote so my colors work
properly on his replies. Now i'm going to have create one special
for yours :)
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
Hey,
> I had created a custom regex for his '%' quote so my colors work
> properly on his replies. Now i'm going to have create one special
> for yours :)
If you do that I guess I will just have to change my quoting style everytime
i send a mail :-D
Cheers,
-Ryan
We will slaughter you all! - The Iraqi (Dis)information ministers site
http://MrSahaf.com
> * Thus wrote Ryan A (ryan
coinpass.com):
> > Hey,
> >
> > /*
> > >hmm.. whats with the weird quoting style? only david is allowed to
> > > use weird characters :)
> > */
> >
> > Whatdayamean? as far as I know he has not copyrighted the right to be
weird
> > ok? there are a lot of weirdos on this list and why should i be left
> > out????!!!???
>
> I had created a custom regex for his '%' quote so my colors work
> properly on his replies. Now i'm going to have create one special
> for yours :)
>
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
attached mail follows:
Curt, et al --
...and then Curt Zirzow said...
%
% * Thus wrote Ryan A (ryan
coinpass.com):
...
% > /*
% > That would be terrible for anyone behind a firewall. Leave it at once
...
%
% hmm.. whats with the weird quoting style? only david is allowed to
% use weird characters :)
ROFLMAO
A complete spit-take surprise. Thanks :-)
HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg
justpickone.org * society and not sufficient moral courage.
(work) davidtgwork
justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
iD8DBQE/aQHgGb7uCXufRwARAsBpAKCGOXGx2K0NqGtjviOzpN+1eite+QCg6ITD
ZdHTtj7xSp4JvFq3ouhmmM0=
=CvLd
-----END PGP SIGNATURE-----
attached mail follows:
Curt --
...and then Curt Zirzow said...
%
% * Thus wrote Ryan A (ryan
coinpass.com):
% >
% > /*
% > >hmm.. whats with the weird quoting style? only david is allowed to
% > > use weird characters :)
% > */
...
%
% I had created a custom regex for his '%' quote so my colors work
Oh, c'mon... You and I both know that a single char like %_ is easy to
fit into $reply_regexp. No whining :-)
% properly on his replies. Now i'm going to have create one special
% for yours :)
Now *that* I would like to see. Good luck!
HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg
justpickone.org * society and not sufficient moral courage.
(work) davidtgwork
justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
iD8DBQE/aQJCGb7uCXufRwARAlqzAJ4huj50t6mEcJat2tmiSL4WorQZYACdGKdc
HzHKyGd9V4qLd+6bfUBQXEs=
=t0im
-----END PGP SIGNATURE-----
attached mail follows:
Ryan --
...and then Ryan A said...
%
% Hey David,
% Thanks for replying.
Sure thing!
%
% % Voteing will be allowed only to clients who register and confirm their
% email
% % addresses, plus only 1 vote per IP and we will be using cookies...
%
% /*
% That would be terrible for anyone behind a firewall. Leave it at once
% per email address and just live with the fact that some people have more
% than one available.
% */
% Let me explain, when the person registers they wont just recive permission
% to vote but also other things as a control panel will be created for them to
Good enough. Lots of bells and whistles; that's great.
% save their favourite packages from the differient hosts and even compare the
Excellent!
% packages side by side...if the cookie fails then i will try for ip and if
% the ip fails then it will go only for the username....
OK. You haven't really explained how the cookie might fail or how your
fallback works, but that's probably OK.
%
% /*
% In addition, I presume you mean that one can only vote once for a given
% web host vs having to pick a single one and vote for it and that's it...
% I know of a few directly and should be able to vote on all of them.
% */
% Nope, its not that you have limited votes, you can vote for each and every
Good.
% host on the site...but just one vote per host, dont you think thats fair?
Nope. What if you have two users on a host?
%
% /*
% It would be nice if you saved everyone's votes and let users modify them,
% */
% Let users modify them? what do you mean? if users can modify a vote whats
% the use of a vote?
It depends; it might be a cast-it-once-in-stone kind of vote, or it might
be a running report that stays up to date. Suppose I rank my current
provider very highly but next month they lay off half of their staff and
service goes down the drain; I should be able to change my vote to
reflect their new status if this is something that people will want to
see as worthwhile for more than just a short survey period.
%
% /*
% but that gets into a bit more work on your part. But it would be nice :-)
% */
% Now you've gotten me confused :-(
Well, if you're going to keep my vote around so that I can change it you
now have to have an entire database record for me. If I'm just throwing
my vote into the pile then you need only keep a running total. The
latter is certainly easier.
%
%
% /*
% HTH & HAND
% */
% Meant to ask you this before...whats HAND?
Have A Nice Day :-)
:-D
--
David T-G * There is too much animal courage in
(play) davidtg
justpickone.org * society and not sufficient moral courage.
(work) davidtgwork
justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
iD8DBQE/aQM1Gb7uCXufRwARAtsNAJ9YZYvntu92b0s5Y9PubxyOiTxB8wCeIYOi
xsDQfFiyzNTCN25u6jQsijQ=
=2B23
-----END PGP SIGNATURE-----
attached mail follows:
[snip]
/*
HTH & HAND
*/
Meant to ask you this before...whats HAND?
[/snip]
Looks like noone's replied to this question, it's: Have A Nice Day...
HTH
Martin
attached mail follows:
How to use file() function with an "HTTPS:\\www.example.com"
<?php
$lines = file ('https://www.example.com/');
foreach ($lines as $line_num => $line) {
echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br>\n";
}
?>
Thanks a million!
Rodrigo Nakahodo
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.518 / Virus Database: 316 - Release Date: 9/11/2003
attached mail follows:
> How to use file() function with an "HTTPS:\\www.example.com"
>
> <?php
>
> $lines = file ('https://www.example.com/');
>
> foreach ($lines as $line_num => $line) {
> echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line)
> . "<br>\n";
> }
My interpretation of the manual page
(http://us3.php.net/manual/en/function.file.php) is as follows:
1.) you need fopen_wrappers enabled
2.) https is only available in versions >= 4.3.0
attached mail follows:
[snip]
How to use file() function with an "HTTPS:\\www.example.com"
[/snip]
Use cURL http://www.php.net/curl because you will have to login to the
https: location first, before you can use file()
attached mail follows:
I would like to piggyback on an Apache realm/dialog authentication and
feed these credentials to a mysql connection (or connection to anything
else) in my php scripts.
Is there a way using the php Apache apis (seems like no) or via apache
itself to make these credentials available/visible to a php script?
I'm not sure if this presents a security risk as I trust the pages in my
web server to not be malevolent.
mike
attached mail follows:
[snip]
I would like to piggyback on an Apache realm/dialog authentication and
feed these credentials to a mysql connection (or connection to anything
else) in my php scripts.
Is there a way using the php Apache apis (seems like no) or via apache
itself to make these credentials available/visible to a php script?
I'm not sure if this presents a security risk as I trust the pages in my
web server to not be malevolent.
[/snip]
Should be $PHP_AUTH_USER and $PHP_AUTH_PW, see
http://us4.php.net/features.http-auth
Funny how the manual works for these things! ;)
Have a pleasant and productive day.
attached mail follows:
Anyone knows how to get a simple(HTML) https response using CURL session.
Thanks a million!!
Rodrigo Nakahodo
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.518 / Virus Database: 316 - Release Date: 9/11/2003
attached mail follows:
- Edwin - <mailto:copperwa11s
yahoo.co.jp>
on Tuesday, September 16, 2003 5:53 PM said:
This japanese page thing was a project I started at home so now that I'm
at work I'll do my best to respond using my memory (good luck, me!).
> Did you check if the Japanese characters are readable inside
> html-kit? In other words, Japanese characters should appear as it is
> inside your editor...
No the japanese characters did not appear correctly.
>> 7. Save the page
>
> Did you save it as euc-jp or shift_jis?
No. I don't think there is that option in html-kit, but I think that
this may be the key.
If you (a person) can save the file as the proper type there's probably
no reason to send the header() function, or for that matter there would
probably be no REASON to send the header().
>> 8. open it in the web browser
>
> Before opening it in your browser, did you try opening again in your
> editor just to see whether you saved it correctly?
No.
>> 9. cry because it doesn't work
>
> Hmm... If everything is properly declared inside your <head> tags,
> your browser *should* automatically render the page correctly.
> Anyway, if it doesn't work, check that the "character coding" in your
> browser is properly selected. (If you're on Netscape or Mozilla,
> choose "View" -> "Character coding" -> your_character_coding_here.)
Yes this is how I would expect it to work but it ended up not working
that way. But like I said I think it may be because of the type it saves
the file as.
>> A friend later figured out that the header() declaration at the top
>> of the page was what made the difference.
>
> Did this one work for you?
Yes, adding the header() made the page display correctly from my server.
>> Do you know why it wouldn't work until that php code was added?
>
> Not really sure. But think about this. People can write HTML pages
> without the help of php and the like and still have Japanese pages
> correctly rendered by their browsers. In other words, I can write an
> HTML page with Japanese characters in it, save it on my desktop (and
> not on my web server), double click it, my browser starts and show me
> the characters correctly--no php code necessary.
That's how I expected it to work.
> Btw, iirc, phpedit on Win2k worked for me. Just make sure that you
> have Japanese fonts (and an IME) installed and you chose the correct
> (default) font for phpedit. This works even if you have on English
> version of Win2k (or XP).
Oh cool. I have that already so I'll try it out.
Chris.
attached mail follows:
Hello listmembers,
I'm building up a site which should be german and english. So I have a
site object which remembers this choice during the session and do a
include('lang_'.$site->lang.'.php');
in my topmost.php.
This works good, but this file is growing and I thought about how to
handle this.
Two things came in mind:
1. Split the content parts and use a different include file for each
section.
2. Do a switch ($site->curMenu) in the lang_xx.php and define only
what is needed for current section.
The first option is not so good, as I would have up to 10 new files.
And when thinking of the second option, I thought that it could be
even more performant, if you had a static included file, as this could
be cached somehow.
So, what to do?
And: hello to all, it's my first post here. :)
--
shinE!
http://www.thequod.de ICQ#152282665
I'm sitting in silence.
attached mail follows:
* Thus wrote daniel hahler (phpnetgul
thequod.de):
> Hello listmembers,
>
> I'm building up a site which should be german and english. So I have a
> site object which remembers this choice during the session and do a
> include('lang_'.$site->lang.'.php');
> in my topmost.php.
>
> This works good, but this file is growing and I thought about how to
> handle this.
>
> Two things came in mind:
> 1. Split the content parts and use a different include file for each
> section.
> 2. Do a switch ($site->curMenu) in the lang_xx.php and define only
> what is needed for current section.
>
> The first option is not so good, as I would have up to 10 new files.
> And when thinking of the second option, I thought that it could be
> even more performant, if you had a static included file, as this could
> be cached somehow.
>
> So, what to do?
>
I would suggest using gettext it will make the application real
flexible. I havn't used it but from what I've seen it really is
simple to use. Plus it keeps your translations completely seperate
from your program.
http://php.net/manual/en/ref.gettext.php
> And: hello to all, it's my first post here. :)
Hello and Welcome.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
I'm not fond of the phrase "framework," but for lack of any other term, this
is what I use ..
Without going to a bloated framework such as fusebox or MVP, have any of you
put together a simple structure to allow very basic template and module
inclusion with menuing?
attached mail follows:
I have a fairly complicated regular expression that was written for perl.
I've spent the last 4 days trying to convert it to PHP.
I guess I'm just that bright.
I can't even get the sub parts (between the || to work, much less the
conditionals
Would someone mind showing me how I can make this work in PHP?
Thanks
walter
# Does input match this RegEx?
(($day,$mon,$yr,$hr,$min,$sec,$tz) =
/^
(\w{1,3}) # month
\s+
(\d\d?) # day
\s+
(\d\d?):(\d\d) # hour:min
(?::(\d\d))? # optional seconds
\s+
(?:([A-Za-z]+)\s+)? # optional timezone
(\d+) # year
\s*$ # allow trailing whitespace
/x)
# If not that one, then this RegEx?
||
# Then the Unix 'ls -l' date format
(($mon, $day, $yr, $hr, $min, $sec) =
/^
(\w{3}) # month
\s+
(\d\d?) # day
\s+
(?:
(\d\d\d\d) | # year
(\d{1,2}):(\d{2}) # hour:min
(?::(\d\d))? # optional seconds
)
\s*$
/x)
# If not that one, then this RegEx?
||
# ISO 8601 format '1996-02-29 12:00:00 -0100' and variants
(($yr, $mon, $day, $hr, $min, $sec, $tz) =
/^
(\d{4}) # year
[-\/]?
(\d\d?) # numerical month
[-\/]?
(\d\d?) # day
(?:
(?:\s+|[-:Tt]) # separator before clock
(\d\d?):?(\d\d) # hour:min
(?::?(\d\d(?:\.\d*)?))? # optional seconds (and fractional)
)? # optional clock
\s*
([-+]?\d\d?:?(:?\d\d)?
|Z|z)? # timezone (Z is "zero meridian", i.e. GMT)
\s*$
/x)
# If not that one, then this RegEx?
||
# Windows 'dir' 11-12-96 03:52PM
(($mon, $day, $yr, $hr, $min, $ampm) =
/^
(\d{2}) # numerical month
-
(\d{2}) # day
-
(\d{2}) # year
\s+
(\d\d?):(\d\d)([APap][Mm]) # hour:min AM or PM
\s*$
/x)
# I guess not any. So bale!
||
return; # unrecognized format
attached mail follows:
* Thus wrote jsWalter (jsWalter
torres.ws):
> I have a fairly complicated regular expression that was written for perl.
>
> I've spent the last 4 days trying to convert it to PHP.
have you looked at strtotime()?
http://php.net/strtotime
The Date formats it can find are defined here:
http://www.gnu.org/manual/tar-1.12/html_chapter/tar_7.html
Those regex's look like a nightmare, like they usually do :)
>
> # Does input match this RegEx?
>
> (($day,$mon,$yr,$hr,$min,$sec,$tz) =
> /^
> (\w{1,3}) # month
> \s+
> (\d\d?) # day
> \s+
> (\d\d?):(\d\d) # hour:min
> (?::(\d\d))? # optional seconds
> \s+
> (?:([A-Za-z]+)\s+)? # optional timezone
> (\d+) # year
> \s*$ # allow trailing whitespace
> /x)
>
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
Thanks for the pointer, but this only deals with date/time in EPOCH range.
I'm trying to handle dates pre-epoch.
Thanks
Walter
"Curt Zirzow" <php-general
zirzow.dyndns.org> wrote in message
news:20030917211347.GF4251
bagend.shire...
> * Thus wrote jsWalter (jsWalter
torres.ws):
> > I have a fairly complicated regular expression that was written for
perl.
> >
> > I've spent the last 4 days trying to convert it to PHP.
>
> have you looked at strtotime()?
> http://php.net/strtotime
>
> The Date formats it can find are defined here:
> http://www.gnu.org/manual/tar-1.12/html_chapter/tar_7.html
>
>
> Those regex's look like a nightmare, like they usually do :)
>
> >
> > # Does input match this RegEx?
> >
> > (($day,$mon,$yr,$hr,$min,$sec,$tz) =
> > /^
> > (\w{1,3}) # month
> > \s+
> > (\d\d?) # day
> > \s+
> > (\d\d?):(\d\d) # hour:min
> > (?::(\d\d))? # optional seconds
> > \s+
> > (?:([A-Za-z]+)\s+)? # optional timezone
> > (\d+) # year
> > \s*$ # allow trailing whitespace
> > /x)
> >
>
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
Hey,
Been working a bit too much i guess so am feeling braindead...
I have a couple of records in the database, i am doing a: "select
age,salTotal from blah where section=3"
this is getting me a list of records, how do i calculate the average age and
salary total (salTotal) to display in my php page?
Cheers,
-Ryan A
We will slaughter you all! - The Iraqi (Dis)information ministers site
http://MrSahaf.com
attached mail follows:
off the top of my head:
SELECT AVG(age), SUM(salTotal)
FROM blah
WHERE section = 3
i'm not sure if you can use the 2 functions in the same query,
you might have to break it into 2 queries.
Craig
-----Original Message-----
From: Ryan A [mailto:ryan
coinpass.com]
Sent: Wednesday, September 17, 2003 3:08 PM
To: php-general
lists.php.net
Subject: [PHP] Feeling a bit brain dead, please help in maths: averages
Hey,
Been working a bit too much i guess so am feeling braindead...
I have a couple of records in the database, i am doing a: "select
age,salTotal from blah where section=3"
this is getting me a list of records, how do i calculate the average age and
salary total (salTotal) to display in my php page?
Cheers,
-Ryan A
We will slaughter you all! - The Iraqi (Dis)information ministers site
http://MrSahaf.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hey,
Thanks for replying.
Actually I made that example simple, i actually need the average of 7 to 9
fields....and i dont want to run 7 selects :-(
I know its been done on elance....but how?
Thanks,
-Ryan
> off the top of my head:
>
> SELECT AVG(age), SUM(salTotal)
> FROM blah
> WHERE section = 3
>
> i'm not sure if you can use the 2 functions in the same query,
> you might have to break it into 2 queries.
>
> Craig
>
> -----Original Message-----
> From: Ryan A [mailto:ryan
coinpass.com]
> Sent: Wednesday, September 17, 2003 3:08 PM
> To: php-general
lists.php.net
> Subject: [PHP] Feeling a bit brain dead, please help in maths: averages
>
>
> Hey,
> Been working a bit too much i guess so am feeling braindead...
>
> I have a couple of records in the database, i am doing a: "select
> age,salTotal from blah where section=3"
> this is getting me a list of records, how do i calculate the average age
and
> salary total (salTotal) to display in my php page?
>
> Cheers,
> -Ryan A
>
>
>
>
>
>
>
> We will slaughter you all! - The Iraqi (Dis)information ministers site
> http://MrSahaf.com
>
> --
> 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:
* Thus wrote Craig Lonsbury (craig
topdraw.com):
> off the top of my head:
>
> SELECT AVG(age), SUM(salTotal)
> FROM blah
> WHERE section = 3
>
> i'm not sure if you can use the 2 functions in the same query,
> you might have to break it into 2 queries.
Yes you can. And if you have other fields in the select you add a
group by to the sql statement
SELECT AVG(age), SUM(salTotal), otherfield
FROM blah
WHERE section = 3
group by otherfield
Assuming this is mysql:
http://www.mysql.com/doc/en/GROUP-BY-Functions.html
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
> -----Original Message-----
> From: Ryan A [mailto:ryan
coinpass.com]
> Sent: Wednesday, September 17, 2003 3:21 PM
> To: craig
topdraw.com; php-general
lists.php.net
> Subject: Re: [PHP] Feeling a bit brain dead, please help in maths:
> averages
>
>
> Hey,
> Thanks for replying.
>
> Actually I made that example simple, i actually need the average
> of 7 to 9
> fields....and i dont want to run 7 selects :-(
> I know its been done on elance....but how?
>
> Thanks,
> -Ryan
this should do the trick... but it's not tested ;)
#assuming you are using mysql and your query
#has successfully executed and your results
#are in $resultSet
$rowCount = 0;
$ageSum = 0;
$salarySum = 0; #use as many sums as needed
while ($row = mysql_fetch_object($resultSet)) {
$ageSum += $row->age;
$salarySum += $row->sal;
$rowCount++;
}
$salaryAvg = $ageSum / $rowCount;
>
>
> > off the top of my head:
> >
> > SELECT AVG(age), SUM(salTotal)
> > FROM blah
> > WHERE section = 3
> >
> > i'm not sure if you can use the 2 functions in the same query,
> > you might have to break it into 2 queries.
> >
> > Craig
> >
> > -----Original Message-----
> > From: Ryan A [mailto:ryan
coinpass.com]
> > Sent: Wednesday, September 17, 2003 3:08 PM
> > To: php-general
lists.php.net
> > Subject: [PHP] Feeling a bit brain dead, please help in maths: averages
> >
> >
> > Hey,
> > Been working a bit too much i guess so am feeling braindead...
> >
> > I have a couple of records in the database, i am doing a: "select
> > age,salTotal from blah where section=3"
> > this is getting me a list of records, how do i calculate the average age
> and
> > salary total (salTotal) to display in my php page?
> >
> > Cheers,
> > -Ryan A
> >
> >
> >
> >
> >
> >
> >
> > We will slaughter you all! - The Iraqi (Dis)information ministers site
> > http://MrSahaf.com
> >
> > --
> > 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:
I have a section of my script where I call gethostbyname($hostname) .
For some host names that are not registered (according to register.com)
I am still getting an IP address returned?
What is happening?
-Dan
attached mail follows:
Well, try only the toplevel domain... For example, I have like
hns345667dsvdtrt34.telia.com, I doubt that is registred, but telia.com sure
is... I hope.. :S
--
// DvDmanDT
MSN: dvdmandt
hotmail.com
Mail: dvdmandt
telia.com
"Dan Anderson" <dan
mathjunkies.com> skrev i meddelandet
news:1063834084.2453.49.camel
syr-24-58-14-3.twcny.rr.com...
> I have a section of my script where I call gethostbyname($hostname) .
> For some host names that are not registered (according to register.com)
> I am still getting an IP address returned?
>
> What is happening?
>
> -Dan
attached mail follows:
> > I have a section of my script where I call gethostbyname($hostname) .
> > For some host names that are not registered (according to register.com)
> > I am still getting an IP address returned?
> >
> > What is happening?
> Well, try only the toplevel domain... For example, I have like
> hns345667dsvdtrt34.telia.com, I doubt that is registred, but
> telia.com sure
> is... I hope.. :S
telia.com is a second level, not a top level, .com is the top level in your
example. Also, only looking up the second level is a bad idea. In many
cases the third level is actually being used to signify something (the
host). All of the hosts in our server farm use the same second level, but
the third level signifies which box I'm talking about. If I do an nslookup
on my second level I'm going to get the IP bound to the webserver that hosts
the corporate site (because that's how we have it set up), but if I do an
nslookup on servername.domain.com (servername being the name of one of the
servers in our farm) I'm going to get the IP for the host designated by
servername. For example, ftb.ca.gov (California franchise tax board) is not
the same as dot.ca.gov (California Dept. of Transportation) which is not the
same as cdfa.ca.gov (department of food and agriculture), but they all fall
under the ca.gov second level because they are all government offices for
the state of California, which falls under the .gov top level because it is
a government branch within the United States.
To answer the original question, verisign has decided it is a good idea to
wildcard the .com and .net TLDs to point to http://sitefinder.verisign.com,
so if you do a look up on a non-existant domain in those TDLs it will now
give an IP. I believe a BIND patch has already been released to negate this
change.
attached mail follows:
Ok, I was wrong about top level stuff... My point was that you don't
register every box at like register.com, you only register secondlevel..
Register.com only checks second level (I guess), while php queries the name
on some dns server, which gives php another dns server and so on, until it
finds what it's looking for... Gah, jusst forget I even started typing this
message, I have no real idea what I'm talking about...
--
// DvDmanDT
MSN: dvdmandt
hotmail.com
Mail: dvdmandt
telia.com
"Jennifer Goodie" <goodie
apollointeractive.com> skrev i meddelandet
news:NEBBIJJIKBGCCCNKMPBCCEEFJIAA.goodie
apollointeractive.com...
> > > I have a section of my script where I call gethostbyname($hostname) .
> > > For some host names that are not registered (according to
register.com)
> > > I am still getting an IP address returned?
> > >
> > > What is happening?
>
> > Well, try only the toplevel domain... For example, I have like
> > hns345667dsvdtrt34.telia.com, I doubt that is registred, but
> > telia.com sure
> > is... I hope.. :S
>
> telia.com is a second level, not a top level, .com is the top level in
your
> example. Also, only looking up the second level is a bad idea. In many
> cases the third level is actually being used to signify something (the
> host). All of the hosts in our server farm use the same second level, but
> the third level signifies which box I'm talking about. If I do an
nslookup
> on my second level I'm going to get the IP bound to the webserver that
hosts
> the corporate site (because that's how we have it set up), but if I do an
> nslookup on servername.domain.com (servername being the name of one of the
> servers in our farm) I'm going to get the IP for the host designated by
> servername. For example, ftb.ca.gov (California franchise tax board) is
not
> the same as dot.ca.gov (California Dept. of Transportation) which is not
the
> same as cdfa.ca.gov (department of food and agriculture), but they all
fall
> under the ca.gov second level because they are all government offices for
> the state of California, which falls under the .gov top level because it
is
> a government branch within the United States.
>
> To answer the original question, verisign has decided it is a good idea to
> wildcard the .com and .net TLDs to point to
http://sitefinder.verisign.com,
> so if you do a look up on a non-existant domain in those TDLs it will now
> give an IP. I believe a BIND patch has already been released to negate
this
> change.
attached mail follows:
BIND9 isn't the only game in town... Here's something from bugtraq
Worth noting (although a bit OT for php-general) that versign mananged to
introduce a nice little XSS w/ this- see full-disclosure list for details
-Evan
---------- Forwarded Message ----------
Subject: Re: Verisign abusing .COM/.NET monopoly, BIND releases new
Date: Wed, 17 Sep 2003 18:19:32 -0400 (EDT)
From: Damaged Industries <damaged
damaged.no-ip.com>
To: bugtraq
securityfocus.com
On Wed, 17 Sep 2003, SR wrote:
> > This is simply amazing, Verisign has just turned the .COM and .NET TLD
> > DNS servers up-side-down for their own economical gain and, in doing so,
> > disrupted network traffic for most of the Internet. Mail administrators
> > who use any non-existant DNSBL to mark email as spam suddenly has all
> > their mails deleted, people using localhost.localdomain.com on their
> > servers for administrative purposes are scrambling to find out the cause
> > of their problems and DNS problems arise everywhere as neg caching is
> > essentially disabled and all DNS caches have to cache each and every
> > randomly typed DNS query.
> >
> > The BIND patch that prevents this should be released Wednesday.
>
> djbdns already has a patch (make that two patches).
>
> They are available from djbdns.org
Several patches have been out:
Bind9 patch:
http://www.isc.org/products/BIND/delegation-only.html
Bind8 patch:
http://achurch.org/bind-verisign-patch.html
Djbdns patch:
http://tinydns.org/djbdns-1.05-ignoreip.patch
PowerDNS patch:
http://www.imperialviolet.org/binary/powerdns.patch
Userfriendly :)
http://ars.userfriendly.org/cartoons/?id=20030917&mode=classic
----
-- damaged
-------------------------------------------------------
On Wednesday 17 September 2003 04:31 pm, Jennifer Goodie wrote:
> > > I have a section of my script where I call gethostbyname($hostname) .
> > > For some host names that are not registered (according to register.com)
> > > I am still getting an IP address returned?
> > >
> > > What is happening?
> >
> > Well, try only the toplevel domain... For example, I have like
> > hns345667dsvdtrt34.telia.com, I doubt that is registred, but
> > telia.com sure
> > is... I hope.. :S
>
> telia.com is a second level, not a top level, .com is the top level in your
> example. Also, only looking up the second level is a bad idea. In many
> cases the third level is actually being used to signify something (the
> host). All of the hosts in our server farm use the same second level, but
> the third level signifies which box I'm talking about. If I do an nslookup
> on my second level I'm going to get the IP bound to the webserver that
> hosts the corporate site (because that's how we have it set up), but if I
> do an nslookup on servername.domain.com (servername being the name of one
> of the servers in our farm) I'm going to get the IP for the host designated
> by servername. For example, ftb.ca.gov (California franchise tax board) is
> not the same as dot.ca.gov (California Dept. of Transportation) which is
> not the same as cdfa.ca.gov (department of food and agriculture), but they
> all fall under the ca.gov second level because they are all government
> offices for the state of California, which falls under the .gov top level
> because it is a government branch within the United States.
>
> To answer the original question, verisign has decided it is a good idea to
> wildcard the .com and .net TLDs to point to http://sitefinder.verisign.com,
> so if you do a look up on a non-existant domain in those TDLs it will now
> give an IP. I believe a BIND patch has already been released to negate
> this change.
attached mail follows:
* Thus wrote Jennifer Goodie (goodie
apollointeractive.com):
> > > I have a section of my script where I call gethostbyname($hostname) .
> > > For some host names that are not registered (according to register.com)
> > > I am still getting an IP address returned?
> > >
> > > What is happening?
>
> > Well, try only the toplevel domain... For example, I have like
> > hns345667dsvdtrt34.telia.com, I doubt that is registred, but
> > telia.com sure
> > is... I hope.. :S
>
>
> To answer the original question, verisign has decided it is a good idea to
> wildcard the .com and .net TLDs to point to http://sitefinder.verisign.com,
> so if you do a look up on a non-existant domain in those TDLs it will now
> give an IP. I believe a BIND patch has already been released to negate this
> change.
hmm.. that explains quite a bit. I was wondering how opera got
there on a lookup that should have been bad.
Time to block that IP now.. geesh. I dont want to be going to that
site if the lookup fails.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
Once again, I ask a stupid question, wotk on it some more and find the
answer under my nose.
Thanks anyway, I have what I'm looking for.
Walter
BTW: If you would like to know what I did, or even look at it and comment...
===================
/*
American Standard Format - accepts SLASH or DASH
"02/03/1994 14:15:29 EST" -- American Standard 24 Hr Clock
"02/03/1994 02:15:29 PM EST" -- American Standard 12 Hr Clock
"02/03/1994 14:15:29" -- zone is optional
"02/03/1994" -- only date
Will work on dates before 1000, but must have leading ZEROs
*/
$strDate = "01-02-1994";
file://$strDate = "01/02/1994 01:02:03";
file://$strDate = "01/02/1994 01:02:03 GMT";
file://$strDate = "01/02/1994 01:02:03 AM GMT";
$regExp = "^"; // Start at begining of string
$regExp .= "("; // Start Date Block
$regExp = "([0-9]{2})[-|\/]"; // Month DASH or SLASH
$regExp .= "([0-9]{2})[-|\/]"; // Day DASH or SLASH
$regExp .= "([0-9]{4})"; // Year
$regExp .= ")?"; // End Time Block
$regExp .= "("; // Start Time Block
$regExp .= "[[:space:]]"; // Space
$regExp .= "([0-9]{2}):"; // Hour COLON
$regExp .= "([0-9]{2}):"; // Minute COLON
$regExp .= "([0-9]{2})"; // Seconds
$regExp .= "("; // Start Meridium Block
$regExp .= "[[:space:]]"; // Space
$regExp .= "[a-zA-Z]{1,2}"; // AM/PM
$regExp .= ")?"; // End Meridium Block
$regExp .= "("; // Start TZ Block
$regExp .= "[[:space:]]"; // Space
$regExp .= "[a-z|A-Z]{1,3}"; // Time Zone
$regExp .= ")?"; // End TZ Block
$regExp .= ")?"; // End Time Block
$regExp .= "$"; // End at end of string
if (ereg ($regExp, $strDate, $regs))
{
echo '<pre>';
echo '|' . $strDate . '|' . '<br />';
echo print_r($regs);
echo '</pre>';
}
else
{
echo "Invalid date format: $strDate";
}
attached mail follows:
Hi there why is it that innodb is playing up with persistant connections i
turned it off and it seems fine for now , also sometimes mysql_query on
innodb tables dont result true even though the query is fine, so therefore
if ($this->query()) {
do something
} else {
die error
}
sometimes dies an error with no mysql_error produced. :\
attached mail follows:
----- Original Message -----
From: "Juan Carlos Borrero" <juancabo
thesector.net>
To: <php-general
lists.php.net>
Sent: Wednesday, September 17, 2003 8:11 PM
Subject: Re: [PHP] Problem sending HTML formated mail
>
> ----- Original Message -----
> From: "David T-G" <davidtg
justpickone.org>
> To: "Juan Carlos Borrero" <juancabo
thesector.net>
> Sent: Wednesday, September 17, 2003 7:48 PM
> Subject: Re: [PHP] Problem sending HTML formated mail
>
> Acording with David Instructios i am attaching the 2 examples of the same
> mail generates with 5 seconds of difference producen this two results.
>
> Thanks
>
> Juan Carlos
>
attached mail follows:
* Thus wrote Juan Carlos Borrero (juancabo
thesector.net):
>
> ----- Original Message -----
> From: "Juan Carlos Borrero" <juancabo
thesector.net>
> To: <php-general
lists.php.net>
> Sent: Wednesday, September 17, 2003 8:11 PM
> Subject: Re: [PHP] Problem sending HTML formated mail
>
>
> >
> > ----- Original Message -----
> > From: "David T-G" <davidtg
justpickone.org>
> > To: "Juan Carlos Borrero" <juancabo
thesector.net>
> > Sent: Wednesday, September 17, 2003 7:48 PM
> > Subject: Re: [PHP] Problem sending HTML formated mail
> >
> > Acording with David Instructios i am attaching the 2 examples of the same
> > mail generates with 5 seconds of difference producen this two results.
> >
> > Thanks
> >
> > Juan Carlos
Your emails are an utter confusion.
first, you original message (which I had to go digging for, to
recall what your problem was) was posted in another thread.
Second, this email content is quoting the wrong person with your
text inside his quote.
Third, Your attachments are all messed-up. I can't make heads or
tails as to what is what. Besides that attachements are not suppose
to be posted to the list.
Fourth, I finally make something out of it and your code is very
hard to read, you have commented out code here and there.
Fifth, Your email attatchments are way to complicated to decipher,
you have special headers and the like inside of them, and is very
difficult to determain exactly what the problem is.
Try to make things simple and go from there. I would also
suggest using a class of some sort that works already, such as was
suggested ealier (phpmailer.)
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
Hi all,
I have a a timestamp in a DB (14 digits) that I want to display like I
want in my pages. I tried to use strtotime, mktime and date functions
with no success... it always return the current timestamp instead of the
one I have stored. This is what I've done so far:
for ($x = 0; $x < $num_rows; $x++)
{
$row = mysql_fetch_array($result);
$date1 = strtotime($row[lugar_lastinsert]);
&n