php-general Digest 22 Jan 2011 11:17:37 -0000 Issue 7146

2011-01-22 Thread php-general-digest-help

php-general Digest 22 Jan 2011 11:17:37 - Issue 7146

Topics (messages 310960 through 310971):

Re: Organisational question: surely someone has implemented many Boolean values 
(tags) and a solution exist
310960 by: David Harkness

Re: array to var - with different name
310961 by: Donovan Brooke
310963 by: Donovan Brooke

Re: email address syntax checker
310962 by: Marc Guay

Script mysteriously restarting
310964 by: Richard S. Crawford
310965 by: Jim Lucas
310966 by: Richard S. Crawford

Parse question
310967 by: Ron Piggott
310968 by: Joshua Kehn
310969 by: Nicholas Kell
310970 by: Ron Piggott

JunkBox - File Download Analytics
310971 by: Lukasz Cepowski

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
On Fri, Jan 21, 2011 at 4:44 AM, Dotan Cohen dotanco...@gmail.com wrote:

 Then I would have to check what values are available when inserting,
 and possibly normalise every so often. I'll think about that, and when
 I have enough data in the database I'll set up a test system to play
 with the possibility.


Yes, it's a much more complicated process, and one that I wouldn't enter
into without verifying there was a performance problem. The neat thing is
you could do this at any point as you can renumber the left and right values
at will--as long as you don't *reorder* them.


 I see, thanks. Good point about making sure that the problem exists

before trying to fix it, I've seen people optimise away where there is
 no bottleneck.


People who love to work on complicated problems often fall victim to
premature optimization because it's fun to do. I was guilty of this myself
earlier in my career, but as CPUs and memory and disk speeds increased over
the decades, it's harder to justify it. At least back then the optimization
that wasn't *necessary* still had a good payoff. Nowadays you can waste days
shaving 10ms off of an operation that takes 1s. Congratulations, you've just
poured $$ down the drain. But boy wasn't that fun! :)

Good luck with the implementation. I'd love to hear how it pans out once
you're done, and I'm sure the list would find it useful as well.

David
---End Message---
---BeginMessage---

Paul M Foster wrote:
[snip]

Shawn, I don't know if I have a good reason, other than I rather like
working with string vars instead of array vars from $_REQUEST for
(sticky forms and conditionals). I can check/verify them as well in the
process.


You should probably get used to dealing with the array variables.
However, you can also look at the extract() function. It won't do
exactly what you want, but it will pull the array keys/values into the
current symbol table. Use with caution (note the second parameter to the
function).

Paul



Well, It occurs to me that you can't code in PHP without getting use to 
dealing with arrays. ;-)


I just much rather like typing:
input name=f_email value=?PHP if (isset($t_email)) { print 
htmlspecialchars($t_email);} ? /


Instead of:
input name=f_email value=?PHP if (isset($_GET['f_email'])) { print 
htmlspecialchars($_GET['f_email']);} ? /


or

if ($t_ok) {

}

instead of:
if ($_GET['f_ok']) {

}

Save's a lot of typing time as far as I can tell.

Donovan





--
D Brooke
---End Message---
---BeginMessage---

Donovan Brooke wrote:
[snip]

if ($t_ok) {

}



Small correction.. with my established naming convention.. the above 
ideally would be:

 if ($b_ok) {

 }


D

--
D Brooke
---End Message---
---BeginMessage---
 In fact I'm wondering why the OP doesn't just do what every other site
 seems to do - accept the registering user's input as valid, and ask them
 to validate it by sending them an email address to that address.

It still makes sense to validate the format of the address as soon as
possible.  The way you describe it the problem will have to be dealt
with further down the pipe when email is sent to haha your form
doesn't have@validation!.  Why not grab it before it gets that far?
---End Message---
---BeginMessage---
I've got a massive PHP script which takes nearly an hour to run. Sometimes,
when it comes close to the end, it mysterious restarts itself and I have to
wait for another hour for it to complete.

Is there any reason why a PHP script would restart itself like this?

FWIW, I'm running PHP5 with Apache 2 on a Linux server.

-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com
---End Message---
---BeginMessage---
On 1/21/2011 12:37 PM, Richard S. Crawford wrote:
 I've got a massive PHP script which takes nearly an hour to run. Sometimes,
 when it comes close to the end, it mysterious restarts itself and I have to
 wait 

php-general Digest 23 Jan 2011 00:52:43 -0000 Issue 7147

2011-01-22 Thread php-general-digest-help

php-general Digest 23 Jan 2011 00:52:43 - Issue 7147

Topics (messages 310972 through 310975):

Difference between CURLOPT_URL and wget
310972 by: Ashim Kapoor
310974 by: Tommy Pham

Re: JunkBox - File Download Analytics
310973 by: Tommy Pham

Re: No SMTP server? Can't get mail()
310975 by: Paul S

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
Dear All,

I am a beginner at PHP. I was studying the curl library and I came across
CURLOPT_URL.I think this can be used similar to wget ? What would be the
major differences in these 2 ?

Thank you,
Ashim
---End Message---
---BeginMessage---
 -Original Message-
 From: Ashim Kapoor [mailto:ashimkap...@gmail.com]
 Sent: Saturday, January 22, 2011 5:09 AM
 To: php-gene...@lists.php.net
 Subject: [PHP] Difference between CURLOPT_URL and wget
 
 Dear All,
 
 I am a beginner at PHP. I was studying the curl library and I came across
 CURLOPT_URL.I think this can be used similar to wget ? What would be the
 major differences in these 2 ?
 
 Thank you,
 Ashim

See the official info at #1 search result [1] from search [2].

Regards,
Tommy

[1] http://daniel.haxx.se/docs/curl-vs-wget.html
[2]
http://www.google.com/search?q=CURL_OPT+vs+wgetie=utf-8oe=utf-8aq=tclien
t=firefox-arlz=1R1GGLL_en___US395

---End Message---
---BeginMessage---
 -Original Message-
 From: Lukasz Cepowski [mailto:c...@freecode.pl]
 Sent: Saturday, January 22, 2011 3:17 AM
 To: php-gene...@lists.php.net
 Subject: [PHP] JunkBox - File Download Analytics
 
 Hello,
 
 recently I had a trouble with tracking how many downloads of files I get,
 that is why I have decided to write my own simple solution and now I would
 like to share with product that can be usefull for many of You!
 
 JunkBox :: File Download Analytics
 
 http://junkbox.ognisco.com
 
 JunkBox is a lightweight web application that can track your files and
record
 every single click. You can get the total number of hits and statistics on
who
 downloaded your files and how and when. Moreover it is completely
 transparent so every link looks like an ordinary link to an ordinary file.
 
 For example this looks like an ordinary link to an ordinary file:
 
 http://files.ognisco.com/junkbox/junkbox-0.2-r93-20110120.zip
 
 but, just add '?stats' at the end:
 
 http://files.ognisco.com/junkbox/junkbox-0.2-r93-20110120.zip?stats
 
 and here you can get statistics of how many hits per day this particular
file
 has.
 
 What's more you can go and list files in the directory where you can see
hits
 counter for every file inside.
 
 http://files.ognisco.com/junkbox/
 
 And at the end you can get the list of the most popular files:
 
 http://files.ognisco.com/?top
 
 Also you can create your own custom theme.
 
 JunkBox is distributed under terms of GNU GPL license.
 
 Home page: http://junkbox.ognisco.com
 Online demo: http://junkbox.ognisco.com/demo
 
 Feel free to download, test and use JunkBox.
 Any feedback highly appreciated.
 
 Thanks,
 
 Lukasz (cepa) Cepowski
 Krakow, Poland
 +48 502 670 711
 www.ognisco.com
 
 
Hi Lukasz,

This tool looks great.  Since I couldn't find the info on the site or in
your e-mail.  Does keep track of aborted/cancel downloads in progress also?

Thanks,
Tommy

---End Message---
---BeginMessage---

On Fri, 21 Jan 2011 13:41:21 +0700, Peter Lind peter.e.l...@gmail.com
wrote:

Probably not the solution you were looking for, but I've always found  
mail()

very unstable and I tend to use a mail library instead. Like phpmailer or
swiftmailer. Easier to configure and figure out problems with.

Regards
Peter


Peter, that is warranted advice here.

I'm a little new to PHP. I'm set up to develop Apache/PHP/MySQL on my PC
uploading results to a unix server. My situation here is that I am trying
to get a PHP Mailing List program running for a friend's business web site
(on unix). That program has 2 options for mailing: 1) mail()/SMTP and
2) phpmailer options. Mail()/SMTP works, at least, on my PC. But I can't
get either of
the two emailing options to work on the UNIX server. (Whatever those mail
problems are, it is mangled with odd PHP/MySQL problems on unix).
I'm just 'back here' starting debugging with the mail()/SMTP option on
unix and my conclusion based on feedback above (thank you) is that email
IS reaching the unix SMTP server but is not being forwarded (and that's
unresolved now).

My mentioned SMTP server echo problem is irrelevant. Maybe they fixed it
last night, or maybe I was smoking something yesterday. It IS echoing
correctly.
I finally figured out that part of my problem was misunderstanding a
warning
message caused by my not single quoting SMTP (yikes!).

Or maybe I 

[PHP] JunkBox - File Download Analytics

2011-01-22 Thread Lukasz Cepowski

Hello,

recently I had a trouble with tracking how many downloads of files I 
get, that is why I have decided to write my own simple solution and now 
I would like to share with product that can be usefull for many of You!


JunkBox :: File Download Analytics

http://junkbox.ognisco.com

JunkBox is a lightweight web application that can track your files and 
record every single click. You can get the total number of hits and 
statistics on who downloaded your files and how and when. Moreover it 
is completely transparent so every link looks like an ordinary link to 
an ordinary file.


For example this looks like an ordinary link to an ordinary file:

http://files.ognisco.com/junkbox/junkbox-0.2-r93-20110120.zip

but, just add '?stats' at the end:

http://files.ognisco.com/junkbox/junkbox-0.2-r93-20110120.zip?stats

and here you can get statistics of how many hits per day this particular 
file has.


What's more you can go and list files in the directory where you can see 
hits counter for every file inside.


http://files.ognisco.com/junkbox/

And at the end you can get the list of the most popular files:

http://files.ognisco.com/?top

Also you can create your own custom theme.

JunkBox is distributed under terms of GNU GPL license.

Home page: http://junkbox.ognisco.com
Online demo: http://junkbox.ognisco.com/demo

Feel free to download, test and use JunkBox.
Any feedback highly appreciated.

Thanks,

Lukasz (cepa) Cepowski
Krakow, Poland
+48 502 670 711
www.ognisco.com


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



[PHP] Difference between CURLOPT_URL and wget

2011-01-22 Thread Ashim Kapoor
Dear All,

I am a beginner at PHP. I was studying the curl library and I came across
CURLOPT_URL.I think this can be used similar to wget ? What would be the
major differences in these 2 ?

Thank you,
Ashim


RE: [PHP] JunkBox - File Download Analytics

2011-01-22 Thread Tommy Pham
 -Original Message-
 From: Lukasz Cepowski [mailto:c...@freecode.pl]
 Sent: Saturday, January 22, 2011 3:17 AM
 To: php-general@lists.php.net
 Subject: [PHP] JunkBox - File Download Analytics
 
 Hello,
 
 recently I had a trouble with tracking how many downloads of files I get,
 that is why I have decided to write my own simple solution and now I would
 like to share with product that can be usefull for many of You!
 
 JunkBox :: File Download Analytics
 
 http://junkbox.ognisco.com
 
 JunkBox is a lightweight web application that can track your files and
record
 every single click. You can get the total number of hits and statistics on
who
 downloaded your files and how and when. Moreover it is completely
 transparent so every link looks like an ordinary link to an ordinary file.
 
 For example this looks like an ordinary link to an ordinary file:
 
 http://files.ognisco.com/junkbox/junkbox-0.2-r93-20110120.zip
 
 but, just add '?stats' at the end:
 
 http://files.ognisco.com/junkbox/junkbox-0.2-r93-20110120.zip?stats
 
 and here you can get statistics of how many hits per day this particular
file
 has.
 
 What's more you can go and list files in the directory where you can see
hits
 counter for every file inside.
 
 http://files.ognisco.com/junkbox/
 
 And at the end you can get the list of the most popular files:
 
 http://files.ognisco.com/?top
 
 Also you can create your own custom theme.
 
 JunkBox is distributed under terms of GNU GPL license.
 
 Home page: http://junkbox.ognisco.com
 Online demo: http://junkbox.ognisco.com/demo
 
 Feel free to download, test and use JunkBox.
 Any feedback highly appreciated.
 
 Thanks,
 
 Lukasz (cepa) Cepowski
 Krakow, Poland
 +48 502 670 711
 www.ognisco.com
 
 
Hi Lukasz,

This tool looks great.  Since I couldn't find the info on the site or in
your e-mail.  Does keep track of aborted/cancel downloads in progress also?

Thanks,
Tommy


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



RE: [PHP] Difference between CURLOPT_URL and wget

2011-01-22 Thread Tommy Pham
 -Original Message-
 From: Ashim Kapoor [mailto:ashimkap...@gmail.com]
 Sent: Saturday, January 22, 2011 5:09 AM
 To: php-general@lists.php.net
 Subject: [PHP] Difference between CURLOPT_URL and wget
 
 Dear All,
 
 I am a beginner at PHP. I was studying the curl library and I came across
 CURLOPT_URL.I think this can be used similar to wget ? What would be the
 major differences in these 2 ?
 
 Thank you,
 Ashim

See the official info at #1 search result [1] from search [2].

Regards,
Tommy

[1] http://daniel.haxx.se/docs/curl-vs-wget.html
[2]
http://www.google.com/search?q=CURL_OPT+vs+wgetie=utf-8oe=utf-8aq=tclien
t=firefox-arlz=1R1GGLL_en___US395


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



Re: [PHP] No SMTP server? Can't get mail()

2011-01-22 Thread Paul S

On Fri, 21 Jan 2011 13:41:21 +0700, Peter Lind peter.e.l...@gmail.com
wrote:

Probably not the solution you were looking for, but I've always found  
mail()

very unstable and I tend to use a mail library instead. Like phpmailer or
swiftmailer. Easier to configure and figure out problems with.

Regards
Peter


Peter, that is warranted advice here.

I'm a little new to PHP. I'm set up to develop Apache/PHP/MySQL on my PC
uploading results to a unix server. My situation here is that I am trying
to get a PHP Mailing List program running for a friend's business web site
(on unix). That program has 2 options for mailing: 1) mail()/SMTP and
2) phpmailer options. Mail()/SMTP works, at least, on my PC. But I can't
get either of
the two emailing options to work on the UNIX server. (Whatever those mail
problems are, it is mangled with odd PHP/MySQL problems on unix).
I'm just 'back here' starting debugging with the mail()/SMTP option on
unix and my conclusion based on feedback above (thank you) is that email
IS reaching the unix SMTP server but is not being forwarded (and that's
unresolved now).

My mentioned SMTP server echo problem is irrelevant. Maybe they fixed it
last night, or maybe I was smoking something yesterday. It IS echoing
correctly.
I finally figured out that part of my problem was misunderstanding a
warning
message caused by my not single quoting SMTP (yikes!).

Or maybe I was just
enraged over my lack of success all day yesterday to confirm Apache server
information on the unix server (which would help me guarantee that I have
the same Apache/PHP/MySQL configurations between the PC and unix servers).
But today the SMTP server info IS echo'd on the unix server. From the Unix
server ...

---
?php
function apacheversion() {
  $ver = split([/ ],$_SERVER['SERVER_SOFTWARE']);
  $apver = $ver[1] $ver[2];
   return $apver;
}
echo br;
print ('Apache Version: ' . apacheversion());
echo br;
print ($_SERVER[SERVER_SIGNATURE]);
print ($_SERVER[SERVER_SOFTWARE]);
echo br;
?

?php
echo br;
echo PHP_OS;
$os = php_uname();
echo 'OS' . $os;
echo brbr;
?

?php
error_reporting(E_ALL);
echo 'display_errors = ' . ini_get('display_errors') . \n;
echo 'register_globals = ' . ini_get('register_globals') . \n;
echo brbr;
echo SMTP host:  . ini_get(SMTP);
echo br;
echo smtp_port:  . ini_get(smtp_port);
echo br;
echo sendmail_from:  . ini_get(sendmail_from);
echo brbr;
?

?php
// prints e.g. 'Current PHP version: 4.1.1'
echo 'Current PHP version: ' . phpversion();
echo brbr;
// prints e.g. '2.0' or nothing if the extension isn't enabled
echo phpversion('mysqli');
echo brbr;
?

?php
$link = mysql_connect('localhost', 'xx', 'xx');
if (!$link) {
  die('Could not connect: ' .
mysql_error());
}
printf(MySQL server version: %s\n, mysql_get_server_info());
echo brbr;
?

?php
phpinfo();
?


gets:


Apache Version:
Apache

LinuxOSLinux clientx.xx.com 2.4.33.2 #4 SMP Wed Aug 23 10:41:21 EDT
2006 i686

display_errors = 1 register_globals = 1

SMTP host: localhost
smtp_port: 25
sendmail_from:

Current PHP version: 4.4.4


MySQL server version: 5.0.67-community


Warning: phpinfo() has been disabled for security reasons in
/home/xxx/php/unameunix.php on line 57




--
Using Opera's revolutionary email client: http://www.opera.com/mail/

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



Re: [PHP] No SMTP server? Can't get mail()

2011-01-22 Thread David Robley
Paul S wrote:

 On Fri, 21 Jan 2011 13:41:21 +0700, Peter Lind peter.e.l...@gmail.com
 wrote:
 
 Probably not the solution you were looking for, but I've always found
 mail()
 very unstable and I tend to use a mail library instead. Like phpmailer or
 swiftmailer. Easier to configure and figure out problems with.

 Regards
 Peter
 
 Peter, that is warranted advice here.
 
 I'm a little new to PHP. I'm set up to develop Apache/PHP/MySQL on my PC
 uploading results to a unix server. My situation here is that I am trying
 to get a PHP Mailing List program running for a friend's business web site
 (on unix). That program has 2 options for mailing: 1) mail()/SMTP and
 2) phpmailer options. Mail()/SMTP works, at least, on my PC. But I can't
 get either of
 the two emailing options to work on the UNIX server. (Whatever those mail
 problems are, it is mangled with odd PHP/MySQL problems on unix).
 I'm just 'back here' starting debugging with the mail()/SMTP option on
 unix and my conclusion based on feedback above (thank you) is that email
 IS reaching the unix SMTP server but is not being forwarded (and that's
 unresolved now).
 
 My mentioned SMTP server echo problem is irrelevant. Maybe they fixed it
 last night, or maybe I was smoking something yesterday. It IS echoing
 correctly.
 I finally figured out that part of my problem was misunderstanding a
 warning
 message caused by my not single quoting SMTP (yikes!).
 
 Or maybe I was just
 enraged over my lack of success all day yesterday to confirm Apache server
 information on the unix server (which would help me guarantee that I have
 the same Apache/PHP/MySQL configurations between the PC and unix servers).
 But today the SMTP server info IS echo'd on the unix server. From the Unix
 server ...
 

Nobody seems to have mentioned it, but the SMTP info is only needed on a Win
system. The following is an extract from a default php.ini file:

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = m...@example.com

; For Unix only.  You may supply arguments as well
(default: sendmail -t -i).
;sendmail_path =

; Force the addition of the specified parameters to be passed as extra
parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

mail() should be functional; if mail() is returning true then your next step
in the debug process would be to check the mail logs, if they are
accessible to you.

On the other hand, using an SMTP class will give you a bit more
functionality.




Cheers
-- 
David Robley

Supernovae are a Blast
Today is Pungenday, the 23rd day of Chaos in the YOLD 3177. 


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



[PHP] Different sessions, same client

2011-01-22 Thread Paul M Foster
Storing any sort of login/auth data in cookies has regularly been panned
on this list. The preference seems to be to store whatever login/auth
information *must* be stored in the $_SESSION variable.

Well and good. My problem, however, is that I have multiple applications
in different tabs running on the same server, which may all use the same
sub-variables, like username. As a result, they run into each other.
One application will think I'm logged in when I'm not logged in to that
application, but to another in the same browser on the same box.

So my question is how to prevent this using the standard PHP functions
relating to sessions. I'd like different applications in different tabs
on the same box/browser to have different sessions, so they don't share
data.

Thoughts?

Paul

-- 
Paul M. Foster
http://noferblatz.com


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