[PHP] E-mail injection question

2010-11-21 Thread Gary
I have been testing various scripts to kill email injection attacks.  I 
adapted this script and it seems to work well.  Does anyone see any issues 
with this?

 $val_newline){
if(stristr($val_newline, '\r')){$newlinecounter++;}
if(stristr($val_newline, '\n')){$newlinecounter++;}
if(stristr($val_newline, '\\r')){$newlinecounter++;}
if(stristr($val_newline, '\\n')){$newlinecounter++;}
if(stristr($val_newline, '\r\n')){$newlinecounter++;}
if(stristr($val_newline, '\\r\\n')){$newlinecounter++;}
if(stristr($val_newline, 'Bcc')){$newlinecounter++;}
}
if ($newlinecounter >= 1){ die('die scum die');
}

?>

Thank you,
Gary 



__ Information from ESET Smart Security, version of virus signature 
database 5636 (20101121) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] MySQL Query Help

2010-11-21 Thread PW
SELECT * FROM products p LEFT JOIN criteria_values cv ON p.key=cv.key LEFT JOIN 
criteria c ON cv.key=c.key WHERE c.value IS NOT NULL

Hard to answer without more detail, but I am guessing the answer will be 
something like the above. Your question makes it hard to understand whether c 
or cv is joined to p. So swap em around if I misunderstood. 

iPhone 4. It rocks!

On Nov 21, 2010, at 1:37 AM, Simcha Younger  wrote:

> On Sat, 20 Nov 2010 13:54:29 -0700
> "Ben Miller"  wrote:
> 
>> Hi,
>> 
>> I'm building a website for a client in which I need to compare their
>> products, side-by-side, but only include criteria for which all selected
>> products have a value for that criteria.
>> 
>> In my database (MySQL), I have a tables named "products","criteria" and
>> "criteria_values"
>> 
>> If I have something like
>> 
>> $selected_product = array("1"=>"Product 1","2"=>"Product 2"...)  //  All
>> products selected for comparison by the user
>> 
>> I need to get only rows from "criteria" where there is a row in
>> "criteria_values" matching "criteria.criteria_id" for each $selected_product
>> - in other words, if any of the $selected_product does not have a row in
>> "criteria_values" that matches "criteria.criteria_id", that criteria would
>> not be returned.  I hope that makes sense.
> 
> It would be a lot easier to think about this if you could provide the table 
> structure or create table statements.
> 
> If I understood correctly, you have products which reference a criteria ID 
> which has no matching value. If this is the problem you have a to first take 
> care of the integrity of your data, as this should never happen. 
> 
> 
> -- 
> Simcha Younger 
> 
> -- 
> 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



Re: [PHP] E-mail injection question

2010-11-21 Thread Adam Richardson
On Sun, Nov 21, 2010 at 12:02 PM, Gary  wrote:

> I have been testing various scripts to kill email injection attacks.  I
> adapted this script and it seems to work well.  Does anyone see any issues
> with this?
>
>  $newlinecounter = 0;
> foreach($_POST as $key => $val_newline){
> if(stristr($val_newline, '\r')){$newlinecounter++;}
> if(stristr($val_newline, '\n')){$newlinecounter++;}
> if(stristr($val_newline, '\\r')){$newlinecounter++;}
> if(stristr($val_newline, '\\n')){$newlinecounter++;}
> if(stristr($val_newline, '\r\n')){$newlinecounter++;}
> if(stristr($val_newline, '\\r\\n')){$newlinecounter++;}
> if(stristr($val_newline, 'Bcc')){$newlinecounter++;}
> }
> if ($newlinecounter >= 1){ die('die scum die');
> }
>
> ?>
>
> Thank you,
> Gary
>

Hi Gary,

There are issues with this approach (one being that checking all POST fields
non-discriminately will lead to false positives, as the body/message of an
email can contain new line characters without issue.)

I'd suggest using Zend's Email capabilities.  You just upload the framework
to your site, add it to your include path, and then you can even use SMTP
email capabilities through an account such as gmail or another email
provider, which is much better than using the general mail() function,
anyway.  And, you have all the security benefits.

Here's a link to Zend's Mail class documentation:
http://framework.zend.com/manual/en/zend.mail.html

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


RE: [PHP] MySQL Query Help

2010-11-21 Thread Ben Miller


SELECT * FROM products p LEFT JOIN criteria_values cv ON p.key=cv.key LEFT
JOIN criteria c ON cv.key=c.key WHERE c.value IS NOT NULL

Hard to answer without more detail, but I am guessing the answer will be
something like the above. Your question makes it hard to understand whether
c or cv is joined to p. So swap em around if I misunderstood. 

iPhone 4. It rocks!

On Nov 21, 2010, at 1:37 AM, Simcha Younger  wrote:

> On Sat, 20 Nov 2010 13:54:29 -0700
> "Ben Miller"  wrote:
> 
>> Hi,
>> 
>> I'm building a website for a client in which I need to compare their 
>> products, side-by-side, but only include criteria for which all 
>> selected products have a value for that criteria.
>> 
>> In my database (MySQL), I have a tables named "products","criteria" 
>> and "criteria_values"
>> 
>> If I have something like
>> 
>> $selected_product = array("1"=>"Product 1","2"=>"Product 2"...)  //  
>> All products selected for comparison by the user
>> 
>> I need to get only rows from "criteria" where there is a row in 
>> "criteria_values" matching "criteria.criteria_id" for each 
>> $selected_product
>> - in other words, if any of the $selected_product does not have a row 
>> in "criteria_values" that matches "criteria.criteria_id", that 
>> criteria would not be returned.  I hope that makes sense.
> 
> It would be a lot easier to think about this if you could provide the
table structure or create table statements.
> 
> If I understood correctly, you have products which reference a criteria ID
which has no matching value. If this is the problem you have a to first take
care of the integrity of your data, as this should never happen. 
> 

To help clarify - the 3 tables look something like the following (tableName
=> column,column,column...):

Products => product_id,product_name,product_description...  (key =
product_id)
Criteria => criteria_id,criteria_title,criteria_text,...  (key =
criteria_id)
Criteria_values => product_id,criteria_id,criteria_value,... (key =
product_id & criteria_id)

The user selects up to X product_id's to compare, stored in
$selected_products.

I then need to get each criteria_title and criteria_text from
table(criteria) where there is a matching criteria_id in
table(criteria_values) for each/all $selected_products, also returning the
criteria_value for each $selected_products, ultimately ending up with an
array or object that looks something like:

(Assuming the user selected Product A (product_id=1), Product B
(product_id=2) and Product C (product_id=3)

criteria => Array  (
[$criteria_id] => Array (
[title] => query_row[criteria_title]
[text] => query_row[criteria_text]
[values] => Array (
[1] => Product A's value for this criteria
[2] => Product B's value for this criteria
[3] => Product C's value for this criteria
)
)
[$criteria_id] => Array (
.
)
)

Again, displaying only/all criteria where there is a matching value for
each/all $selected_products

Thanks again,
Ben



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



Re: [PHP] Problem with functions and arrays...

2010-11-21 Thread Tamara Temple


On Nov 20, 2010, at 5:31 PM, Jason Pruim wrote:




Maybe it's just me, but using the name of a global as a function  
parameter just seems like a bad idea. Yes, you can do it. Should you?  
I think not. Especially, as, you are passing it a scalar below and  
treating it here like the global array.



   //Make sure to post form start/stop OUTSIDE of this function...
   //It's not meant to be a one size fits all function!
echo "NAME: " . $name . "";
echo "MESSAGE: " . $message . "";

echo "POST: " . $_POST . "";
echo "OPTION: " . $option . "";


$sticky = '';
if(isset($_POST['submit'])) {


Check the error messages -- since you're passing in $startYear as a  
scalar below, you shouldn't be able to access $_POST as an associative  
array.



$sticky = $_POST["{$name}"];
echo "STICKY: " . $sticky;
}
//echo "OPTION: ";
//print_r($option);

   echo <<
{$message}

HTML;

foreach ($option as $key => $value){

if($key == $sticky) {
echo '' . $value . '';
}else{
echo '' . $value . '';
}

}

echo <<
HTML;
unset($value);
return;
}

?>

One for Month, Day & Year... All the same exact code... When I get  
brave I'll combine it into 1 functions :)


Now... What it's trying to do.. It's on a "update" form on my  
website. Basically pulls the info from the database and displays it  
in the form again so it can be edited and resubmitted...


As I'm sure you can tell from the function it checks to see if the a  
value has been selected in the drop down box and if it has then set  
the drop down box to that value.


I call the function like this:
$startYear = date("Y", $row['startdate']); //Actual DBValue:  
1265000400


You're setting $startYear as a scalar value here.

$optionYear = array("2010" => "2010", "2011" => "2011", "2012" =>  
"2012", "2013" => "2013", "2014" => "2014");


ddbYear("startYear", "Select Year", $startYear, $optionYear);


And passing it in to the $_POST variable in your function. Then you  
treat the $_POST variable as an associative array (seemingly much like  
the global $_POST array).





?>

The output I'm getting is:
THESE ARE THE ACTUAL UNPROCESSED (OTHER THEN SEPARATING) VALUES FROM  
THE DATABASE

startmonth: 2
startday: 1
startYear: 2010
endmonth: 11
endDay: 30
endYear: 1999

THESE ARE THE VALUES INSIDE THE FUNCTION
NAME: startYear
MESSAGE: Select Year
POST: 2010
OPTION: Array
STICKY: 2

Now... The problem is that $sticky get set to "2" instead of  
"2010"... But I can't figure out why...


Anyone have any ideas?

And just incase I didn't provide enough info here's a link that  
shows it happening:


HTTP://jason.pruimphotography.com/dev/cms2/events/update_form.php? 
id=62


Again, I will reiterate that taking the name of a global variable and  
using it as a parameter in a function is a bad idea. It can be done,  
and my in some cases have some uses, but I don't think the way you're  
using it is a good idea, and looks wrong to me as well.



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



[PHP] How to install ext/intl on Mac OSX (NumberFormatter and so on)

2010-11-21 Thread cimodev
Hallo

Apple is shipping PHP 5.3.3 on Mac OSX Darwin without the PECL-Extension
"ext/intl".

So i tried to install ext/intl with "pecl install intl".

The Error Message is:
/private/var/tmp/apache_mod_php/apache_mod_php-53~1/Build/tmp/pear/temp/intl/collator/collator_class.c:92:
error: duplicate ‘static’
/private/var/tmp/apache_mod_php/apache_mod_php-53~1/Build/tmp/pear/temp/intl/collator/collator_class.c:96:
error: duplicate ‘static’
/private/var/tmp/apache_mod_php/apache_mod_php-53~1/Build/tmp/pear/temp/intl/collator/collator_class.c:101:
error: duplicate ‘static’
/private/var/tmp/apache_mod_php/apache_mod_php-53~1/Build/tmp/pear/temp/intl/collator/collator_class.c:107:
error: duplicate ‘static’
make: *** [collator/collator_class.lo] Error 1
ERROR: `make' failed


phpize output is:

Configuring for:
PHP Api Version: 20090626
Zend Module Api No:  20090626
Zend Extension Api No:   220090626

gcc -v:

gcc -v
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5664~105/src/configure --disable-checking
--enable-werror --prefix=/usr --mandir=/share/man
--enable-languages=c,objc,c++,obj-c++
--program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib
--build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10-
--host=x86_64-apple-darwin10 --target=i686-apple-darwin10
--with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5664)

Has anyone good tips for solving this?


[PHP] range header in curl?

2010-11-21 Thread Tontonq Tontonq
hi im downloading files from h0tf1le as a premium user by curl i want to do
something like streaming i want it resend to user what it got from server
i couldnt find any resource about curl and streaming the executed source
so i did by the Range header but sometimes i see files are corrupted i check
the logs

GET
http://s137.hotfile.com/get/7006d266367d7975861e5f7200b604ad478674fc/4ce9a4ff/1/f37a0969e2e26077/332dfdf/2137758/pimp.rarHTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.9.2)
Gecko/20100115 Firefox/3.6
Host: s137.hotfile.com
Pragma: no-cache
Accept: */*
Connection: Keep-Alive
Range: bytes=1-2

i only get 1 byte for learn length


Content-Disposition: attachment; filename="pimp.rar"
Content-Transfer-Encoding: binary
Content-Range: bytes 1-2/5781810

i see the range

request:Range: bytes=0-2097152
response:
Content-Disposition: attachment; filename="pimp.rar"
Content-Transfer-Encoding: binary
Content-Range: bytes 0-2097152/5781810
Connection: close

request:Range: bytes=2097152-4194304
response:
Content-Disposition: attachment; filename="pimp.rar"
Content-Transfer-Encoding: binary
Content-Range: bytes 2097152-4194304/5781810
Connection: close

request:Range: bytes=4194304-5781810

Content-Disposition: attachment; filename="pimp.rar"
Content-Transfer-Encoding: binary
Content-Range: bytes 4194304-5781810/5781810
Connection: close


i can not see any error do you?

and this is a part of it



$kackb=arasi('Content-Range: bytes 1-2/','
',$cikti);
$bytes=(int)$kackb;
$infocuk=curl_getinfo($ch);
$sabiturl=$infocuk["url"];
curl_close($ch);
$sinir*=1024;
$kackez=$bytes/$sinir;


for($i=0;$i<=$kackez;$i++)
{
$bsinir=$i*$sinir;
$ssinir+=$sinir;
if($bytes<$ssinir) { $ssinir=$bytes; }
$header = array("Range: bytes=$bsinir-$ssinir");
$ch = curl_init();
curl_setopt($ch , CURLOPT_URL, $sabiturl);
curl_setopt($ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT
5.1; tr; rv:1.9.2) Gecko/20100115 Firefox/3.6');
curl_setopt($ch , CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookies.txt');
curl_setopt($ch , CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookies.txt');
curl_setopt($ch , CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookies.txt');
if($proxy) { curl_setopt($ch , CURLOPT_PROXY, $proxy); }
curl_setopt ( $ch , CURLOPT_HTTPHEADER, $header );
curl_setopt($ch , CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch , CURLOPT_RETURNTRANSFER , 1);
$cikti = curl_exec($ch);
echo $cikti;

}


Re: [PHP] range header in curl?

2010-11-21 Thread Michael Shadle
Is range the right header to be sending? I thought it was something else.

Also I believe there is a curl_setopt option for range... Look at php.net's 
predefined constants for the curl modul

On Nov 21, 2010, at 3:05 PM, Tontonq Tontonq  wrote:

> hi im downloading files from h0tf1le as a premium user by curl i want to do
> something like streaming i want it resend to user what it got from server
> i couldnt find any resource about curl and streaming the executed source
> so i did by the Range header but sometimes i see files are corrupted i check
> the logs
> 
> GET
> http://s137.hotfile.com/get/7006d266367d7975861e5f7200b604ad478674fc/4ce9a4ff/1/f37a0969e2e26077/332dfdf/2137758/pimp.rarHTTP/1.1
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.9.2)
> Gecko/20100115 Firefox/3.6
> Host: s137.hotfile.com
> Pragma: no-cache
> Accept: */*
> Connection: Keep-Alive
> Range: bytes=1-2
> 
> i only get 1 byte for learn length
> 
> 
> Content-Disposition: attachment; filename="pimp.rar"
> Content-Transfer-Encoding: binary
> Content-Range: bytes 1-2/5781810
> 
> i see the range
> 
> request:Range: bytes=0-2097152
> response:
> Content-Disposition: attachment; filename="pimp.rar"
> Content-Transfer-Encoding: binary
> Content-Range: bytes 0-2097152/5781810
> Connection: close
> 
> request:Range: bytes=2097152-4194304
> response:
> Content-Disposition: attachment; filename="pimp.rar"
> Content-Transfer-Encoding: binary
> Content-Range: bytes 2097152-4194304/5781810
> Connection: close
> 
> request:Range: bytes=4194304-5781810
> 
> Content-Disposition: attachment; filename="pimp.rar"
> Content-Transfer-Encoding: binary
> Content-Range: bytes 4194304-5781810/5781810
> Connection: close
> 
> 
> i can not see any error do you?
> 
> and this is a part of it
> 
> 
> 
> $kackb=arasi('Content-Range: bytes 1-2/','
> ',$cikti);
> $bytes=(int)$kackb;
> $infocuk=curl_getinfo($ch);
> $sabiturl=$infocuk["url"];
> curl_close($ch);
> $sinir*=1024;
> $kackez=$bytes/$sinir;
> 
> 
> for($i=0;$i<=$kackez;$i++)
> {
> $bsinir=$i*$sinir;
> $ssinir+=$sinir;
> if($bytes<$ssinir) { $ssinir=$bytes; }
> $header = array("Range: bytes=$bsinir-$ssinir");
> $ch = curl_init();
> curl_setopt($ch , CURLOPT_URL, $sabiturl);
> curl_setopt($ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT
> 5.1; tr; rv:1.9.2) Gecko/20100115 Firefox/3.6');
> curl_setopt($ch , CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookies.txt');
> curl_setopt($ch , CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookies.txt');
> curl_setopt($ch , CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookies.txt');
> if($proxy) { curl_setopt($ch , CURLOPT_PROXY, $proxy); }
> curl_setopt ( $ch , CURLOPT_HTTPHEADER, $header );
> curl_setopt($ch , CURLOPT_FOLLOWLOCATION, 1);
> curl_setopt($ch , CURLOPT_RETURNTRANSFER , 1);
> $cikti = curl_exec($ch);
> echo $cikti;
> 
> }

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



Re: [PHP] range header in curl?

2010-11-21 Thread shiplu
On Mon, Nov 22, 2010 at 5:05 AM, Tontonq Tontonq  wrote:

> hi im downloading files from h0tf1le as a premium user by curl i want to do
> something like streaming i want it resend to user what it got from server
> i couldnt find any resource about curl and streaming the executed source
> so i did by the Range header but sometimes i see files are corrupted i
> check
> the logs
>
> GET
>
> http://s137.hotfile.com/get/7006d266367d7975861e5f7200b604ad478674fc/4ce9a4ff/1/f37a0969e2e26077/332dfdf/2137758/pimp.rarHTTP/1.1
> User-Agent:
> Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.9.2)
> Gecko/20100115 Firefox/3.6
> Host: s137.hotfile.com
> Pragma: no-cache
> Accept: */*
> Connection: Keep-Alive
> Range: bytes=1-2
>
> i only get 1 byte for learn length
>

Not sure why your are getting 1 byte. You should get 2 bytes. Is the size of
pimp.rar 2 bytes? In that case first 2 byte will returned by bytes=0-1 range
specifier instead of bytes=1-2

Check this spec out
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35

May be this will help you.


-- 
Shiplu Mokaddim
http://talk.cmyweb.net


Re: [PHP] PHP Sockets, problem with remote execution (exec/system)

2010-11-21 Thread 惠新宸

Hi:
 is there a chance that there is a "Listen 8133" in your apache2 
configure file? always no as "httpd.conf" or *.conf in the 
apache2/conf/extra folder.


thanks

Best regards

惠新宸 Xinchen Hui
http://www.laruence.com/

On 2010/11/19 15:18, Ronny Tiebel wrote:

Good Morning List ;)

ive allready postet my question on the german phpbar mailinglist, but no
responses from anyone yet. i hope someone on that list could give me an
advice or hint.

i'm writing a php-daemon which will run on a debian lenny/squeeze.
this daemon should listen to a specific port of a
vpn-interface/ip-address (it creates a socket)

if the daemon script recieves a string from my management webinterface
(other server) it should run some code e.g. exec('/etc/init.d/apache2
restart'); or system('something'); or whatever.

i got it working, but there is a (for me) strange behavior. After the
daemon has restarted the apache2 service for example and the php daemon
is stoped, the apache2 process takes over the socket. that means, in
`netstat -tulpen` or `netstat -anp` i first can see something like that:

tcp0  0 10.0.0.1:8133   0.0.0.0:*LISTEN  29168/php
tcp6   0  0 :::80 :::*   LISTEN  29155/apache2

after the daemon has restarted apache2 and stops itself (or i have to
kill him), netstat shows up the following:

tcp0  0 10.0.0.1:8133   0.0.0.0:*  LISTEN  31490/apache2
tcp6   0  0 :::80 :::* LISTEN  31490/apache2

so i cant restart the daemon because apache uses that port/ip (or socket?)

after invoking "/etc/init.d/apache2 restart" on the shell, everything is
fine again and im able to start the daemon. btw, the same with the
openvpn service. (mysql doesnt act like apache or openvpn).

Am i missing something? Or is that the default behavior of
linux/apache/php/sockets ???

Additional Information about OS etc.

Server/Client   Debian LennyApache 2.2.9PHP 5.2.6-1+lenny9 with
Suhosin-Patch 0.9.6.2 (cli) (built: Aug  4 2010 06:06:53)

Client/Server   Ubuntu LucidApache 2.2.14   PHP 5.3.2-1ubuntu4.5 with
Suhosin-Patch (cli) (built: Sep 17 2010 13:49:46)


Ive tested it both way: Ubuntu as Server, Debian as Client and vice versa.

The Ubuntu System (my workstation) is in our Office and the Debian
System is in the datacentre@ our provider...


Any help would be great!

Thanks in advance,

kind regards
Ronny

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



Re: [PHP] PHP Sockets, problem with remote execution (exec/system)

2010-11-21 Thread Ronny Tiebel
Hi Xinchen,

thank you for your reply.

Nope, Apache runs in its standard configuration and is listening on
"*:80" and "*:443", quiet as normal.

But after some tests yesterday and after checking the init scripts of
apache2 and openvpn (where that problem occours) ive testet to invoke
the "apache2ctl" script. if i use "exec('apache2ctl restart');"
everything works fine and as i expected it. that means imho, that the
behavior described below is caused by the standard apache initscript...

i think its possible that the initscript is setting some vars which will
cause that "bug"?

i'll have a look at that, but maybe thats the solution for my problem.

thanks

kind regards

Ronny


> Hi:
>  is there a chance that there is a "Listen 8133" in your apache2
> configure file? always no as "httpd.conf" or *.conf in the
> apache2/conf/extra folder.
> 
> thanks
> 
> Best regards
> 
> 惠新宸Xinchen Hui
> http://www.laruence.com/
> 
> On 2010/11/19 15:18, Ronny Tiebel wrote:
>> Good Morning List ;)
>>
>> ive allready postet my question on the german phpbar mailinglist, but no
>> responses from anyone yet. i hope someone on that list could give me an
>> advice or hint.
>>
>> i'm writing a php-daemon which will run on a debian lenny/squeeze.
>> this daemon should listen to a specific port of a
>> vpn-interface/ip-address (it creates a socket)
>>
>> if the daemon script recieves a string from my management webinterface
>> (other server) it should run some code e.g. exec('/etc/init.d/apache2
>> restart'); or system('something'); or whatever.
>>
>> i got it working, but there is a (for me) strange behavior. After the
>> daemon has restarted the apache2 service for example and the php daemon
>> is stoped, the apache2 process takes over the socket. that means, in
>> `netstat -tulpen` or `netstat -anp` i first can see something like that:
>>
>> tcp0  0 10.0.0.1:8133   0.0.0.0:*LISTEN  29168/php
>> tcp6   0  0 :::80 :::*   LISTEN  29155/apache2
>>
>> after the daemon has restarted apache2 and stops itself (or i have to
>> kill him), netstat shows up the following:
>>
>> tcp0  0 10.0.0.1:8133   0.0.0.0:*  LISTEN  31490/apache2
>> tcp6   0  0 :::80 :::* LISTEN  31490/apache2
>>
>> so i cant restart the daemon because apache uses that port/ip (or
>> socket?)
>>
>> after invoking "/etc/init.d/apache2 restart" on the shell, everything is
>> fine again and im able to start the daemon. btw, the same with the
>> openvpn service. (mysql doesnt act like apache or openvpn).
>>
>> Am i missing something? Or is that the default behavior of
>> linux/apache/php/sockets ???
>>
>> Additional Information about OS etc.
>>
>> Server/Client   Debian LennyApache 2.2.9PHP 5.2.6-1+lenny9 with
>> Suhosin-Patch 0.9.6.2 (cli) (built: Aug  4 2010 06:06:53)
>>
>> Client/Server   Ubuntu LucidApache 2.2.14   PHP 5.3.2-1ubuntu4.5 with
>> Suhosin-Patch (cli) (built: Sep 17 2010 13:49:46)
>>
>>
>> Ive tested it both way: Ubuntu as Server, Debian as Client and vice
>> versa.
>>
>> The Ubuntu System (my workstation) is in our Office and the Debian
>> System is in the datacentre@ our provider...
>>
>>
>> Any help would be great!
>>
>> Thanks in advance,
>>
>> kind regards
>> Ronny
>>
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>> .
>>


-- 
Cloud IT Services GmbH   Telefon: +49 351 47940230
Altplauen 19 Telefax: +49 351 47940239
01187 DresdenE-Mail:  i...@cloud-it-services.com
 Web: www.cloud-it-services.com

Geschäftsführung:Wolfram Gürlich
Sitz der Gesellschaft:   Blankenburg
Amtsgericht Stendal: HRB 12528


Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese
E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie
die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.
Internetkommunikationen sind nicht sicher. Daher übernimmt die
Cloud IT Services GmbH keinerlei Haftung für den Inhalt dieser
Nachricht. Jegliche Ansichten oder dargestellte Meinungen
sind ausschließlich solche des Autors und repräsentieren nicht
notwendigerweise die der Cloud IT Services GmbH.

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient (or have received this e-mail in
error) please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden. Internet communications are not secure and
therefore Cloud IT Services GmbH does not accept legal responsibility
for the contents of this message. Any views or opinions presented are
solely those of the author and do not necessarily represent those of
Cloud IT Services GmbH.

-- 
PHP General Mailing Lis

Re: [PHP] My project requires creating office documents on PHP. Any recommendations on what to use?

2010-11-21 Thread Aman Singh
Not sure of all office documents, but for Excel, you may want to try out
http://phpexcel.codeplex.com/?ocid=soc-c-in-loc--cfp.
>From the page: "Project providing a set of classes for the PHP programming
language, which allow you to write to and read from different file formats,
like Excel 2007, PDF, HTML, ... This project is built around Microsoft's
OpenXML standard and PHP."



On Sat, Nov 20, 2010 at 11:40 AM, chetan ahuja wrote:

> My project requires creating office documents on PHP. Any recommendations
> on
> what to use?
>