php-general Digest 5 Apr 2006 13:02:23 -0000 Issue 4054

Topics (messages 233233 through 233249):

Re: redirect using php
        233233 by: Mark Kelly
        233234 by: Andrei
        233235 by: Barry
        233236 by: Andrei
        233248 by: Chris Shiflett

Error when compiling PHP from source on Mac OS X 10.4 server
        233237 by: Frank Arensmeier
        233239 by: Georgi Ivanov
        233240 by: T.Lensselink

HTML_AJAX and formSubmit method
        233238 by: Georgi Ivanov
        233244 by: Jochem Maas

Re: test for illegal characters and consequences
        233241 by: Angelo Zanetti
        233242 by: Paul Scott
        233243 by: Angelo Zanetti

Magic quotes good or Bad?
        233245 by: Angelo Zanetti
        233246 by: Brad Bonkoski

Download image in PHP
        233247 by: Russell Jones

Re: HTML_AJAX and formSubmit method - Yes ! But why ?
        233249 by: Georgi Ivanov

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On Tuesday 04 April 2006 22:27, Brady Mitchell wrote:
> > -----Original Message-----
> > In JSP I have access to a function called sendRedirect() to
> > send a user
> > from one page to another, usually after some processing completed. Is
> > there a similar function in PHP?
>
> Take a look at the header() function.
> http://php.net/header
>
> To redirect you can use:  header("Location: http://www.example.com/";);

You can also use something like: 

echo "<meta http-equiv=\"Refresh\" content=\"0;url=$from_page\">";

depending on your needs.

Mark

--- End Message ---
--- Begin Message ---


Or with javascript:
<?
   ...
?>
<script language="JavaScript">
<!--
   document.location =
'http://where.to.go.com/example.php?param1=<?=$param1?>';
//-->
</script>
<?
   ...
?>

PS: Sorry Mark...

   Andy

Mark Kelly wrote:
On Tuesday 04 April 2006 22:27, Brady Mitchell wrote:
-----Original Message-----
In JSP I have access to a function called sendRedirect() to
send a user
from one page to another, usually after some processing completed. Is
there a similar function in PHP?
Take a look at the header() function.
http://php.net/header

To redirect you can use:  header("Location: http://www.example.com/";);

You can also use something like:
echo "<meta http-equiv=\"Refresh\" content=\"0;url=$from_page\">";

depending on your needs.

Mark


--- End Message ---
--- Begin Message ---
Andrei wrote:
   document.location =
'http://where.to.go.com/example.php?param1=<?=$param1?>';

Wasn't it -> document.location.href ='www.example.com';
o_O ?

Barry
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

--- End Message ---
--- Begin Message ---

It works with document.location = '...'; too. I use only this method and it worked on all browsers...

    Andy

Barry wrote:
Andrei wrote:
   document.location =
'http://where.to.go.com/example.php?param1=<?=$param1?>';

Wasn't it -> document.location.href ='www.example.com';
o_O ?

Barry

--- End Message ---
--- Begin Message ---
Mark Kelly wrote:
You can also use something like:
echo "<meta http-equiv=\"Refresh\" content=\"0;url=$from_page\">";

There's no need to use a meta tag to mimic HTTP headers. PHP provides the header() function.

Chris

--- End Message ---
--- Begin Message ---
Hello.

I try to compile PHP 4.4.2 from source on Mac OS X 10.4 server but I am getting error messages. The the install configuration runs just fine using the following options:

./configure
--prefix=/usr/local/php
--with-config-file-path=/usr/local/php/lib
--with-apxs --with-iconv=/usr/local/php
--with-zlib=/usr
--with-mysql
--enable-cgi
--with-gd
--with-png-dir=/usr/local/php
--with-freetype-dir=/usr/local/php
--with-t1lib=/usr/local/php
--with-jpeg-dir=/sw
--with-tiff-dir=/usr/local/php
--with-curl=/usr/local/php
--with-mcrypt=/usr/local/php
--with-mhash=/usr/local/php
--with-expat-dir=/usr/local/php
--with-gettext=/usr/local/php
--with-dom=/usr/local/php
--with-dom-xslt=/usr/local/php
--with-dom-exslt=/usr/local/php
--with-xslt-sablot=/usr/local/php
--enable-xslt
--with-ldap
--with-xmlrpc
--with-xml
--with-iodbc
--enable-sockets
--enable-trans-sid
--enable-exif
--enable-wddx
--enable-ftp
--enable-mbstring
--with-mime-magic

I might also add that the current PHP installed on the server is the one from entropy.ch. This install would be absolutely perfect for my needs, except the fact that PDFlib is compiled directly into PHP. I do not want pdfLIB compiled into PHP, because I like to update PDFlib to 6.0.3.

The make command fires always an error saying that "In file included from /path/to/php/source/sapi/apache/sapi_apache.c:24:" followed by ten or more lines saying "... error: httpd.h: No such file or directory" and last line: "make: [sapi/apache/sapi_apache.lo) Error 1".

I also tried a very basic install of PHP:
./configure --with-apxs

but the error remains. Looking into the file sapi_apache.lo I saw that it wants some source files from the Apache distribution, right? I tried to just copy those files into the same directory as sapi_apache.lo is in but then I get other error messages.

I am not that familiar with compiling from source so please be patient with me.

Google was not my friend...

What can I do?

Regards,
frank

--- End Message ---
--- Begin Message ---
I think you are missing httpd-devel package. At least on Linux is called 
something like this.
Also look for /usr/sbin/apxs(2)
If you are with apache 2.x you should use --with-apxs2[=/usr/sbin/apxs2]

Good luck

On Wednesday April 5 2006 12:54, Frank Arensmeier wrote:
> Hello.
>
> I try to compile PHP 4.4.2 from source on Mac OS X 10.4 server but I
> am getting error messages. The the install configuration runs just
> fine using the following options:
>
> ./configure
> --prefix=/usr/local/php
> --with-config-file-path=/usr/local/php/lib
> --with-apxs --with-iconv=/usr/local/php
> --with-zlib=/usr
> --with-mysql
> --enable-cgi
> --with-gd
> --with-png-dir=/usr/local/php
> --with-freetype-dir=/usr/local/php
> --with-t1lib=/usr/local/php
> --with-jpeg-dir=/sw
> --with-tiff-dir=/usr/local/php
> --with-curl=/usr/local/php
> --with-mcrypt=/usr/local/php
> --with-mhash=/usr/local/php
> --with-expat-dir=/usr/local/php
> --with-gettext=/usr/local/php
> --with-dom=/usr/local/php
> --with-dom-xslt=/usr/local/php
> --with-dom-exslt=/usr/local/php
> --with-xslt-sablot=/usr/local/php
> --enable-xslt
> --with-ldap
> --with-xmlrpc
> --with-xml
> --with-iodbc
> --enable-sockets
> --enable-trans-sid
> --enable-exif
> --enable-wddx
> --enable-ftp
> --enable-mbstring
> --with-mime-magic
>
> I might also add that the current PHP installed on the server is the
> one from entropy.ch. This install would be absolutely perfect for my
> needs, except the fact that PDFlib is compiled directly into PHP. I
> do not want pdfLIB compiled into PHP, because I like to update PDFlib
> to 6.0.3.
>
> The make command fires always an error saying that "In file included
> from /path/to/php/source/sapi/apache/sapi_apache.c:24:" followed by
> ten or more lines saying "... error: httpd.h: No such file or
> directory" and last line: "make: [sapi/apache/sapi_apache.lo) Error 1".
>
> I also tried a very basic install of PHP:
> ./configure --with-apxs
>
> but the error remains. Looking into the file sapi_apache.lo I saw
> that it wants some source files from the Apache distribution, right?
> I tried to just copy those files into the same directory as
> sapi_apache.lo is in but then I get other error messages.
>
> I am not that familiar with compiling from source so please be
> patient with me.
>
> Google was not my friend...
>
> What can I do?
>
> Regards,
> frank

--- End Message ---
--- Begin Message ---
Maybe try to configure with the direct path to the apache source files...

--with-apxs=/path/to/apache/bin/apxs

Frank Arensmeier said:
> Hello.
>
> I try to compile PHP 4.4.2 from source on Mac OS X 10.4 server but I
> am getting error messages. The the install configuration runs just
> fine using the following options:
>
> ./configure
> --prefix=/usr/local/php
> --with-config-file-path=/usr/local/php/lib
> --with-apxs --with-iconv=/usr/local/php
> --with-zlib=/usr
> --with-mysql
> --enable-cgi
> --with-gd
> --with-png-dir=/usr/local/php
> --with-freetype-dir=/usr/local/php
> --with-t1lib=/usr/local/php
> --with-jpeg-dir=/sw
> --with-tiff-dir=/usr/local/php
> --with-curl=/usr/local/php
> --with-mcrypt=/usr/local/php
> --with-mhash=/usr/local/php
> --with-expat-dir=/usr/local/php
> --with-gettext=/usr/local/php
> --with-dom=/usr/local/php
> --with-dom-xslt=/usr/local/php
> --with-dom-exslt=/usr/local/php
> --with-xslt-sablot=/usr/local/php
> --enable-xslt
> --with-ldap
> --with-xmlrpc
> --with-xml
> --with-iodbc
> --enable-sockets
> --enable-trans-sid
> --enable-exif
> --enable-wddx
> --enable-ftp
> --enable-mbstring
> --with-mime-magic
>
> I might also add that the current PHP installed on the server is the
> one from entropy.ch. This install would be absolutely perfect for my
> needs, except the fact that PDFlib is compiled directly into PHP. I
> do not want pdfLIB compiled into PHP, because I like to update PDFlib
> to 6.0.3.
>
> The make command fires always an error saying that "In file included
> from /path/to/php/source/sapi/apache/sapi_apache.c:24:" followed by
> ten or more lines saying "... error: httpd.h: No such file or
> directory" and last line: "make: [sapi/apache/sapi_apache.lo) Error 1".
>
> I also tried a very basic install of PHP:
> ./configure --with-apxs
>
> but the error remains. Looking into the file sapi_apache.lo I saw
> that it wants some source files from the Apache distribution, right?
> I tried to just copy those files into the same directory as
> sapi_apache.lo is in but then I get other error messages.
>
> I am not that familiar with compiling from source so please be
> patient with me.
>
> Google was not my friend...
>
> What can I do?
>
> Regards,
> frank
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Hi List !
I'm playing around with HTML_AJAX PEAR module and came to a strange 
situation .
Consider following code :
<div id="target" style="border:solid 1px">&nbsp;This is where the result will 
be printed </div>
<center>
<form onsubmit="return !HTML_AJAX.formSubmit(this,'target');" 
action="/ajax/test1.php" method="post" name="frmTest" id="frmTest">
<div>
<table border="0">
        <tr>
                <td style="white-space: nowrap; background-color: #CCCCCC;" 
align="left" 
valign="top" colspan="2"><b><center>Login</center></b></td>
        </tr>
        <tr>
                <td align="right" valign="top"><b>User:</b></td>
                <td valign="top" align="left"><input name="user" type="text" 
/></td>
        </tr>
        <tr>
                <td align="right" valign="top"><b>Password:</b></td>
                <td valign="top" align="left"><input name="pass" 
type="password" /></td>
        </tr>
        <tr>
                <td align="right" valign="top"><b></b></td>
                <td valign="top" align="left"><input name="" 
value="Authenticate" 
type="submit" /></td>
        </tr>
</table>
</div>
</form></center>

Nothing special here. This actually works. 
HTML_AJAX.formSubmit(this,'target')
send the request and get what is printed from test1.php in the DIV with 
ID=target.
The problem is when i try to change the ID of the DIV with something else . 
Whatever ID i choose the script does not work as expected. It does not change 
the innerHTML of the div but the content of the FORM. 
Looking at the generated code from server.php i notice this:

formSubmit: function (form, target, customRequest)
    {
        if (typeof form == 'string') {
            form = document.getElementById(form);
            if (!form) {
                // let the submit be processed normally
                return false;
            }
        }
        if (typeof target == 'string') {
                //I think we MUST go here but it seems we don't...
            target = document.getElementById('target');
        }
        if (!target) {
        //I guess we enter here but we shouldn't.....
            target = form;
        }
..........................
The script seems to be OK but...
So generally this script works ONLY if the DIV is with ID=target and function 
called like this : HTML_AJAX.formSubmit(this,'target')
If i change the div with ID=alabala and call the script with : 
HTML_AJAX.formSubmit(this,'alabala') it does not work.
Any ideas ?

--- End Message ---
--- Begin Message ---
does the following make it work? ...

Georgi Ivanov wrote:

...

formSubmit: function (form, target, customRequest)
    {
        if (typeof form == 'string') {
            form = document.getElementById(form);
            if (!form) {
                // let the submit be processed normally
                return false;
            }
        }
        if (typeof target == 'string') {
                //I think we MUST go here but it seems we don't...
            target = document.getElementById('target');

target = document.getElementById(target);

                //               ^-- no quotes!


        }
        if (!target) {
        //I guess we enter here but we shouldn't.....
            target = form;
        }
..........................
The script seems to be OK but...
So generally this script works ONLY if the DIV is with ID=target and function called like this : HTML_AJAX.formSubmit(this,'target') If i change the div with ID=alabala and call the script with : HTML_AJAX.formSubmit(this,'alabala') it does not work.
Any ideas ?


--- End Message ---
--- Begin Message ---
Paul Scott wrote:
On Tue, 2006-04-04 at 15:32 -0800, Angelo Zanetti wrote:

Ive developed a site and now I've come to the stage where I need to test each 
textfield on each form for illegal characters that have been inputted.
I would like to know from some of you how you go about it?



In our framework, we use a few methods, depending on what needs to be
done in what way...

If you look at our wiki module, we use AJAX to check for valid PageNames
when using SmashWordsTogether. In our other forms we use a form
validation object that checks for numeric, alphanumeric, textonly etc on
form submission.

It sounds as though the AJAX route is more what you are looking for. If
you would like some help let me know, or ask on our developers list.

hi Paul.

Thanks for the reply. So what do you do if someone enters illegal characters in one of your form? Do you inform the user and prompt them to enter the fields again or do you just strip out all the bad characters and enter the rest of the info into the database?

Im concerned with what to do once a user has added the bad characters. I will 
be using a regular expression.

thanks in advance

--- End Message ---
--- Begin Message ---
On Wed, 2006-04-05 at 13:34 -0800, Angelo Zanetti wrote:

> Thanks for the reply. So what do you do if someone enters illegal characters 
> in one of your form? Do you inform the user and prompt them to enter the 
> fields again or do you just strip out all the bad 
> characters and enter the rest of the info into the database?
> 
> Im concerned with what to do once a user has added the bad characters. I will 
> be using a regular expression.
> 

depends on what "illegal characters" are...

If I want a name, I will discard anything other than text for instance.
Send an error message to the user and get them to refill the input box.
Not sure what the question is?

--Paul

--- End Message ---
--- Begin Message ---

Paul Scott wrote:
On Wed, 2006-04-05 at 13:34 -0800, Angelo Zanetti wrote:


Thanks for the reply. So what do you do if someone enters illegal characters in one of your form? Do you inform the user and prompt them to enter the fields again or do you just strip out all the bad characters and enter the rest of the info into the database?

Im concerned with what to do once a user has added the bad characters. I will 
be using a regular expression.



depends on what "illegal characters" are...

If I want a name, I will discard anything other than text for instance.
Send an error message to the user and get them to refill the input box.
Not sure what the question is?

Ok thats perfect. So best is to prompt user to reinput their information. Thats 
exactly what I was asking.

thanks

--- End Message ---
--- Begin Message ---
Hi guys.

I've just read an article that gives a good explanation about escaping single quote characters with slashes, the author then says that magic_quotes_gpc can do this for you if enabled on your server, he then he also mentions how if your magic_quotes_gpc are not turned on/enabled that you could use addslashes() with the same result and when retrieving info from the database that we need to use stripslashes().

All seems hunky dory but then he concludes that magic_quotes_gpc that they are evil as we have less control over the information we receive. Which does make sense. So should i avoid magic_quotes_gpc all together? my local development server has them enabled and when testing the input of a textfield that does a select query I input 'hello' (including single quotes) and it works really well with the single quotes escaped. But my live server has them disabled and therefore the single quotes break the SQL statement. So on my live server should I enable magic_quotes_gpc or should I use addslashes() and stripslashes()?

Thanks in advance.
--

Angelo

--- End Message ---
--- Begin Message ---
IMHO,
it really depends on a couple of things...
1). how you use it
and 2). How much control you want...

If you have a single point of entry for database actions, like a class that mimics the database structure and handles updates, inserts, deletes, then it makes sense to turn them off to give you the control, as with the single point of entry you can easily add/strip slashes. But if your design allows for many points of entry it becomes problematic to make sure you are adding/stripping slashes in all the appropriate areas. So, I would say that magic_quotes is a tool, it has some limitations, but can also be helpful. So it really depends on the wielder of the tool if it should be used or not.

-Brad

Angelo Zanetti wrote:

Hi guys.

I've just read an article that gives a good explanation about escaping single quote characters with slashes, the author then says that magic_quotes_gpc can do this for you if enabled on your server, he then he also mentions how if your magic_quotes_gpc are not turned on/enabled that you could use addslashes() with the same result and when retrieving info from the database that we need to use stripslashes().

All seems hunky dory but then he concludes that magic_quotes_gpc that they are evil as we have less control over the information we receive. Which does make sense. So should i avoid magic_quotes_gpc all together? my local development server has them enabled and when testing the input of a textfield that does a select query I input 'hello' (including single quotes) and it works really well with the single quotes escaped. But my live server has them disabled and therefore the single quotes break the SQL statement. So on my live server should I enable magic_quotes_gpc or should I use addslashes() and stripslashes()?

Thanks in advance.

--- End Message ---
--- Begin Message ---
I have an image library on one site that I want to be able to access from
another, but I actually want the image downloaded and cached to the new site
(so that it doesnt keep taxing the image server).

I allow the file() command to pull from other sites, can I do this with just
the file('http://www.site.com/image.jpg";); - or how would i do this?

Russ

--- End Message ---
--- Begin Message ---
> does the following make it work? ...
Yes it did ! But why ?
I'm passing string ... not variable...
I don't understand ....

>
> Georgi Ivanov wrote:
>
> ...
>
> > formSubmit: function (form, target, customRequest)
> >     {
> >         if (typeof form == 'string') {
> >             form = document.getElementById(form);
> >             if (!form) {
> >                 // let the submit be processed normally
> >                 return false;
> >             }
> >         }
> >         if (typeof target == 'string') {
> >             //I think we MUST go here but it seems we don't...
> >             target = document.getElementById('target');
>
> target = document.getElementById(target);
>
>               //               ^-- no quotes!
>
> >         }
> >         if (!target) {
> >     //I guess we enter here but we shouldn't.....
> >             target = form;
> >         }
> > ..........................
> > The script seems to be OK but...
> > So generally this script works ONLY if the DIV is with ID=target and
> > function called like this : HTML_AJAX.formSubmit(this,'target')
> > If i change the div with ID=alabala and call the script with :
> > HTML_AJAX.formSubmit(this,'alabala') it does not work.
> > Any ideas ?

--- End Message ---

Reply via email to