Re: [PHP] Create .php file with php

2007-06-26 Thread Adam Schroeder
You might also consider looking at variable variables and dynamic PHP 
(writing and evaluating php expressions on the fly). 


http://us.php.net/variables.variable
http://us.php.net/eval

Writing the PHP to a file could be a potential security vulnerability.  
Especially if this was going to go into usage within a high usage web 
app. =)


Adam


Daniel Brown wrote:


On 6/26/07, Marius Toma <[EMAIL PROTECTED]> wrote:


I can not believe how stupid I can be sometime.

I was trying to create a file, but a file with the same name already
existed on the server - and I did not have the write permission to it,
so from here I got the error message saying that I can not create the
file :(

Thank for your time,
Marius

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




If you absolutely *must* create PHP files on-the-fly, and only
need them for a one-off thing, put them in a specific directory that
only the web server has access to read, write, and execute, and then
delete the files immediately after you've used them as needed.



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



Re: [PHP] Create .php file with php [POC CODE INCLUDED]

2007-06-26 Thread Adam Schroeder
... if you really couldn't write it as dynamic PHP -- you could also 
save it in a database.



Edward Vermillion wrote:



On Jun 26, 2007, at 3:31 PM, Crayon Shin Chan wrote:


On Wednesday 27 June 2007 03:53, Daniel Brown wrote:


On 6/26/07, Al Rider <[EMAIL PROTECTED]> wrote:


I think most systems have a /tmp directory above the web dir, so
outsiders can't watch it anyhow.



True, but on an unsecured box, this becomes possible, as Apache
will most likely be running universally as `nobody`, `httpd`,
`apache`, or `daemon` for all scripts, including all web-based  scripts
writing to the /tmp directory.  This includes session information,
temporary .php files (as Marius requested), et cetera.



How is this different from:

"put them in a specific directory that only the web server has  
access to

read, write, and execute"



Most /tmp directories are world rwx. So anyone that can log into the  
server through a shell, or any account running on the server, has at  
least read access to anything in the /tmp directory. They wouldn't  
need to do it through a web script.


At least if the temp directory is rwx web server only, shell logins  
and other accoounts are denied access. Any web script can still get  
to it though.


Ed



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



Re: [PHP] Removing Spaces from Array Values

2007-07-02 Thread Adam Schroeder
The function str_replace() DOES NOT change the parameter.  Rather, 
str_replace() returns the desired string.  Try changing your code to:



for($num = 0; $cntr < $num; $cntr++)
{
$someArray[$num] = str_replace(' ','',$someArray[$num]);
echo "$someArray[$num]";
}



http://us.php.net/manual/en/function.str-replace.php


Adam

kvigor wrote:


Need to remove all spaces from Array Values... And this doesn't work.

This is similar info that's within array values: $someArray[0] = "PHP is 
awesome";s/b PHPisawesome
This is similar info that's within array values: $someArray[1] = "The Toy 
Boat";s/b TheToyBoat


Begin Code===
$num = count($someArray);

for($num = 0; $cntr < $num; $cntr++)
{
str_replace(' ','',$someArray[$num]);
echo "$someArray[$num]";
}
End Code=== 

 



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



Re: [PHP] how PHP is batter?

2007-07-03 Thread Adam Schroeder
This is an important debate and I would hope to see a more lively 
discussion.  Many of us have to validate our choices and our employers 
don't care about anti-microsoft and anti-corporation arguments (I do 
believe the open-source versus closed-source argument is a valid one to 
make to your  employers).  I'm sure this question has come up many times 
on this board (and countless others), which might be why it is such a 
volatile topic.


Though, this has been an ongoing debate for many years... the debate is 
very fluid.  Arguments made in the past, like ASP.NET only works on IIS, 
might not be valid today.  Much of the literature out there does not 
reflect this.  I would like to offer this to the debate, benchmarks 
showing PHP to run faster:



http://www.wrensoft.com/zoom/benchmarks.html


I thought this was a very interesting find, as ASP.NET is a compiled 
language.  Theoretically, this would give ASP.NET an advantage as far as 
speed is concerned.  Does anyone else have other evidence where ASP.NET 
has been shown to run faster?  I don't think the benchmark I have given 
is very valid. 


Thanks,
Adam



Edward Vermillion wrote:



On Jul 3, 2007, at 8:52 AM, Stut wrote:


Andrei wrote:


Muhammad Hassan Samee wrote:


ASP.net VS PHP?

how PHP is batter?

.


In short words it's not Micro$oft and you don't need to buy stuff to
develop in it.



You have never needed to buy anything to develop ASP.net applications.



Ummm... Windows?



;)

Ed



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



Re: [PHP] how PHP is batter?

2007-07-05 Thread Adam Schroeder

Crayon Shin Chan wrote:


On Tuesday 03 July 2007 22:56, Stut wrote:

 


I saw there is a free version of Studio, but I think it's for
students... You cannot go build a corporate project with it I
think...
 


More FUD. Go read the licence before claiming to know what it says!
   



Regardless, the "Express" version has strings attached:

http://www.theregister.co.uk/2007/06/05/microsoft_mvp_threats/

 


Two more good (but dated) articles:

http://www.webpronews.com/expertarticles/2005/12/22/asp-vs-php

http://www.builderau.com.au/program/web/soa/PHP-ASP-or-ASP-NET-/0,339024632,320283074,00.htm


One claims ASP.NET is *much* faster, as I would have suspected.  It 
would be interesting to compare a LAMP server (mysql running MyISAM) and 
Win2k3/MS-SQL/.NET.


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