Re: [PHP] redirect using php

2006-04-05 Thread Mark Kelly
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

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



Re: [PHP] redirect using php

2006-04-05 Thread Andrei



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



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



Re: [PHP] redirect using php

2006-04-05 Thread Barry

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)

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



Re: [PHP] redirect using php

2006-04-05 Thread Andrei


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


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



[PHP] Error when compiling PHP from source on Mac OS X 10.4 server

2006-04-05 Thread Frank Arensmeier

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



[PHP] HTML_AJAX and formSubmit method

2006-04-05 Thread Georgi Ivanov
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 1pxnbsp;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: #CC; 
align=left 
valign=top colspan=2bcenterLogin/center/b/td
/tr
tr
td align=right valign=topbUser:/b/td
td valign=top align=leftinput name=user type=text 
//td
/tr
tr
td align=right valign=topbPassword:/b/td
td valign=top align=leftinput name=pass 
type=password //td
/tr
tr
td align=right valign=topb/b/td
td valign=top align=leftinput 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 ?

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



Re: [PHP] Error when compiling PHP from source on Mac OS X 10.4 server

2006-04-05 Thread Georgi Ivanov
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

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



Re: [PHP] Error when compiling PHP from source on Mac OS X 10.4 server

2006-04-05 Thread T.Lensselink
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



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



Re: [PHP] test for illegal characters and consequences

2006-04-05 Thread Angelo Zanetti

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

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



Re: [PHP] test for illegal characters and consequences

2006-04-05 Thread Paul Scott
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

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



Re: [PHP] test for illegal characters and consequences

2006-04-05 Thread Angelo Zanetti


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

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



Re: [PHP] HTML_AJAX and formSubmit method

2006-04-05 Thread Jochem Maas

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 ?



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



[PHP] Magic quotes good or Bad?

2006-04-05 Thread Angelo Zanetti

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

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



Re: [PHP] Magic quotes good or Bad?

2006-04-05 Thread Brad Bonkoski

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.


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



[PHP] Download image in PHP

2006-04-05 Thread Russell Jones
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


Re: [PHP] redirect using php

2006-04-05 Thread Chris Shiflett

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

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



Re: [PHP] HTML_AJAX and formSubmit method - Yes ! But why ?

2006-04-05 Thread Georgi Ivanov
 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 ?

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



Re: [PHP] Magic quotes good or Bad?

2006-04-05 Thread Chris Shiflett

Angelo Zanetti wrote:

So should i avoid magic_quotes_gpc all together?


In my opinion, yes.


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.


Your live application has an SQL injection vulnerability. This scenario 
is one of several reasons why magic_quotes_gpc does more to degrade 
security than promote it. By depending upon it, you have written code 
that is vulnerable to SQL injection.


Chris

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



[PHP] open / check SSL activation

2006-04-05 Thread Alain Roger
Hi,

I would like to ebsure that my user has SSL activated.

for that i would like to do something like that :
1. after lo-in button click, application will check if SSL is already
activated.
   1.a if no, php code should activate SSL
   1.b if yes, php code should control login and password entered.
2. 

how from PHP code, can i test if SSL is activated and if need activate SSL ?

thanks a lot,
Alain


Re: [PHP] Download image in PHP

2006-04-05 Thread mbneto
Hi,

If all you want to do is this as a suggestion (altough not php
related) you could call wget from your php script to fetch this image
without having to worry with other things.

Something like this

exec ('/path/to/wget http://www.foo.com/bar.jpg');

Of course you'd have to check if everything went fine.

On 4/5/06, Russell Jones [EMAIL PROTECTED] wrote:
 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



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



Re: [PHP] Magic quotes good or Bad?

2006-04-05 Thread tedd

At 2:37 PM -0800 4/5/06, 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.
--

Angelo



Angelo:

Everything I've read and have been told says Magic quotes is Bad 
--- turn it off.


I do it by placing a text file at root named .htaccess with the following

php_value magic_quotes_gpc 0
php_value magic_quotes_sybase 0
php_value magic_quotes_runtime 0

I'm not sure as to other methods, but they're are other ways -- 
however, I'm not sure if this works for all.


HTH's.

tedd
--

http://sperling.com

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



Re: [PHP] redirect using php

2006-04-05 Thread Mark Kelly
On Wednesday 05 April 2006 13:55, Chris Shiflett wrote:
 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.

I have been using that method when I got part-way through some processing 
that produces output, and hit something that requires a redirect. As I 
understand it headers are no use to me here.

I'm very much a beginner, so if this is the wrong way to do this, I'd 
appreciate pointers. Thanks for the reply, either way.

Mark

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



Re: [PHP] open / check SSL activation

2006-04-05 Thread Thomas Munz
if request come from port 443, SSL = Active

you can get the port from $_SERVER[SERVER_PORT]

on Wednesday 05 April 2006 15:12, Alain Roger wrote:
 Hi,

 I would like to ebsure that my user has SSL activated.

 for that i would like to do something like that :
 1. after lo-in button click, application will check if SSL is already
 activated.
1.a if no, php code should activate SSL
1.b if yes, php code should control login and password entered.
 2. 

 how from PHP code, can i test if SSL is activated and if need activate SSL
 ?

 thanks a lot,
 Alain

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



RE: [PHP] redirect using php

2006-04-05 Thread Dan Parry
If it helps here's the code I use to redirect

?php
function chrome_redirect($url)
{ // redirect the page
if (headers_sent())
{ // perform JS redirect
echo 'script type=text/javascript
language=javascript!-- document.location.href=\'' . $url . '\'; //
--/script';
} else { // no headers sent... much nicer header redirect
header('location: ' . $url);
die();
}
}
?

HTH

Dan

-
Dan Parry
Senior Developer
Virtua Webtech Ltd
http://www.virtuawebtech.co.uk

-Original Message-
From: Mark Kelly [mailto:[EMAIL PROTECTED] 
Sent: 05 April 2006 14:19
To: php-general@lists.php.net
Subject: Re: [PHP] redirect using php

On Wednesday 05 April 2006 13:55, Chris Shiflett wrote:
 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.

I have been using that method when I got part-way through some processing 
that produces output, and hit something that requires a redirect. As I 
understand it headers are no use to me here.

I'm very much a beginner, so if this is the wrong way to do this, I'd 
appreciate pointers. Thanks for the reply, either way.

Mark

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


__ NOD32 1.1454 (20060321) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



Re: [PHP] redirect using php

2006-04-05 Thread tedd

At 11:21 PM +0200 4/4/06, Schalk wrote:

Greetings All,

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?


After processing a form and sending the data via email, I need to 
redirect them to another page. I currently use a method of merely 
replacing the form with some 'thank you' text after submitting the 
form, I prefer this but, the client wants me to redirect to another 
page. All help appreciated. Thanks!


--
Kind Regards
Schalk Neethling



Schalk:

Try: http://www.weberdev.com/header

tedd
--

http://sperling.com

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



Re: [PHP] redirect using php

2006-04-05 Thread Chris Shiflett

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.

I have been using that method when I got part-way through some
processing that produces output, and hit something that requires a
redirect. As I understand it headers are no use to me here.


You're still using a Refresh header. The difference is that you're using 
a meta tag to mimic the header (e.g., http-equiv).


Using meta:

meta http-equiv=Name content=Value /

Using header():

?php header('Name: Value'); ?

Hope that helps.

Chris

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



Re: [PHP] redirect using php

2006-04-05 Thread Thomas Munz
Function that will work also, when JS is not activate and headers are allready 
send :) :

?php
function chrome_redirect($url)
{
 // redirect the page
 if (headers_sent())
 { // perform JS redirect
echo 'script type=text/javascript language=javascript
   !--
document.location.href=\'' . $url . '\'; 
   // --
  /script
  noscript
  meta http-equiv=refresh content=0; url='$url' /
  /noscript';
} else { // no headers sent... much nicer header redirect
header('location: ' . $url);
die();
}
}
?


on Wednesday 05 April 2006 15:30, Dan Parry wrote:
 If it helps here's the code I use to redirect

 ?php
 function chrome_redirect($url)
 { // redirect the page
   if (headers_sent())
   { // perform JS redirect
   echo 'script type=text/javascript
 language=javascript!-- document.location.href=\'' . $url . '\'; //
 --/script';
   } else { // no headers sent... much nicer header redirect
   header('location: ' . $url);
   die();
   }
 }
 ?

 HTH

 Dan

 -
 Dan Parry
 Senior Developer
 Virtua Webtech Ltd
 http://www.virtuawebtech.co.uk

 -Original Message-
 From: Mark Kelly [mailto:[EMAIL PROTECTED]
 Sent: 05 April 2006 14:19
 To: php-general@lists.php.net
 Subject: Re: [PHP] redirect using php

 On Wednesday 05 April 2006 13:55, Chris Shiflett wrote:
  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.

 I have been using that method when I got part-way through some processing
 that produces output, and hit something that requires a redirect. As I
 understand it headers are no use to me here.

 I'm very much a beginner, so if this is the wrong way to do this, I'd
 appreciate pointers. Thanks for the reply, either way.

 Mark

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


 __ NOD32 1.1454 (20060321) Information __

 This message was checked by NOD32 antivirus system.
 http://www.eset.com

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



Re: [PHP] redirect using php

2006-04-05 Thread Mark Kelly
On Wednesday 05 April 2006 14:33, Chris Shiflett wrote:
 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.
 
  I have been using that method when I got part-way through some
  processing that produces output, and hit something that requires a
  redirect. As I understand it headers are no use to me here.

 You're still using a Refresh header. The difference is that you're using
 a meta tag to mimic the header (e.g., http-equiv).

I understand that. I'm sorry, I am obviously not making myself clear...

The php manual page tells me that I can't use header() after any output has 
been sent, thus making it useless in my (obviously badly explained) case 
above.

What happens in my app is: the data processing is in several discrete 
sequential stages, each one echoing status to the user. When it hits 
something that requires additional pre-processing by a different page, I 
use the http-equiv redirect with a 3 second delay so the user can read the 
message telling them what is going on.

Am I correct that header() is no use for this, and is there a correct way 
to achieve what I describe? I'm a bit concerned that my ignorance may have 
led me to do this wrong - this is my first php app.

Also, thanks to all the folk suggesting javascript, but this is an internal 
app, and policy has javascript turned off on all browsers.

Thanks again,

Mark

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



Re: [PHP] redirect using php

2006-04-05 Thread John Nichel

Andrei wrote:


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




Assuming the end user has JS turned on.  JS and Meta Refreshes are not 
acceptable when you need to be sure the redirect works.


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Magic quotes good or Bad?

2006-04-05 Thread John Nichel

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().


The 'author' is an idiot

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? 


Yes

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()?


No.  Disable magic_quotes on both boxes.  If your db is MySQL, use 
mysql_real_escape_string().  Otherwise look into writing a routine that 
will escape the proper characters for your db.


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



[Fwd: Re: [PHP] redirect using php]

2006-04-05 Thread Andrei


Andrei wrote:


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




Assuming the end user has JS turned on.  JS and Meta Refreshes are not
acceptable when you need to be sure the redirect works.

Depends on your user target...
I generally suppose the users using my code enabled JS on their 
browsers. If they didn't too bad. I can't code everything judging there 
are ppl that do restrictions on their browsers.


Andy

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



[PHP] no,no,no,Re: [PHP] HTML_AJAX and formSubmit method - Yes ! But why ?

2006-04-05 Thread Georgi Ivanov
I didn't  understood what are you saying at first.

I don't control the JS code . It is generated from the HTML_AJAX code.

The problem was fixed when calling formSubmit method like this :
HTML_AJAX.formSubmit(this,target) // No quotes here; target is just a string !

instead of :

HTML_AJAX.formSubmit(this,'target') // This was in the example i've used for 
testing

So i didn't changed the HTML_AJAX code. Just the client code.
Now the problem is fixed but i still don't understand why ...

On Wednesday April 5 2006 16:05, Georgi Ivanov wrote:
  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 ?

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



Re: [PHP] Error when compiling PHP from source on Mac OS X 10.4 server

2006-04-05 Thread Frank Arensmeier
I tried to install PHP 4 with darwinports yesterday. And it gave me  
the same error. Configuring the install seems not to be the problem,  
but the install make. It has definitely something to do with the  
absence of some developer packages from Apache on my machine.


I actually found a rather brief description on how to recompile PHP  
with the same compile options Apple uses.


http://maxo.captainnet.net/installs/tiger/php/index_4.4.2.html

no success... I don't get it.

I give upp. I think I have to stick to the old PDFlib bundled with  
the entropy distribution. Somewhere on entropy.ch Marc says that  
there will be a distribution with PHP 5 with PDFlib as DSO. Thats  
what I need.


If someone can share any binary package with PHP5 / PDFlib 6.0.3 - I  
would appreciate that. Or maybe a step-by-step description on how to  
recompile PHP on Mac OS X 10.4.4 server?


cheers.

/frank


5 apr 2006 kl. 16.07 skrev Venkat Venkataraju:


I'm a bit OT though...

I have php5, apache, mysql installed thru darwinports. if you are  
not the LFS kind of person, it helps a lot to install darwinports  
and intall all your packages thru it. Fink is another alternative,  
but i prefer darwinports.


Cheers
/V

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
--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



[PHP] newbie question

2006-04-05 Thread David Doonan
I'm developing my first php mysql site and have hit a stumbling block  
regarding how text is being returned out of the database.


This is the code that I'm using on the display page. It is displaying  
the returned text as one long paragraph, instead of mulitiple

paragraphs:

p?php echo $row_GetWritings['Writings_Text']; ?/p
---
This block of code is from the CMS edit page which is correctly  
displaying the text as multiple paragraphs:


tdtextarea name=Writings_Text cols=50 rows=5?php echo
$row_GetWritings['Writings_Text']; ?/textarea
 /td


The only difference is the textarea tag from the form. What am I  
missing?


I've looked through numerous books and dozens of web pages without  
finding anything that makes sense to me. Lots of references to n12br  
which I have no idea how to implement.


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



RE: [PHP] newbie question

2006-04-05 Thread Jay Blanchard
[snip]
I'm developing my first php mysql site and have hit a stumbling block  
regarding how text is being returned out of the database.

This is the code that I'm using on the display page. It is displaying  
the returned text as one long paragraph, instead of mulitiple
paragraphs:

p?php echo $row_GetWritings['Writings_Text']; ?/p
---
This block of code is from the CMS edit page which is correctly  
displaying the text as multiple paragraphs:

tdtextarea name=Writings_Text cols=50 rows=5?php echo
$row_GetWritings['Writings_Text']; ?/textarea
  /td


The only difference is the textarea tag from the form. What am I  
missing?

I've looked through numerous books and dozens of web pages without  
finding anything that makes sense to me. Lots of references to n12br  
which I have no idea how to implement.
[/snip]

Read this http://www.php.net/nl2br

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



[PHP] IP Address Filtering - Problem Continues

2006-04-05 Thread Rahul S. Johari

Ave,

Unfortunately my problem persists.
The reason my script was recording NULL as IP address was because I was
using $REMOTE_ADDR. When I started using the correct syntax, i.e.,
$SERVER['REMOTE_ADDR'], it actually did start recording the IP Address of
the spammer.

The problem is, the spammer is using multiple IP Address. His IP Address
changes every 6 - 8 entries. I have so far recorded 5 different IP Addresses
of the spammer. Although I can create a Database and keep adding his IP
Address to the database, and run a check from the Guestbook script to scan
against Blocked Addresses, It¹s not the most efficient method in the world.
What other logic can I apply to automatically block the spammer? Or at least
have a more efficient method of blocking the Spammer and his IP¹s?

Thanks.


On 3/30/06 8:41 AM, Rahul S. Johari [EMAIL PROTECTED] wrote:

 Ave,
 
 Curt, thanks for your response.
 
 Is this a common guestbook, like a 3rd party tool you got and added
 to the web site? If so, do they already have a solution in place
 with an add-on or such.
 
 No, actually it's a script I have written myself from scratch. And
 unfortunately (or fortunately perhaps), I haven't ever run into this problem
 before. 
 
 You really want to use $_SERVER['REMOTE_ADDR'];
 
 That is should, I agree!
  
 
 A common method (now adays) is have the form that is being posted
 provide a challange/response method (like CAPTCHA) to verify that
 someone is actually sitting there filling out the form instead of a
 script doing the work.
 
 One of the problems with this method is well it limits your
 visually impared audience from being able to add to the
 guestbook, since it requires a visual response to the challenge.
 
 Another method is to require javascript for a challenge response
 method, this of course limits your audience to those who have
 javascript enabled, and I'm not sure if it really 'visually
 impared' friendly.
 
 I have implemented both those methods in different scripts I have written
 and maintain across different websites. Visual Confirmation using Image
 Verification and JavaScript Confirmation. However, I honestly don't want to
 add such an 'extra' step in my Guestbook for users who simply wish to put in
 a nice comment about the site, at least not at this point, which is why I do
 want to stay away from these methods for the Guestbook for now.
 
 Let me try a few other suggestions first and see how it goes, and then I'll
 decide if I need to add more capabilities/security to the Guestbook.
 
 Thanks for your insight, always brain-enhancing.
 
 Rahul S. Johari
 Coordinator, Internet  Administration
 Informed Marketing Services Inc.
 500 Federal Street, Suite 201
 Troy NY 12180
 
 Tel: (518) 687-6700 x154
 Fax: (518) 687-6799
 Email: [EMAIL PROTECTED]
 http://www.informed-sources.com
 

Rahul S. Johari
Coordinator, Internet  Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com



Re: [PHP] Download image in PHP

2006-04-05 Thread Joe Henry
On Wednesday 05 April 2006 7:16 am, mbneto wrote:
 Hi,

 If all you want to do is this as a suggestion (altough not php
 related) you could call wget from your php script to fetch this image
 without having to worry with other things.

 Something like this

 exec ('/path/to/wget http://www.foo.com/bar.jpg');

 Of course you'd have to check if everything went fine.

 On 4/5/06, Russell Jones [EMAIL PROTECTED] wrote:
  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

You might want to look at CURL, too.

http://us2.php.net/manual/en/ref.curl.php
-- 
Joe Henry
www.celebrityaccess.com
[EMAIL PROTECTED]

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



RE: [PHP] IP Address Filtering - Problem Continues

2006-04-05 Thread Jay Blanchard
[snip]
The problem is, the spammer is using multiple IP Address. His IP Address
changes every 6 - 8 entries. I have so far recorded 5 different IP Addresses
of the spammer. Although I can create a Database and keep adding his IP
Address to the database, and run a check from the Guestbook script to scan
against Blocked Addresses, It¹s not the most efficient method in the world.
What other logic can I apply to automatically block the spammer? Or at least
have a more efficient method of blocking the Spammer and his IP¹s?
[/snip]

You could always block a range of IP addresses, but you may cut out a 
legitimate user.

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



RE: [PHP] newbie question

2006-04-05 Thread Jay Blanchard
[snip]
Read this http://www.php.net/nl2br

The page stops writing once it hits this line:

p?php echo n12br($row_Recordset1['Writings_Text']); ?/p
[/snip]

And?

What is the content of 'Writings Text'? Is there anything there?

[helpful hint]
When responding to e-mails on the list you must hit replay all or the
list will never see the response and therefore cannot continue to help.
If you respond directly to someone who answers your question they may no
longer be there or you e-mail may go directly to the spam folder since
it would not be recognized.
[/helpful hint]

Oh: Text only.

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



Re: [PHP] newbie question

2006-04-05 Thread Evan Priestley


On Apr 5, 2006, at 11:41 AM, Jay Blanchard wrote:


p?php echo n12br($row_Recordset1['Writings_Text']); ?/p

 ^

Not sure if this is just a transcription error, but that should be an  
'l' (ell), not a '1' (one) in nl2br.


Evan

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



Re: [PHP] newbie question

2006-04-05 Thread David Doonan
Writings_Text is the field in the d/b that contains the text I'm  
trying to return.


I've done a couple of dozen ColdFusion sites and would format like this:
cfoutputp#ParagraphFormat(Writings_Text)#/p/cfoutput
and the results would be retuned exactly as stored in the d/b.

What I'm searching for is the php equilevant of the above.

Please bear in mind that this is my first php site and my background  
is in fine art, not programming.


david


On Apr 5, 2006, at 11:41 AM, Jay Blanchard wrote:


[snip]
Read this http://www.php.net/nl2br

The page stops writing once it hits this line:

p?php echo n12br($row_Recordset1['Writings_Text']); ?/p
[/snip]

And?

What is the content of 'Writings Text'? Is there anything there?

[helpful hint]
When responding to e-mails on the list you must hit replay all or the
list will never see the response and therefore cannot continue to  
help.
If you respond directly to someone who answers your question they  
may no

longer be there or you e-mail may go directly to the spam folder since
it would not be recognized.
[/helpful hint]

Oh: Text only.


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



Re: [PHP] newbie question

2006-04-05 Thread David Doonan

On Apr 5, 2006, at 11:51 AM, Evan Priestley wrote:



On Apr 5, 2006, at 11:41 AM, Jay Blanchard wrote:


p?php echo n12br($row_Recordset1['Writings_Text']); ?/p

 ^

Not sure if this is just a transcription error, but that should be  
an 'l' (ell), not a '1' (one) in nl2br.


Evan


Grazi! Exactly what I'm looking for!

a very grateful newbie!

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



Re: [PHP] no,no,no,Re: [PHP] HTML_AJAX and formSubmit method - Yes ! But why ?

2006-04-05 Thread Jochem Maas

Georgi Ivanov wrote:

I didn't  understood what are you saying at first.

I don't control the JS code . It is generated from the HTML_AJAX code.

The problem was fixed when calling formSubmit method like this :
HTML_AJAX.formSubmit(this,target) // No quotes here; target is just a string !

instead of :

HTML_AJAX.formSubmit(this,'target') // This was in the example i've used for 
testing


So i didn't changed the HTML_AJAX code. Just the client code.
Now the problem is fixed but i still don't understand why ...


maybe you're misunderstanding strings and variables
(and the difference between the 2) in javascript (forgive me if I am wrong
on this).

Either way you have hacked round a what seems to be bug in HTML_AJAX:

if (typeof target == 'string') {
target = document.getElementById('target');
}

in the above target is a variable - which if of type string
is fed to the document.getElementById() method - only the variable
is not passed but instead a string literal is passed (which
happens to contain the name of the variable that should have been passed)



On Wednesday April 5 2006 16:05, Georgi Ivanov wrote:


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 ?





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



Re: [PHP] newbie question

2006-04-05 Thread John Wells
On 4/5/06, David Doonan [EMAIL PROTECTED] wrote:
 The only difference is the textarea tag from the form. What am I
 missing?

nl2br is short for newline to br.  If you pass a string of
content that contains newline characters (these signal the ending of a
line of text) to nl2br(), it will replace those newlines with br
tags, so that when outputted to the screen, you will see the line
breaks.

The reason why you see the line breaks when contained within the
textarea / tags is that browsers honor newline characters (and
other whitespace) when wrapped in textarea /.  This is similar to
the pre / tags.

HTH,

John W

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



Re: [PHP] IP Address Filtering - Problem Continues

2006-04-05 Thread Jochem Maas

Jay Blanchard wrote:

[snip]
The problem is, the spammer is using multiple IP Address. His IP Address
changes every 6 - 8 entries. I have so far recorded 5 different IP Addresses
of the spammer. Although I can create a Database and keep adding his IP
Address to the database, and run a check from the Guestbook script to scan
against Blocked Addresses, It¹s not the most efficient method in the world.
What other logic can I apply to automatically block the spammer? Or at least
have a more efficient method of blocking the Spammer and his IP¹s?
[/snip]

You could always block a range of IP addresses, but you may cut out a 
legitimate user.


I'm missing the beginning of this thread so maybe it's be mentioned before but 
is an image
CAPTCHA not an option? (and yes I know the accesibility arguments against using 
CAPTCHA,
and the fact that crap CAPCHTA can be broken by image recognition tools - but 
my pragmatic
feeling is that it's often better than a bucket load of SPAM.)





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



Re: [PHP] Download image in PHP

2006-04-05 Thread Jochem Maas

Russell Jones wrote:

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?


you can if the ini setting 'allow_url_fopen' is set to true (you hosting 
provider
may not allow it - in which case the cURL exntension or the 'wget' trick 
mentioned
by others are alternative solutions).

I would recommend using file_get_contents() if you have it (depends on you
php version) iso file().



Russ



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



Re: [PHP] calling php script from C - pclose problem

2006-04-05 Thread Jochem Maas

Ysidro wrote:

Hello,

Calling a php script from legacy c code using popen(), works great.
Problem: when php script is done, pclose() in c code fails with ECHILD, 
No child process, wait4() failed.


This is because the php script does not hang around to be wait'ed for; 
any idea how to make a command line php script behave like a normal 
child process that waits for its parent to get a status via a wait 
system call?


good question.

given that nobody has answered it probably means nobody here who has read
the list in the last couple of days knows the answer.

I assume google/yahoo didn't help you either (given your programming in C, it's
probably safe to assume your not new to the 'research the problem' game :-)

it might be worth asking on internals@lists.php.net if you still don't get a
reponse in the next 24 hours (make sure to mention that you already asked 
here!).






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



Re: [PHP] calling php script from C - pclose problem

2006-04-05 Thread Ysidro

Jochem Maas wrote:

Ysidro wrote:


Hello,

Calling a php script from legacy c code using popen(), works great.
Problem: when php script is done, pclose() in c code fails with 
ECHILD, No child process, wait4() failed.


This is because the php script does not hang around to be wait'ed for; 
any idea how to make a command line php script behave like a normal 
child process that waits for its parent to get a status via a wait 
system call?



good question.

given that nobody has answered it probably means nobody here who has read
the list in the last couple of days knows the answer.

I assume google/yahoo didn't help you either (given your programming in 
C, it's

probably safe to assume your not new to the 'research the problem' game :-)

it might be worth asking on internals@lists.php.net if you still don't 
get a
reponse in the next 24 hours (make sure to mention that you already 
asked here!).





Thanks for the reply.  Yes I've been 'researching' for last couple of 
days, only it sure doesn't help the results when php also contains a 
popen and pclose function!  I'll try the internals suggestion if nothing 
comes in today.  FYI: I have a suspicion that it has to do with php's 
primary purpose of getting invoked from web servers like Apache.  You 
obviously don't want Apache to wait around to check status on php 
scripts.  I could wrap the php script in a shell script to make sure I 
get a waiting child, but that should not be necessary if php would act 
properly when called in command line mode.


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



[PHP] problem using mysql_connect function under windows XP

2006-04-05 Thread Alain Roger
Hi,

i wrote a simple testing page. it should test if it can connect to MySQL db.

however, i have an error message as followed :
*Fatal error*: Call to undefined function mysql_connect() in *F:\Mes
documents\Development\Website\Immense\checklogin.php* on line *23

*on line 23, i have the following thing :

mysql_connect($host, $username, $password) or die(cannot connect);

where is the problem ?
thansk a lot,

Alain


Re: [PHP] problem using mysql_connect function under windows XP

2006-04-05 Thread Jochem Maas

Alain Roger wrote:

Hi,

i wrote a simple testing page. it should test if it can connect to MySQL db.

however, i have an error message as followed :
*Fatal error*: Call to undefined function mysql_connect() in *F:\Mes
documents\Development\Website\Immense\checklogin.php* on line *23

*on line 23, i have the following thing :

mysql_connect($host, $username, $password) or die(cannot connect);

where is the problem ?


line 23.

you don't have the mysql extension installed/loaded.
maybe your php build has the mysqli extension?



thansk a lot,

Alain



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



Re: [PHP] problem using mysql_connect function under windows XP

2006-04-05 Thread Alain Roger
i've seen that non of extension are activated...neither mysql.dll nor
mysqli.dll

after uncommenting them and restarting Apache, it still does not work :-(

On 4/5/06, Jochem Maas [EMAIL PROTECTED] wrote:

 Alain Roger wrote:
  Hi,
 
  i wrote a simple testing page. it should test if it can connect to MySQL
 db.
 
  however, i have an error message as followed :
  *Fatal error*: Call to undefined function mysql_connect() in *F:\Mes
  documents\Development\Website\Immense\checklogin.php* on line *23
 
  *on line 23, i have the following thing :
 
  mysql_connect($host, $username, $password) or die(cannot
 connect);
 
  where is the problem ?

 line 23.

 you don't have the mysql extension installed/loaded.
 maybe your php build has the mysqli extension?


  thansk a lot,
 
  Alain
 




Re: [PHP] problem using mysql_connect function under windows XP

2006-04-05 Thread Brad Bonkoski

Create a page like this:
?php
   phpinfo();
?

and see what the output tells you about mysql...might shed some light on it.
-B

Alain Roger wrote:


i've seen that non of extension are activated...neither mysql.dll nor
mysqli.dll

after uncommenting them and restarting Apache, it still does not work :-(

On 4/5/06, Jochem Maas [EMAIL PROTECTED] wrote:
 


Alain Roger wrote:
   


Hi,

i wrote a simple testing page. it should test if it can connect to MySQL
 


db.
   


however, i have an error message as followed :
*Fatal error*: Call to undefined function mysql_connect() in *F:\Mes
documents\Development\Website\Immense\checklogin.php* on line *23

*on line 23, i have the following thing :

mysql_connect($host, $username, $password) or die(cannot
 


connect);
   


where is the problem ?
 


line 23.

you don't have the mysql extension installed/loaded.
maybe your php build has the mysqli extension?


   


thansk a lot,

Alain

 

   



 



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



Re: [PHP] problem using mysql_connect function under windows XP

2006-04-05 Thread Alain Roger
nothing about MySQL...only what is in my path variable :-(
1. i stopped apache server
2. i uncomment -- extension=php_mysql.dll and extension=php_mysqli.dll in
my php.ini file
3. i updated my extension_dir like that -- extension_dir =
F:\WebServer\PHP511\ext
4. i restarted apache
5. phpinfo still provide no info regarding MySQL

what should i do ?


On 4/5/06, Brad Bonkoski [EMAIL PROTECTED] wrote:

 Create a page like this:
 ?php
 phpinfo();
 ?

 and see what the output tells you about mysql...might shed some light on
 it.
 -B

 Alain Roger wrote:

 i've seen that non of extension are activated...neither mysql.dll nor
 mysqli.dll
 
 after uncommenting them and restarting Apache, it still does not work :-(
 
 On 4/5/06, Jochem Maas [EMAIL PROTECTED] wrote:
 
 
 Alain Roger wrote:
 
 
 Hi,
 
 i wrote a simple testing page. it should test if it can connect to
 MySQL
 
 
 db.
 
 
 however, i have an error message as followed :
 *Fatal error*: Call to undefined function mysql_connect() in *F:\Mes
 documents\Development\Website\Immense\checklogin.php* on line *23
 
 *on line 23, i have the following thing :
 
 mysql_connect($host, $username, $password) or die(cannot
 
 
 connect);
 
 
 where is the problem ?
 
 
 line 23.
 
 you don't have the mysql extension installed/loaded.
 maybe your php build has the mysqli extension?
 
 
 
 
 thansk a lot,
 
 Alain
 
 
 
 
 
 
 
 



[PHP] Oracle stored procedures

2006-04-05 Thread Jay Blanchard
Howdy group...

I have a stored procedure in Oracle;

p_BILL_TO_ADDRESS1 IN CONT_ADDRESS.ADDRESS1%TYPE
Default NULL,  --VC(50)

With a condition;
IF p_BILL_TO_ADDRESS1 is NULL THEN
Raise_Application_Error(-20100,'BILL TO Address cannot be a NULL
Value');
  END IF;


I have some PHP code that tries to insert the data;

$addr = '1234 Main';
$sth = oci_parse($conn, begin D_ACCT_NEW(:p_BILL_TO_ADDRESS1,
:P_Error_Return );end;);

oci_bind_by_name($sth, :p_BILL_TO_ADDRESS1, $addr, -1);
oci_bind_by_name($sth, :P_Error_Return, $errorcode, -1);
oci_execute($sth);

echo $errorcode;

And I always get the following error;

Warning: oci_execute() [function.oci-execute]: ORA-06502: PL/SQL:
numeric or value error ORA-06512: at SYSADM.D_ACCT_NEW, line 483
ORA-20100: BILL TO Address cannot be a NULL Value ORA-06512: at line 1
in /home/foo/bar/glorp.php on line 25

If anyone on the list understands the intricacies of Oracle, could you
sooth my aching head and help me to understand what is going on here? I
have RTFM and the following article from the PHP Oracle Cookbook;

http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/fuecks
_sps.html


;and I still am clueless. Thanks a million in advance!

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



Re: [PHP] problem using mysql_connect function under windows XP

2006-04-05 Thread John Nichel

Alain Roger wrote:

nothing about MySQL...only what is in my path variable :-(
1. i stopped apache server
2. i uncomment -- extension=php_mysql.dll and extension=php_mysqli.dll in
my php.ini file
3. i updated my extension_dir like that -- extension_dir =
F:\WebServer\PHP511\ext
4. i restarted apache
5. phpinfo still provide no info regarding MySQL

what should i do ?



In that phpinfo() page you created, look for this line...

Configuration File (php.ini) Path

And ensure you're editing the php.ini that your version of PHP is reading.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] problem using mysql_connect function under windows XP

2006-04-05 Thread Brad Bonkoski

One alternative is to try this:
http://www.en.wampserver.com

Otherwise, make sure the php.ini file you are editing is the one pointed 
to by the line:

Configuration File (php.ini) Path from the phpinfo generated file

Also, you could check any Apache log files to see if they output any 
errors when you restart the web server.


-B

Alain Roger wrote:


nothing about MySQL...only what is in my path variable :-(
1. i stopped apache server
2. i uncomment -- extension=php_mysql.dll and extension=php_mysqli.dll in
my php.ini file
3. i updated my extension_dir like that -- extension_dir =
F:\WebServer\PHP511\ext
4. i restarted apache
5. phpinfo still provide no info regarding MySQL

what should i do ?


On 4/5/06, Brad Bonkoski [EMAIL PROTECTED] wrote:
 


Create a page like this:
?php
   phpinfo();
?

and see what the output tells you about mysql...might shed some light on
it.
-B

Alain Roger wrote:

   


i've seen that non of extension are activated...neither mysql.dll nor
mysqli.dll

after uncommenting them and restarting Apache, it still does not work :-(

On 4/5/06, Jochem Maas [EMAIL PROTECTED] wrote:


 


Alain Roger wrote:


   


Hi,

i wrote a simple testing page. it should test if it can connect to
 


MySQL
   

 


db.


   


however, i have an error message as followed :
*Fatal error*: Call to undefined function mysql_connect() in *F:\Mes
documents\Development\Website\Immense\checklogin.php* on line *23

*on line 23, i have the following thing :

mysql_connect($host, $username, $password) or die(cannot


 


connect);


   


where is the problem ?


 


line 23.

you don't have the mysql extension installed/loaded.
maybe your php build has the mysqli extension?




   


thansk a lot,

Alain



 

   



 



 



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



Re: [PHP] problem using mysql_connect function under windows XP

2006-04-05 Thread Alain Roger
thanks a lot Brad...

i was updating the php.ini from PHP installation folder and not the one that
apache was reading.
so i replace the php.ini in my C:\Windows folder and in my Phpinfo page i
have a new part regarding MySQL.
it's ok now.

thanks a lot,
Alain

On 4/5/06, Brad Bonkoski [EMAIL PROTECTED] wrote:

 One alternative is to try this:
 http://www.en.wampserver.com

 Otherwise, make sure the php.ini file you are editing is the one pointed
 to by the line:
 Configuration File (php.ini) Path from the phpinfo generated file

 Also, you could check any Apache log files to see if they output any
 errors when you restart the web server.

 -B

 Alain Roger wrote:

 nothing about MySQL...only what is in my path variable :-(
 1. i stopped apache server
 2. i uncomment -- extension=php_mysql.dll and extension=php_mysqli.dll
 in
 my php.ini file
 3. i updated my extension_dir like that -- extension_dir =
 F:\WebServer\PHP511\ext
 4. i restarted apache
 5. phpinfo still provide no info regarding MySQL
 
 what should i do ?
 
 
 On 4/5/06, Brad Bonkoski [EMAIL PROTECTED] wrote:
 
 
 Create a page like this:
 ?php
 phpinfo();
 ?
 
 and see what the output tells you about mysql...might shed some light on
 it.
 -B
 
 Alain Roger wrote:
 
 
 
 i've seen that non of extension are activated...neither mysql.dll nor
 mysqli.dll
 
 after uncommenting them and restarting Apache, it still does not work
 :-(
 
 On 4/5/06, Jochem Maas [EMAIL PROTECTED] wrote:
 
 
 
 
 Alain Roger wrote:
 
 
 
 
 Hi,
 
 i wrote a simple testing page. it should test if it can connect to
 
 
 MySQL
 
 
 
 
 db.
 
 
 
 
 however, i have an error message as followed :
 *Fatal error*: Call to undefined function mysql_connect() in *F:\Mes
 documents\Development\Website\Immense\checklogin.php* on line *23
 
 *on line 23, i have the following thing :
 
 mysql_connect($host, $username, $password) or die(cannot
 
 
 
 
 connect);
 
 
 
 
 where is the problem ?
 
 
 
 
 line 23.
 
 you don't have the mysql extension installed/loaded.
 maybe your php build has the mysqli extension?
 
 
 
 
 
 
 thansk a lot,
 
 Alain
 
 
 
 
 
 
 
 
 
 
 
 
 



[PHP] Sessions and Frames

2006-04-05 Thread Shaun
Hi,

I have a site that uses frames. The frameset loads another site (both on the 
same server) in the lower frame window. Every time the page changes in the 
lower frame the session id changes, how can I stop this happening?

Thanks for your help 

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



Re: [PHP] Sessions and Frames

2006-04-05 Thread Richard Lynch
On Wed, April 5, 2006 1:02 pm, Shaun wrote:
 I have a site that uses frames. The frameset loads another site (both
 on the
 same server) in the lower frame window. Every time the page changes in
 the
 lower frame the session id changes, how can I stop this happening?

You might be able to reduce the occurence by doing start_session() in
the top frame as well.

However, the browser is free to fetch the two frames in parallel, and
that means you could sometimes end up with different sessions in each.

This is a really good reason to just abandon frames, as if there
weren't enough others already...

That said, in the FRAMESET page, you can do start_session() and pass
it down into the FRAME URLs:

?php
  session_start();
  $session_id = session_id();
?
FRAMESET ...
  FRAME SRC=...PHPSESSID=?php echo $session_id? ...
  FRAME SRC=...PHPSESSID=?php echo $session_id? ...
/FRAMESET

You will need to get the right variable name, or you may even need to
do like this in the FRAME pages:

?php
  $session_id = $_GET['PHPSESSID'];
  session_id($session_id); //SET the session ID to what's passed in
  session_start();
?

The caveat, though, is that you are now exposing your session ID in
the URLs, which is not so good for security reasons.

If it's over SSL, it's fine.

If it's not, and if security matters, then you either need to move to
SSL or abandon frames.

You should abandon frames anyway...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] ZEND Certification

2006-04-05 Thread Bobby Matthis
I'm sure this has been asked in the past, but I figured up to date info
never hurts.  I'm going to be scheduling my certification soon, but I wanted
to hear from any of you that recently got zend certified recently and if you
had any advice.

Is there any particular portion I should make sure I have strong knowledge
of more than any other?

Any sites with good advice for this exam?

I have read countless online tutorials, but perhaps there are some good ones
out there I have passed upany good links?

I have read the official Zend Certification guide - which with all the
grammatical mistakes, I still was able to make sense of 98% of it or at
least knew that when they made a mistake, I knew it was a mistake and what
should have been there.

Anyway, any certification advice, any at all would be much
appreciated...

Thanks,
B

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



Re: [PHP] Sessions and Frames

2006-04-05 Thread Joe Wollard
I agree with Richard on this one. Frames should really be avoided if for no
other reason than they cause headaches like the one you have right now. ;-)

If you can't avoid them, keep it simple - just store the ID in one place,
like a session cookie. Doing so will make sure that if the session ID gets
changed in one frame it will still be correct in all of the other frames.

- Joe

On 4/5/06, Richard Lynch [EMAIL PROTECTED] wrote:

 On Wed, April 5, 2006 1:02 pm, Shaun wrote:
  I have a site that uses frames. The frameset loads another site (both
  on the
  same server) in the lower frame window. Every time the page changes in
  the
  lower frame the session id changes, how can I stop this happening?

 You might be able to reduce the occurence by doing start_session() in
 the top frame as well.

 However, the browser is free to fetch the two frames in parallel, and
 that means you could sometimes end up with different sessions in each.

 This is a really good reason to just abandon frames, as if there
 weren't enough others already...

 That said, in the FRAMESET page, you can do start_session() and pass
 it down into the FRAME URLs:

 ?php
   session_start();
   $session_id = session_id();
 ?
 FRAMESET ...
   FRAME SRC=...PHPSESSID=?php echo $session_id? ...
   FRAME SRC=...PHPSESSID=?php echo $session_id? ...
 /FRAMESET

 You will need to get the right variable name, or you may even need to
 do like this in the FRAME pages:

 ?php
   $session_id = $_GET['PHPSESSID'];
   session_id($session_id); //SET the session ID to what's passed in
   session_start();
 ?

 The caveat, though, is that you are now exposing your session ID in
 the URLs, which is not so good for security reasons.

 If it's over SSL, it's fine.

 If it's not, and if security matters, then you either need to move to
 SSL or abandon frames.

 You should abandon frames anyway...

 --
 Like Music?
 http://l-i-e.com/artists.htm

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




Re: [PHP] Sessions and Frames

2006-04-05 Thread Richard Lynch
On Wed, April 5, 2006 1:33 pm, Joe Wollard wrote:
 If you can't avoid them, keep it simple - just store the ID in one
 place,
 like a session cookie. Doing so will make sure that if the session ID
 gets
 changed in one frame it will still be correct in all of the other
 frames.

No, it won't.

That's the whole problem.

Watch this slow-motion instant replay.

HTTP Interaction #1
Browser requests URL  Server sends out FRAMESET/FRAME/FRAME ---\

Browser gets FRAMESET /


HTTP Interaction #2A (starts)
Browser requests FRAME #1 URL --

HTTP Interaction #2B (starts, in parallel, by browser)
Browser requests FRAME #2 URL --

Server responds to #2A, with session_start() sending out Cookie
headers, and setting up session #2A

Server responds to #2B, with session_start() sending out *NEW* Cookie
headers, and setting up session #2B, because the browser has *NOT* yet
received, much less sent back, the Cookies from #2A

The browser now has *TWO* parallel sessions.

You  *MUST* *MUST* *MUST* get the session started in the FRAMESET, or
this *WILL* happen, intermittently, between the frames.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Failed MySQL queries

2006-04-05 Thread Ben Miller
Rather than using the following, which simply displays a white screen with
the die message, is there a way to add the die message to the body of the
original form page, such as in a variable, so that I can display the message
on the original form page with all the values already filled out, so that
all the user has to do is resubmit?

$result = mysql_query($query)
or die(User Account could not be created.nbsp; Please try 
again
later.);

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



RE: [PHP] Failed MySQL queries

2006-04-05 Thread Jim Moseby
 
 Rather than using the following, which simply displays a 
 white screen with
 the die message, is there a way to add the die message to the 
 body of the
 original form page, such as in a variable, so that I can 
 display the message
 on the original form page with all the values already filled 
 out, so that
 all the user has to do is resubmit?
 
   $result = mysql_query($query)
   or die(User Account could not be 
 created.nbsp; Please try again
 later.);
 

Yeah.  Don't use die().  die() kills the script.  You can use echo to echo a
message, but you'll have to handle any problems the failed query may cause.

JM

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



RE: [PHP] Failed MySQL queries

2006-04-05 Thread Jay Blanchard
[snip]
Rather than using the following, which simply displays a white screen
with
the die message, is there a way to add the die message to the body of
the
original form page, such as in a variable, so that I can display the
message
on the original form page with all the values already filled out, so
that
all the user has to do is resubmit?

$result = mysql_query($query)
or die(User Account could not be created.nbsp; Please
try again
later.);
[/snip]

Yes.













You could submit the form to itself until all of the conditions are met.
Each time a condition is not met you can output an error message on the
page along with the rest of the form. Don't forget to capture the $_POST
values.

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



Re: [PHP] IP Address Filtering - Problem Continues

2006-04-05 Thread tedd

At 5:58 PM +0200 4/5/06, Jochem Maas wrote:

Jay Blanchard wrote:

[snip]
The problem is, the spammer is using multiple IP Address. His IP Address
changes every 6 - 8 entries. I have so far recorded 5 different IP Addresses
of the spammer. Although I can create a Database and keep adding his IP
Address to the database, and run a check from the Guestbook script to scan
against Blocked Addresses, It's not the most efficient method in the world.
What other logic can I apply to automatically block the spammer? Or at least
have a more efficient method of blocking the Spammer and his IP's?
[/snip]

You could always block a range of IP addresses, but you may cut out 
a legitimate user.


I'm missing the beginning of this thread so maybe it's be mentioned 
before but is an image
CAPTCHA not an option? (and yes I know the accesibility arguments 
against using CAPTCHA,
and the fact that crap CAPCHTA can be broken by image recognition 
tools - but my pragmatic

feeling is that it's often better than a bucket load of SPAM.)


disclaimer
Not that I promote CAPCHTA, but there are simple solutions that will 
slow down some spam while allowing some with vision problems to pass, 
such as --


http://www.xn--ovg.com/captcha

-- namely, the graphic selection demo.

Granted it's not the best, it doesn't solve everything, and I never 
said it did (at least no one can prove it) -- so don't whack me for 
it -- it's just a suggestion.

/disclaimer

tedd
--

http://sperling.com

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



Re: [PHP] Problems creating images

2006-04-05 Thread Philip Hallstrom
I added image confirmation to a guestbook and even though it works greate for 
most people, some people have problem and I can't seem to figure out why this 
happens. Note that I'm not talking about the same guestbook on one server but 
the guestbook is on people's own hosting server.


The php code to create the image can't be simpler:

*confirm_image.php:*
$datekey = date(F j);
	$rcode = hexdec(md5($_SERVER[HTTP_USER_AGENT] . $cfg_sitekey . 
$random_num . $datekey));

$code = substr($rcode, 2, 6);
$image = ImageCreateFromJPEG(images/code_bg.jpg);
$text_color = ImageColorAllocate($image, 80, 80, 80);
Header(Content-type: image/jpeg);
ImageString ($image, 5, 12, 2, $code, $text_color);
ImageJPEG($image, '', 75);
ImageDestroy($image);

Most people get a nice image but some people get only, what appears to be, 
garbage:


JFIF;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), 
quality = 75 C    $.' 
,#(7),01444'9=82.342C  
2!!22

...snip...

For the complete output have a look here:
http://www.samuel-area.de/phpbook/confirm_image.php

Do you know what is going wrong here?


Not entirely, but when I go to that URL and check the headers (Live HTTP 
header extension in firefox) I get this:


HTTP/1.x 200 OK
Date: Wed, 05 Apr 2006 20:02:02 GMT
Server: Apache/2.0.53 (Fedora)
X-Powered-By: PHP/4.3.11
Content-Length: 1501
Connection: close
Content-Type: text/html; charset=iso-8859-1

Notice that last one... I see you set it up above, but it isn't 
sticking


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

[PHP] Problems creating images

2006-04-05 Thread Age Bosma

Hi,

I added image confirmation to a guestbook and even though it works 
greate for most people, some people have problem and I can't seem to 
figure out why this happens. Note that I'm not talking about the same 
guestbook on one server but the guestbook is on people's own hosting server.


The php code to create the image can't be simpler:

*confirm_image.php:*
$datekey = date(F j);
	$rcode = hexdec(md5($_SERVER[HTTP_USER_AGENT] . $cfg_sitekey . 
$random_num . $datekey));

$code = substr($rcode, 2, 6);
$image = ImageCreateFromJPEG(images/code_bg.jpg);
$text_color = ImageColorAllocate($image, 80, 80, 80);
Header(Content-type: image/jpeg);
ImageString ($image, 5, 12, 2, $code, $text_color);
ImageJPEG($image, '', 75);
ImageDestroy($image);

Most people get a nice image but some people get only, what appears to 
be, garbage:


ÿØÿàJFIFÿþ;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), 
quality = 75 ÿÛC    $.' 
,#(7),01444'9=82.342ÿÛC  
2!!22ÿÀ

...snip...

For the complete output have a look here:
http://www.samuel-area.de/phpbook/confirm_image.php

Do you know what is going wrong here?

Yours,

Age

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



Re: [PHP] Sessions and Frames

2006-04-05 Thread Shaun

Richard Lynch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Wed, April 5, 2006 1:33 pm, Joe Wollard wrote:
 If you can't avoid them, keep it simple - just store the ID in one
 place,
 like a session cookie. Doing so will make sure that if the session ID
 gets
 changed in one frame it will still be correct in all of the other
 frames.

 No, it won't.

 That's the whole problem.

 Watch this slow-motion instant replay.

 HTTP Interaction #1
 Browser requests URL  Server sends out FRAMESET/FRAME/FRAME ---\

 Browser gets FRAMESET /


 HTTP Interaction #2A (starts)
 Browser requests FRAME #1 URL --

 HTTP Interaction #2B (starts, in parallel, by browser)
 Browser requests FRAME #2 URL --

 Server responds to #2A, with session_start() sending out Cookie
 headers, and setting up session #2A

 Server responds to #2B, with session_start() sending out *NEW* Cookie
 headers, and setting up session #2B, because the browser has *NOT* yet
 received, much less sent back, the Cookies from #2A

 The browser now has *TWO* parallel sessions.

 You  *MUST* *MUST* *MUST* get the session started in the FRAMESET, or
 this *WILL* happen, intermittently, between the frames.

 -- 
 Like Music?
 http://l-i-e.com/artists.htm

Thanks for your advice guys,

I have started the session for the main application in the main application 
frameset file, however every time I click the link to load the new 
application in the lower frame window the new application generates a new 
session_id. Obviously the new applcation can't maintain a session with this 
configuration, any ideas?

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



Re: [PHP] open / check SSL activation

2006-04-05 Thread Jochem Maas

Alain Roger wrote:

Hi,

I would like to ebsure that my user has SSL activated.

for that i would like to do something like that :
1. after lo-in button click, application will check if SSL is already
activated.
   1.a if no, php code should activate SSL
   1.b if yes, php code should control login and password entered.
2. 

how from PHP code, can i test if SSL is activated and if need activate SSL ?


if (isset($_SERVER['HTTPS'])  (strtolower($_SERVER['HTTPS']) == 'on')) {
echo your http connection is running over SSL!;
}



thanks a lot,
Alain



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



Re: [PHP] open / check SSL activation

2006-04-05 Thread Jochem Maas

Thomas Munz wrote:

if request come from port 443, SSL = Active


443 is the default port for SSL connections but there is
no garantee that a connection on port 443 is actually encrypted.

therefore I would suggest that using the port number
to determine whether SSL is active is a bad idea.

see my other post in this thread for a better way to do it.

rgds,
jochem

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



Re: [Fwd: Re: [PHP] redirect using php]

2006-04-05 Thread Schalk
Thanks everyone for your help. In the end the simplest one that works 
for this specific project was:


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

Andrei wrote:


Andrei wrote:


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




Assuming the end user has JS turned on.  JS and Meta Refreshes are not
acceptable when you need to be sure the redirect works.

Depends on your user target...
I generally suppose the users using my code enabled JS on their 
browsers. If they didn't too bad. I can't code everything judging 
there are ppl that do restrictions on their browsers.


Andy



--
Kind Regards
Schalk Neethling
Web Developer.Designer.Programmer.President
Volume4.Business.Solution.Developers

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



Re: [PHP] Problems creating images

2006-04-05 Thread Tom Rogers
Hi,

Thursday, April 6, 2006, 5:42:05 AM, you wrote:
AB Hi,

AB I added image confirmation to a guestbook and even though it works 
AB greate for most people, some people have problem and I can't seem to 
AB figure out why this happens. Note that I'm not talking about the same 
AB guestbook on one server but the guestbook is on people's own hosting server.

AB The php code to create the image can't be simpler:

AB *confirm_image.php:*
AB $datekey = date(F j);
AB $rcode = hexdec(md5($_SERVER[HTTP_USER_AGENT] . $cfg_sitekey . 
AB $random_num . $datekey));
AB $code = substr($rcode, 2, 6);
AB $image = ImageCreateFromJPEG(images/code_bg.jpg);
AB $text_color = ImageColorAllocate($image, 80, 80, 80);
AB Header(Content-type: image/jpeg);
AB ImageString ($image, 5, 12, 2, $code, $text_color);
AB ImageJPEG($image, '', 75);
AB ImageDestroy($image);

AB Most people get a nice image but some people get only, what appears to 
AB be, garbage:

AB ÿØÿàJFIFÿþ;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), 
AB quality = 75 ÿÛC    $.' 
AB ,#(7),01444'9=82.342ÿÛC  
AB 2!!22ÿÀ
AB ...snip...

AB For the complete output have a look here:
AB http://www.samuel-area.de/phpbook/confirm_image.php

AB Do you know what is going wrong here?

AB Yours,

AB Age


Make sure you don't have any blank lines before the ?php

-- 
regards,
Tom

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



[PHP] int to string

2006-04-05 Thread Tanner Postert
I don't think it's built in, so I was wondering ya'll would recommend as the
best way to convert int to string, not basic type casting, but converting to
the english word the int represents.

Something like this:

5 = Five or 20 = Twenty


Re: [PHP] Magic quotes good or Bad?

2006-04-05 Thread Peter Hoskin



tedd wrote:
I do it by placing a text file at root named .htaccess with the 
following


php_value magic_quotes_gpc 0
php_value magic_quotes_sybase 0
php_value magic_quotes_runtime 0
Only works if your web server allows you to do this. In Apache the 
controlling option for this is:


Directory /path/to/www
   AllowOverride All
/Directory

You should note in a virtual hosting environment, this is typically 
disabled.


See http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride

Regards,
Peter Hoskin

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



Re: [PHP] int to string

2006-04-05 Thread Peter Hoskin

Tanner Postert wrote:

I don't think it's built in, so I was wondering ya'll would recommend as the
best way to convert int to string, not basic type casting, but converting to
the english word the int represents.

Something like this:

5 = Five or 20 = Twenty
  

You're right - its not built in.

You could use something like this

function numerictotext($numeric) {
 for ($i;$i  strlen($numeric);$i++) {
   $character = substr($numeric,$i,1);
   switch ($character) {
 case 0:
   $return .= 'Zero ';
   break;
 case 1:
   $return .= 'One ';
   break;
   }
 }
 return $return;
}

Regards,
Peter Hoskin
Do I get a cookie?

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



RE: [PHP] int to string

2006-04-05 Thread Chrome
Won't work

20 would become 'two zero' not 'twenty' as the for loop identifies 1
character at a time

Don't have any suggestions... Just critisms :-D... hehe sorry

Dan
 
---
http://chrome.me.uk
 

-Original Message-
From: Peter Hoskin [mailto:[EMAIL PROTECTED] 
Sent: 06 April 2006 00:47
To: Tanner Postert; php-general@lists.php.net
Subject: Re: [PHP] int to string

Tanner Postert wrote:
 I don't think it's built in, so I was wondering ya'll would recommend as
the
 best way to convert int to string, not basic type casting, but converting
to
 the english word the int represents.

 Something like this:

 5 = Five or 20 = Twenty
   
You're right - its not built in.

You could use something like this

function numerictotext($numeric) {
  for ($i;$i  strlen($numeric);$i++) {
$character = substr($numeric,$i,1);
switch ($character) {
  case 0:
$return .= 'Zero ';
break;
  case 1:
$return .= 'One ';
break;
}
  }
  return $return;
}

Regards,
Peter Hoskin
Do I get a cookie?

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


__ NOD32 1.1474 (20060405) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



Re: [PHP] int to string

2006-04-05 Thread Peter Hoskin



Chrome wrote:

Won't work

20 would become 'two zero' not 'twenty' as the for loop identifies 1
character at a time

Don't have any suggestions... Just critisms :-D... hehe sorry
  
You don't say... it won't even convert 2 to 'two' so obviously this is 
an EXAMPLE and not a COMPLETE SOLUTION.


Want a complete solution? $88 AUD/hr.

Want to criticize? look at the for loop, its infinite. $i isn't set, the 
first call to it should actually be $i = 0


Regards,
Peter Hoskin

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



[PHP] Re: int to string

2006-04-05 Thread Al

Tanner Postert wrote:

I don't think it's built in, so I was wondering ya'll would recommend as the
best way to convert int to string, not basic type casting, but converting to
the english word the int represents.

Something like this:

5 = Five or 20 = Twenty


What is your number range?  1...20 or what?

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



Re: [PHP] Re: int to string

2006-04-05 Thread Tanner Postert
number range is relatively small... i'll just make an array, and reference
it by index;

$INT2STRING = array(
1= One,
2=Two,
30 = Thirty);

Then reference it by:

print ($x .=. $INT2STRING[$x]);


should work just fine.  just wondering if there was an easier solution.
thanx for the help though.

On 4/5/06, Al [EMAIL PROTECTED] wrote:

 Tanner Postert wrote:
  I don't think it's built in, so I was wondering ya'll would recommend as
 the
  best way to convert int to string, not basic type casting, but
 converting to
  the english word the int represents.
 
  Something like this:
 
  5 = Five or 20 = Twenty
 
 What is your number range?  1...20 or what?

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




RE: [PHP] int to string

2006-04-05 Thread Chrome
Please accept my apologies... I only scanned then reread and spotted the
obvious (deliberate) omissions

It is late here :)

Sorry

Dan

 
---
http://chrome.me.uk
 

-Original Message-
From: Peter Hoskin [mailto:[EMAIL PROTECTED] 
Sent: 06 April 2006 01:06
To: Chrome; php-general@lists.php.net
Subject: Re: [PHP] int to string



Chrome wrote:
 Won't work

 20 would become 'two zero' not 'twenty' as the for loop identifies 1
 character at a time

 Don't have any suggestions... Just critisms :-D... hehe sorry
   
You don't say... it won't even convert 2 to 'two' so obviously this is 
an EXAMPLE and not a COMPLETE SOLUTION.

Want a complete solution? $88 AUD/hr.

Want to criticize? look at the for loop, its infinite. $i isn't set, the 
first call to it should actually be $i = 0

Regards,
Peter Hoskin

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


__ NOD32 1.1474 (20060405) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



Re: [PHP] int to string

2006-04-05 Thread Ray Hauge
On Wednesday 05 April 2006 16:47, Peter Hoskin wrote:
 Tanner Postert wrote:
  I don't think it's built in, so I was wondering ya'll would recommend as
  the best way to convert int to string, not basic type casting, but
  converting to the english word the int represents.
 
  Something like this:
 
  5 = Five or 20 = Twenty

 You're right - its not built in.

 You could use something like this

 function numerictotext($numeric) {
   for ($i;$i  strlen($numeric);$i++) {
 $character = substr($numeric,$i,1);
 switch ($character) {
   case 0:
 $return .= 'Zero ';
 break;
   case 1:
 $return .= 'One ';
 break;
 }
   }
   return $return;
 }

 Regards,
 Peter Hoskin
 Do I get a cookie?

Actually, this isn't far off.  I would think that you would have to treat the 
numbers in the base 10 thinking of it.  (I realized this because my wife 
asked me how binary worked last night, and it was fresh in my head of trying 
to explain how base 10 actually works)

This would mean find out how many characters are in the string (yes, make sure 
it is a string, not int).  Let's assume the number is 256.  

So then you know that you are using 3 placeholders, btw, this would only work 
for int... not float.

So, for each place holder you have a maximum of 10 possibilities.

2 - hundred
5 - ten
6 - one

for the hundreds place you would have a nice big switch statement
1 = one hundred
2 = two hundred
etc.

for the tens place you have another switch statement
1 = I'm not sure how 1 would work just yet, but it's not far off
2 = 'twenty'
3 = 'thirty'

and for the Ones place another switch statement
1= One
2 = Two

I think the Ones place would be special depending on if the tens place is a 1

I hope I explained it good enough... working under a deadline at work ;)

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



Re: [PHP] Re: int to string

2006-04-05 Thread Tanner Postert
number range is relatively small... i'll just make an array, and reference
it by index;

$INT2STRING = array(
1= One,
2=Two,
30 = Thirty);

Then reference it by:

print ($x .=. $INT2STRING[$x]);


should work just fine.  just wondering if there was an easier solution.
thanx for the help though.

On 4/5/06, Al [EMAIL PROTECTED] wrote:

 Tanner Postert wrote:
  I don't think it's built in, so I was wondering ya'll would recommend as
 the
  best way to convert int to string, not basic type casting, but
 converting to
  the english word the int represents.
 
  Something like this:
 
  5 = Five or 20 = Twenty
 
 What is your number range?  1...20 or what?

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




Re: [PHP] Re: int to string

2006-04-05 Thread Robert Cummings
On Wed, 2006-04-05 at 20:09, Al wrote:
 Tanner Postert wrote:
  I don't think it's built in, so I was wondering ya'll would recommend as the
  best way to convert int to string, not basic type casting, but converting to
  the english word the int represents.
  
  Something like this:
  
  5 = Five or 20 = Twenty
  
 What is your number range?  1...20 or what?

*bites pinky* ONE MEEELLION!

Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] int to string

2006-04-05 Thread Philip Hallstrom

I don't think it's built in, so I was wondering ya'll would recommend as the
best way to convert int to string, not basic type casting, but converting to
the english word the int represents.

Something like this:

5 = Five or 20 = Twenty


If you wanted a full solution (well maybe, I didn't read it closely) I'd 
search google and take the second link.


http://www.google.com/search?q=convert+number+to+words

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



Re: [PHP] int to string

2006-04-05 Thread Robert Cummings
On Wed, 2006-04-05 at 21:27, Philip Hallstrom wrote:
  I don't think it's built in, so I was wondering ya'll would recommend as the
  best way to convert int to string, not basic type casting, but converting to
  the english word the int represents.
 
  Something like this:
 
  5 = Five or 20 = Twenty
 
 If you wanted a full solution (well maybe, I didn't read it closely) I'd 
 search google and take the second link.
 
 http://www.google.com/search?q=convert+number+to+words

This might be more useful, and it may even already be installed on your
system:

http://pear.php.net/package-info.php?package=Numbers_Words

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] PHP Form Help

2006-04-05 Thread Jai Rangi

Greeting,
I hope this is the right place for this. If not please guide me.
I am having problem with my Form. Code is below. I want to generate an 
error message if the required fields are not filled. If they are filled 
then I want to add them to the database and display the form again to 
make another entry. Database part is working fine. But when it exist 
with an error for blank entry, it wipe out all the values the user has 
entered, how can I save user input in case user does not have to enter 
all the values again.

Thank you for help.



?php
include db.php;


echo Title is  . $_POST['title'];
//logincheck();
session_start();
echo You are logged in $user;

if (isset($message))
 {
   echo font color=\red\{$message} /fontbr;
   echo You are logged in $user;

?
html



table border=0  width=80% height=100% align=center  border=0 
cellspacing=0 cellpadding=0

STYLE=color: ? echo($fontcol); ?; bgcolor=? echo($BOXCOLOR); ?
tr width=100% background=./images/bg.jpg
td width=100% background=./images/bg.jpg align=center
div style=border: 2px groove #88; border-left: 0px; border-right: 
0px;br


brbr/div
/td/tr



tr width=100% 
td width=100%  align=center

div align=center
 form name=sds action=?php echo $_SERVER['PHP_SELF']; ?  
METHOD=POST onfiltered=return check()

 table cellpadding=4 cellspacing=0 border=0
   trtdfont color=? echo($FONTCOLOR); ?iTitle: * 
/i/font/tdtdinput type=text name=title size=40 
value=?=$_POST['title']? /td/tr
   trtdfont color=? echo($FONTCOLOR); ?iLocation :  
/i/font/tdtdinput type=text name=location size=40 /td/tr
   trtdfont color=? echo($FONTCOLOR); ?iCity: * 
/i/font/tdtdinput type=text name=City size=15/td/tr


   trtdfont color=? echo($FONTCOLOR); ?iEmail: * 
/i/font/tdtdinput type=text name=Email size=40 value=? 
echo($user); ?/td/tr
trtdfont color=? echo($FONTCOLOR); ?iPhone: * 
/i/font/tdtdinput type=text name=Phone size=40/td/tr


trtdfont color=? echo($FONTCOLOR); ?iMain Keywords for this 
search: * /i/font/tdtdinput type=text name=Keywords 
size=60/td/tr


td/td
trtd colspan=2font color=? echo($FONTCOLOR);? bArticle 
Details: * /b/fontbr

   textarea name=Details rows=13 cols=55 wrap=physical/textarea
   /td/tr


trtd colspan=2 align=centerinput type=submit value=NEXT/td/tr
   /table
   /form
   /div
/td
/tr

/table

/html

?php

}else
{


if (empty($title) || empty($Email) || empty($Phone) || empty($Details) 
|| empty($Keywords) || empty($City))

{
 $message = Please fill all the required fields.;
// Now, redirect the browser to the current page
   session_start();
 header(Location: form.php?message= . urlencode($message));

}
else
{
   // Connect to the MySQL DBMS - credentials are in the file db.php
   if (!($connection = @ mysql_pconnect($hostName, $username, 
$password)))

  showerror();

   // Use the User database
   if (!mysql_select_db($databaseName, $connection))
  showerror();

  // Create a query to find The Company ID
   $query = SELECT ID
 FROM table
 WHERE email = \$user\;

   // Run the query through the connection

if (!($result = @ mysql_query($query, $connection)))
  showerror();

   // Were there any matching rows?
   if (mysql_num_rows($result) == 0)
   {
  // No. So insert the new username and password into the table
$message = The user account -b$user/b- does not have ID.;

 // Now, redirect the browser to the current page
 header(Location: form.php?message= . urlencode($message));
 exit;
}
$row = @ mysql_fetch_array($result);
   $ID = (rand()%);
   $CID = $row[CompID];

   $jquery = INSERT INTO table 
(Title,Email,Phone,Details,Keywords,Location,City,) 
Values('$title','$Email','$Phone','$Details','$Keywords','$location','$City');



   if (!($result = @ mysql_query($query, $connection)))
  showerror();

   $message = Your Article has been posted. Fill in the form to 
post more Articles;


 // Now, redirect the browser to the current page
 header(Location: form.php?message= . urlencode($message));
 exit;
}

}

?

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



Re: [PHP] PHP Form Help

2006-04-05 Thread Chris

Jai Rangi wrote:

Greeting,
I hope this is the right place for this. If not please guide me.
I am having problem with my Form. Code is below. I want to generate an 
error message if the required fields are not filled. If they are filled 
then I want to add them to the database and display the form again to 
make another entry. Database part is working fine. But when it exist 
with an error for blank entry, it wipe out all the values the user has 
entered, how can I save user input in case user does not have to enter 
all the values again.

Thank you for help.


Start a new thread next time please - don't reply to an existing thread. 
It makes it really hard to follow.


trtdfont color=? echo($FONTCOLOR); ?iMain Keywords for this 
search: * /i/font/tdtdinput type=text name=Keywords 
size=60/td/tr


You're not including the post values.

It should be something like:

..input type=text name=Keywords value=?php echo 
(isset($_POST['Keywords'])) ? htmlentities($_POST['Keywords']) : ''; ? 
size=60..


or you could check everything before hand:

if (isset($_POST['Keywords'])) {
  $keywords = htmlentities($_POST['Keywords']);
} else {
  $keywords = '';
}

...
input type=text name=Keywords value=?php echo $keywords; ? size=60
...

--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] IF or SWITCH

2006-04-05 Thread Ray Hauge
Hello World! wait, not coding... (sorry, long night)

Okay, I finally finished hashing out all the logic for a very complex set of 
rules to determine what type an application should be set to.  I won't bore 
you with the details of it, but the question is...

I have 57 if/elseif/else statements because of all the different criteria.  Is 
it considered better programming practice to use if/elseif/else statements 
over a switch(true) case (true  false || true || false) syntax?

Basically, I'm not too happy with the readability of the code, but I'm afraid 
that at this point there's not much I can do...

code snippet:

if($numFFELP  1  count($FFELP_Lenders)  1  $numFFELP == $numTotal){
$retVal = array(TRUE, 'A');
}elseif($numFFELP  0  $enumFFELP  0  count($FFELP_Lenders)  1  
$enumFFELP + $numFFELP == $numTotal){
$retVal = array(TRUE, 'A');
}elseif($numFFELP  0  $numCONS  0  count($FFELP_Lenders)  1  
$numFFELP + $numCONS == $numTotal){
etc.

Any suggestions?

Thanks,
-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



Re: [PHP] IF or SWITCH

2006-04-05 Thread Robert Cummings
On Wed, 2006-04-05 at 22:48, Ray Hauge wrote:
 Hello World! wait, not coding... (sorry, long night)
 
 Okay, I finally finished hashing out all the logic for a very complex set of 
 rules to determine what type an application should be set to.  I won't bore 
 you with the details of it, but the question is...
 
 I have 57 if/elseif/else statements because of all the different criteria.  
 Is 
 it considered better programming practice to use if/elseif/else statements 
 over a switch(true) case (true  false || true || false) syntax?
 
 Basically, I'm not too happy with the readability of the code, but I'm afraid 
 that at this point there's not much I can do...
 
 code snippet:
 
 if($numFFELP  1  count($FFELP_Lenders)  1  $numFFELP == $numTotal){
   $retVal = array(TRUE, 'A');
 }elseif($numFFELP  0  $enumFFELP  0  count($FFELP_Lenders)  1  
 $enumFFELP + $numFFELP == $numTotal){
   $retVal = array(TRUE, 'A');
 }elseif($numFFELP  0  $numCONS  0  count($FFELP_Lenders)  1  
 $numFFELP + $numCONS == $numTotal){
 etc.

Well I'd use if/elseif/else but I don't format like you...

?php
if( $numFFELP  1

count( $FFELP_Lenders )  1

$numFFELP == $numTotal )
{
$retVal = array( TRUE, 'A' );
}
else
if( $numFFELP  0

$enumFFELP  0

count( $FFELP_Lenders )  1

($enumFFELP + $numFFELP) == $numTotal )
{
$retVal = array( TRUE, 'A' );
}
else
if( $numFFELP  0

$numCONS  0

count( $FFELP_Lenders )  1

($numFFELP + $numCONS) == $numTotal )
{
// Wh!
}
?

Yeah it's vertically sprawling, yeah it looks tedious to type, but damn
is it clear *lol*. Once you get into a habit it becomes second nature.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] IF or SWITCH

2006-04-05 Thread Ray Hauge
On Wednesday 05 April 2006 20:11, Robert Cummings wrote:
 Well I'd use if/elseif/else but I don't format like you...

 ?php
 if( $numFFELP  1
 
 count( $FFELP_Lenders )  1
 
 $numFFELP == $numTotal )
 {
 $retVal = array( TRUE, 'A' );
 }
 else
 if( $numFFELP  0
 
 $enumFFELP  0
 
 count( $FFELP_Lenders )  1
 
 ($enumFFELP + $numFFELP) == $numTotal )
 {
 $retVal = array( TRUE, 'A' );
 }
 else
 if( $numFFELP  0
 
 $numCONS  0
 
 count( $FFELP_Lenders )  1
 
 ($numFFELP + $numCONS) == $numTotal )
 {
 // Wh!
 }
 ?

 Yeah it's vertically sprawling, yeah it looks tedious to type, but damn
 is it clear *lol*. Once you get into a habit it becomes second nature.

 Cheers,
 Rob.

Thanks for the input.  I especially like the Wheee part.  Maybe I'll add 
that in there... it's been a long day *lol*
-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



Re: [PHP] IF or SWITCH

2006-04-05 Thread Chris

Ray Hauge wrote:

Hello World! wait, not coding... (sorry, long night)

Okay, I finally finished hashing out all the logic for a very complex set of 
rules to determine what type an application should be set to.  I won't bore 
you with the details of it, but the question is...


I have 57 if/elseif/else statements because of all the different criteria.  Is 
it considered better programming practice to use if/elseif/else statements 
over a switch(true) case (true  false || true || false) syntax?


Basically, I'm not too happy with the readability of the code, but I'm afraid 
that at this point there's not much I can do...


code snippet:

if($numFFELP  1  count($FFELP_Lenders)  1  $numFFELP == $numTotal){
$retVal = array(TRUE, 'A');
}elseif($numFFELP  0  $enumFFELP  0  count($FFELP_Lenders)  1  
$enumFFELP + $numFFELP == $numTotal){

$retVal = array(TRUE, 'A');
}elseif($numFFELP  0  $numCONS  0  count($FFELP_Lenders)  1  
$numFFELP + $numCONS == $numTotal){

etc.


Are you in a function? Maybe it'll be clearer/easier to follow if you 
return when you find the right condition:


if ($numFFELP  1  count($FFELP_Lenders)  1  $numFFELP == $numTotal) {
  return array(TRUE, 'A');
}

if (.

PS - count($array) does a count every time, so depending on how large 
you expect this array to get, it could be quicker (processing time) to:


$count_lenders = count($FFELP_Lenders);

if ($count_lenders  1)

--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] PHP post data

2006-04-05 Thread John Taylor-Johnston

Scrolling back and forward through my PHP generated search engine,
my browser (FF) alerts to remind me that I have post data.
What kind of header can I add to avoid it doing that?
Else what is the problem?
John

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



Re: [PHP] PHP post data

2006-04-05 Thread Chris

John Taylor-Johnston wrote:

Scrolling back and forward through my PHP generated search engine,
my browser (FF) alerts to remind me that I have post data.
What kind of header can I add to avoid it doing that?


This has been discussed a few times in the past. Here's a couple of 
threads which might give you some ideas on how to tackle the issue.


http://marc.theaimsgroup.com/?l=php-generalm=110985128027075w=2

http://marc.theaimsgroup.com/?l=php-generalm=113657072623457w=2

http://marc.theaimsgroup.com/?l=php-generalm=100938508922704w=2


--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] Wired WSDL Error

2006-04-05 Thread Venkat Venkataraju

Hi All

I'm currently developing a SOAP server/client using NuSOAP. I have 
rigged my apache so that i can work on multiple applications at the same 
time.


So, as all my apps are in virtual hosts, i'm getting 404 error while 
parsing the WSDL file. The wired thing is, the parsing breaks somewhere 
in the middle rather than at the beginning.


it looks like the client is sending the relative address of the WSDL 
than the absolute address. is there a way with which i can force the 
client to send the absolute address?


Any help will be appriciated.

Thanks
/V

WSDL at http://pastebin.com/643480
Here is the request/response just after it breaks:


Request:
POST /SOAP/ppservice.php?wsdl HTTP/1.0
Host: postpaid.freya
User-Agent: NuSOAP/0.7.2 (1.94)
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: 
Content-Length: 482

?xml version=1.0 encoding=ISO-8859-1?
SOAP-ENV:Envelope 
SOAP-ENV:encodingStyle=http://schemas.xmlsoap.org/soap/encoding/; 
xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/; 
xmlns:xsd=http://www.w3.org/2001/XMLSchema; 
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; 
xmlns:SOAP-ENC=http://schemas.xmlsoap.org/soap/encoding/;

SOAP-ENV:Body
ns4834:getAuthChallenge xmlns:ns4834=http://tempuri.org;
/ns4834:getAuthChallenge
/SOAP-ENV:Body
/SOAP-ENV:Envelope

Response:
HTTP/1.1 404 Not Found
Date: Thu, 06 Apr 2006 03:28:59 GMT
Server: Apache/2.2.0 (Unix) mod_ssl/2.2.0 OpenSSL/0.9.8a DAV/2 PHP/5.1.2
Content-Length: 216
Connection: close
Content-Type: text/html; charset=iso-8859-1

!DOCTYPE HTML PUBLIC -//IETF//DTD HTML 2.0//EN
htmlhead
title404 Not Found/title
/headbody
h1Not Found/h1
pThe requested URL /SOAP/ppservice.php was not found on this server./p
/body/html

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