php-general Digest 2 Feb 2013 04:40:53 -0000 Issue 8109

2013-02-01 Thread php-general-digest-help

php-general Digest 2 Feb 2013 04:40:53 - Issue 8109

Topics (messages 320136 through 320142):

how to calculate how much data does each ip address use ?
320136 by: Bulent  Malik
320137 by: Sean Greenslade
320139 by: Bulent  Malik
320140 by: Sean Greenslade
320141 by: Mike Mackintosh

Re: Complex MySQL query for lowest price
320138 by: Angela Barone

Integer
320142 by: Ron Piggott

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---
Hello

I have  a freebsdbox firewall . also I have some internet customers.  I want
to save how much data they used in a table ( such as mysql table ) for each
ip address.
Apache2, php5 and mysql5.5 work on the box.

How can I do it ?  any script or tool.

Thanks

---End Message---
---BeginMessage---
This task is not really suited for php. I would suggest looking into Ntop.
It does exactly what you described.
On Feb 1, 2013 9:40 AM, Bulent Malik bma...@ihlas.net.tr wrote:

 Hello

 I have  a freebsdbox firewall . also I have some internet customers.  I
 want
 to save how much data they used in a table ( such as mysql table ) for each
 ip address.
 Apache2, php5 and mysql5.5 work on the box.

 How can I do it ?  any script or tool.

 Thanks


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


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


This task is not really suited for php. I would suggest looking into Ntop.
It does exactly what you described.

 Hello

 I have  a freebsdbox firewall . also I have some internet customers.  
 I want to save how much data they used in a table ( such as mysql 
 table ) for each ip address.
Apache2, php5 and mysql5.5 work on the box.

 How can I do it ?  any script or tool.

 Thanks

How can i save in table using ntop ?  is there any document ? 

---End Message---
---BeginMessage---
On Feb 1, 2013 10:25 AM, Bulent Malik bma...@ihlas.net.tr wrote:



 This task is not really suited for php. I would suggest looking into
Ntop.
 It does exactly what you described.

  Hello
 
  I have  a freebsdbox firewall . also I have some internet customers.
  I want to save how much data they used in a table ( such as mysql
  table ) for each ip address.
 Apache2, php5 and mysql5.5 work on the box.
 
  How can I do it ?  any script or tool.
 
  Thanks

 How can i save in table using ntop ?  is there any document ?


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


Read the man pages. There are sql export options that you can specify on
run.
---End Message---
---BeginMessage---


 Original message 
From: Sean Greenslade zootboys...@gmail.com 
Date:  
To: Bulent Malik bma...@ihlas.net.tr 
Cc: php-gene...@lists.php.net 
Subject: RE: [PHP] how to calculate how much data does each ip address use ? 
 
On Feb 1, 2013 10:25 AM, Bulent Malik bma...@ihlas.net.tr wrote:



 This task is not really suited for php. I would suggest looking into
Ntop.
 It does exactly what you described.

  Hello
 
  I have  a freebsdbox firewall . also I have some internet customers.
  I want to save how much data they used in a table ( such as mysql
  table ) for each ip address.
 Apache2, php5 and mysql5.5 work on the box.
 
  How can I do it ?  any script or tool.
 
  Thanks

 How can i save in table using ntop ?  is there any document ?


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



Look at www.highonphp.com/regex-pattern-parsing-ifconfig

You can use exec to run ifconfig and parse the output using the above.---End Message---
---BeginMessage---
Thank you for everyone's input.  Someone suggested the MySQL list, so I 
posted my question there and got the answer I needed.

Regards,
Angela---End Message---
---BeginMessage---
In the following the “2.” means a moderator response and “25” is the account # 
of the moderator.   

?php

$author = 2.00025

?

How can I get the 25 by itself?  
- I want to drop the “2.” and remove all the zero’s

Would it be best to turn this into a STRING?

Any suggestions?


Ron Piggott



www.TheVerseOfTheDay.info 
---End Message---


[PHP] how to calculate how much data does each ip address use ?

2013-02-01 Thread Bulent Malik
Hello

I have  a freebsdbox firewall . also I have some internet customers.  I want
to save how much data they used in a table ( such as mysql table ) for each
ip address.
Apache2, php5 and mysql5.5 work on the box.

How can I do it ?  any script or tool.

Thanks


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



Re: [PHP] how to calculate how much data does each ip address use ?

2013-02-01 Thread Sean Greenslade
This task is not really suited for php. I would suggest looking into Ntop.
It does exactly what you described.
On Feb 1, 2013 9:40 AM, Bulent Malik bma...@ihlas.net.tr wrote:

 Hello

 I have  a freebsdbox firewall . also I have some internet customers.  I
 want
 to save how much data they used in a table ( such as mysql table ) for each
 ip address.
 Apache2, php5 and mysql5.5 work on the box.

 How can I do it ?  any script or tool.

 Thanks


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




Re: [PHP] Complex MySQL query for lowest price

2013-02-01 Thread Angela Barone
Thank you for everyone's input.  Someone suggested the MySQL list, so I 
posted my question there and got the answer I needed.

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



RE: [PHP] how to calculate how much data does each ip address use ?

2013-02-01 Thread Bulent Malik


This task is not really suited for php. I would suggest looking into Ntop.
It does exactly what you described.

 Hello

 I have  a freebsdbox firewall . also I have some internet customers.  
 I want to save how much data they used in a table ( such as mysql 
 table ) for each ip address.
Apache2, php5 and mysql5.5 work on the box.

 How can I do it ?  any script or tool.

 Thanks

How can i save in table using ntop ?  is there any document ? 


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



RE: [PHP] how to calculate how much data does each ip address use ?

2013-02-01 Thread Sean Greenslade
On Feb 1, 2013 10:25 AM, Bulent Malik bma...@ihlas.net.tr wrote:



 This task is not really suited for php. I would suggest looking into
Ntop.
 It does exactly what you described.

  Hello
 
  I have  a freebsdbox firewall . also I have some internet customers.
  I want to save how much data they used in a table ( such as mysql
  table ) for each ip address.
 Apache2, php5 and mysql5.5 work on the box.
 
  How can I do it ?  any script or tool.
 
  Thanks

 How can i save in table using ntop ?  is there any document ?


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


Read the man pages. There are sql export options that you can specify on
run.


RE: [PHP] how to calculate how much data does each ip address use ?

2013-02-01 Thread Mike Mackintosh


 Original message 
From: Sean Greenslade zootboys...@gmail.com 
Date:  
To: Bulent Malik bma...@ihlas.net.tr 
Cc: php-general@lists.php.net 
Subject: RE: [PHP] how to calculate how much data does each ip address use ? 
 
On Feb 1, 2013 10:25 AM, Bulent Malik bma...@ihlas.net.tr wrote:



 This task is not really suited for php. I would suggest looking into
Ntop.
 It does exactly what you described.

  Hello
 
  I have  a freebsdbox firewall . also I have some internet customers.
  I want to save how much data they used in a table ( such as mysql
  table ) for each ip address.
 Apache2, php5 and mysql5.5 work on the box.
 
  How can I do it ?  any script or tool.
 
  Thanks

 How can i save in table using ntop ?  is there any document ?


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



Look at www.highonphp.com/regex-pattern-parsing-ifconfig

You can use exec to run ifconfig and parse the output using the above.

[PHP] Integer

2013-02-01 Thread Ron Piggott
In the following the “2.” means a moderator response and “25” is the account # 
of the moderator.   

?php

$author = 2.00025

?

How can I get the 25 by itself?  
- I want to drop the “2.” and remove all the zero’s

Would it be best to turn this into a STRING?

Any suggestions?


Ron Piggott



www.TheVerseOfTheDay.info 


Re: [PHP] Integer

2013-02-01 Thread tamouse mailing lists
On Fri, Feb 1, 2013 at 10:40 PM, Ron Piggott
ron.pigg...@actsministries.org wrote:
 In the following the “2.” means a moderator response and “25” is the account 
 # of the moderator.

 ?php

 $author = 2.00025

 ?

 How can I get the 25 by itself?
 - I want to drop the “2.” and remove all the zero’s

 Would it be best to turn this into a STRING?

 Any suggestions?

Storing data as a float is a bad idea. Way bad. Also, I think that's
too many significant digits for php to handle in a float.

You should store data in an accessible way. For instance, assuming
there are actually only two pieces of interesting data there, you
could store them as a hash:

php  $author = Array('account' = 25, 'response' = 2);
php  var_dump($author);
array(2) {
  [account]=
  int(25)
  [response]=
  int(2)
}

If that data is coming from somewhere beyond your control and is
presented as that, then parsing as a string will be the way to go.
Again, assuming there is no other useful information, a simple regexp
to parse it would be:

php  if (preg_match('/(\d+)\.0+(\d+)/','2.00025',$matches))
{
php {   $author = Array('account' = $matches[2], 'response' = $matches[1]);
php { }
php  // else handle error if need be
php  var_dump($author);
array(2) {
  [account]=
  string(2) 25
  [response]=
  string(1) 2
}

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



Re: [PHP] Integer

2013-02-01 Thread Adam Richardson
On Fri, Feb 1, 2013 at 11:40 PM, Ron Piggott ron.pigg...@actsministries.org
 wrote:

 How can I get the 25 by itself?
 - I want to drop the “2.” and remove all the zero’s

 Would it be best to turn this into a STRING?


I would recommend turning it into a string, splitting the string at the
decimal, then scanning the second string for the first non-zero and storing
the subsequent characters. Working with floats at that precision level
would likely lead to tragic results:

10.0 times .1 is hardly ever 1.0
http://www.eg.bucknell.edu/~xmeng/Course/CS2330/Handout/StyleKP.html

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com


Re: [PHP] Integer

2013-02-01 Thread tamouse mailing lists
On Fri, Feb 1, 2013 at 11:27 PM, tamouse mailing lists
tamouse.li...@gmail.com wrote:
 On Fri, Feb 1, 2013 at 10:40 PM, Ron Piggott
 ron.pigg...@actsministries.org wrote:
 In the following the “2.” means a moderator response and “25” is the account 
 # of the moderator.

 ?php

 $author = 2.00025

 ?

 How can I get the 25 by itself?
 - I want to drop the “2.” and remove all the zero’s

 Would it be best to turn this into a STRING?

Sorry for complicating things. I didn't read your request carefully enough.

YES, treat it as a string, and if you just need the last 2 digits,
just grab the substring:

php  $author = substr('2.00025',-2);
php  echo $author;
25

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