Re: [PHP] CURL cannot connect to URL - IP address - after successful connection

2010-04-29 Thread Gary .
On 4/25/10, ioan...@btinternet.com wrote:
> I can return a target page - once, but then on refresh within a few
> hours the script curl_error is that it cannot connect to the host and
> return is empty.

Failed to connect to host is a pretty strange error if they're doing
anything regarding cookies and so on, IMO - I think I'd expect at
least a connection to be established before they decide they don't
like you. Have you used curl's --trace & --trace-ascii options?

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



Re: [PHP] Security/Development Question

2010-04-29 Thread tedd

At 4:54 PM -0400 4/28/10, David Stoltz wrote:

My concern is passing SQL queries in this way is not best practice - am
I wrong? Please let me know how you would react to this?


David :

First, you are not wrong.

Second, that's exactly the type of security risk you want to protect 
yourself from.


Third, never trust anything coming from client-side (i.e., POST, GET, 
or COOKIE).


Now, they (the vendor) can throw all the layers of confusion/nonsense 
(it's SSL, APS.NET, or will happen later) on this as they want, but 
the point remains this is permitting client-side access to a database 
and that is NOT good.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Two color rows in table inside while iteration

2010-04-29 Thread tedd

At 8:29 AM -0300 4/28/10, Juan Rodriguez Monti wrote:

Hello Guys,
I would like to implement a two color row table for some queries 
that I'm doing.


I use PHP to query a DB, then I use while to print all its results. I
have a code pretty similar to this one :

 $results = Here the QUERY;
echo "";
echo "";
echo '';
echo "";
echo "";
echo '';

echo "Results";
echo ("");
echo "At1
At2 At3  $

  while ($row = while condition )) {
echo ("");
echo "$row[0]$row[1] $row[2]
$row[3]$row[4] ";
echo "";
echo "";
echo "";

I just want to show you how I write the table. What I would like to
know is what do you suggest to do a two color row format.

Thanks!,
Juan



Juan:

Everyone has done this at one time or another -- this is my solution.

http://webbytedd.com/b/color-rows/

Plus, it validates and keeps things simple.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Two color rows in table inside while iteration

2010-04-29 Thread Juan Rodriguez Monti
2010/4/29 tedd :
> At 8:29 AM -0300 4/28/10, Juan Rodriguez Monti wrote:
>>
>> Hello Guys,
>> I would like to implement a two color row table for some queries that I'm
>> doing.
>>
>> I use PHP to query a DB, then I use while to print all its results. I
>> have a code pretty similar to this one :
>>
>>  $results = Here the QUERY;
>>        echo "";
>>        echo "";
>>        echo '';
>>        echo "";
>>        echo "";
>>        echo '';
>>
>>        echo "Results";
>>        echo ("");
>>        echo "At1
>> At2 At3      $
>>
>>  while ($row = while condition )) {
>>        echo ("");
>>        echo "$row[0]$row[1] $row[2]
>> $row[3]$row[4] ";
>>        echo "";
>>        echo "";
>>        echo "";
>>
>> I just want to show you how I write the table. What I would like to
>> know is what do you suggest to do a two color row format.
>>
>> Thanks!,
>> Juan
>
>
> Juan:
>
> Everyone has done this at one time or another -- this is my solution.
>
> http://webbytedd.com/b/color-rows/
>
> Plus, it validates and keeps things simple.
>
> Cheers,
>
> tedd

Tedd,
Thanks. I'm gonna check it. I finally solved it using:

if ( CONDITIONS )) {

  $results = query( QUERY );
 $colors = array('#97b7cd','#96bf8c');
 $index= 0; 
echo "";
echo "";
echo '';
echo "";
echo "";
echo '';

echo "";
echo "a1 a2
a3 a4
a5 ";

  while ($row = CONDITIONS )) {
echo '';   
echo "$row[0]$row[1] $row[2]
$row[3]$row[4] ";
  }
echo "";
echo "";
echo "";
echo 'back';
echo "";
echo "";

This solution was the best for me. It's solved with your help.

Thanks a lot!.

Juan

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



[PHP] Re: Malware Question

2010-04-29 Thread Al



On 4/28/2010 7:50 PM, Ashley Sheridan wrote:

Hi all,

This isn't exactly a PHP question, but I don't know anyone else with the
collected smarts of this list. Basically, a site I built and am managing
has been identified by Google as a source of malware. Now, I've been
over the source code with a fine-toothed comb and found nothing, I've
gone over the HTML output for anything suspicious, checked ever single
Javascript file out, looked to see the server headers are correct and
aren't malformed, checked the .htaccess is as expected and have run the
site against the unmask parasites website which found no problems except
the 'suspicious' listing which Google has given it.

The Google webmaster tools tell me nothing more than 'Of the 2 pages we
tested on the site over the past 90 days, 2 page(s) resulted in
malicious software being downloaded and installed without user consent.'
It won't tell me what pages, although it tells me that the malicious
software is hosted on one domain and tells me what it is. Needless to
say I can't find that domain string anywhere in the code. I can't find
any hidden iframe tags or hidden Javascript eval() statements.

Basically now, although this is totally beyond my control, the owner of
the site is expecting me to get this sorted asap. I want to, and have
spent the entire day today looking at it, but have really come to the
point where I'm coming unstuck. I can find nothing wrong with the site
at all.

Does anyone have any helpful advice for this sort of thing? Tools that I
can use to check out the site with, or any bit of information that I can
use to fix this? I can give the URL of the site to anyone off-list if
they wish to check it out.

Thanks,
Ash
http://www.ashleysheridan.co.uk



Ross had a good suggest about planted links to external malicious sites. One of 
the sites I worked on a couple of years ago had this happen. They ask me to look 
into it.


There were about 90 htaccess files that redirected the user to a malicious site 
whenever there was an error, 404 etc.


About 400 html files had a javascript appended on the end that sent the 
visitor's IP and the file's complete URL to a website in Russia.


About 300 php files had some php code that generated html code had likewise sent 
the visitor's IP and the file's complete URL to a website in Russia.


About 75 implanted php stand-alone files that were very sophisticated file 
manipulators. I would have taken me days to figure out exactly what it was doing.


A couple of years ago I was involved in cleansing a site and wrote a script for 
searching it.  It uses regex search patterns.


Wild cards "*", covering all directories and leading text, are assumed before 
the filename. However, you must include an extension or append "*" to your 
filename. Can use "*.htaccess"


It list all the files meeting the criteria e.g.,

Sel File Size[bytes] File Time  DirPerms Del DirOwner Dir Time
1  /.htaccess 9428Aug09 14:33:060750 *   system   17Apr10 20:38:56  

You can select a file and view its source including an htmlentities() version
And select one or a batch to delete.

Has a convenient notepad to record your result stats and add a note. e.g.

1Apr09 21 files; "*.htaccess" => "\*" Addition htaccess files added, OK
19Jul08 6 files; "*.htaccess" => "\*"

Has good PW protection,. etc.

Easy to install, one file, instructions at the top.

I'll send you a zip if you reply and send me addr.

Al...








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



[PHP] Re: Two color rows in table inside while iteration

2010-04-29 Thread Al



On 4/28/2010 7:29 AM, Juan Rodriguez Monti wrote:

Hello Guys,
I would like to implement a two color row table for some queries that I'm doing.

I use PHP to query a DB, then I use while to print all its results. I
have a code pretty similar to this one :

  $results = Here the QUERY;
 echo "";
 echo "";
 echo '';
 echo "";
 echo "";
 echo '';

 echo "Results";
 echo ("");
 echo "At1
At2  At3   $

   while ($row = while condition )) {
 echo ("");
 echo "$row[0]$row[1]  $row[2]
$row[3]$row[4]  ";
 echo "";
 echo "";
 echo "";

I just want to show you how I write the table. What I would like to
know is what do you suggest to do a two color row format.

Thanks!,
Juan


$str= "";

$alt = 'even';

foreach(...){
 $alt = ($alt == 'odd')?'even':'odd';
 $str .= "foo"; // Populate each row;
}

$str .= "\n";

echo $str;


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



Re: [PHP] CURL cannot connect to URL - IP address - after successful connection

2010-04-29 Thread ioan...@btinternet.com



On 2010/04/29 19:46, Gary . wrote:

On 4/25/10, ioan...@btinternet.com wrote:

I can return a target page - once, but then on refresh within a few
hours the script curl_error is that it cannot connect to the host and
return is empty.


Failed to connect to host is a pretty strange error if they're doing
anything regarding cookies and so on, IMO - I think I'd expect at
least a connection to be established before they decide they don't
like you. Have you used curl's --trace&  --trace-ascii options?


Is that debug_backtrace() in php, as I am not using the command line 
(can't work out how to get the window up having downloaded curl, I am 
not up to 'building libraries' that seems to be needed).


debug_backtrace() does not give any useful information other than saying 
the target link fails to connect (this is after it connects once, and 
then on refresh and for several hours does not connect). I guess there 
is some program that notes the calling IP address and if it is in a 
range it does not like, adds it to a list and refuses subsequent 
connections to the same address for a while.  Cookies are not required 
when using the browser directly.


John

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



Re: [PHP] CURL cannot connect to URL - IP address - after successful connection

2010-04-29 Thread Gary .
On 4/29/10, ioan...@btinternet.com wrote:
> On 2010/04/29 19:46, Gary . wrote:
>> Failed to connect to host is a pretty strange error if they're doing
>> anything regarding cookies and so on, IMO - I think I'd expect at
>> least a connection to be established before they decide they don't
>> like you. Have you used curl's --trace&  --trace-ascii options?
>
> Is that debug_backtrace() in php

Not sure :-P

> as I am not using the command line
> (can't work out how to get the window up having downloaded curl, I am
> not up to 'building libraries' that seems to be needed).

Windows? http://curl.haxx.se/download.html *n*x variants should allow
installing via their packge management systems.

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



Re: [PHP] Re: Malware Question

2010-04-29 Thread Gary .
On 4/29/10, Al wrote:
> Ross had a good suggest about planted links to external malicious sites. One
> of
> the sites I worked on a couple of years ago had this happen. They ask me to
> look
> into it.
>
> There were about 90 htaccess files that redirected the user to a malicious
> site
> whenever there was an error, 404 etc.
>
> About 400 html files had a javascript appended on the end that sent the
> visitor's IP and the file's complete URL to a website in Russia.
>
> About 300 php files had some php code that generated html code had likewise
> sent
> the visitor's IP and the file's complete URL to a website in Russia.
[snip remainder of horror story]

How do people get their sites into this state? Is it just me, or
wouldn't a regular comparison of MD5s of the site contents with SCM
contents stop most of that kind of thing (after the event, but still,
better that than continue in that state).

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



[PHP] In need of CVS/SVN checkout script for Production servers

2010-04-29 Thread Daevid Vincent
Semi-off-topic, but I'm pretty sure you all are faced with this same
challenge, I figured it's worth a shot and maybe some flaming.

I'm looking for a script (bash or php) that I would run on my production
web server that would do this or close to it:

1. do a CVS/SVN checkout to a new timestamped directory
2. change the symlink from the old directory
3. change permissions to www-data:www-data on new directory
4. and possibly tarball up the old directory.

I'm assuming this is a fairly common task, and I actually wrote one of
these at my previous job, but I can't find the script anymore. I remember
it's not quite as trivial as it sounds and took a few hours to perfect, so
I thought I'd try to save myself some time. :)
 
I have some other useful SVN scripts here if anyone is interested:
http://daevid.com/content/examples/snippets.php


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



Re: [PHP] Two color rows in table inside while iteration

2010-04-29 Thread tedd

At 11:01 AM -0300 4/29/10, Juan Rodriguez Monti wrote:

2010/4/29 tedd :

 At 8:29 AM -0300 4/28/10, Juan Rodriguez Monti wrote:


 Hello Guys,
 I would like to implement a two color row table for some queries that I'm
 doing.

 I use PHP to query a DB, then I use while to print all its results. I
 have a code pretty similar to this one :

  $results = Here the QUERY;
echo "";
echo "";
echo '';
echo "";
echo "";
echo '';

echo "Results";
echo ("");
echo "At1
 At2 At3  $

  while ($row = while condition )) {
echo ("");
echo "$row[0]$row[1] $row[2]
 $row[3]$row[4] ";
echo "";
echo "";
echo "";

 I just want to show you how I write the table. What I would like to
 know is what do you suggest to do a two color row format.

 Thanks!,
 Juan



 Juan:

 Everyone has done this at one time or another -- this is my solution.

 http://webbytedd.com/b/color-rows/

 Plus, it validates and keeps things simple.

 Cheers,

 tedd


Tedd,
Thanks. I'm gonna check it. I finally solved it using:

if ( CONDITIONS )) {

  $results = query( QUERY );
 $colors = array('#97b7cd','#96bf8c');
 $index= 0;
echo "";
echo "";
echo '';
echo "";
echo "";
echo '';

echo "";
echo "a1 a2
a3 a4
a5 ";

  while ($row = CONDITIONS )) {
	echo '';  
	echo "$row[0]$row[1] $row[2]

$row[3]$row[4] ";
  }
echo "";
echo "";
echo "";
echo 'back';
echo "";
echo "";

This solution was the best for me. It's solved with your help.

Thanks a lot!.

Juan


The above is far more complicated than it has to be.

Please critically review my example.

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Admin Interface

2010-04-29 Thread Brandon Rampersad
What guide/ebook/tutorial/article that would explain best-practices and
best-interfaces for admin/backend panels would you recommend?. I already
know how to build them, now i just need to narrow my  techniques to the best
ones by reading best practices and implementations :)

Thank You Buds
Brandon_R

-- 
A Brandon_R Production


Re: [PHP] Admin Interface

2010-04-29 Thread Karl DeSaulniers

JPMaster made a good simple login/admin panel. Google him maybe?

Karl

Sent from losPhone

On Apr 29, 2010, at 4:39 PM, Brandon Rampersad  
 wrote:


What guide/ebook/tutorial/article that would explain best-practices  
and
best-interfaces for admin/backend panels would you recommend?. I  
already
know how to build them, now i just need to narrow my  techniques to  
the best

ones by reading best practices and implementations :)

Thank You Buds
Brandon_R

--
A Brandon_R Production


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



Re: [PHP] Re: Malware Question

2010-04-29 Thread Al



On 4/29/2010 1:35 PM, Gary . wrote:

On 4/29/10, Al wrote:

Ross had a good suggest about planted links to external malicious sites. One
of
the sites I worked on a couple of years ago had this happen. They ask me to
look
into it.

There were about 90 htaccess files that redirected the user to a malicious
site
whenever there was an error, 404 etc.

About 400 html files had a javascript appended on the end that sent the
visitor's IP and the file's complete URL to a website in Russia.

About 300 php files had some php code that generated html code had likewise
sent
the visitor's IP and the file's complete URL to a website in Russia.

[snip remainder of horror story]

How do people get their sites into this state? Is it just me, or
wouldn't a regular comparison of MD5s of the site contents with SCM
contents stop most of that kind of thing (after the event, but still,
better that than continue in that state).



You are correct in theory; but, in practice maybe somewhat limited for CMS which 
have DB contents and raw text files changed almost hourly.


When I departed the site I was working on a couple of years ago, I left a strong 
recommendation that someone run my FileSniffer program weekly and check out any 
suspect changes. They didn't and now have the above situation.


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



Re: [PHP] Two color rows in table inside while iteration

2010-04-29 Thread shiplu
$a=0;
while (++$a, $row=mysql_fetch_...){
echo "<..."
}


Shiplu Mokaddim
My talks, http://talk.cmyweb.net
Follow me, http://twitter.com/shiplu
SUST Programmers, http://groups.google.com/group/p2psust
Innovation distinguishes bet ... ... (ask Steve Jobs the rest)

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



[PHP] Getting root privs

2010-04-29 Thread Nilesh Govindarajan

Hi,

As you know there are lot of control panels lying around like Cpanel, 
Lxadmin, most of them based on PHP. The control panels allow editing of 
system files which requires root privileges, can somebody tell me how to 
gain root privileges inside the script so that it can be useful if I 
want to give my users a DNS editing interface instead of loading a big 
bloated control panel.


--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com
मेरा भारत महान !
मम भारत: महत्तम भवतु !

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



Re: [PHP] Getting root privs

2010-04-29 Thread Jim Lucas
Nilesh Govindarajan wrote:
> Hi,
> 
> As you know there are lot of control panels lying around like Cpanel,
> Lxadmin, most of them based on PHP. The control panels allow editing of
> system files which requires root privileges, can somebody tell me how to
> gain root privileges inside the script so that it can be useful if I
> want to give my users a DNS editing interface instead of loading a big
> bloated control panel.
> 

We use an interface that writes everything to a DB. Then, every 5 minutes, a
cron job comes around and dumps the db and builds the zone files for us.

Might try something similar.  It would be a lot safer then giving root access
via PHP... :)

-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Getting root privs

2010-04-29 Thread Nilesh Govindarajan

On 04/30/2010 11:26 AM, Jim Lucas wrote:

Nilesh Govindarajan wrote:

Hi,

As you know there are lot of control panels lying around like Cpanel,
Lxadmin, most of them based on PHP. The control panels allow editing of
system files which requires root privileges, can somebody tell me how to
gain root privileges inside the script so that it can be useful if I
want to give my users a DNS editing interface instead of loading a big
bloated control panel.



We use an interface that writes everything to a DB. Then, every 5 minutes, a
cron job comes around and dumps the db and builds the zone files for us.

Might try something similar.  It would be a lot safer then giving root access
via PHP... :)



Hmm that's a great idea. But my question is in general, suppose I get 
some freelance job to write a control panel for managing httpd, etc.


Same procedure can be used ? I think so ?

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com
मेरा भारत महान !
मम भारत: महत्तम भवतु !

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