Re: [PHP] Re: Search like php.net's URL thingy [0.T]

2008-06-05 Thread Philip Olson
Hello,

php.net uses a 404 error handler for this, and most mirrors store url data
in an sqlite database. A simple $_SERVER dump in your 404 page will show you
which variables are available.

Regards,
Philip


[PHP] Sr. PHP Engineer job opportunity / Denver

2008-06-05 Thread Nick Gasparro
Hello Group,

 

I have an immediate opportunity available for a Senior Software Engineer in
Denver, CO (relocation assistance is available). This is a great opportunity
to join a dynamic and growing Internet-based company.  The individual will
be responsible for the development, implementation, and maintenance of our
scalable, reusable, web/software based user interfaces. You must be familiar
with design patterns and be able to write abstract classes that adhere to
standard OOP methodologies. The qualified candidate will expand our
web-based platform, building new features and products.  

 

Software Development Experience with the Following: 

* Linux, Apache, PHP 4, PHP 5, MySQL 

* Object-oriented design and distributed systems 

* Open source development tools, languages and application servers. 


* Competent with JavaScript, Prototype, Scriptaculous, Moo 

 

Best,

 

Nick Gasparro

Managing Partner, REMY Corp.

Denver, CO 80202

303-539-0448 Direct

303-547-7469 Cell

  [EMAIL PROTECTED] 

  www.remycorp.com





 



Re: [PHP] Re: Search like php.net's URL thingy [0.T]

2008-06-05 Thread Daniel Brown
On Thu, Jun 5, 2008 at 4:52 PM, Ryan S <[EMAIL PROTECTED]> wrote:
> Hey again,
>
> First of all please note that i added a [0.T]  (= off topic ) to the subject 
> so if you dont want to continue with something OT, now's the time...
>
> Ok... for anyone thats curious as to why i wanted this.. just completed my 
> version of tinyURL... except, its even more tiny!! Have christened it ezeeURL 
> :) if anyone wants to take it for a test spin (as its not officially "open" 
> yet) feel free to check it out here:
>
> http://ezee.se/a.html

It worked for me, first try.

I had built a site like this years ago, but never used it.  If
you're missing code for anything, let me know and I'll see if I can
dig it up for you.

-- 

Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] Re: Search like php.net's URL thingy [0.T]

2008-06-05 Thread Ryan S
Hey again,

First of all please note that i added a [0.T]  (= off topic ) to the subject so 
if you dont want to continue with something OT, now's the time...

Ok... for anyone thats curious as to why i wanted this.. just completed my 
version of tinyURL... except, its even more tiny!! Have christened it ezeeURL 
:) if anyone wants to take it for a test spin (as its not officially "open" 
yet) feel free to check it out here:

http://ezee.se/a.html

Thought i would do something with my small domain name... and this worked out 
pretty good, for example:

http://tinyurl.com/
http://ezee.se/  <-- Size does matter!

cant beat tiny if you even have MICROurl coz "tiny" is smaller :p
but ezee does beat tiny plus .se is smaller than .com... now if only it could 
beat it in traffic!

Cheers!
R



  

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



Re: [PHP] Re: Search like php.net's URL thingy

2008-06-05 Thread Nate Tallman
Why is an ErrorDocument "insufficient" or "not the elegant way"?
It accomplishes the goal in a clean way, no?

Nate

On Thu, Jun 5, 2008 at 3:25 PM, Yeti <[EMAIL PROTECTED]> wrote:

> still telling Ryan to produce errors is insufficient or at least not the
> elegant way
>
> On 6/5/08, Nate Tallman <[EMAIL PROTECTED]> wrote:
>>
>> Correction for my statement:
>> As long as the content length is greater than 512 bytes, IE will display
>> the
>> content from the 404. Less than that and it will display it's own pretty
>> message.
>>
>>
>> http://www.404-error-page.com/404-error-page-too-short-problem-microsoft-ie.shtml
>> http://www.mattcutts.com/blog/404-pages-in-google-toolbar/
>>
>>
>>
>> On Thu, Jun 5, 2008 at 3:06 PM, Shawn McKenzie <[EMAIL PROTECTED]>
>> wrote:
>>
>> > http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807
>> >
>> > Also, why would you want Google let's say, to receive a 404 Not Found
>> > header for http://php.net/arrays???
>> >
>> > -Shawn
>> >
>> > Nate Tallman wrote:
>> >
>> >> Not true, Apache does return a 404, but IE will use the custom 404 page
>> if
>> >> it is available.
>> >>
>> >> Nate
>> >>
>> >> On Thu, Jun 5, 2008 at 2:57 PM, Shawn McKenzie <[EMAIL PROTECTED]
>> > >> [EMAIL PROTECTED]>> wrote:
>> >>
>> >>As far as I remember, errordocument still send the code, in this
>> >>case 404 to the client.  In the case of IE, this will display IEs
>> >>built-in error doc if the server supplied one is < 512 Bytes.
>> >> Maybe other implications for spiders also.  I might be wrong, but
>> >>this is from some old memory.
>> >>
>> >>-Shawn
>> >>
>> >>Nate Tallman wrote:
>> >>
>> >>ErrorDocument 404 /path/to/some/script.php
>> >>* $_SERVER['REDIRECT_URL']
>> >>
>> >>(somehow misplaced underscore)
>> >>
>> >>On Thu, Jun 5, 2008 at 2:50 PM, Nate Tallman
>> >><[EMAIL PROTECTED]
>> >>
>> >>> >>>> wrote:
>> >>
>> >>   Why not just set:
>> >>   ErrorDocument 404 /path/to/some/script.php
>> >>   Then check $SERVER['REDIRECT_URL'] for the failed request.
>> >>
>> >>
>> >>
>> >>
>> >>   On Thu, Jun 5, 2008 at 2:41 PM, Shawn McKenzie
>> >>   <[EMAIL PROTECTED] 
>> >>>>
>> >>wrote:
>> >>
>> >>   Ryan S wrote:
>> >>
>> >>   Hey,
>> >>   one of the things that make the php.net
>> >> 
>> >>
>> >>   site so cool is how easy it is to find info for a
>> >>function
>> >>   or a list of topics.. eg:
>> >>
>> >>   http://php.net/arrays
>> >>   http://php.net/count
>> >>
>> >>   I'm sure nearly all of you reading this have done
>> >>it more
>> >>   times than you would care to count, i'm trying to get
>> >>   something like this on my own site but even after
>> >>going to
>> >>   php.net   and
>> >>
>> >>clicking on the view source
>> >>
>> >>   buttons am a bit confused.
>> >>
>> >>   basically this is what i am trying, people who type
>> in
>> >>   http://www.mysite.com/asdf
>> >>   should not be shown a 404 not found page but instead
>> >>   "asdf" should be passed onto my script where i can do
>> a
>> >>   search on the term and either give them back the
>> >>results
>> >>   of that search or direct them to a custom 404 page.
>> >>
>> >>   since i couldnt find the answer via php.net
>> >>
>> >>   's source i started messing around
>> >>with
>> >>
>> >>   how i *think* its done... tell me if i am on the
>> >>correct
>> >>   track: when someone requests a page that does not
>> >>exist, a
>> >>   .htaccess file them up and also takes the page name
>> >>they
>> >>   were searching for and redirects them to a script...
>> >>   So far i have only been able to get the .htaccess
>> file
>> >>   point to my custom 404 page... but how do i get it
>> >>to pass
>> >>   the parameter of the not-found-page to my script?
>> >>
>> >>   Would appreciate any code, tips, urls you can give
>> me.
>> >>
>> >>   Thanks!
>> >>   Ryan
>> >>
>> >>
>> >>
>> >>--
>> >>   - The faulty interface lies between the chair and the
>> >>   keyboard.
>> >>   - Creativity is great, but plagiarism is faster!

Re: [PHP] Re: Search like php.net's URL thingy

2008-06-05 Thread Ryan S


As far as I remember, errordocument still send the code, in this case 
404 to the client.  In the case of IE, this will display IEs built-in 
error doc if the server supplied one is < 512 Bytes.  Maybe other 
implications for spiders also.  I might be wrong, but this is from some 
old memory.

-Shawn

Nate Tallman wrote:
> ErrorDocument 404 /path/to/some/script.php
> * $_SERVER['REDIRECT_URL']
>
> (somehow misplaced underscore)




Your memory might be old... but its still good! :)
While searching for my answers i did come accross what you wrote above..

Cheers!
R

P.S Thanks for replying guys


  

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



Re: [PHP] Re: Search like php.net's URL thingy

2008-06-05 Thread Nate Tallman
Correction for my statement:
As long as the content length is greater than 512 bytes, IE will display the
content from the 404. Less than that and it will display it's own pretty
message.

http://www.404-error-page.com/404-error-page-too-short-problem-microsoft-ie.shtml
http://www.mattcutts.com/blog/404-pages-in-google-toolbar/


On Thu, Jun 5, 2008 at 3:06 PM, Shawn McKenzie <[EMAIL PROTECTED]> wrote:

> http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807
>
> Also, why would you want Google let's say, to receive a 404 Not Found
> header for http://php.net/arrays???
>
> -Shawn
>
> Nate Tallman wrote:
>
>> Not true, Apache does return a 404, but IE will use the custom 404 page if
>> it is available.
>>
>> Nate
>>
>> On Thu, Jun 5, 2008 at 2:57 PM, Shawn McKenzie <[EMAIL PROTECTED]> [EMAIL PROTECTED]>> wrote:
>>
>>As far as I remember, errordocument still send the code, in this
>>case 404 to the client.  In the case of IE, this will display IEs
>>built-in error doc if the server supplied one is < 512 Bytes.
>> Maybe other implications for spiders also.  I might be wrong, but
>>this is from some old memory.
>>
>>-Shawn
>>
>>Nate Tallman wrote:
>>
>>ErrorDocument 404 /path/to/some/script.php
>>* $_SERVER['REDIRECT_URL']
>>
>>(somehow misplaced underscore)
>>
>>On Thu, Jun 5, 2008 at 2:50 PM, Nate Tallman
>><[EMAIL PROTECTED]
>>
>>>>> wrote:
>>
>>   Why not just set:
>>   ErrorDocument 404 /path/to/some/script.php
>>   Then check $SERVER['REDIRECT_URL'] for the failed request.
>>
>>
>>
>>
>>   On Thu, Jun 5, 2008 at 2:41 PM, Shawn McKenzie
>>   <[EMAIL PROTECTED] 
>>>>
>>wrote:
>>
>>   Ryan S wrote:
>>
>>   Hey,
>>   one of the things that make the php.net
>> 
>>
>>   site so cool is how easy it is to find info for a
>>function
>>   or a list of topics.. eg:
>>
>>   http://php.net/arrays
>>   http://php.net/count
>>
>>   I'm sure nearly all of you reading this have done
>>it more
>>   times than you would care to count, i'm trying to get
>>   something like this on my own site but even after
>>going to
>>   php.net   and
>>
>>clicking on the view source
>>
>>   buttons am a bit confused.
>>
>>   basically this is what i am trying, people who type in
>>   http://www.mysite.com/asdf
>>   should not be shown a 404 not found page but instead
>>   "asdf" should be passed onto my script where i can do a
>>   search on the term and either give them back the
>>results
>>   of that search or direct them to a custom 404 page.
>>
>>   since i couldnt find the answer via php.net
>>
>>   's source i started messing around
>>with
>>
>>   how i *think* its done... tell me if i am on the
>>correct
>>   track: when someone requests a page that does not
>>exist, a
>>   .htaccess file them up and also takes the page name
>>they
>>   were searching for and redirects them to a script...
>>   So far i have only been able to get the .htaccess file
>>   point to my custom 404 page... but how do i get it
>>to pass
>>   the parameter of the not-found-page to my script?
>>
>>   Would appreciate any code, tips, urls you can give me.
>>
>>   Thanks!
>>   Ryan
>>
>>
>>
>>--
>>   - The faulty interface lies between the chair and the
>>   keyboard.
>>   - Creativity is great, but plagiarism is faster!
>>   - Smile, everyone loves a moron. :-)
>>
>>
>>
>>
>>   If you use .htaccess and have mod_rewrite then it is
>>simpler.
>>Something like this (untested):
>>
>>
>>   
>>  RewriteEngine On
>>  RewriteCond %{REQUEST_FILENAME} !-d
>>  RewriteCond %{REQUEST_FILENAME} !-f
>>  RewriteRule ^(.*)$ index.php?term=$1 [L]
>>   
>>
>>   Then in index.php you can use the contents of
>>$_GET['term'],
>>   which in your example would be asdf.
>>
>>   [QSA,L] will give you the query string if the user typed in
>>   something like 

Re: [PHP] Re: Search like php.net's URL thingy

2008-06-05 Thread Shawn McKenzie

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807

Also, why would you want Google let's say, to receive a 404 Not Found 
header for http://php.net/arrays???


-Shawn

Nate Tallman wrote:
Not true, Apache does return a 404, but IE will use the custom 404 
page if it is available.


Nate

On Thu, Jun 5, 2008 at 2:57 PM, Shawn McKenzie <[EMAIL PROTECTED] 
> wrote:


As far as I remember, errordocument still send the code, in this
case 404 to the client.  In the case of IE, this will display IEs
built-in error doc if the server supplied one is < 512 Bytes.
 Maybe other implications for spiders also.  I might be wrong, but
this is from some old memory.

-Shawn

Nate Tallman wrote:

ErrorDocument 404 /path/to/some/script.php
* $_SERVER['REDIRECT_URL']

(somehow misplaced underscore)

On Thu, Jun 5, 2008 at 2:50 PM, Nate Tallman
<[EMAIL PROTECTED]

>> wrote:

   Why not just set:
   ErrorDocument 404 /path/to/some/script.php
   Then check $SERVER['REDIRECT_URL'] for the failed request.




   On Thu, Jun 5, 2008 at 2:41 PM, Shawn McKenzie
   <[EMAIL PROTECTED] 
>>
wrote:

   Ryan S wrote:

   Hey,
   one of the things that make the php.net
 

   site so cool is how easy it is to find info for a
function
   or a list of topics.. eg:

   http://php.net/arrays
   http://php.net/count

   I'm sure nearly all of you reading this have done
it more
   times than you would care to count, i'm trying to get
   something like this on my own site but even after
going to
   php.net   and
clicking on the view source

   buttons am a bit confused.

   basically this is what i am trying, people who type in
   http://www.mysite.com/asdf
   should not be shown a 404 not found page but instead
   "asdf" should be passed onto my script where i can do a
   search on the term and either give them back the
results
   of that search or direct them to a custom 404 page.

   since i couldnt find the answer via php.net

   's source i started messing around
with

   how i *think* its done... tell me if i am on the
correct
   track: when someone requests a page that does not
exist, a
   .htaccess file them up and also takes the page name
they
   were searching for and redirects them to a script...
   So far i have only been able to get the .htaccess file
   point to my custom 404 page... but how do i get it
to pass
   the parameter of the not-found-page to my script?

   Would appreciate any code, tips, urls you can give me.

   Thanks!
   Ryan



--
   - The faulty interface lies between the chair and the
   keyboard.
   - Creativity is great, but plagiarism is faster!
   - Smile, everyone loves a moron. :-)



   


   If you use .htaccess and have mod_rewrite then it is
simpler.
Something like this (untested):


   
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php?term=$1 [L]
   

   Then in index.php you can use the contents of
$_GET['term'],
   which in your example would be asdf.

   [QSA,L] will give you the query string if the user typed in
   something like http://www.mysite.com/asdf?your=mom.

   Then $_GET['your'] = 'mom'.

   -Shawn


   --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] Re: Search like php.net's URL thingy

2008-06-05 Thread Nate Tallman
Not true, Apache does return a 404, but IE will use the custom 404 page if
it is available.

Nate

On Thu, Jun 5, 2008 at 2:57 PM, Shawn McKenzie <[EMAIL PROTECTED]> wrote:

> As far as I remember, errordocument still send the code, in this case 404
> to the client.  In the case of IE, this will display IEs built-in error doc
> if the server supplied one is < 512 Bytes.  Maybe other implications for
> spiders also.  I might be wrong, but this is from some old memory.
>
> -Shawn
>
> Nate Tallman wrote:
>
>> ErrorDocument 404 /path/to/some/script.php
>> * $_SERVER['REDIRECT_URL']
>>
>> (somehow misplaced underscore)
>>
>> On Thu, Jun 5, 2008 at 2:50 PM, Nate Tallman <
>> [EMAIL PROTECTED] >
>> wrote:
>>
>>Why not just set:
>>ErrorDocument 404 /path/to/some/script.php
>>Then check $SERVER['REDIRECT_URL'] for the failed request.
>>
>>
>>
>>
>>On Thu, Jun 5, 2008 at 2:41 PM, Shawn McKenzie
>><[EMAIL PROTECTED] > wrote:
>>
>>Ryan S wrote:
>>
>>Hey,
>>one of the things that make the php.net 
>>site so cool is how easy it is to find info for a function
>>or a list of topics.. eg:
>>
>>http://php.net/arrays
>>http://php.net/count
>>
>>I'm sure nearly all of you reading this have done it more
>>times than you would care to count, i'm trying to get
>>something like this on my own site but even after going to
>>php.net  and clicking on the view source
>>buttons am a bit confused.
>>
>>basically this is what i am trying, people who type in
>>http://www.mysite.com/asdf
>>should not be shown a 404 not found page but instead
>>"asdf" should be passed onto my script where i can do a
>>search on the term and either give them back the results
>>of that search or direct them to a custom 404 page.
>>
>>since i couldnt find the answer via php.net
>>'s source i started messing around with
>>
>>how i *think* its done... tell me if i am on the correct
>>track: when someone requests a page that does not exist, a
>>.htaccess file them up and also takes the page name they
>>were searching for and redirects them to a script...
>>So far i have only been able to get the .htaccess file
>>point to my custom 404 page... but how do i get it to pass
>>the parameter of the not-found-page to my script?
>>
>>Would appreciate any code, tips, urls you can give me.
>>
>>Thanks!
>>Ryan
>>
>>
>>
>> --
>>- The faulty interface lies between the chair and the
>>keyboard.
>>- Creativity is great, but plagiarism is faster!
>>- Smile, everyone loves a moron. :-)
>>
>>
>>
>>
>>
>>If you use .htaccess and have mod_rewrite then it is simpler.
>> Something like this (untested):
>>
>>
>>
>>   RewriteEngine On
>>   RewriteCond %{REQUEST_FILENAME} !-d
>>   RewriteCond %{REQUEST_FILENAME} !-f
>>   RewriteRule ^(.*)$ index.php?term=$1 [L]
>>
>>
>>Then in index.php you can use the contents of $_GET['term'],
>>which in your example would be asdf.
>>
>>[QSA,L] will give you the query string if the user typed in
>>something like http://www.mysite.com/asdf?your=mom.
>>
>>Then $_GET['your'] = 'mom'.
>>
>>-Shawn
>>
>>
>>--PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>>


[PHP] fsockopen Fread and fget issue

2008-06-05 Thread Ross King II
When I do the following it grabs the response (And using a packet sniffer I
can see the server responds quick). If I only call fread  one time it will
read and return the page to the server. If I read a second batch after the
eof it hangs for 30 seconds.

 

 

All I want to do is send a raw POST and get the response that can be up to
500K or as little as 450 bytes of XML.

 


PHP Version 5.2.1

 


System 

Linux lamp 2.6.20-16-server #2 SMP Tue Feb 12 05:48:21 UTC 2008 i686 


Build Date 

Nov 28 2007 23:00:22 


Server API 

Apache 2.0 Handler 

 

 

$fp = fsockopen($host, $port, $errno, $errstr, 30);

if (!$fp) {

echo "$errstr ($errno)\n";

} else {

 

fwrite($fp, SOAP_Call("Email_AddWithFields" ,$Parms));

 

while (!feof($fp)) {

$x .= fread($fp, 16000);

}

fclose($fp);

}





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



Re: [PHP] Re: Search like php.net's URL thingy

2008-06-05 Thread Shawn McKenzie
As far as I remember, errordocument still send the code, in this case 
404 to the client.  In the case of IE, this will display IEs built-in 
error doc if the server supplied one is < 512 Bytes.  Maybe other 
implications for spiders also.  I might be wrong, but this is from some 
old memory.


-Shawn

Nate Tallman wrote:

ErrorDocument 404 /path/to/some/script.php
* $_SERVER['REDIRECT_URL']

(somehow misplaced underscore)

On Thu, Jun 5, 2008 at 2:50 PM, Nate Tallman 
<[EMAIL PROTECTED] 
> wrote:


Why not just set:
ErrorDocument 404 /path/to/some/script.php
Then check $SERVER['REDIRECT_URL'] for the failed request.




On Thu, Jun 5, 2008 at 2:41 PM, Shawn McKenzie
<[EMAIL PROTECTED] > wrote:

Ryan S wrote:

Hey,
one of the things that make the php.net 
site so cool is how easy it is to find info for a function
or a list of topics.. eg:

http://php.net/arrays
http://php.net/count

I'm sure nearly all of you reading this have done it more
times than you would care to count, i'm trying to get
something like this on my own site but even after going to
php.net  and clicking on the view source
buttons am a bit confused.

basically this is what i am trying, people who type in
http://www.mysite.com/asdf
should not be shown a 404 not found page but instead
"asdf" should be passed onto my script where i can do a
search on the term and either give them back the results
of that search or direct them to a custom 404 page.

since i couldnt find the answer via php.net
's source i started messing around with
how i *think* its done... tell me if i am on the correct
track: when someone requests a page that does not exist, a
.htaccess file them up and also takes the page name they
were searching for and redirects them to a script...
So far i have only been able to get the .htaccess file
point to my custom 404 page... but how do i get it to pass
the parameter of the not-found-page to my script?

Would appreciate any code, tips, urls you can give me.

Thanks!
Ryan



 --
- The faulty interface lies between the chair and the
keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



 



If you use .htaccess and have mod_rewrite then it is simpler.
 Something like this (untested):



   RewriteEngine On
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(.*)$ index.php?term=$1 [L]


Then in index.php you can use the contents of $_GET['term'],
which in your example would be asdf.

[QSA,L] will give you the query string if the user typed in
something like http://www.mysite.com/asdf?your=mom.

Then $_GET['your'] = 'mom'.

-Shawn


-- 
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] Re: Search like php.net's URL thingy

2008-06-05 Thread Nate Tallman
ErrorDocument 404 /path/to/some/script.php
* $_SERVER['REDIRECT_URL']

(somehow misplaced underscore)

On Thu, Jun 5, 2008 at 2:50 PM, Nate Tallman <
[EMAIL PROTECTED]> wrote:

> Why not just set:
> ErrorDocument 404 /path/to/some/script.php
> Then check $SERVER['REDIRECT_URL'] for the failed request.
>
>
>
>
> On Thu, Jun 5, 2008 at 2:41 PM, Shawn McKenzie <[EMAIL PROTECTED]>
> wrote:
>
>> Ryan S wrote:
>>
>>> Hey,
>>> one of the things that make the php.net site so cool is how easy it is
>>> to find info for a function or a list of topics.. eg:
>>>
>>> http://php.net/arrays
>>> http://php.net/count
>>>
>>> I'm sure nearly all of you reading this have done it more times than you
>>> would care to count, i'm trying to get something like this on my own site
>>> but even after going to php.net and clicking on the view source buttons
>>> am a bit confused.
>>>
>>> basically this is what i am trying, people who type in
>>> http://www.mysite.com/asdf
>>> should not be shown a 404 not found page but instead "asdf" should be
>>> passed onto my script where i can do a search on the term and either give
>>> them back the results of that search or direct them to a custom 404 page.
>>>
>>> since i couldnt find the answer via php.net's source i started messing
>>> around with how i *think* its done... tell me if i am on the correct track:
>>> when someone requests a page that does not exist, a .htaccess file them up
>>> and also takes the page name they were searching for and redirects them to a
>>> script...
>>> So far i have only been able to get the .htaccess file point to my custom
>>> 404 page... but how do i get it to pass the parameter of the not-found-page
>>> to my script?
>>>
>>> Would appreciate any code, tips, urls you can give me.
>>>
>>> Thanks!
>>> Ryan
>>>
>>>
>>>
>>>  --
>>> - The faulty interface lies between the chair and the keyboard.
>>> - Creativity is great, but plagiarism is faster!
>>> - Smile, everyone loves a moron. :-)
>>>
>>>
>>>
>>>
>>>
>>
>> If you use .htaccess and have mod_rewrite then it is simpler.  Something
>> like this (untested):
>>
>> 
>>RewriteEngine On
>>RewriteCond %{REQUEST_FILENAME} !-d
>>RewriteCond %{REQUEST_FILENAME} !-f
>>RewriteRule ^(.*)$ index.php?term=$1 [L]
>> 
>>
>> Then in index.php you can use the contents of $_GET['term'], which in your
>> example would be asdf.
>>
>> [QSA,L] will give you the query string if the user typed in something like
>> http://www.mysite.com/asdf?your=mom.
>>
>> Then $_GET['your'] = 'mom'.
>>
>> -Shawn
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>


Re: [PHP] Re: Search like php.net's URL thingy

2008-06-05 Thread Nate Tallman
Why not just set:
ErrorDocument 404 /path/to/some/script.php
Then check $SERVER['REDIRECT_URL'] for the failed request.



On Thu, Jun 5, 2008 at 2:41 PM, Shawn McKenzie <[EMAIL PROTECTED]> wrote:

> Ryan S wrote:
>
>> Hey,
>> one of the things that make the php.net site so cool is how easy it is to
>> find info for a function or a list of topics.. eg:
>>
>> http://php.net/arrays
>> http://php.net/count
>>
>> I'm sure nearly all of you reading this have done it more times than you
>> would care to count, i'm trying to get something like this on my own site
>> but even after going to php.net and clicking on the view source buttons
>> am a bit confused.
>>
>> basically this is what i am trying, people who type in
>> http://www.mysite.com/asdf
>> should not be shown a 404 not found page but instead "asdf" should be
>> passed onto my script where i can do a search on the term and either give
>> them back the results of that search or direct them to a custom 404 page.
>>
>> since i couldnt find the answer via php.net's source i started messing
>> around with how i *think* its done... tell me if i am on the correct track:
>> when someone requests a page that does not exist, a .htaccess file them up
>> and also takes the page name they were searching for and redirects them to a
>> script...
>> So far i have only been able to get the .htaccess file point to my custom
>> 404 page... but how do i get it to pass the parameter of the not-found-page
>> to my script?
>>
>> Would appreciate any code, tips, urls you can give me.
>>
>> Thanks!
>> Ryan
>>
>>
>>
>>  --
>> - The faulty interface lies between the chair and the keyboard.
>> - Creativity is great, but plagiarism is faster!
>> - Smile, everyone loves a moron. :-)
>>
>>
>>
>>
>>
>
> If you use .htaccess and have mod_rewrite then it is simpler.  Something
> like this (untested):
>
> 
>RewriteEngine On
>RewriteCond %{REQUEST_FILENAME} !-d
>RewriteCond %{REQUEST_FILENAME} !-f
>RewriteRule ^(.*)$ index.php?term=$1 [L]
> 
>
> Then in index.php you can use the contents of $_GET['term'], which in your
> example would be asdf.
>
> [QSA,L] will give you the query string if the user typed in something like
> http://www.mysite.com/asdf?your=mom.
>
> Then $_GET['your'] = 'mom'.
>
> -Shawn
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


[PHP] Re: Search like php.net's URL thingy

2008-06-05 Thread Shawn McKenzie

Ryan S wrote:

Hey,
one of the things that make the php.net site so cool is how easy it is to find 
info for a function or a list of topics.. eg:

http://php.net/arrays
http://php.net/count

I'm sure nearly all of you reading this have done it more times than you would 
care to count, i'm trying to get something like this on my own site but even 
after going to php.net and clicking on the view source buttons am a bit 
confused.

basically this is what i am trying, people who type in 
http://www.mysite.com/asdf
should not be shown a 404 not found page but instead "asdf" should be passed 
onto my script where i can do a search on the term and either give them back the results 
of that search or direct them to a custom 404 page.

since i couldnt find the answer via php.net's source i started messing around with how i *think* its done... tell me if i am on the correct track: when someone requests a page that does not exist, a .htaccess file them up and also takes the page name they were searching for and redirects them to a script... 


So far i have only been able to get the .htaccess file point to my custom 404 
page... but how do i get it to pass the parameter of the not-found-page to my 
script?

Would appreciate any code, tips, urls you can give me.

Thanks!
Ryan



 --
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



  


If you use .htaccess and have mod_rewrite then it is simpler.  Something 
like this (untested):



RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?term=$1 [L]


Then in index.php you can use the contents of $_GET['term'], which in 
your example would be asdf.


[QSA,L] will give you the query string if the user typed in something 
like http://www.mysite.com/asdf?your=mom.


Then $_GET['your'] = 'mom'.

-Shawn

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



Re: [PHP] Search like php.net's URL thingy

2008-06-05 Thread Ryan S
Hey!

Thanks for replying.

Digging a bit more i found 


RewriteEngine On
RewriteRule ^([a-z][0-9][A-Z][aA0-zZ0])$ jj.php?show=$1


But it does not work :( do you see any fault with the above?

Thanks!
R


 --
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



- Original Message 
From: Bernhard Kohl <[EMAIL PROTECTED]>
To: Ryan S <[EMAIL PROTECTED]>
Sent: Thursday, June 5, 2008 9:25:46 PM
Subject: Re: [PHP] Search like php.net's URL thingy

you should familiarize yourself with the rewrite module of the apache server 
(if u operate on that one)

it's pretty much the same as regular expressions syntax

example:

i want all requests going to www.example.com/test being forwarded to 
index.php?a=test

place following into your .htaccess file in the root directory:

RewriteEngine on
RewriteBase /

RewriteRule ^([a-zA-Z])$ index.php?a=$1

the whole thing can get pretty complex with alot of rewrite conditions and 
stuff.

good luck


On 6/5/08, Ryan S <[EMAIL PROTECTED]> wrote:
Hey,
one of the things that make the php.net site so cool is how easy it is to find 
info for a function or a list of topics.. eg:

http://php.net/arrays
http://php.net/count

I'm sure nearly all of you reading this have done it more times than you would 
care to count, i'm trying to get something like this on my own site but even 
after going to php.net and clicking on the view source buttons am a bit 
confused.

basically this is what i am trying, people who type in 
http://www.mysite.com/asdf
should not be shown a 404 not found page but instead "asdf" should be passed 
onto my script where i can do a search on the term and either give them back 
the results of that search or direct them to a custom 404 page.

since i couldnt find the answer via php.net's source i started messing around 
with how i *think* its done... tell me if i am on the correct track: when 
someone requests a page that does not exist, a .htaccess file them up and also 
takes the page name they were searching for and redirects them to a script...

So far i have only been able to get the .htaccess file point to my custom 404 
page... but how do i get it to pass the parameter of the not-found-page to my 
script?

Would appreciate any code, tips, urls you can give me.

Thanks!
Ryan



  --
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)






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


  

Re: [PHP] Search like php.net's URL thingy

2008-06-05 Thread Daniel Brown
On Thu, Jun 5, 2008 at 3:07 PM, Ryan S <[EMAIL PROTECTED]> wrote:
> Hey,
> one of the things that make the php.net site so cool is how easy it is to 
> find info for a function or a list of topics.. eg:
>
> http://php.net/arrays
> http://php.net/count
>
[snip!]
>
> since i couldnt find the answer via php.net's source i started messing around 
> with how i *think* its done... tell me if i am on the correct track: when 
> someone requests a page that does not exist, a .htaccess file them up and 
> also takes the page name they were searching for and redirects them to a 
> script...

You're on the right track, Ryan.

Look up mod_rewrite for Apache, and also consider that php.net
uses operations similar to (though not exactlt like) the following
procedure:

#.htaccess
Redirect /ciel http://php.net/manual/en/function.ceil.php


-- 

Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



RE: Re: [PHP] Are there free http mysql tunneling writed in php ?

2008-06-05 Thread Per Jessen
Boyd, Todd M. wrote:

>> Well DUH, but then you should already know that we on this list don't
>> CODE everything for some and that the general consensus is secure
>> your own code.
> 
> I seem to have hit a nerve. Sorry for explaining best practices when I
> feel they're applicable.

Todd, the thing is - you felt obliged to explain that my answer quite
obviously wasn't the whole answer. 
Second, of course my outline was open to sql injection - mysql tunnelled
over http is exactly that. 


/Per Jessen, Zürich


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



[PHP] Search like php.net's URL thingy

2008-06-05 Thread Ryan S
Hey,
one of the things that make the php.net site so cool is how easy it is to find 
info for a function or a list of topics.. eg:

http://php.net/arrays
http://php.net/count

I'm sure nearly all of you reading this have done it more times than you would 
care to count, i'm trying to get something like this on my own site but even 
after going to php.net and clicking on the view source buttons am a bit 
confused.

basically this is what i am trying, people who type in 
http://www.mysite.com/asdf
should not be shown a 404 not found page but instead "asdf" should be passed 
onto my script where i can do a search on the term and either give them back 
the results of that search or direct them to a custom 404 page.

since i couldnt find the answer via php.net's source i started messing around 
with how i *think* its done... tell me if i am on the correct track: when 
someone requests a page that does not exist, a .htaccess file them up and also 
takes the page name they were searching for and redirects them to a script... 

So far i have only been able to get the .htaccess file point to my custom 404 
page... but how do i get it to pass the parameter of the not-found-page to my 
script?

Would appreciate any code, tips, urls you can give me.

Thanks!
Ryan



 --
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



  

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



[PHP] Updating inherited attributes without __construct()

2008-06-05 Thread Tyson Vanover
I have a class that has a list of valid keys, and an 
array of values.  When a value is added to the array 
it's key is first checked against the list of valid 
keys (this is to prevent injection issues we have been 
having later on in the project).


  class parent{
private $validkeys = 'title,color,name';
private $values = array();
  }
That class is inherited by other classes that mostly 
just have an expanded list of valid keys.  I would like 
to be able to update the valid key list without having 
to craft a constructor for child objects.  I would 
rather not give each child class the constructor,


  __construct()
  {
$this->validkeys.= ',setting,...';
parent::__construct();
  }

since most child classes have no need of a unique 
constructor.


I thought of defining a protected extended valid keys 
variable in the parent that the child could set that 
the parent constructor would combine with the valid keys.


class parent{
  private $validkeys = 'title,color,name';
  private $values = array();
  protected $extendedkeys;
  __construct(){
$this->validkeys .= $this->extendedkeys;
  }
}

But the children may become parents for further child 
classes.  And if the sub-child classes use the 
$extendedkeys variable it will overwrite the 
intermediate class's version.


Is there any way to tack on extra additional data by 
the child classes without creating a constructor.  I am 
not wedded to strings as a means, it just needs to be 
able to hold a string value.


Thanks

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



RES: [PHP] Execute php commands that are in an array

2008-06-05 Thread Thiago Pojda
I'm not sure I understand what you're trying to accomplish, but wouldn't
array_walk() help you out?


Atenciosamente,
www.softpartech.com.br
Thiago Henrique Pojda
Desenvolvimento Web
+55 41 3033-7676
[EMAIL PROTECTED]
Excelência em Softwares Financeiros


-Mensagem original-
De: Daniel Brown [mailto:[EMAIL PROTECTED] 
Enviada em: quinta-feira, 5 de junho de 2008 14:18
Para: Ryan S
Cc: php php
Assunto: Re: [PHP] Execute php commands that are in an array

On Thu, Jun 5, 2008 at 12:34 PM, Ryan S <[EMAIL PROTECTED]> wrote:
> Hey,
> its easier to start with code and then explain:
>
> $t_array[]='chr(rand(97,122))';
> echo $t_array[0];
>
> The above code outputs
> chr(rand(97,122))
>
> How can i execute that above code from the array instead of displaying it?

Try using create_function().



Note the manner in which the second parameter is laid-out.  You
must include what you want returned by the dynamic function, complete
with an ending semicolon.

-- 

Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
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] Caching and Optimization

2008-06-05 Thread Nathan Nobbe
On Thu, Jun 5, 2008 at 10:16 AM, VamVan <[EMAIL PROTECTED]> wrote:

> Hello All,
>
> Today my question is about the all important topic "Web Optimization"
>
> What kind of caching mechanisms can I use for Mysql Queries?


mysql has its own caching support, worth looking into.  you can also cache
query results on the webserver.  there you have a variety of mediums to save
the queries in, files (session perhaps), apc, memcache, etc..


> What kind of caching and optimization mechanisms can I use for frequent Web
> Service calls?


typically, reverse proxies are used for this purpose.  squid is very
popular, also, in apache 2.2 mod_proxy + mod_cache is looking pretty sweet
;)

Any kind of code explaining the process would be highly appreciated...
>

the only place in here you would need any php code would be caching sql
queries on the webserver.  its not too difficult really (but there is a
large gradient of complexity), here is a super trivial example,

$query = 'some sql';
if(in_cache($query))
  return fetch_from_cache($query);
else {
  $resultSet = mysql_query($query);
  store_in_cache($query, $resultSet);
  return $resultSet;
}

-nathan


Re: [PHP] Execute php commands that are in an array

2008-06-05 Thread Daniel Brown
On Thu, Jun 5, 2008 at 12:34 PM, Ryan S <[EMAIL PROTECTED]> wrote:
> Hey,
> its easier to start with code and then explain:
>
> $t_array[]='chr(rand(97,122))';
> echo $t_array[0];
>
> The above code outputs
> chr(rand(97,122))
>
> How can i execute that above code from the array instead of displaying it?

Try using create_function().



Note the manner in which the second parameter is laid-out.  You
must include what you want returned by the dynamic function, complete
with an ending semicolon.

-- 

Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



[PHP] Execute php commands that are in an array

2008-06-05 Thread Ryan S
Hey, 
its easier to start with code and then explain:

$t_array[]='chr(rand(97,122))';
echo $t_array[0];

The above code outputs 
chr(rand(97,122))

How can i execute that above code from the array instead of displaying it?

 
Thanks!
Ryan


--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



  

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



Re: [PHP] Re: Execute php commands that are in an array

2008-06-05 Thread Gabriel Sosa
you can use eval http://ar2.php.net/manual/es/function.eval.php
but remember escape all wildcard caracters

try

eval("\$a = 3; \$b = 2; \$c = \$a + \$b;");
echo $c // should show 5

saludos

On Thu, Jun 5, 2008 at 1:46 PM, Ryan S <[EMAIL PROTECTED]> wrote:
> Hey all!
> Disregard my last email as i solved it myself via eval()...
>
> Cheers!
> R
>
>
>
>
>
>
>
> Hey,
> its easier to start with code and then explain:
>
> $t_array[]='chr(rand(97,122))';
> echo $t_array[0];
>
> The above code outputs
> chr(rand(97,122))
>
> How can i execute that above code from the array instead of displaying it?
>
>
> Thanks!
> Ryan
>
>
> --
> - The faulty interface lies between the chair and the keyboard.
> - Creativity is great, but plagiarism is faster!
> - Smile, everyone loves a moron. :-)
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
Los sabios buscan la sabiduría; los necios creen haberla encontrado.
Gabriel Sosa

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



RE: Re: [PHP] Are there free http mysql tunneling writed in php ?

2008-06-05 Thread Boyd, Todd M.
> -Original Message-
> From: Wolf [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 05, 2008 11:51 AM
> To: Boyd, Todd M.
> Cc: php-general@lists.php.net
> Subject: RE: Re: [PHP] Are there free http mysql tunneling writed in
> php ?
> 

---8<--- snip

> I'm all for securing your PHP stuff, but at the same time, post some
> relevant PHP code for whatever security measuring you are saying to
> use, or point to a good reference for it.

You're right... I should have posted a link to information regarding SQL 
Injection rather than just speaking of it like the Boogey Man. On that note, 
I've tracked down an article I read some time ago that still holds quite a bit 
of water on the topic:

http://www.unixwiz.net/techtips/sql-injection.html

Hope that helps the OP (and anyone else curious about SQL Injection 
techniques/preventative measures).


Todd Boyd
Web Programmer


RE: Re: [PHP] Are there free http mysql tunneling writed in php ?

2008-06-05 Thread Wolf
> > 
> I don't feel that this is violating any guidelines for this mailing list (or 
> any programming-related mailing list, for that matter, without a specific 
> "security" counterpart), and so your "DUH" was taken as offensive and 
> unprovoked. If this was not the case, well, then let's let bygones be bygone. 
> In fact, I don't care about that either way--but I do care that my 
> security-related suggestion was squashed as being irrelevant to the list.
> 

I never said the security related suggestion was irrelevant nor was it 
squashed, but I DID feel it as a "DUH" statement due to the number of things 
posted on this list (stick around for a while) that are about securing the code 
or servers on the back end.

I for one am against short-open tags, but have seen people being taught to use 
them as shortcuts.  I've cleaned up other code that used the short-open in 
conjunction with other 'shortcuts' to save some typing but died when put onto a 
hardened server.

I'm all for securing your PHP stuff, but at the same time, post some relevant 
PHP code for whatever security measuring you are saying to use, or point to a 
good reference for it.  

Speaking of which, I need to update my links on some of that stuff myself and 
then post them to the hardened server I run.  Every environment you run into is 
different, whether it be as you pointed out that people say "secure your code" 
and then continue with their example of a form.  People expect that the one 
using the knowledge are responsible for their own code on their own servers.  
Due-diligence is expected by the older generation as that is what the teachings 
were growing up.  No silver spoons, no temper tantrums when something didn't go 
there way.  They investigated and fixed.  

Ultimately you are responsible for what you code.  Nobody else.  When I post 
code, I expect people to secure it down, using their own protocols.  I don't 
remind everyone to do it and some have even suggested that the code I have 
posted to the list can be easily exploited.  But then, I haven't posted my 
security checks or other tweaks either.  ;)

Wolf

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



[PHP] Re: Execute php commands that are in an array

2008-06-05 Thread Ryan S
Hey all!
Disregard my last email as i solved it myself via eval()...

Cheers!
R







Hey, 
its easier to start with code and then explain:

$t_array[]='chr(rand(97,122))';
echo $t_array[0];

The above code outputs 
chr(rand(97,122))

How can i execute that above code from the array instead of displaying it?


Thanks!
Ryan


--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)


  

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



RE: Re: [PHP] Are there free http mysql tunneling writed in php ?

2008-06-05 Thread Boyd, Todd M.
> -Original Message-
> From: Wolf [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 05, 2008 10:49 AM
> To: Boyd, Todd M.
> Cc: php-general@lists.php.net
> Subject: RE: Re: [PHP] Are there free http mysql tunneling writed in
> php ?
> 
> 
> > I seem to have hit a nerve. Sorry for explaining best practices when
> I feel they're applicable.
> >
> 
> If you read through the archives, this same type of thing comes up
> about every other month.  That and the "I want to know how to do this"
> where there is no PHP involved and/or no PHP code posted that is
> actually being used (such as how come I'm getting an empty variable
> from a strtolower call).
> 
> So, a bit of a nerve if you read the FAQs and such attached to the join
> the list page (at least last I looked), it talked about these same
> things.
> 
> If you take code from the list and don't test it and put in your own
> security practices, you are asking for exploitation as this list is
> rife with spammers and such.  So when someone gives a brief "do
> something along these lines" in some bit of code, it's normally a fore-
> gone conclusion that it's expected the one using it to be responsible
> for their own coding and security of their code.

Warning: Getting a tad bit off-topic here...

I have read through (some of) the archives, and I have scanned the "join the 
list" page. I am not some mailing-list-autistic user who jumps from forum to 
forum and steals the thunder of the list's regulars. However, I have noticed 
that security is often left unattended with regard to coding examples, 
suggestions, and the like. In one of my database systems classes, the professor 
didn't even explain the steps one would take to encrypt a password so that it 
isn't tossed around as plain text.

I don't see the point in replying to someone's question with a solution that is 
completely open to vulnerabilities (and not touching on the fact that it is 
vulnerable). I don't mean buffer overflows and the like, but suggesting that a 
user create a PHP script that accepts almost-literally anything as input and is 
translated directly to SQL baffles me. Why not just suggest that a user 
eliminate passwords to simplify their login code?

If security concerns are never mentioned, then mobs of coders come to the front 
lines ill-prepared to deal with security. This is one of the reasons that SQL 
Injection (which is INCREDIBLY easy to safeguard against) is such a rampant 
occurrence on the web nowadays.

Tutorials explain forms without even a casual mention of HTTP Splitting. 
Programmers suggest code for Javascript data sanitizing without alluding to the 
fact that server-side sanitization must also be performed in order for it to 
truly matter. Et cetera...

I understand that code submitted to this list should be taken with a grain of 
salt, and your own best practices should be applied before the code is run in a 
production environment, but... jeez, dude. Calm down. PHP is predominantly a 
language for programming web applications. Web (or even just networked) 
applications require security above and beyond that of local applications, and 
I don't see the harm in my suggesting to the OP that he take a different 
route... or at least take steps to secure the method in question.

If secondary or tertiary posts to answer a user's question containing security 
tips are not welcome, then I will desist; but it seems counterproductive to the 
programming community as a whole to leave these topics undisturbed. Yes, as you 
said, the user is responsible for the security of their own code. They are also 
responsible for their own code itself--which you have given suggestions as to 
the nature of. I am merely giving suggestions as to the nature of the security 
of that code.

I don't feel that this is violating any guidelines for this mailing list (or 
any programming-related mailing list, for that matter, without a specific 
"security" counterpart), and so your "DUH" was taken as offensive and 
unprovoked. If this was not the case, well, then let's let bygones be bygone. 
In fact, I don't care about that either way--but I do care that my 
security-related suggestion was squashed as being irrelevant to the list.


Todd Boyd
Web Programmer


[PHP] Caching and Optimization

2008-06-05 Thread VamVan
Hello All,

Today my question is about the all important topic "Web Optimization"

What kind of caching mechanisms can I use for Mysql Queries? I was wondering
if you have some methods would you share some code?

What kind of caching and optimization mechanisms can I use for frequent Web
Service calls?

Any kind of code explaining the process would be highly appreciated...

Thanks


RE: Re: [PHP] Are there free http mysql tunneling writed in php ?

2008-06-05 Thread Wolf
 
> I seem to have hit a nerve. Sorry for explaining best practices when I feel 
> they're applicable.
> 

If you read through the archives, this same type of thing comes up about every 
other month.  That and the "I want to know how to do this" where there is no 
PHP involved and/or no PHP code posted that is actually being used (such as how 
come I'm getting an empty variable from a strtolower call).

So, a bit of a nerve if you read the FAQs and such attached to the join the 
list page (at least last I looked), it talked about these same things.  

If you take code from the list and don't test it and put in your own security 
practices, you are asking for exploitation as this list is rife with spammers 
and such.  So when someone gives a brief "do something along these lines" in 
some bit of code, it's normally a fore-gone conclusion that it's expected the 
one using it to be responsible for their own coding and security of their code.

Wolf

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



RE: Re: [PHP] Are there free http mysql tunneling writed in php ?

2008-06-05 Thread Boyd, Todd M.
> -Original Message-
> From: Wolf [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 05, 2008 10:33 AM
> To: Boyd, Todd M.
> Cc: Per Jessen; php-general@lists.php.net
> Subject: RE: Re: [PHP] Are there free http mysql tunneling writed in
> php ?
> 
> > > I don't know of any specific implementation, but surely you can
> write
> > > one in about 60 seconds.
> > >
> > > get http://domain/run-this-sql?db=database&text=blahblahblah
> > >
> > > I'm sure you get the idea.
> >
> > From a security standpoint, this is wde open for SQL
> injection. I would recommend against using something like this for
> performing SQL queries, as malicious SQL would be easy as pie to
> execute. Of course, you can place the script behind layers of
> security... but ad-hoc queries are a dangerous beast.
> >
> >
> > Todd Boyd
> > Web Programmer
> 
> Well DUH, but then you should already know that we on this list don't
> CODE everything for some and that the general consensus is secure your
> own code.

I seem to have hit a nerve. Sorry for explaining best practices when I feel 
they're applicable.


Todd Boyd
Web Programmer





RE: Re: [PHP] Are there free http mysql tunneling writed in php ?

2008-06-05 Thread Wolf

 "Boyd wrote: 
> > -Original Message-
> > From: Per Jessen [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, June 05, 2008 3:06 AM
> > To: php-general@lists.php.net
> > Subject: Re: [PHP] Are there free http mysql tunneling writed in php ?
> > 
> > KLEIN Stéphane wrote:
> > 
> > > Hi,
> > >
> > > do you know one free (open source) http mysql tunneling writed in php
> > > ?
> > 
> > I don't know of any specific implementation, but surely you can write
> > one in about 60 seconds.
> > 
> > get http://domain/run-this-sql?db=database&text=blahblahblah
> > 
> > I'm sure you get the idea.
> 
> From a security standpoint, this is wde open for SQL injection. I 
> would recommend against using something like this for performing SQL queries, 
> as malicious SQL would be easy as pie to execute. Of course, you can place 
> the script behind layers of security... but ad-hoc queries are a dangerous 
> beast.
> 
> 
> Todd Boyd
> Web Programmer

Well DUH, but then you should already know that we on this list don't CODE 
everything for some and that the general consensus is secure your own code.

Wolf

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



RE: [PHP] Dynamic form changes without refresh

2008-06-05 Thread Boyd, Todd M.
> -Original Message-
> From: Mayer, Jonathan [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 05, 2008 7:18 AM
> To: 'php-general@lists.php.net'
> Subject: [PHP] Dynamic form changes without refresh

---8<--- snip
 
> Using some basic javascript/AJAX, I have set up a link next to each
> text
> box, which calls code that updates the database in the background
> without
> refreshing the page. If I manually refresh the page, the textarea box
> in
> question updates correctly, proving that the database update has
> worked.
> However, I cannot work out how to get the textarea boxes to toggle the
> disable on/off "on the fly". I assume they would need to continually
> check
> the database and adjust as required.
> 
> I realise there may not be too much PHP involved here, but I was
> wondering
> whether anyone could assist or point me in the right direction.

There is actually no PHP involved beyond your AJAX response page, and
that is basic at most. What you will need to do if you want to
*continually* update your status is to use the javascript
"setInterval()" or "setTimeout()" method(s).

I recommend setInterval(), as it repeats itself at the specified time
interval. The function passed to setTimeout() would need to set a new
timeout every time it was executed.

Hope this helps.


Todd Boyd
Web Programmer




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



RE: Re: [PHP] Are there free http mysql tunneling writed in php ?

2008-06-05 Thread Boyd, Todd M.
> -Original Message-
> From: Per Jessen [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 05, 2008 3:06 AM
> To: php-general@lists.php.net
> Subject: Re: [PHP] Are there free http mysql tunneling writed in php ?
> 
> KLEIN Stéphane wrote:
> 
> > Hi,
> >
> > do you know one free (open source) http mysql tunneling writed in php
> > ?
> 
> I don't know of any specific implementation, but surely you can write
> one in about 60 seconds.
> 
> get http://domain/run-this-sql?db=database&text=blahblahblah
> 
> I'm sure you get the idea.

From a security standpoint, this is wde open for SQL injection. I would 
recommend against using something like this for performing SQL queries, as 
malicious SQL would be easy as pie to execute. Of course, you can place the 
script behind layers of security... but ad-hoc queries are a dangerous beast.


Todd Boyd
Web Programmer





RE: [PHP] Dynamic form changes without refresh

2008-06-05 Thread Per Jessen
Mayer, Jonathan wrote:

> I suppose that, as well as updating the database when I click the
> link, I could also update a CSS toggle, but I'd really like it to be
> deciding whether to toggle only based on the flag in the database.
> 
> So:
> 
> // check database
> if ($toggle == 1)
> {
>...
> }
> else
> {
>...
> }
> 
> This is called every time the page is refreshed, of course, but if the
> database is changed afterwards, the form doesn't know. I would like
> some way of continually checking in the background whether $toggle is
> 1 or 0, and update the form appropriately. I assumed AJAX was the way
> to go.

Ajax or iframe-rpc would work, yes.  Continually poll your database and
set the display attribute accordingly.  


/Per Jessen, Zürich


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



Re: [PHP] Dynamic form changes without refresh

2008-06-05 Thread Wolf

BOTTOM POST

Mayer, Jonathan wrote:

I suppose that, as well as updating the database when I click the link, I
could also update a CSS toggle, but I'd really like it to be deciding
whether to toggle only based on the flag in the database.

So:

// check database
if ($toggle == 1)
{
   ...
}
else
{
   ...
}

This is called every time the page is refreshed, of course, but if the
database is changed afterwards, the form doesn't know. I would like some way
of continually checking in the background whether $toggle is 1 or 0, and
update the form appropriately. I assumed AJAX was the way to go.

Perhaps I'm making this more complicated than it needs to be, but there is a
reason why I want to store the state of the toggle in the database (as
opposed to simply using a javascript on/off snippet) as I use this
information in other places in the code.



Use AJAX and change the visible section, if you want something that 
continually updates and stores it, what you need to do is something 
along the lines of having the text box name clickable, and if they 
choose to enter something in it, then toggle it in the DB, show it on 
the form, then take their information from it.


PHP has nothing to do with it.

Wolf


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



RE: [PHP] Dynamic form changes without refresh

2008-06-05 Thread Mayer, Jonathan
I suppose that, as well as updating the database when I click the link, I
could also update a CSS toggle, but I'd really like it to be deciding
whether to toggle only based on the flag in the database.

So:

// check database
if ($toggle == 1)
{
   ...
}
else
{
   ...
}

This is called every time the page is refreshed, of course, but if the
database is changed afterwards, the form doesn't know. I would like some way
of continually checking in the background whether $toggle is 1 or 0, and
update the form appropriately. I assumed AJAX was the way to go.

Perhaps I'm making this more complicated than it needs to be, but there is a
reason why I want to store the state of the toggle in the database (as
opposed to simply using a javascript on/off snippet) as I use this
information in other places in the code.

-Original Message-
From: Per Jessen [mailto:[EMAIL PROTECTED]
Sent: 05 June 2008 13:26
To: php-general@lists.php.net
Subject: Re: [PHP] Dynamic form changes without refresh


Mayer, Jonathan wrote:

> Using some basic javascript/AJAX, I have set up a link next to each
> text box, which calls code that updates the database in the background
> without refreshing the page. If I manually refresh the page, the
> textarea box in question updates correctly, proving that the database
> update has worked. However, I cannot work out how to get the textarea
> boxes to toggle the disable on/off "on the fly". I assume they would
> need to continually check the database and adjust as required.

This sounds too obvious, so I've probably misunderstood your question -
but surely it is just a matter of toggling the CSS 'display' attribute? 


/Per Jessen, Zürich


-- 
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] Dynamic form changes without refresh

2008-06-05 Thread Per Jessen
Mayer, Jonathan wrote:

> Using some basic javascript/AJAX, I have set up a link next to each
> text box, which calls code that updates the database in the background
> without refreshing the page. If I manually refresh the page, the
> textarea box in question updates correctly, proving that the database
> update has worked. However, I cannot work out how to get the textarea
> boxes to toggle the disable on/off "on the fly". I assume they would
> need to continually check the database and adjust as required.

This sounds too obvious, so I've probably misunderstood your question -
but surely it is just a matter of toggling the CSS 'display' attribute? 


/Per Jessen, Zürich


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



[PHP] Dynamic form changes without refresh

2008-06-05 Thread Mayer, Jonathan
Hiya all,

I have a PHP page with a form holding a large number of textarea boxes.

These text boxes are individually set as enabled or disabled based on a flag
held in a MySQL database.

I want to be able to dynamically enable or disable a specific box without
the page being recalled (potentially loosing the parameters passed, and
having to rebuild a large complex table).

Using some basic javascript/AJAX, I have set up a link next to each text
box, which calls code that updates the database in the background without
refreshing the page. If I manually refresh the page, the textarea box in
question updates correctly, proving that the database update has worked.
However, I cannot work out how to get the textarea boxes to toggle the
disable on/off "on the fly". I assume they would need to continually check
the database and adjust as required.

I realise there may not be too much PHP involved here, but I was wondering
whether anyone could assist or point me in the right direction.

Thanks,
Jon.

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



Re: [PHP] A problem with fgets()

2008-06-05 Thread Usamah M. Ali
Well, finally found an explanation and a solution: calling fgets()
twice. Because if there's no length limit supplied (and it's not EOF)
when calling the function, it continues reading until it finds the
first newline character. So calling fgets() again will ensure that it
will read from the _beginning_ of the *next* line:



To clarify more, if the first call to fgets() reads the line
containing the city name 'Alexandria', it might be read as:
andria

Now calling fgets() again will definitely read the whole next line:
Dallas


>
> Yes, I agree that that note is complete hogwash, and have just deleted
> it!
>
> Cheers!
>
> Mike
>

Thanks. :)

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



[PHP] cancel of <[EMAIL PROTECTED]>

2008-06-05 Thread Henrik Johansson
cancel by original author

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



Re: [PHP] mail() error handling

2008-06-05 Thread Stut

On 5 Jun 2008, at 09:48, Henrik Johansson wrote:

I have a piece of code that uses mail() to, well, send mail.
It works, but not the error handling which is as follows:


$send = @mail( $to, $subject, $body, $headers );

if($send)
{header( "Location: http://somewhere/thankyou.html"; );}
else
{print "Oops, couldn't deliver the message, please try again soon."; }

I checked, and it always returns 1, even though I tried a  
[EMAIL PROTECTED] that

doesn't exist!
Anyone got a clue what I've done wrong?


The mail function will succeed if it completes it's task, which on  
unix-based systems is simply to pass the message on to sendmail. So,  
in your case I'd say sendmail is accepting the message so mail is  
quite correct in thinking it succeeded.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: Quickly verifying single word.

2008-06-05 Thread Per Jessen
Usamah M. Ali wrote:

> According to your needs, it could be simply shortened to the first if:
> if (preg_match('/\s+/i', $string) === 0)
> {
> echo 'No white spaces';
> } 

And you could even remove the '+'. 


/Per Jessen, Zürich


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



Re: [PHP] Regex in PHP

2008-06-05 Thread Richard Heyes

> sorry to bother you richard.

You didn't, I just wanted to make sure I wasn't losing it (more).

--
Richard Heyes

++
| Access SSH with a Windows mapped drive |
|http://www.phpguru.org/sftpdrive|
++

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



Re: [PHP] Re: Quickly verifying single word.

2008-06-05 Thread Usamah M. Ali
On Thu, Jun 5, 2008 at 12:02 PM, Usamah M. Ali <[EMAIL PROTECTED]> wrote:

> Won't work either. The problem lies in using the === comparison
> operator. preg_match() returns 0 if no match is found, and FALSE if an
> error occurred. So using === will always echo 'No spaces' whether
> there were spaces or not, provided that no error has occurred.
>
> if (!preg_match('/\s+/i', $string))
> {
>echo 'No spaces';
> }
>
> should suffice.
>
> Regards,
> Usamah
>

Won't work either. :)

This should work fine:
if (preg_match('|\s+|i', $string) === 0)
{
echo '$string does not contain white spaces!';
}
elseif preg_match('/\s+/i', $string)
{
echo 'One or more white spaces found!';
}
else
{
echo 'An error has occurred!';
}

According to your needs, it could be simply shortened to the first if:
if (preg_match('/\s+/i', $string) === 0)
{
echo 'No white spaces';
}

Hope that works well.

Regards,
Usamah

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



Re: [PHP] Re: Quickly verifying single word.

2008-06-05 Thread Usamah M. Ali
On Thu, Jun 5, 2008 at 9:19 AM, Per Jessen <[EMAIL PROTECTED]> wrote:
> Shawn McKenzie wrote:
>
>>> if (preg_match('/[\s]*/', $string) === false) {
>>> echo 'No spaces!';
>>> }
>>>
>>> -Shawn
>>
>> Second one doesn't work for some reason.  No time now to test, will
>> later.
>
> How about:
>
> if (preg_match('/\s/', $string) === false) {
>echo 'No spaces!';
> }
>
>
Won't work either. The problem lies in using the === comparison
operator. preg_match() returns 0 if no match is found, and FALSE if an
error occurred. So using === will always echo 'No spaces' whether
there were spaces or not, provided that no error has occurred.

if (!preg_match('/\s+/i', $string))
{
echo 'No spaces';
}

should suffice.

Regards,
Usamah

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



[PHP] mail() error handling

2008-06-05 Thread Henrik Johansson
Hi.

I have a piece of code that uses mail() to, well, send mail.
It works, but not the error handling which is as follows:


$send = @mail( $to, $subject, $body, $headers );

if($send)
{header( "Location: http://somewhere/thankyou.html"; );}
else
{print "Oops, couldn't deliver the message, please try again soon."; }

I checked, and it always returns 1, even though I tried a [EMAIL PROTECTED] that
doesn't exist!
Anyone got a clue what I've done wrong?

Kind Regards,
Henrik Johansson
System Administrator
RADIUS Sweden AB

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



[PHP] Re: Are there free http mysql tunneling writed in php ?

2008-06-05 Thread Colin Guthrie

KLEIN Stéphane wrote:

do you know one free (open source) http mysql tunneling writed in php ?


Do you mean tunnelling in the classic sense, e.g. have a webpage that 
spits reads in data and spits out data and to which you can effectively 
connect a standard mysql client to?


Or do you just mean a generic interact to mysql written in PHP?

If the former, I don't know. If the latter PHPMyAdmin is your friend.

Col


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



Re: [PHP] Are there free http mysql tunneling writed in php ?

2008-06-05 Thread Per Jessen
KLEIN Stéphane wrote:

> Hi,
> 
> do you know one free (open source) http mysql tunneling writed in php
> ?

I don't know of any specific implementation, but surely you can write
one in about 60 seconds. 

get http://domain/run-this-sql?db=database&text=blahblahblah

I'm sure you get the idea.


/Per Jessen, Zürich


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



[PHP] Are there free http mysql tunneling writed in php ?

2008-06-05 Thread KLEIN Stéphane
Hi,

do you know one free (open source) http mysql tunneling writed in php ?

Thanks for your information,
Stephane


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