|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 10 Aug 2005 18:40:46 -0000 Issue 3617
php-general-digest-help
lists.php.net
Date: Wed Aug 10 2005 - 13:40:46 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 10 Aug 2005 18:40:46 -0000 Issue 3617
Topics (messages 220323 through 220353):
Re: N/A
220323 by: Jasper Bryant-Greene
220328 by: John Nichel
220352 by: Rory Browne
Fixing Invalid Characters in RSS Feeds.. ?
220324 by: Greg Schnippel
220350 by: Manuel Lemos
Re: Insert one or many chekbox values in a db mysql
220325 by: Greg Schnippel
220327 by: John Nichel
Re: php output to string
220326 by: Matthew Weier O'Phinney
Restarting windows from php
220329 by: Karl-Heinz Christian Zeck
220330 by: Jay Blanchard
220331 by: Karl-Heinz Christian Zeck
220332 by: Cafer ÅžimÅŸek
220333 by: Joseph Oaks
220334 by: Richard Davey
220335 by: tg-php.gryffyndevelopment.com
220336 by: Richard Davey
220337 by: George Pitcher
220347 by: Stut
redirect based off server string
220338 by: Robert Sossomon
220340 by: Greg Schnippel
220351 by: Leon Vismer
display error line in object method
220339 by: Georgi Ivanov
220341 by: Mike Johnson
220342 by: Georgi Ivanov
220343 by: Mike Johnson
REGEX for query
220344 by: Jay Blanchard
220348 by: Michael Sims
Re: Re[2]:[PHP] Restarting windows from php
220345 by: Joseph Oaks
force download
220346 by: Sebastian
220353 by: James R.
dynamic object instances
220349 by: Thomas Angst
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
R. Ragunathan wrote:
> can we implement lock to a table using postgres with php.
> if any of u all knows the solution do reply back.
>
You may also want to look at the following URL:
http://www.postgresql.org/docs/8.0/interactive/explicit-locking.html
attached mail follows:
R. Ragunathan wrote:
>
> hi,
>
> can we implement lock to a table using postgres with php.
> if any of u all knows the solution do reply back.
>
http://www.catb.org/~esr/faqs/smart-questions.html
Pay close attention to the sections dealing with "Before you ask", and
"Use meaningful, specific subject headers"
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john
kegworks.com
attached mail follows:
As Ireland's property developers scramble to snap up every last square
metre of prime Dublin real estate, a green oasis in the heart of this
booming capital is standing firm against the tide of change.
All this may seem highly irrelevent, but when you have a N/A subject,
then anything is in.
Consider yourself lucky, that Jay, and Jasper, gave your question
enough seriousness to direct you to the manual. Personally I would
have simply directed you to ESR's essay on Smart Questions(available
from John Nichels response)
On 8/9/05, R. Ragunathan <ragu
ooty.tenet.res.in> wrote:
>
>
> hi,
>
> can we implement postgres transactions with php.
> if anyone knows the solution please reply back.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
I wrote a custom blog/CMS script that I use to generate RSS feeds.
Every so often, in the process of cutting and pasting from other sites
I will inadvertently enter a bad character that RSS doesn't like which
causes the whole feed to break. (For example, versions of quotation
marks or long dashes). My solution now is to check the feed at
feedvalidator.org and then edit any offending characters by hand.
Does anyone know an easier way to do this? In truth, I'm not sure I
know what kind of characters are valid and which are not and why. Is
there an easy way to validate and correct any incoming text?
Thanks,
- schnippy
attached mail follows:
Hello,
on 08/10/2005 10:05 AM Greg Schnippel said the following:
> I wrote a custom blog/CMS script that I use to generate RSS feeds.
> Every so often, in the process of cutting and pasting from other sites
> I will inadvertently enter a bad character that RSS doesn't like which
> causes the whole feed to break. (For example, versions of quotation
> marks or long dashes). My solution now is to check the feed at
> feedvalidator.org and then edit any offending characters by hand.
>
> Does anyone know an easier way to do this? In truth, I'm not sure I
> know what kind of characters are valid and which are not and why. Is
> there an easy way to validate and correct any incoming text?
There is no such thing as invalid RSS characters. All characters are
valid as long as they are properly encoded to include in XML documents.
If you are not sure how to do it, you may want to take a look at this
RSS writer and XML writer classes that do it properly:
http://www.phpclasses.org/rsswriter
http://www.phpclasses.org/xmlwriter
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
attached mail follows:
Try this article on Evolt:
http://www.evolt.org/article/Storing_form_array_data_to_MySQL_using_PHP/18/60222/
that covers the whole process with good code examples..
- schnippy
On 8/9/05, Jesús Alain Rodríguez Santos <wmaster
cfg.jovenclub.cu> wrote:
> Hi, I have 5 chekboxes in a page, I would like insert the values of all
> chekboxes checked in a mysql db.
>
>
> --
> Este mensaje ha sido analizado por MailScanner
> en busca de virus y otros contenidos peligrosos,
> y se considera que está limpio.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Jesús Alain Rodríguez Santos wrote:
> Hi, I have 5 chekboxes in a page, I would like insert the values of all
> chekboxes checked in a mysql db.
Okay, have fun.
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john
kegworks.com
attached mail follows:
* Jesús Fernández <jesusfs
gmail.com>:
> thanks, it works, but that returns the php code.
> what i actually need is the output of that php code evaluated.
So eval() the string...
--
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/
attached mail follows:
Does anyone have any idea how to restart windows from a php script?
I tried the following:
exec('SHUTDOWN -r -t 01');
or
exec('SHUTDOWN /r');
I received the following warning message: Warning: exec(): Unable to
fork [SHUTDOWN -r -t 01].
I never used this kind of functions before. What's wrong? In IIS for
"Execute Permissions" I have "Scripts and Executables". What
permissions should I set for the Internet Guest Account? Or something
else caused the problem, not the permissions? Please help me.:)
Thanks!
attached mail follows:
[snip]
Does anyone have any idea how to restart windows from a php script?
I tried the following:
exec('SHUTDOWN -r -t 01');
or
exec('SHUTDOWN /r');
I received the following warning message: Warning: exec(): Unable to
fork [SHUTDOWN -r -t 01].
I never used this kind of functions before. What's wrong? In IIS for
"Execute Permissions" I have "Scripts and Executables". What
permissions should I set for the Internet Guest Account? Or something
else caused the problem, not the permissions? Please help me.:)
[/snip]
Everyone, repeat after me......
PHP is server-side, there's no place like home,
PHP is server-side, there's no place like home,
PHP is server-side, there's no place like home......
If you are trying to restart Windows, locally, you have to use something
client-side to affect that.
attached mail follows:
I don't want to restart windows locally, I want to restart it
remotely. I need a php script that restarts the server. Is this
possible or not?
On 8/10/05, Jay Blanchard <jay.blanchard
niicommunications.com> wrote:
> [snip]
> Does anyone have any idea how to restart windows from a php script?
> I tried the following:
> exec('SHUTDOWN -r -t 01');
> or
> exec('SHUTDOWN /r');
>
> I received the following warning message: Warning: exec(): Unable to
> fork [SHUTDOWN -r -t 01].
>
> I never used this kind of functions before. What's wrong? In IIS for
> "Execute Permissions" I have "Scripts and Executables". What
> permissions should I set for the Internet Guest Account? Or something
> else caused the problem, not the permissions? Please help me.:)
> [/snip]
>
> Everyone, repeat after me......
>
> PHP is server-side, there's no place like home,
> PHP is server-side, there's no place like home,
> PHP is server-side, there's no place like home......
>
> If you are trying to restart Windows, locally, you have to use something
> client-side to affect that.
>
>
attached mail follows:
Hi,
I think, Karl says that to how to shutdown the server.
This is posible with rundll, or using Win32API functions.
This is the detailed information about how to use Win32API functions
in PHP:
http://www.php.net/manual/en/ref.w32api.php
So, also this is an information about ExitWindows() API function:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/exitwindows.asp
Best Regards.
"Jay Blanchard" <jay.blanchard
niicommunications.com> writes:
> [snip]
> Does anyone have any idea how to restart windows from a php script?
> I tried the following:
> exec('SHUTDOWN -r -t 01');
> or
> exec('SHUTDOWN /r');
>
> I received the following warning message: Warning: exec(): Unable to
> fork [SHUTDOWN -r -t 01].
>
> I never used this kind of functions before. What's wrong? In IIS for
> "Execute Permissions" I have "Scripts and Executables". What
> permissions should I set for the Internet Guest Account? Or something
> else caused the problem, not the permissions? Please help me.:)
> [/snip]
>
> Everyone, repeat after me......
>
> PHP is server-side, there's no place like home,
> PHP is server-side, there's no place like home,
> PHP is server-side, there's no place like home......
>
> If you are trying to restart Windows, locally, you have to use something
> client-side to affect that.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
Cafer ÅžimÅŸek
http://cafer.org
attached mail follows:
First off, windows has no clue what a fork is, much less the command
'shutdown -r -t 01'.
You can get a windows based version here for windows 2000,
http://support.microsoft.com/default.aspx?scid=kb;en-us;317371&sd=tech
If you on windows xp or 2003 servers I'm not sure how this will work
now that MS in there infinate wisdom has implemented the shutdown/
reboot logging stuff where you have to tell it why your rebooting or
shutting it down. (IMHO the dumbest thing ever)
From personal experiance I would test this on a local machine first
before putting it on a production system, as they don't always act the
way you intend them to.
Second, why are you having to reboot the system? Is an application
stopping or something else like that because it would be easier to
restart the service / application than rebooting the sytem if thats
the case.
Karl-Heinz Christian Zeck (christizeck84
gmail.com) wrote:
>
> I don't want to restart windows locally, I want to restart it
> remotely. I need a php script that restarts the server. Is this
> possible or not?
>
>
> On 8/10/05, Jay Blanchard <jay.blanchard
niicommunications.com> wrote:
> > [snip]
> > Does anyone have any idea how to restart windows from a php script?
> > I tried the following:
> > exec('SHUTDOWN -r -t 01');
> > or
> > exec('SHUTDOWN /r');
> >
> > I received the following warning message: Warning: exec(): Unable to
> > fork [SHUTDOWN -r -t 01].
> >
> > I never used this kind of functions before. What's wrong? In IIS for
> > "Execute Permissions" I have "Scripts and Executables". What
> > permissions should I set for the Internet Guest Account? Or something
> > else caused the problem, not the permissions? Please help me.:)
> > [/snip]
> >
> > Everyone, repeat after me......
> >
> > PHP is server-side, there's no place like home,
> > PHP is server-side, there's no place like home,
> > PHP is server-side, there's no place like home......
> >
> > If you are trying to restart Windows, locally, you have to use something
> > client-side to affect that.
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
"Computers are like air conditioners - they stop working properly when you
open Windows"
attached mail follows:
Hello Karl-Heinz,
Wednesday, August 10, 2005, 3:05:32 PM, you wrote:
KHCZ> Does anyone have any idea how to restart windows from a php script?
KHCZ> I tried the following:
KHCZ> exec('SHUTDOWN -r -t 01');
KHCZ> or
KHCZ> exec('SHUTDOWN /r');
KHCZ> I received the following warning message: Warning: exec():
KHCZ> Unable to fork [SHUTDOWN -r -t 01].
KHCZ> I never used this kind of functions before. What's wrong? In IIS
KHCZ> for "Execute Permissions" I have "Scripts and Executables". What
KHCZ> permissions should I set for the Internet Guest Account? Or
KHCZ> something else caused the problem, not the permissions? Please
KHCZ> help me.:)
While you can call shutdown directly from exec - some things are best
not called like this. PHP will be left hanging waiting for the process
to finish, so you'll get a really nasty shutdown going on without
properly ending your sessions.
You'd be better off looking at COM scripting it to be honest. Or write
a Windows application that does what you require (closes down all
services smoothly, reboots, etc) and exec that, providing your IIS
user has the correct permissions to do so.
The warning most likely comes from IIS, or your php.ini settings - I
just tested "shutdown -i" on Apache (in WinXP) and it ran without any
problems.
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
Zend Certified Engineer
"I do not fear computers. I fear the lack of them." - Isaac Asimov
attached mail follows:
Could be that he's trying to use PHP to restart the server. Or could be using php via command line or through a system like GTK or Winbinder. It's worth noting that you should make sure you're restarting the machine you think you are, but the question still remains... is this possible and how is it done?
If shutdown can't be forked, is it an issue of PHP spinning off the program and not and returning control to PHP before the program is finished (so they run concurrently)... if that's the case, is there a way to make PHP give full control to the program it calls?
If just using EXEC to call a program is considered 'forking', is there another method? Could you use PHP to EXEC a script file that ran shutdown instead? Would this behave better?
Is there a way to do this and/or any tricks to making it work?
I think that's the question being asked.
-TG
= = = Original message = = =
[snip]
Does anyone have any idea how to restart windows from a php script?
I tried the following:
exec('SHUTDOWN -r -t 01');
or
exec('SHUTDOWN /r');
I received the following warning message: Warning: exec(): Unable to
fork [SHUTDOWN -r -t 01].
I never used this kind of functions before. What's wrong? In IIS for
"Execute Permissions" I have "Scripts and Executables". What
permissions should I set for the Internet Guest Account? Or something
else caused the problem, not the permissions? Please help me.:)
[/snip]
Everyone, repeat after me......
PHP is server-side, there's no place like home,
PHP is server-side, there's no place like home,
PHP is server-side, there's no place like home......
If you are trying to restart Windows, locally, you have to use something
client-side to affect that.
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
attached mail follows:
Hello Joseph,
Wednesday, August 10, 2005, 3:26:05 PM, you wrote:
JO> First off, windows has no clue what a fork is,
A fork is several different things, and there's no reason why Windows
cannot implement a fork via its standard APIs.
JO> much less the command 'shutdown -r -t 01'.
-r = Shutdown with restart
-t = Set the timeout for shutdown (xx seconds)
01 = The timeout value
Open a command prompt, type in it.
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
Zend Certified Engineer
"I do not fear computers. I fear the lack of them." - Isaac Asimov
attached mail follows:
Just out of interest, how is the restart going to authenticate itself to get
up and running?
I used to do something like this between two servers - but the were Macs and
I was using Frontier and it did work, but not without the odd mishap.
If you just want to do it remotely (without recourse to PHP), look at VNC.
George
> -----Original Message-----
> From: Jay Blanchard [mailto:jay.blanchard
niicommunications.com]
> Sent: 10 August 2005 3:09 pm
> To: Karl-Heinz Christian Zeck; php-general
lists.php.net
> Subject: RE: [PHP] Restarting windows from php
>
>
> [snip]
> Does anyone have any idea how to restart windows from a php script?
> I tried the following:
> exec('SHUTDOWN -r -t 01');
> or
> exec('SHUTDOWN /r');
>
> I received the following warning message: Warning: exec(): Unable to
> fork [SHUTDOWN -r -t 01].
>
> I never used this kind of functions before. What's wrong? In IIS for
> "Execute Permissions" I have "Scripts and Executables". What
> permissions should I set for the Internet Guest Account? Or something
> else caused the problem, not the permissions? Please help me.:)
> [/snip]
>
> Everyone, repeat after me......
>
> PHP is server-side, there's no place like home,
> PHP is server-side, there's no place like home,
> PHP is server-side, there's no place like home......
>
> If you are trying to restart Windows, locally, you have to use something
> client-side to affect that.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Karl-Heinz Christian Zeck wrote:
> Does anyone have any idea how to restart windows from a php script?
> I tried the following:
> exec('SHUTDOWN -r -t 01');
> or
> exec('SHUTDOWN /r');
>
> I received the following warning message: Warning: exec(): Unable to
> fork [SHUTDOWN -r -t 01].
There are a couple of possible causes here. First I would try this
instead...
system('shutdown -r -t 1 &');
I don't have a windows machine I can restart at the moment to try this,
but you might have more luck with system than with exec.
Another possible cause is that the user the web server runs as doesn't
have sufficient permissions to initiate a restart. While the error
you're getting doesn't appear to have anything to do with permissions I
would certainly consider it a possibility.
-Stuart
attached mail follows:
Anyone have a script or know of a way to check and see what the url is of a
system and then sending it to another url if it is not right?
I have this problem where if someone is using:
http://www.ces.ncsu.edu/depts/fourh
instead of:
http://www.nc4h.org
to get to my site it is breaking other pieces within it (though there is code in
place which supposedly stops this from happening, I have found that this is not
the case)
what I plan on doing is invoking the script on the main page of each man
sub-directory and the main page so that it should catch the majority of folks.
Any suggestions/help would be greatly appreciated!
Robert
--
Robert Sossomon, Business and Technology Application Technician
4-H Youth Development Department
512 BrickHaven Drive Suite 220L, Campus Box 7606
N.C. State University
Raleigh NC 27695-7606
Phone: 919/515-8474
Fax: 919/515-7812
robert_sossomon
ncsu.edu
attached mail follows:
Try doing a pattern match on the server string and then using Header
to redirect them if its coming from the old server:
if (preg_match("/ces.ncsu/i", $_SERVER["HTTP_HOST"])) {
header("Location: http://www.nc4h.org");
}
- schnippy
On 8/10/05, Robert Sossomon <robert_sossomon
ncsu.edu> wrote:
> Anyone have a script or know of a way to check and see what the url is of a
> system and then sending it to another url if it is not right?
>
> I have this problem where if someone is using:
> http://www.ces.ncsu.edu/depts/fourh
> instead of:
> http://www.nc4h.org
>
> to get to my site it is breaking other pieces within it (though there is code in
> place which supposedly stops this from happening, I have found that this is not
> the case)
>
> what I plan on doing is invoking the script on the main page of each man
> sub-directory and the main page so that it should catch the majority of folks.
>
> Any suggestions/help would be greatly appreciated!
>
> Robert
>
> --
> Robert Sossomon, Business and Technology Application Technician
> 4-H Youth Development Department
> 512 BrickHaven Drive Suite 220L, Campus Box 7606
> N.C. State University
> Raleigh NC 27695-7606
> Phone: 919/515-8474
> Fax: 919/515-7812
> robert_sossomon
ncsu.edu
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
If you are using apache you can use the redirect module
<VirtualHost 152.1.45.10>
Servername www.ces.ncsu.edu
ServerAlias *
Redirect permanent / http://www.nc4h.org/
</VirtualHost>
--
Leon
On Wednesday 10 August 2005 16:52, Robert Sossomon wrote:
> Anyone have a script or know of a way to check and see what the url is of a
> system and then sending it to another url if it is not right?
>
> I have this problem where if someone is using:
> http://www.ces.ncsu.edu/depts/fourh
> instead of:
> http://www.nc4h.org
>
> to get to my site it is breaking other pieces within it (though there is
> code in place which supposedly stops this from happening, I have found that
> this is not the case)
>
> what I plan on doing is invoking the script on the main page of each man
> sub-directory and the main page so that it should catch the majority of
> folks.
>
> Any suggestions/help would be greatly appreciated!
>
> Robert
>
> --
> Robert Sossomon, Business and Technology Application Technician
> 4-H Youth Development Department
> 512 BrickHaven Drive Suite 220L, Campus Box 7606
> N.C. State University
> Raleigh NC 27695-7606
> Phone: 919/515-8474
> Fax: 919/515-7812
> robert_sossomon
ncsu.edu
attached mail follows:
Hi,
I have a db wrapper class.
I use it like this :
$db->query"(SQL HERE") or die ($db->error());
Is there a way to display the line on which $db->error() is executed without
doing die (__LINE__." ".$db->error() )?
If i put __LINE__ in the class the line number is always the line in the class
file.
I want when i call $db->error() to display the current line number.
attached mail follows:
From: Georgi Ivanov [mailto:joro
abacustrade.com]
> Hi,
> I have a db wrapper class.
> I use it like this :
> $db->query"(SQL HERE") or die ($db->error());
> Is there a way to display the line on which $db->error() is
> executed without
> doing die (__LINE__." ".$db->error() )?
> If i put __LINE__ in the class the line number is always the
> line in the class
> file.
>
> I want when i call $db->error() to display the current line number.
Probably not the answer you're looking for, but I think your best option
may be to pass __LINE__ as an arg to error() and use it there as you
please. I don't know of any $parent::__LINE__ syntax, which is what it
sounds like you're asking about...
--
Mike Johnson Smarter Living, Inc.
Web Developer www.smartertravel.com
mike
smarterliving.com (617) 886-5539
attached mail follows:
Thank you for the replay.
I know i can pass __LINE to $db->error().
This is not the idea. I want $db->error() to print the line on which it was
executed .
$parent::__LINE__
Who is the $parent here ?
On Wednesday 10 August 2005 18:20, Mike Johnson wrote:
> From: Georgi Ivanov [mailto:joro
abacustrade.com]
>
> > Hi,
> > I have a db wrapper class.
> > I use it like this :
> > $db->query"(SQL HERE") or die ($db->error());
> > Is there a way to display the line on which $db->error() is
> > executed without
> > doing die (__LINE__." ".$db->error() )?
> > If i put __LINE__ in the class the line number is always the
> > line in the class
> > file.
> >
> > I want when i call $db->error() to display the current line number.
>
> Probably not the answer you're looking for, but I think your best option
> may be to pass __LINE__ as an arg to error() and use it there as you
> please. I don't know of any $parent::__LINE__ syntax, which is what it
> sounds like you're asking about...
>
> --
> Mike Johnson Smarter Living, Inc.
> Web Developer www.smartertravel.com
> mike
smarterliving.com (617) 886-5539
attached mail follows:
From: Georgi Ivanov [mailto:joro
abacustrade.com]
> Thank you for the replay.
> I know i can pass __LINE to $db->error().
> This is not the idea. I want $db->error() to print the line
> on which it was
> executed .
> $parent::__LINE__
> Who is the $parent here ?
There isn't, necessarily. That was pseudo-code to demonstrate what I
thought you were asking about.
The point of my reply was "I don't think it's possible to do what you
want to do here," and offer up an alternative in passing __LINE__ as an
argument to error().
Good luck!
--
Mike Johnson Smarter Living, Inc.
Web Developer www.smartertravel.com
mike
smarterliving.com (617) 886-5539
attached mail follows:
Howdy boys and girls!
I have a rather interesting issue. I need to locate every query in every
PHP application we have for an integration project. I have started doing
some research, but I wanted throw this out there as a little exercize
because it is interesting.
Several queries are written as
$variableName = "SELECT foo FROM bar WHERE glorp = '12' ";
Others are written as
$variableName = "INSERT INTO bar (foo) ";
$variableName .= "VALUES ('".$foo."') ";
And still others may be written as
$variableName = "SELECT foo ";
$variableName .= "FROM bar ";
$variableName .= "WHERE glorp = '12' ";
while('stinky' == $caca){
$variableName .= "AND poot = '" . $caca['texture'] . "' ";
}
How would you begin to get the queries using PHP? Regex? Other methods?
I am working on isolating where the applications live right now, but I
would be thrilled to read your opinions and methods.
Thanks!
attached mail follows:
Jay Blanchard wrote:
> I have a rather interesting issue. I need to locate every query in
> every PHP application we have for an integration project. I have
> started doing some research, but I wanted throw this out there as a
> little exercize because it is interesting.
>
> Several queries are written as
[...]
> How would you begin to get the queries using PHP? Regex? Other
> methods? I am working on isolating where the applications live right
> now, but I would be thrilled to read your opinions and methods.
Assuming unix, I'd do the following from the root of the application to get a list
of files that contain queries:
$ egrep "=[:space:]*\".*\b(SELECT|INSERT|UPDATE)\b" * -ril
That is assuming that you always assign a query to a variable before executing it,
and the select|insert|update is always on the same line as the assignment operator.
For example, the above would not catch:
$variableName =
"SELECT foo .... ";
But if you're reasonably sure you don't do that anywhere then it might be enough.
I'm assuming that at some point you're going to want to update those queries, or the
code surrounding them. I'd use a good editor that supports regex searches across
multiple files. I'd suggest jEdit (www.jedit.org); it's quite powerful and free,
but your favorite editor may have similar functionality already. My next step would
be to load all of the files that egrep found for me into jEdit, then do a regex
search across all buffers for a similar pattern (
=\s*".*\b(SELECT|INSERT|UPDATE)\b ). jEdit also has a feature known as HyperSearch
which opens a dockable window that lists every occurrence by file and line number,
and allows you to jump from occurrence to occurence by clicking on each one. I'd
then hit each one and do the appropriate update (that is, assuming the update in
question isn't so simple that it can be done with a global search and replace).
Anyway, that's how I'd do it. Hope you got something out of this... :)
attached mail follows:
Richard, thanks for the pointer on the shutdown command, nice to see them
implement that in 2k3 and XP, I don't use them on a regular base and sure
don't use them in server environment.
As for the fork, windows can't preform a fork of a process. There are API's
out there that can do this for windows such as perls Win32::Process, or
using the MKS Toolkit, i think the developer or interopertablility versions
will do this.
If you have documents showing that windows can do a fork, I would like to read
about it, however the last time I checked this was not possible, maybe they
are
trying to implement this, if so thats great, it will be a plus for them.
Thanks,
Richard Davey (rich
launchcode.co.uk) wrote:
>
> Hello Joseph,
>
> Wednesday, August 10, 2005, 3:26:05 PM, you wrote:
>
> JO> First off, windows has no clue what a fork is,
>
> A fork is several different things, and there's no reason why Windows
> cannot implement a fork via its standard APIs.
>
> JO> much less the command 'shutdown -r -t 01'.
>
> -r = Shutdown with restart
> -t = Set the timeout for shutdown (xx seconds)
> 01 = The timeout value
>
> Open a command prompt, type in it.
>
> Best regards,
>
> Richard Davey
> --
> http://www.launchcode.co.uk - PHP Development Services
> Zend Certified Engineer
> "I do not fear computers. I fear the lack of them." - Isaac Asimov
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
"Computers are like air conditioners - they stop working properly when you
open Windows"
attached mail follows:
some of my users are complaining that when they try download media files
(mp3, mpeg, etc) their media player opens and doesn't allow them to
physically download the media. These are IE users, firefox seems to like
my code, but IE refuses to download the file and plays it instead..
can anyone view my code and see how i can force media file downloads on IE?
--snip--
header('Cache-control: max-age=31536000');
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $file['date']) . '
GMT');
if ($extension != 'txt')
{
header("Content-disposition: inline; filename=\"$file[type]\"");
}
else
{
// force txt files to prevent XSS
header("Content-disposition: attachment; filename=\"$file[type]\"");
}
header('Content-Length: ' . $file['size']);
switch($extension)
{
case 'zip':
$headertype = 'application/zip';
break;
case 'exe':
$headertype = 'application/octet-stream';
break;
case 'mp3':
$headertype = 'audio/mpeg';
break;
case 'wav':
$headertype = 'audio/wav';
break;
case 'mpg':
$headertype = 'video/mpeg';
break;
case 'avi':
$headertype = 'video/avi';
break;
default:
$headertype = 'unknown/unknown';
}
header('Content-type: ' . $headertype);
--/snip--
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.5/67 - Release Date: 8/9/2005
attached mail follows:
That would be browser dependent, something you have no control over. Maybe
you can include a little text message saying "right-click save as" for the
users not intelligent enough to figure it out themselves.
----- Original Message -----
From: "Sebastian" <sebastian
broadbandgaming.net>
To: <php-general
lists.php.net>
Sent: Wednesday, August 10, 2005 12:00 PM
Subject: [PHP] force download
> some of my users are complaining that when they try download media files
> (mp3, mpeg, etc) their media player opens and doesn't allow them to
> physically download the media. These are IE users, firefox seems to like
> my code, but IE refuses to download the file and plays it instead..
>
> can anyone view my code and see how i can force media file downloads on
> IE?
>
> --snip--
>
> header('Cache-control: max-age=31536000');
> header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . '
> GMT');
> header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $file['date']) . '
> GMT');
>
> if ($extension != 'txt')
> {
> header("Content-disposition: inline; filename=\"$file[type]\"");
> }
> else
> {
> // force txt files to prevent XSS
> header("Content-disposition: attachment; filename=\"$file[type]\"");
> }
>
> header('Content-Length: ' . $file['size']);
>
> switch($extension)
> {
> case 'zip':
> $headertype = 'application/zip';
> break;
> case 'exe':
> $headertype = 'application/octet-stream';
> break;
>
> case 'mp3':
> $headertype = 'audio/mpeg';
> break;
>
> case 'wav':
> $headertype = 'audio/wav';
> break;
> case 'mpg':
> $headertype = 'video/mpeg';
> break;
>
> case 'avi':
> $headertype = 'video/avi';
> break;
>
> default:
> $headertype = 'unknown/unknown';
> }
>
> header('Content-type: ' . $headertype);
>
> --/snip--
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.338 / Virus Database: 267.10.5/67 - Release Date: 8/9/2005
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Hello List,
I would like to create an object inside a function with its classname
and a parameter list submitted by the function call.
function create($class, $parameter) {
$obj = new $class($parameter);
return $obj;
}
This is working very well. But I have not every time the same count of
parameters for a class constructor.
If this is a normal method call of an object I can realise it like this:
$ret = call_user_func_array(array(&$obj, 'method'), $parameter_array);
The $parameter_array contains as many entries as the function needs.
Works well too.
But how can I write a function to instance objects with various count of
parameters in the constructor?
I know, can do this with an eval. But I would like to find a solution
where I don't need an eval.
thanks for all answers,
Thomas
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]