php-windows Digest 22 May 2002 20:07:21 -0000 Issue 1157
Topics (messages 13910 through 13929):
Executebale code from a databse
13910 by: Peter
13912 by: Michael Virnstein
13914 by: Luis Ferro
13924 by: Peter
Re: [PHP] Executebale code from a databse
13911 by: Dan Hardiker
Smart Navigation
13913 by: Fred Forsyth
Having problems grasping reg ex
13915 by: R.S. Herhuth
13919 by: Nicole Amashta
Re: php+oracle
13916 by: Nicole Amashta
13928 by: Mauricio
Re: Bits
13917 by: Nicole Amashta
php-mysql-apache-win- GREAT docs for newbies
13918 by: Nick
eregi_replace problems
13920 by: Zac Hillier
Array of COM objects doesn't work in PHP but does in ASP?
13921 by: Noah
Trouble with socket_select
13922 by: Bruce Vander Werf
Problem : track_vars stopped working.
13923 by: Johan Ekström
Re: [PHP] Problem : track_vars stopped working.
13925 by: Philip Olson
13929 by: Patrick Lynch
Re: php-4.2.1 and apache2.0 - how to get php working
13926 by: Johan Ekström
Xslt extension unable to find files
13927 by: Sukhwinder Singh
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Hi.
I'm changing my website to one based on My-SQL which will help with
organization and searching etc. Hopefully, the code for all the pages will
be stored in the database too.
However, I cannot get PHP to parse / execute the code stored in the
database. The script
$query = mysql_query("SELECT * FROM pages", $link);
$result = mysql_fetch_array($query);
print $result['4'];
gets the content of the page (column 4 of the database) but displays
include("common/counter.php"); include("common/navbar.php");
to the screen instead of opening and including these two files in the
output.
Is there something I need to do to the result to make it executable? Might I
need a \n between the two lines of code?
I'm using Win 98, Apache 1.3.19, PHP 4.2.0 and MySQL but I'm not sure which
version! (fairly recent though)
--- End Message ---
--- Begin Message ---
eval ('?>'.$var.'<?php');
if you want to eval usual php scripts.
(We close the ?> then comes the content of the php script which also can
contain
html and then we reopen <?php again)
So if you have a file:
<?php
include('test.php');
?>
and you say
$var = "<?php include('test.php'); ?>";
you'll result in
...
eval("?><?php include('test.php'); ?><?php");
which will evaluate normally.
Regards Michael
"Peter" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi.
> I'm changing my website to one based on My-SQL which will help with
> organization and searching etc. Hopefully, the code for all the pages will
> be stored in the database too.
> However, I cannot get PHP to parse / execute the code stored in the
> database. The script
>
> $query = mysql_query("SELECT * FROM pages", $link);
> $result = mysql_fetch_array($query);
> print $result['4'];
>
> gets the content of the page (column 4 of the database) but displays
>
> include("common/counter.php"); include("common/navbar.php");
>
> to the screen instead of opening and including these two files in the
> output.
>
> Is there something I need to do to the result to make it executable? Might
I
> need a \n between the two lines of code?
>
> I'm using Win 98, Apache 1.3.19, PHP 4.2.0 and MySQL but I'm not sure
which
> version! (fairly recent though)
>
>
--- End Message ---
--- Begin Message ---
The security danger comes from someone calling things like
site_domain/page.php?var=url_encoded_code_here
which will then execute all the code...
Of course you can before getting the code from the database, clear the
var and later check for it's size...
Cheers,
Luis Ferro
TelaDigital
Michael Virnstein wrote:
>eval ('?>'.$var.'<?php');
>if you want to eval usual php scripts.
>(We close the ?> then comes the content of the php script which also can
>contain
> html and then we reopen <?php again)
>
>So if you have a file:
><?php
>include('test.php');
>?>
>
>and you say
>$var = "<?php include('test.php'); ?>";
>
>you'll result in
>
>...
>eval("?><?php include('test.php'); ?><?php");
>
>which will evaluate normally.
>
>Regards Michael
>
>
>"Peter" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>
>>Hi.
>>I'm changing my website to one based on My-SQL which will help with
>>organization and searching etc. Hopefully, the code for all the pages will
>>be stored in the database too.
>>However, I cannot get PHP to parse / execute the code stored in the
>>database. The script
>>
>>$query = mysql_query("SELECT * FROM pages", $link);
>>$result = mysql_fetch_array($query);
>>print $result['4'];
>>
>>gets the content of the page (column 4 of the database) but displays
>>
>>include("common/counter.php"); include("common/navbar.php");
>>
>>to the screen instead of opening and including these two files in the
>>output.
>>
>>Is there something I need to do to the result to make it executable? Might
>>
>>
>I
>
>
>>need a \n between the two lines of code?
>>
>>I'm using Win 98, Apache 1.3.19, PHP 4.2.0 and MySQL but I'm not sure
>>
>>
>which
>
>
>>version! (fairly recent though)
>>
>>
>>
>>
>
>
>
>
>
--- End Message ---
--- Begin Message ---
The security shouldn't be a problem. The user will be taken to
www.whatever.com/index.php?page=thispage
index.php then searches for a record with name = thispage and then evaluates
the code stored in a different column of the database.
If the name isn't found, "This page cannot be found" is displayed and if
nothing is entered it goes to the homepage.
Thanks for your help guys!
"Peter" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi.
> I'm changing my website to one based on My-SQL which will help with
> organization and searching etc. Hopefully, the code for all the pages will
> be stored in the database too.
> However, I cannot get PHP to parse / execute the code stored in the
> database. The script
>
> $query = mysql_query("SELECT * FROM pages", $link);
> $result = mysql_fetch_array($query);
> print $result['4'];
>
> gets the content of the page (column 4 of the database) but displays
>
> include("common/counter.php"); include("common/navbar.php");
>
> to the screen instead of opening and including these two files in the
> output.
>
> Is there something I need to do to the result to make it executable? Might
I
> need a \n between the two lines of code?
>
> I'm using Win 98, Apache 1.3.19, PHP 4.2.0 and MySQL but I'm not sure
which
> version! (fairly recent though)
>
>
--- End Message ---
--- Begin Message ---
Use eval ... although beware of the serious security implications.
> Hi.
> I'm changing my website to one based on My-SQL which will help with
> organization and searching etc. Hopefully, the code for all the pages
> will be stored in the database too.
> However, I cannot get PHP to parse / execute the code stored in the
> database. The script
>
> $query = mysql_query("SELECT * FROM pages", $link);
> $result = mysql_fetch_array($query);
> print $result['4'];
>
> gets the content of the page (column 4 of the database) but displays
>
> include("common/counter.php"); include("common/navbar.php");
>
> to the screen instead of opening and including these two files in the
> output.
>
> Is there something I need to do to the result to make it executable?
> Might I need a \n between the two lines of code?
>
> I'm using Win 98, Apache 1.3.19, PHP 4.2.0 and MySQL but I'm not sure
> which version! (fairly recent though)
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
--- End Message ---
--- Begin Message ---
Is there any way to emulate ASP.NET's smartNavigation trick? What it does it
to maintain control state and scroll position between postbacks, as well as
stopping the page from flickering when reloading. It makes a mostly static
page look very cool.
Anyone done this in PHP, or know how to use IFRAMEs to do it manually?
Cheers
Fred Forsyth.
Senior Software Engineer
--- End Message ---
--- Begin Message ---
I'm really struggling trying to grasp the concept of reg ex rfeplacement.
I have been through the documentation and a few tutorials but I can't
find something that shows me exactly how to return a string that
contains nothing but alpha numeric characters, while stripping out all
other characters.
Couls someone please show me how to do this?
Thanks,
Ron
--- End Message ---
--- Begin Message ---
preg_replace("/[^a-z0-9]/i", '', $str);
R.S. Herhuth wrote:
> I'm really struggling trying to grasp the concept of reg ex rfeplacement.
>
> I have been through the documentation and a few tutorials but I can't
> find something that shows me exactly how to return a string that
> contains nothing but alpha numeric characters, while stripping out all
> other characters.
>
> Couls someone please show me how to do this?
>
> Thanks,
> Ron
--- End Message ---
--- Begin Message ---
Hello,
Make sure that this dll you have is in the correct extension path AND
this dll is a valid version for your verson of PHP. This is usually the
main things that will cause the error you specified.
In your php.ini, check your extension_dir = and make sure it points to
your extensions path. I keep mine under my php directory, like so:
e:\apps\php\extensions
so my extension_dir = e:\apps\php\extensions
Then make sure that dll is in that path. But also make sure it is the
correct version for the version of PHP you are running.
Hope that helps!
Nicole Amashta
www.aeontrek.com
Mauricio wrote:
> Hi for all.
> I have php+apache+win2000+client oracle in my machine.
> I configured my php.ini with:
> extension_dir and uncomment extensions in php_oci8.dll
> But, when I restart my apache, I receive the following error:
>
> Unable to load dynamic library "c:\php\extensions/php_oci8.dll". It was not
> possible to find the specified procedure.
> Can anyone help me with the configuration of php+oracle?
>
> --
> Mauricio
> +55 - (041) - 219-5246
> [EMAIL PROTECTED]
>
>
--- End Message ---
--- Begin Message ---
Hello,
my installation was:
I used php4.2.0-installer.exe and after it I used php4.2.0-win32.zip (it is
the font) for extensions, because the php4.2.0-installer.exe didn't have the
extensions directory (directory of my php_oci8.dll).
I could not do the compilation of php4.2.0-win32.zip (fonts) because was
necessary ms visual c++
Can you help me with any idea?
Thanks in Advance
Mauricio
"Nicole Amashta" <[EMAIL PROTECTED]> escreveu na mensagem
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
>
> Make sure that this dll you have is in the correct extension path AND
> this dll is a valid version for your verson of PHP. This is usually the
> main things that will cause the error you specified.
>
> In your php.ini, check your extension_dir = and make sure it points to
> your extensions path. I keep mine under my php directory, like so:
>
> e:\apps\php\extensions
> so my extension_dir = e:\apps\php\extensions
>
> Then make sure that dll is in that path. But also make sure it is the
> correct version for the version of PHP you are running.
>
> Hope that helps!
> Nicole Amashta
> www.aeontrek.com
>
> Mauricio wrote:
> > Hi for all.
> > I have php+apache+win2000+client oracle in my machine.
> > I configured my php.ini with:
> > extension_dir and uncomment extensions in php_oci8.dll
> > But, when I restart my apache, I receive the following error:
> >
> > Unable to load dynamic library "c:\php\extensions/php_oci8.dll". It was
not
> > possible to find the specified procedure.
> > Can anyone help me with the configuration of php+oracle?
> >
> > --
> > Mauricio
> > +55 - (041) - 219-5246
> > [EMAIL PROTECTED]
> >
> >
>
--- End Message ---
--- Begin Message ---
Check this out:
http://www.php.net/manual/en/language.operators.bitwise.php
Nicole Amashta
www.aeontrek.com
Michael Reynolds wrote:
> Are there any functions or operators, which will modify bits in a
> variable? If so, which? For example, if I were to use C to set bit 4 on
> for variable bit_set, I would use 'bit_set |= 4'.
>
> __________________________________________________
> Do You Yahoo!?
> LAUNCH - Your Yahoo! Music Experience
> http://launch.yahoo.com
--- End Message ---
--- Begin Message ---
Want some great docs on getting started with php mysql and apache.
Seems like there isnt much around for us newbies but finally i've found
some.
I havnt tryed them as yet but have read most of them and they seem very
good.
They may have also saved my computer from getting hurled through my front
window :)
Now to go try them :)~
Heres the link:
http://softwaredev.earthweb.com/script/article/0,,12063_912381,00.html
--- End Message ---
--- Begin Message ---
I'm trying to replace values within a string with a value looked up from a database. I
have a function that looks up the value in the database for me but I'm having trouble
passing the value to the function because of the backslashes, is there a way around
this?
Code:
$cntnt = eregi_replace("\[L=([a-zA-Z]+)]"."([a-zA-Z]+)\[EL]", "<a href=\"" .
fndLnk(\\1) . "\">\\2</a>", $cntnt);
fndLnk is the function and the error I receive is -
Warning: Unexpected character in input: '\' (ASCII=92) state=1
Thanks for any help
Zac
--- End Message ---
--- Begin Message ---
Hey guys,
OK I favor PHP so far above ASP however it doesnt seem like PHP can
handle an array of COM Objects.
Here's the scenario:
Within the 'Deal' object contains an array of 'Bonds'.
I want to access each bond by doing: $comDeal->Bonds->Item[$i];
( btw Item is part of the com object to access each)
However i get this error: Warning: PropGet() failed: Invalid number of
parameters
In ASP I can do:
comDeal.Bonds.Item(i) and it works fine
Any suggestions?
Thanks!
- Noah
--- End Message ---
--- Begin Message ---
Hi,
I am using PHP 4.2.1 under Windows XP. I am having trouble getting
socket_select to work on a UDP socket. Here is my code:
//Create socket
$socket = socket_create(AF_INET, SOCK_DGRAM, 0);
if ($socket < 0)
echo "unable to create socket(".socket_strerror($socket);
else
echo "OK";
//enable broadcasts
socket_setopt($socket, SOL_SOCKET, SO_BROADCAST, 1);
//first, a UDP broadcast command goes out
//I have verified with EtherPeek that this is indeed going out
if (socket_sendto($socket,$packet,$size,0,$IPBroadcast,$TCPIQPort) !=
$size)
echo "failed";
else
echo "OK";
//now call socket_select repeatedly for five seconds
$endtime = Time() + 5;
while (Time() < $endtime) {
$r = array($socket);
if (socket_select($r, $w=null, $e=null, 0) > 0) {
echo "\n<P>readable";
if (socket_recvfrom($socket, $buffer, 2048, 0, $addr, $port))
echo "\n<P>$buffer";
}
}
I never see $socket being readable, i.e. a return value from
socket_select greater than 0. I also can see in EtherPeek that UDP
packets are being sent back to this socket in response to the
broadcast.
Any help would be appreciated.
--Bruce
--
Bruce Vander Werf
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Okay, mystery to me, when I installed PHP 4.2.1 on Apache 2.0.35, the track_vars
function, stopped working.
a simple command like, example :
file : default.php
¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨
<?
echo("$text");
?>
then I type in the address in ie6, like : http://127.0.0.1/default.php?text=this
but it doesn't show anything. it becomes a blank page instead of echoing out "this".
Now, I thought track_vars was set to "Off" but in php.ini, it stood that it always was
on.
So, now I'm stuck... I'm using the php4apache2.dll module, which I suppose may be the
problem, but I don't think they would have forgotten this function in that file.
Anyone got any idée's??? I kind of need that function to do multipages.
johan ekström [EMAIL PROTECTED]
http://www.dynamicduo.nu/
--- End Message ---
--- Begin Message ---
The php directive track_vars is deprecated and is always
on. You appear to be referring to the register_globals
directive though, which is a hot topic these days in the
world of PHP.
If register_globals = on, then $text will exist in your
example (register_globals will create it). Otherwise
it won't exist automagically but will be available in
$_GET and $HTTP_GET_VARS, as well as in $_REQUEST. Also,
extract() or import_request_variables() can create them
if you want.
Try this:
print $_GET['text'];
Read about predefined variables, superglobals, and
register_globals in the PHP manual.
http://www.php.net/manual/
Regards,
Philip Olson
On Wed, 22 May 2002, [Windows-1252] Johan Ekström wrote:
> Okay, mystery to me, when I installed PHP 4.2.1 on Apache 2.0.35, the track_vars
>function, stopped working.
>
> a simple command like, example :
>
> file : default.php
> ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨
> <?
> echo("$text");
> ?>
>
> then I type in the address in ie6, like : http://127.0.0.1/default.php?text=this
>
> but it doesn't show anything. it becomes a blank page instead of echoing out "this".
>
> Now, I thought track_vars was set to "Off" but in php.ini, it stood that it always
>was on.
> So, now I'm stuck... I'm using the php4apache2.dll module, which I suppose may be the
> problem, but I don't think they would have forgotten this function in that file.
>
> Anyone got any idée's??? I kind of need that function to do multipages.
> johan ekström [EMAIL PROTECTED]
> http://www.dynamicduo.nu/
>
>
--- End Message ---
--- Begin Message ---
Hi Johan,
The globals that PHP sets up have changed since since PHP 4.2.x
See: http://www.php.net/release_4_2_0.php
You can turn on register_globals in the php.ini file but it is
recommended to use the more secure $_GET['test'] type variables.
Best Regards,
Patrick Lynch.
Optip Ltd, Internet & Mobile Development
Co. Clare, Ireland.
http://www.optip.com/
-----Original Message-----
From: Johan Ekström [mailto:[EMAIL PROTECTED]]
Sent: 22 May 2002 16:39
To: PHP Windows Discussion List; PHP General Discussion List
Subject: [PHP] Problem : track_vars stopped working.
Okay, mystery to me, when I installed PHP 4.2.1 on Apache 2.0.35, the
track_vars function, stopped working.
a simple command like, example :
file : default.php
¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨
<?
echo("$text");
?>
then I type in the address in ie6, like :
http://127.0.0.1/default.php?text=this
but it doesn't show anything. it becomes a blank page instead of echoing
out "this".
Now, I thought track_vars was set to "Off" but in php.ini, it stood that
it always was on. So, now I'm stuck... I'm using the php4apache2.dll
module, which I suppose may be the problem, but I don't think they would
have forgotten this function in that file.
Anyone got any idée's??? I kind of need that function to do multipages.
johan ekström [EMAIL PROTECTED]
http://www.dynamicduo.nu/
--- End Message ---
--- Begin Message ---
Are U using php4apache2.dll ?
see to it that there is no space " " in the dir to the file.
have you copied all the necessary files???
"Nick" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi
>
> Could someone please tell me or point me to some instructions on how to
get
> PHP 4.2.1 working with Apache 2.0 on Win98
>
> Apache is working, ive tested but it will not recognise PHP code or
> extensions.
>
> I have added the following lines to the apache http config.
>
> AddType application/x-httpd-php .php
> AddType application/x-httpd-php-source .phps
>
> I installed PHP using the php 4.2.1 installer but it spat when it saw i
was
> using he latest apache server and basically said configure it yourself!!
>
> hope somebody can help
>
>
> ta
>
> Nick
>
>
--- End Message ---
--- Begin Message ---
Hello,
I am using php 4.2.0 and apache 2.0 on win95. I am facing some problems with
xslt extension. Problem is that xslt processor is unable to find the xml and
xsl files.
Files are in the same directory as the php file and document_root is
e:\wwwroot\newsite.
So when I do something like:
//////////////////////////////
$proc = xslt_create();
xslt_process($proc, "ptable.xml", "ptable.xsl", "ptable.html");
////////////////////////////////
It tries to find file under some other directory:
///////////////////////////////////////////////////
Warning: Sablotron error on line none: cannot open file
'D:/WINDOWS/SYSTEM/inetsrv/ptable.xsl' in E:\web\newsite\transxml.php on
line 17
//////////////////////////////////////////////////////
But readfile("ptable.xml"); is able to read the file and display its
contents.
Then I changed file paths like this:
/////////////////////////////////////////////
xslt_process($proc, "\ptable.xml", "\ptable.xsl", "\ptable.html");
/////////////////////////////////////////////////
and it searched for files under d:\.
So, I copied both files under d:\ and transformation worked and ptable.html
was created.
But because I wanted these files to be in the original directory I changed
it like this:
/////////////////////////////////////////////////////////////////
$xml_file = stripslashes($_SERVER["DOCUMENT_ROOT"])."\ptable.xml";
$xsl_file = stripslashes($_SERVER["DOCUMENT_ROOT"])."\ptable.xsl";
$html_file = stripslashes($_SERVER["DOCUMENT_ROOT"])."\ptable.html";
echo $xml_file, "<br>";
echo $xsl_file, "<br>";
echo $html_file, "<br>";
$proc = xslt_create();
if (xslt_process($proc, $xml_file, $xsl_file, $html_file))
{
echo "File ptable.xml has been transformed using ptable.xsl";
echo "Contents of this file are:";
readfile("ptable.html");
}
else
{
echo "Some error occurred<br>";
echo "Error is: ", xslt_error($proc);
echo "<br>Error number is: ", xslt_errno($proc);
}
xslt_free($proc);
//////////////////////////////////////////////////////////////////
Result is:
//////////////////////////
E:\web\newsite\ptable.xml
E:\web\newsite\ptable.xsl
E:\web\newsite\ptable.html
Warning: Sablotron error on line 1: unknown encoding '' in
E:\web\newsite\transxml.php on line 22
Some error occured
Error is: unknown encoding ''
Error number is: 66
////////////////////////////
But there is no encoding problem etc. because it created output file when
files were copied to d:\ as mentioned above.
Sukhwinder Singh
--- End Message ---