Re: [PHP] Convert html to pdf with php

2008-03-21 Thread Kai Kauer
Am Donnerstag, 20. März 2008 22:42:59 schrieb Robert Burdo:
> Does anyone know how to convert an HTML form to a pdf with php?

Do you know "FPDF"? This can be a possibility. www.fpdf.org

Kai



-- 
Mit freundlichen Grüßen
Kai Kauer

Bruno - Taut - Ring 60
39130 Magdeburg

Tel.: 0391 - 506 99 76
Mobil: 0171 - 498 17 62
web: http://www.spoekertier.de 


signature.asc
Description: This is a digitally signed message part.


Re: [PHP] question about customized error

2008-03-21 Thread M. Sokolewicz

Jim Lucas wrote:

Sudhakar wrote:

if a user by mistake types the wrong url directly in the address bar ex=
www.website.com/abou.php instead of
typing www.website.com/aboutus.php instead of the browser displaying File
not found or a 404 error message i would like to display a customized 
page
which will still have the same look and feel of my website in terms of 
the

layout and i would like to
a) display a message such as = "Page could not be found" and b) the 
url that
the user originally typed should remain in the browser = I guess this 
would

be the case anyway but i was wondering if something needs to be done in
order to reatin the original address the user typed.

Does this have to be done from apache perspective or can it be done using
php. please suggest the procedure in either case apache OR php.


Both will be involed.

You will use what is referred to as the ErrorDocument entry.

Have apache enforce a customer ErrorDocument for a 404 error.

Then create a php script that is referred to by the ErrorDocument entry.

error404.php





please advice.

thanks.






With it being apache, you could also do it using SHTML (apache's subset 
of some simple extra tags to make files dynamic without having to load 
an entire PHP parser for it). But yes, it is as Jim Lucas posted; used 
quite a lot even.


- Tuk

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



[PHP] Re: fwrite/fclose troubles

2008-03-21 Thread Al

int file_put_contents ( string $filename, mixed $data [, int $flags [, resource 
$context]] )

This function is identical to calling fopen(), fwrite() and fclose() successively to write data to a 
file.


This native function does it for you

Mark Weaver wrote:

Hi all,

I've been lurking and reading now for some time, but have decided to
come out of the shadows cause I've got an issue that's gonna drive me 
crazy!


I'm developing an application and within this application is a class
that is very simple and only serves a singular purpose - to make log
entries to help with debugging. Problem is, now I'm debugging the damned
logging class that is supposed to be helping me debug the application as
I'm putting it together!  I've looked and looked all over the
place, but I don't seem to be able to find an answer to this problem.
The only information that I have found so far deals with permissions and
I don't think that's the problem. At first I was getting an access
denied error but since setting dir perms and log file perms so that both
apache and my user can right to both the directory and the file that one
has gone away.

Log Directory permissions: /mystuff/logs  rwx-rwx-rwx (777)
Log file permissions: /mystuff/logs/run.log   rwx-rwx-rwx
(777)

At any rate, the following is the information I'm getting in the apache
error_log while working on this particular portion of the application:

PHP Warning:  fwrite(): supplied argument is not a valid stream resource
in /mystuff/inc/Log.inc on line 22,
PHP Warning:  fclose(): supplied argument is not a valid stream resource
in /mystuff/inc/Log.inc on line 23,

The Log class:
-
class Log{
public $path, $entry, $logfile;

public function Log(){}

public function setLog($path,$file){

$this->path = $path;
$this->logfile = $file;
}

public function writeLog($entry){

// open the file, in this case the log file
$h = "$this->path/$this->logfile";
fopen($h, 'a+');
fwrite($h,$entry);
fclose($h);
}
}

Code snippet where attempting to write log entry from program:
 


$pl_log = new Log;
$pl_log->setLog($logpath,"run.log");
   
$usernanme = $_POST['username'];

$password = $_POST['secret'];
   
/**

   * (debugging) logging incoming values from form:
   */
$pl_log->writeLog("getDateTime(): Incoming values from Login Form:
blah...blah...blah\n");

Any help with this would be most appreciated. (be gentle... I'm a PERL
program learning PHP OOP)



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



Re: [PHP] Re: fwrite/fclose troubles

2008-03-21 Thread Dave Goodchild
Why are you writing a logging class? Why not use error_log and enable error
logging?

On Fri, Mar 21, 2008 at 1:11 PM, Al <[EMAIL PROTECTED]> wrote:

> int file_put_contents ( string $filename, mixed $data [, int $flags [,
> resource $context]] )
>
> This function is identical to calling fopen(), fwrite() and fclose()
> successively to write data to a
> file.
>
> This native function does it for you
>
> Mark Weaver wrote:
> > Hi all,
> >
> > I've been lurking and reading now for some time, but have decided to
> > come out of the shadows cause I've got an issue that's gonna drive me
> > crazy!
> >
> > I'm developing an application and within this application is a class
> > that is very simple and only serves a singular purpose - to make log
> > entries to help with debugging. Problem is, now I'm debugging the damned
> > logging class that is supposed to be helping me debug the application as
> > I'm putting it together!  I've looked and looked all over the
> > place, but I don't seem to be able to find an answer to this problem.
> > The only information that I have found so far deals with permissions and
> > I don't think that's the problem. At first I was getting an access
> > denied error but since setting dir perms and log file perms so that both
> > apache and my user can right to both the directory and the file that one
> > has gone away.
> >
> > Log Directory permissions: /mystuff/logs  rwx-rwx-rwx
> (777)
> > Log file permissions: /mystuff/logs/run.log   rwx-rwx-rwx
> > (777)
> >
> > At any rate, the following is the information I'm getting in the apache
> > error_log while working on this particular portion of the application:
> >
> > PHP Warning:  fwrite(): supplied argument is not a valid stream resource
> > in /mystuff/inc/Log.inc on line 22,
> > PHP Warning:  fclose(): supplied argument is not a valid stream resource
> > in /mystuff/inc/Log.inc on line 23,
> >
> > The Log class:
> > -
> > class Log{
> > public $path, $entry, $logfile;
> >
> > public function Log(){}
> >
> > public function setLog($path,$file){
> > $this->path = $path;
> > $this->logfile = $file;
> > }
> >
> > public function writeLog($entry){
> > // open the file, in this case the log file
> > $h = "$this->path/$this->logfile";
> > fopen($h, 'a+');
> > fwrite($h,$entry);
> > fclose($h);
> > }
> > }
> >
> > Code snippet where attempting to write log entry from program:
> >
> 
> >
> > $pl_log = new Log;
> > $pl_log->setLog($logpath,"run.log");
> >
> > $usernanme = $_POST['username'];
> > $password = $_POST['secret'];
> >
> > /**
> >* (debugging) logging incoming values from form:
> >*/
> > $pl_log->writeLog("getDateTime(): Incoming values from Login
> Form:
> > blah...blah...blah\n");
> >
> > Any help with this would be most appreciated. (be gentle... I'm a PERL
> > program learning PHP OOP)
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


[PHP] Re: [PHP-INSTALL] I cant get php_gd.dll to work

2008-03-21 Thread Daniel Brown
On Thu, Mar 20, 2008 at 10:04 PM, Mark <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  Im new to php and i cant get the gd graphics library to work.
>  Im running Apache, Mysql, Windows xp
>
>  I downloaded and installed php from php.net.
>
>  After much screwing around I finally got in to work with mysql and wrote a
>  few basic scripts.
>  Im stuck on the gd libarary.
>
>  I downloaded the file php_dg.dll and copied it to my ext directory. I know
>  php can see it because
>  the mysql files are there and they work fine.
>
[snip!]
>  I try to run the following code fragment to test it out 
>
>
>$image=$imagecreate(100,100);
>  ?>

That's not an install problem, it's a general PHP question, so for
the archives, it's being copied over to there as well.  If you haven't
yet, please consider joining PHP-General
(http://php.net/mailinglists).

You're calling the imagecreate() function as a $variable.  Simple
enough to fix:



-- 

Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283

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



Re: [PHP] Re: fwrite/fclose troubles

2008-03-21 Thread Thijs Lensselink

Quoting Dave Goodchild <[EMAIL PROTECTED]>:


Why are you writing a logging class? Why not use error_log and enable error
logging?


Maybe he wants to log user actions in an application? Can log so much  
more then just errors.


But the answer to this problem was already given. :)



On Fri, Mar 21, 2008 at 1:11 PM, Al <[EMAIL PROTECTED]> wrote:


int file_put_contents ( string $filename, mixed $data [, int $flags [,
resource $context]] )

This function is identical to calling fopen(), fwrite() and fclose()
successively to write data to a
file.

This native function does it for you

Mark Weaver wrote:
> Hi all,
>
> I've been lurking and reading now for some time, but have decided to
> come out of the shadows cause I've got an issue that's gonna drive me
> crazy!
>
> I'm developing an application and within this application is a class
> that is very simple and only serves a singular purpose - to make log
> entries to help with debugging. Problem is, now I'm debugging the damned
> logging class that is supposed to be helping me debug the application as
> I'm putting it together!  I've looked and looked all over the
> place, but I don't seem to be able to find an answer to this problem.
> The only information that I have found so far deals with permissions and
> I don't think that's the problem. At first I was getting an access
> denied error but since setting dir perms and log file perms so that both
> apache and my user can right to both the directory and the file that one
> has gone away.
>
> Log Directory permissions: /mystuff/logs  rwx-rwx-rwx
(777)
> Log file permissions: /mystuff/logs/run.log   rwx-rwx-rwx
> (777)
>
> At any rate, the following is the information I'm getting in the apache
> error_log while working on this particular portion of the application:
>
> PHP Warning:  fwrite(): supplied argument is not a valid stream resource
> in /mystuff/inc/Log.inc on line 22,
> PHP Warning:  fclose(): supplied argument is not a valid stream resource
> in /mystuff/inc/Log.inc on line 23,
>
> The Log class:
> -
> class Log{
> public $path, $entry, $logfile;
>
> public function Log(){}
>
> public function setLog($path,$file){
> $this->path = $path;
> $this->logfile = $file;
> }
>
> public function writeLog($entry){
> // open the file, in this case the log file
> $h = "$this->path/$this->logfile";
> fopen($h, 'a+');
> fwrite($h,$entry);
> fclose($h);
> }
> }
>
> Code snippet where attempting to write log entry from program:
>

>
> $pl_log = new Log;
> $pl_log->setLog($logpath,"run.log");
>
> $usernanme = $_POST['username'];
> $password = $_POST['secret'];
>
> /**
>* (debugging) logging incoming values from form:
>*/
> $pl_log->writeLog("getDateTime(): Incoming values from Login
Form:
> blah...blah...blah\n");
>
> Any help with this would be most appreciated. (be gentle... I'm a PERL
> program learning PHP OOP)
>

--
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] question about customized error

2008-03-21 Thread Daniel Brown
On Thu, Mar 20, 2008 at 6:54 PM, Sudhakar <[EMAIL PROTECTED]> wrote:
> if a user by mistake types the wrong url directly in the address bar ex=
>  www.website.com/abou.php instead of
>  typing www.website.com/aboutus.php instead of the browser displaying File
>  not found or a 404 error message i would like to display a customized page
>  which will still have the same look and feel of my website in terms of the
>  layout and i would like to
>  a) display a message such as = "Page could not be found" and b) the url that
>  the user originally typed should remain in the browser = I guess this would
>  be the case anyway but i was wondering if something needs to be done in
>  order to reatin the original address the user typed.

.htaccess:
ErrorDocument 404 /404.php

404.php:


-- 

Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283

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



[PHP] Re: [PHP-DB] ini_set ...

2008-03-21 Thread Daniel Brown
On Fri, Mar 21, 2008 at 10:20 AM, VanBuskirk, Patricia
<[EMAIL PROTECTED]> wrote:
>
>  I have the line "ini_set('display_errors', 'on');" in my code, but it is
>  not working.  Does it need to be the first command on the page?
[merge]
>  I have full access to the php.ini file, which is what I do now to
>  test... go there, change the file, restart the IIS service, etc.  I read
>  somewhere recently where they used this line in their code, and I
>  thought how convenient that would be ... just haven't been able to get
>  it to work.  I will try "true" instead of "on" and see if that works.
>  Does it go back to the default on it's own, or do I need to hard-code
>  that in the page when I'm done?

Trish, this is a general question rather than a database question,
so it's being forwarded to the PHP-General list as well.  It will not
only get you some more detailed replies, but it helps keep the
archives organized.  If you're not already subscribed, please consider
doing so: http://php.net/mailinglists

Try something like this at the head of your code:


Keep in mind that it will only be executed in the same script as
it's coded, and only if/when those lines are executed.  It won't set
the system-wide (or even same-session) display_errors, it only enables
that option for that script at that time.

-- 

Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283

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



[PHP] spider

2008-03-21 Thread tedd

Hi gang:

How do you spider a remote web site in php?

I get the general idea, which is to take the root page, strip out the 
links and repeat the process on those links. But, what's the code? 
Does anyone have an example they can share or a direction for me to 
take?


Also, is there a way to spider through a remote web site gathering 
directory permissions?


I know there are applications, such as Site-sucker, that will travel 
a remote web site looking for anything that it can download and if 
found, do so. But is there a way to determine what the permissions 
are for those directories?


If not, can one attempt to write a file and record the 
failures/successes (0777 directories)?


What I am trying to do is to develop a way to test if a web site is 
secure or not. I'm not trying to develop evil code, but if it can be 
done then I want to know how.


Thanks and Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] spider

2008-03-21 Thread Wolf

 tedd <[EMAIL PROTECTED]> wrote: 
> Hi gang:
> 
> How do you spider a remote web site in php?
> 
> I get the general idea, which is to take the root page, strip out the 
> links and repeat the process on those links. But, what's the code? 
> Does anyone have an example they can share or a direction for me to 
> take?
> 
> Also, is there a way to spider through a remote web site gathering 
> directory permissions?
> 
> I know there are applications, such as Site-sucker, that will travel 
> a remote web site looking for anything that it can download and if 
> found, do so. But is there a way to determine what the permissions 
> are for those directories?
> 
> If not, can one attempt to write a file and record the 
> failures/successes (0777 directories)?
> 
> What I am trying to do is to develop a way to test if a web site is 
> secure or not. I'm not trying to develop evil code, but if it can be 
> done then I want to know how.
> 
> Thanks and Cheers,
> 
> tedd
> 
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com

In one word:  CURL

In another word: WGET

Both are pretty effecitve and give pretty much the same results, however with 
the CURL you can pass other things alone (user:pass) which with wget you can 
not do.

HTH,
Wolf

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



Re: [PHP] spider

2008-03-21 Thread Robert Cummings

On Fri, 2008-03-21 at 13:58 -0400, Wolf wrote:
>  tedd <[EMAIL PROTECTED]> wrote: 
>
> In one word:  CURL
> 
> In another word: WGET
> 
> Both are pretty effecitve and give pretty much the same results, however
> with the CURL you can pass other things alone (user:pass) which with
> wget you can not do.

You can pass user and password via wget also:

wget http://user:[EMAIL PROTECTED]/privateCrud

Or:

--user=USER --password=PASSWORD

Or more specifically so it doesn't also count for FTP:

--http-user=USER --http-password=PASSWORD

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] spider

2008-03-21 Thread Daniel Brown
On Fri, Mar 21, 2008 at 1:58 PM, Wolf <[EMAIL PROTECTED]> wrote:
>
>  In one word:  CURL
>
>  In another word: WGET
>
>  Both are pretty effecitve and give pretty much the same results, however 
> with the CURL you can pass other things alone (user:pass) which with wget you 
> can not do.

[EMAIL PROTECTED] [~/www/img]# wget --help|grep -i password
   --password=PASS   set both ftp and http password to PASS.
   --http-password=PASSset http password to PASS.
   --proxy-password=PASS   set PASS as proxy password.
   --ftp-password=PASS set ftp password to PASS.

-- 

Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283

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



Re: [PHP] spider

2008-03-21 Thread Wolf

 Daniel Brown <[EMAIL PROTECTED]> wrote: 
> On Fri, Mar 21, 2008 at 1:58 PM, Wolf <[EMAIL PROTECTED]> wrote:
> >
> >  In one word:  CURL
> >
> >  In another word: WGET
> >
> >  Both are pretty effecitve and give pretty much the same results, however 
> > with the CURL you can pass other things alone (user:pass) which with wget 
> > you can not do.
> 
> [EMAIL PROTECTED] [~/www/img]# wget --help|grep -i password
>--password=PASS   set both ftp and http password to PASS.
>--http-password=PASSset http password to PASS.
>--proxy-password=PASS   set PASS as proxy password.
>--ftp-password=PASS set ftp password to PASS.

Nice, your guy's version of wget is better then mine!  I tried that once 
(granted that was years ago now that I think about it) and it keeled over and 
died!  

OK, so I stand corrected there...  But has anyone seen a PHP port of wget or is 
curl the only one of the 2 which does it natively in a compiled version of php 
with curl?  :)

If it works natively in PHP, then there are 2 choices and neither has to be 
executed outside of PHP.  :)

Wolf

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



Re: [PHP] spider

2008-03-21 Thread Børge Holen
On Friday 21 March 2008 18:58:59 Wolf wrote:
>  tedd <[EMAIL PROTECTED]> wrote:
> > Hi gang:
> >
> > How do you spider a remote web site in php?
> >
> > I get the general idea, which is to take the root page, strip out the
> > links and repeat the process on those links. But, what's the code?
> > Does anyone have an example they can share or a direction for me to
> > take?
> >
> > Also, is there a way to spider through a remote web site gathering
> > directory permissions?
> >
> > I know there are applications, such as Site-sucker, that will travel
> > a remote web site looking for anything that it can download and if
> > found, do so. But is there a way to determine what the permissions
> > are for those directories?
> >
> > If not, can one attempt to write a file and record the
> > failures/successes (0777 directories)?
> >
> > What I am trying to do is to develop a way to test if a web site is
> > secure or not. I'm not trying to develop evil code, but if it can be
> > done then I want to know how.
> >
> > Thanks and Cheers,
> >
> > tedd
> >
> > --
> > ---
> > http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> In one word:  CURL
>
> In another word: WGET
>
> Both are pretty effecitve and give pretty much the same results, however
> with the CURL you can pass other things alone (user:pass) which with wget
> you can not do.

wget is fast and easy though... umm I'm on an direct 100mbit connection... 
wget does it brute

>
> HTH,
> Wolf



-- 
---
Børge Holen
http://www.arivene.net

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



Re: [PHP] Double click problem [SOLVED]

2008-03-21 Thread tedd

Hi gang:

This is probably trivial for most of you, but here's my solution to 
the problem I presented earlier.


The problem was, I just wanted to be certain that if a use clicked a 
button that they could only do it once. Sounds simple enough, huh?


Certainly, one can use javascript, but I wanted something that was 
basic php and html -- here's my solution with code (please provide 
critical review):


http://www.webbytedd.com/cc/submit-once/index.php

If the user clicks "Submit once", then that's the way it is until 
they quit their browser. If they don't quit their browser, then no 
amount of refresh will allow them to click the button again.


The "Reset Submit", of course, resets this condition but it's for 
demo purposes.


What I have not solved, and I don't think there is a solution (I 
could be wrong) is to prohibit the user from clicking the back button 
on their browser to reset this condition.


I've done a considerable amount of javascript reading, testing, and 
code search and have not found anything that works -- and -- I have 
even found places where the js community says that nothing will work 
to solve the back-button problem.


So, does anyone here know better? If so, please start a different thread.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] spider

2008-03-21 Thread Børge Holen
On Friday 21 March 2008 19:12:04 Wolf wrote:
>  Daniel Brown <[EMAIL PROTECTED]> wrote:
> > On Fri, Mar 21, 2008 at 1:58 PM, Wolf <[EMAIL PROTECTED]> wrote:
> > >  In one word:  CURL
> > >
> > >  In another word: WGET
> > >
> > >  Both are pretty effecitve and give pretty much the same results,
> > > however with the CURL you can pass other things alone (user:pass) which
> > > with wget you can not do.
> >
> > [EMAIL PROTECTED] [~/www/img]# wget --help|grep -i password
> >--password=PASS   set both ftp and http password to PASS.
> >--http-password=PASSset http password to PASS.
> >--proxy-password=PASS   set PASS as proxy password.
> >--ftp-password=PASS set ftp password to PASS.
>
> Nice, your guy's version of wget is better then mine!  I tried that once
> (granted that was years ago now that I think about it) and it keeled over
> and died!
>
> OK, so I stand corrected there...  But has anyone seen a PHP port of wget
> or is curl the only one of the 2 which does it natively in a compiled
> version of php with curl?  :)
>
> If it works natively in PHP, then there are 2 choices and neither has to be
> executed outside of PHP.  :)

so natively isn't alway the best.
example: I've a hard time thinking php image handling is better than programs 
designed for it, neither in speed & accuracy/quality.
lol notepad in windows ;D *ot but still a faint quantity of high altitude 
oxygene loss during easter*
I've got to mention that I'm pretty unfamiliar with curl.


>
> Wolf



-- 
---
Børge Holen
http://www.arivene.net

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



Re: [PHP] spider

2008-03-21 Thread Wolf

 "Børge Holen" <[EMAIL PROTECTED]> wrote: 
> On Friday 21 March 2008 19:12:04 Wolf wrote:
> >  Daniel Brown <[EMAIL PROTECTED]> wrote:
> > > On Fri, Mar 21, 2008 at 1:58 PM, Wolf <[EMAIL PROTECTED]> wrote:
> > > >  In one word:  CURL
> > > >
> > > >  In another word: WGET
> > > >
> > > >  Both are pretty effecitve and give pretty much the same results,
> > > > however with the CURL you can pass other things alone (user:pass) which
> > > > with wget you can not do.
> > >
> > > [EMAIL PROTECTED] [~/www/img]# wget --help|grep -i password
> > >--password=PASS   set both ftp and http password to PASS.
> > >--http-password=PASSset http password to PASS.
> > >--proxy-password=PASS   set PASS as proxy password.
> > >--ftp-password=PASS set ftp password to PASS.
> >
> > Nice, your guy's version of wget is better then mine!  I tried that once
> > (granted that was years ago now that I think about it) and it keeled over
> > and died!
> >
> > OK, so I stand corrected there...  But has anyone seen a PHP port of wget
> > or is curl the only one of the 2 which does it natively in a compiled
> > version of php with curl?  :)
> >
> > If it works natively in PHP, then there are 2 choices and neither has to be
> > executed outside of PHP.  :)
> 
> so natively isn't alway the best.
> example: I've a hard time thinking php image handling is better than programs 
> designed for it, neither in speed & accuracy/quality.
> lol notepad in windows ;D *ot but still a faint quantity of high altitude 
> oxygene loss during easter*
> I've got to mention that I'm pretty unfamiliar with curl.
> 

True, but some sites require natively running instead of running things via 
exec, system, etc...

Heck, I use Editpad, the version from circa 1993...  ;)


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



[PHP] pulling text from a file

2008-03-21 Thread Richard Kurth
I have a text file that looks like the one below. I need to read the 
file into a database.

I was trying the script below but is not working can you help?

$lines = file_get_contents('clientlist1.txt');

$find="Address:";
$f= strstr($f,$find);
$separat="City:";
$ADDRESS = substr($f, 0, strpos($f,$separat));
$ADDRESS=ltrim($ADDRESS,"Address:");
$ADDRESS=trim($ADDRESS);
echo $ADDRESS;
echo "";

$find="City:";
$f= strstr($f,$find);
$separat="State:";
$CITY = substr($f, 0, strpos($f,$separat));
$CITY=ltrim($CITY,"City:");
$CITY=trim($CITY);
echo $CITY;
echo "";

Text File

Address:  5070 myaddress.
City: mycity State: mystateZip: 97268
County: 


Signers
Name: my name

Address:  3925 myaddress.
City: mycity2 State: mystate2 Zip: 97268
County: 


Signers
Name: my name2

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



Re: [PHP] spider

2008-03-21 Thread tedd

At 1:52 PM -0400 3/21/08, tedd wrote:

Hi gang:

How do you spider a remote web site in php?


You guys are always doing this. I ask a simple question like what's a 
+ b and you guys high-jack the thread and start discussing the 
quadratic equation.  :-)


I knew sometime I would have to figure out what CURL is, but now WGET 
(WETFTI) as well. I was hoping for something simple that wouldn't 
hurt my brain.


Thanks a lot guys!  :-)

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] spider

2008-03-21 Thread Daniel Brown
On Fri, Mar 21, 2008 at 1:52 PM, tedd <[EMAIL PROTECTED]> wrote:
> Hi gang:
>
>  How do you spider a remote web site in php?
>
>  I get the general idea, which is to take the root page, strip out the
>  links and repeat the process on those links. But, what's the code?

I make absolutely no warranty whatsoever, and haven't even looked
back at the code since 4 February when I started screwing with the
idea (except to package it today), so I don't know what's done, what's
not, what works, what doesn't, et cetera.

Take a look.  If you can use it, great.  If not, great.


http://www.pilotpig.net/code-library/downloads/htmlspider-core-unfinished.tar.gz

-- 

Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283

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



RE: [PHP] pulling text from a file

2008-03-21 Thread Jay Blanchard
[snip]
I have a text file that looks like the one below. I need to read the 
file into a database.
I was trying the script below but is not working can you help?
[/snip]

Loop through with fopen and fgets

http://www.php.net/fopen
http://www.php.net/fgets


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



Re: [PHP] spider

2008-03-21 Thread Ray Hauge

tedd wrote:

Hi gang:

How do you spider a remote web site in php?

I get the general idea, which is to take the root page, strip out the 
links and repeat the process on those links. But, what's the code? Does 
anyone have an example they can share or a direction for me to take?


Also, is there a way to spider through a remote web site gathering 
directory permissions?


I know there are applications, such as Site-sucker, that will travel a 
remote web site looking for anything that it can download and if found, 
do so. But is there a way to determine what the permissions are for 
those directories?


If not, can one attempt to write a file and record the 
failures/successes (0777 directories)?


What I am trying to do is to develop a way to test if a web site is 
secure or not. I'm not trying to develop evil code, but if it can be 
done then I want to know how.


Thanks and Cheers,

tedd



Have a look at something like this:

http://simplehtmldom.sourceforge.net/

I haven't used it, but if it works you should be able to pull up a list 
of all the  tags quite easily through the DOM ala:


foreach($dom->find('a') as $node)
  echo $node->href . '';

--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Double click problem [SOLVED]

2008-03-21 Thread Eric Butera
On Fri, Mar 21, 2008 at 2:24 PM, tedd <[EMAIL PROTECTED]> wrote:
> Hi gang:
>
>  This is probably trivial for most of you, but here's my solution to
>  the problem I presented earlier.
>
>  The problem was, I just wanted to be certain that if a use clicked a
>  button that they could only do it once. Sounds simple enough, huh?
>
>  Certainly, one can use javascript, but I wanted something that was
>  basic php and html -- here's my solution with code (please provide
>  critical review):
>
>  http://www.webbytedd.com/cc/submit-once/index.php
>
>  If the user clicks "Submit once", then that's the way it is until
>  they quit their browser. If they don't quit their browser, then no
>  amount of refresh will allow them to click the button again.
>
>  The "Reset Submit", of course, resets this condition but it's for
>  demo purposes.
>
>  What I have not solved, and I don't think there is a solution (I
>  could be wrong) is to prohibit the user from clicking the back button
>  on their browser to reset this condition.
>
>  I've done a considerable amount of javascript reading, testing, and
>  code search and have not found anything that works -- and -- I have
>  even found places where the js community says that nothing will work
>  to solve the back-button problem.
>
>  So, does anyone here know better? If so, please start a different thread.
>
>  Cheers,
>
>  tedd
>
>  --
>  ---
>  http://sperling.com  http://ancientstones.com  http://earthstones.com
>
>  --
>  PHP General Mailing List (http://www.php.net/)
>  To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Tedd,

Web pages are supposed to be stateless.  Therefore it is your burden
to deal with the back button because each URI should be able to be
requested in any order at any time with or without sessions.  Just
because a shopping cart has a checkout.php page that requires certain
steps doesn't mean that Google can't stumble upon it and index it to
try and hit it over and over.

So the real question is why is clicking the back button so terrible?

Your workflow might be like this:

form
create crumb and hide in token field & store in session
if (post) re-show form with error message from gateway
show payment form
submit will post to processing

processing:
validate post token == session token, if not then re-display payment
form via require w/ error message
if payment declined then re-display payment form via require w/ error message
if payment accepted then save order, clear cart, and say thank you


If I am on the form and I click process, then it posts to processing
and does some stuff.  If somehow I am fast enough to click the back
button you think there might be an issue of the card transaction being
sent to the merchant but the results not returned?  If that is the
case, on the processing page do this:
- set a session variable saying you have started card processing
- use ignore_user_abort
- continue as normal

then on the form page
- check for started card processing session existance, if it exists
then say please wait a moment and refresh again or however you want to
handle that.
- continue as normal

The web is stateless and we're always going to have to deal with that.
 Just make everyone play by your rules.

BTW Javascript is just fluff, a convenience for the end user.  Your
script should work perfectly without it because googlebot snooping
around will not have it and also any of those rogue spam scripts will
also not have it.

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



Re: [PHP] spider

2008-03-21 Thread Wolf
> I knew sometime I would have to figure out what CURL is, but now WGET 
> (WETFTI) as well. I was hoping for something simple that wouldn't 
> hurt my brain.
> 
> Thanks a lot guys!  :-)

For hijacking the thread?  No Problem!

For making your brain hurt?  Anytime!!  

We're just here to help!  ;)

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



Re: [PHP] pulling text from a file

2008-03-21 Thread Richard Kurth

Richard Kurth wrote:
I have a text file that looks like the one below. I need to read the 
file into a database.

I was trying the script below but is not working can you help?

$lines = file_get_contents('clientlist1.txt');

$find="Address:";
$f= strstr($f,$find);
$separat="City:";
$ADDRESS = substr($f, 0, strpos($f,$separat));
$ADDRESS=ltrim($ADDRESS,"Address:");
$ADDRESS=trim($ADDRESS);
echo $ADDRESS;
echo "";

$find="City:";
$f= strstr($f,$find);
$separat="State:";
$CITY = substr($f, 0, strpos($f,$separat));
$CITY=ltrim($CITY,"City:");
$CITY=trim($CITY);
echo $CITY;
echo "";

Text File

Address:  5070 myaddress.
City: mycity State: mystateZip: 97268
County:
Signers

Name: my name

Address:  3925 myaddress.
City: mycity2 State: mystate2 Zip: 97268
County:
Signers

Name: my name2


Never mined I forgot to change $line to $f

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



Re: [PHP] spider

2008-03-21 Thread Eric Butera
On Fri, Mar 21, 2008 at 1:52 PM, tedd <[EMAIL PROTECTED]> wrote:
>  Also, is there a way to spider through a remote web site gathering
>  directory permissions?

I should hope not.

>
>  If not, can one attempt to write a file and record the
>  failures/successes (0777 directories)?

I don't know if you've thought about it like this, but can people just
upload files to your site?  It has to run through a form somewhere.

>  What I am trying to do is to develop a way to test if a web site is
>  secure or not. I'm not trying to develop evil code, but if it can be
>  done then I want to know how.

People do "pen tests" using fuzzers and such but most people agree the
only real way to do it is by having a human attempting different
things.

You might want to take a look at the OWASP Top 10 [1] to get a better
idea of what to look for.

[1] http://www.owasp.org/index.php/Top_10_2007

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



Re: [PHP] spider

2008-03-21 Thread TG

Ok, so the CURL and WGET stuff has been mentioned, but I don't think that 
really addresses your question.  You didn't ask what the "best way" to do 
this, you asked how you would do it in PHP.

Here's what I would consider to be the 'theory' of the exercise:

* Do we obey robots.txt? If so, get the specs for that and keep it in mind 
during your code building

* Get parameters:  Starting point, how 'deep' to go, stay within that 
domain/subdomain or is it ok to leave?  Are we retrieving content or just 
structure or info (like permissions)?

* Go to starting point, retrieve links.  Figure out the best way to 'crawl'.  
Maybe check out recursive directory crawling routines.  I made a duplicate 
file scanner in PHP and probably did it the hard way, but bsaically I 
created an array of directory paths and marked them scanned or not.  In 
this case, if you already scanned a link, you could skip it.  Keep going 
through your link list until none come up as "not scanned".So retrieve 
links from current page, add links to scan array (if they match allowable 
criteria), check link array to see if anything is unscanned.  Later, rinse, 
repeat.

Since you're talking about a remote site, you're limited to what the remote 
web server is going to give you as far as info goes.  You might get an 
"HTTP Auth Required" code, but there probably won't be a link to something 
that is in a restricted directory, so that's kind of a moot point.

To get directory permissions, you'd really have to go through either FTP or a 
terminal connection (telnet, etc).

If you're doing it as a coding exercise, have fun.  If not, there are already 
tons of tools that could help you.  Years ago I used a program called 
Teleport Pro (for Windows) that could either retrieve or create a sitemap 
or any number of variations.  I did use it once or twice to check for bad 
links on the website (bad = going to invalid pages but also bad = pointing 
to old/restricted parts of the website without requiring authorization).

That's a really basic site security check.  I know you know you should use 
good coding practices and use more intensive site security scanning tools.

-TG

- Original Message -
From: tedd <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Date: Fri, 21 Mar 2008 13:52:38 -0400
Subject: [PHP] spider

> Hi gang:
> 
> How do you spider a remote web site in php?
> 
> I get the general idea, which is to take the root page, strip out the 
> links and repeat the process on those links. But, what's the code? 
> Does anyone have an example they can share or a direction for me to 
> take?
> 
> Also, is there a way to spider through a remote web site gathering 
> directory permissions?
> 
> I know there are applications, such as Site-sucker, that will travel 
> a remote web site looking for anything that it can download and if 
> found, do so. But is there a way to determine what the permissions 
> are for those directories?
> 
> If not, can one attempt to write a file and record the 
> failures/successes (0777 directories)?
> 
> What I am trying to do is to develop a way to test if a web site is 
> secure or not. I'm not trying to develop evil code, but if it can be 
> done then I want to know how.
> 
> Thanks and Cheers,
> 
> tedd


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



[PHP] Posting Summary for Week Ending 21 March, 2008: php-general@lists.php.net

2008-03-21 Thread PostTrack [Dan Brown]

Posting Summary for PHP-General List
Week Ending: Friday, 21 March, 2008

Messages| Bytes  | Sender
++--
349 (100%)  782080 (100%)   EVERYONE
27 (7.7%)  33609   (4.3%)  Daniel Brown 
16 (4.6%)  30215   (3.9%)  Nathan Nobbe 
16 (4.6%)  20689   (2.6%)  Stut 
14 (4%)50030   (6.4%)  Jason Pruim 
14 (4%)14062   (1.8%)  tedd 
13 (3.7%)  12157   (1.6%)  John Taylor-Johnston 
11 (3.2%)  20661   (2.6%)  Jim Lucas 
10 (2.9%)  15444   (2%)Robert Cummings 
8  (2.3%)  15412   (2%)TG 
8  (2.3%)  13696   (1.8%)  George J 
8  (2.3%)  7881(1%)Per Jessen 
7  (2%)4284(0.5%)  Richard Heyes 
6  (1.7%)  19270   (2.5%)  Shawn McKenzie 
6  (1.7%)  9096(1.2%)  jeffry s 
6  (1.7%)  5681(0.7%)  Shelley 
6  (1.7%)  6939(0.9%)  Andrew Ballard 
5  (1.4%)  9255(1.2%)  Lamp Lists 
5  (1.4%)  5831(0.7%)  Wolf 
5  (1.4%)  6138(0.8%)  Mikey 
5  (1.4%)  8195(1%)Ray Hauge 
5  (1.4%)  10913   (1.4%)  Thijs Lensselink 
5  (1.4%)  3479(0.4%)  Donn Ingle 
5  (1.4%)  4780(0.6%)  Edward Kay 
5  (1.4%)  9344(1.2%)  Philip Thompson 
5  (1.4%)  9278(1.2%)  Larry Garfield 
5  (1.4%)  15804   (2%)Eric Butera 
4  (1.1%)  18259   (2.3%)  Jochem Maas 
4  (1.1%)  17247   (2.2%)  Børge Holen 
4  (1.1%)  6027(0.8%)  M dot  Sokolewicz 
4  (1.1%)  3507(0.4%)  Sudhakar 
4  (1.1%)  6305(0.8%)  Aschwin Wesselius 
3  (0.9%)  6026(0.8%)  Chris 
3  (0.9%)  6483(0.8%)  Dotan Cohen 
3  (0.9%)  4415(0.6%)  Robin Vickery 
3  (0.9%)  4624(0.6%)  Colin Guthrie 
3  (0.9%)  3209(0.4%)  Casey 
3  (0.9%)  3238(0.4%)  Manuel Lemos 
3  (0.9%)  5250(0.7%)  Al 
2  (0.6%)  50180   (6.4%)  Evone Wong
2  (0.6%)  50180   (6.4%)  Evone Wong
2  (0.6%)  3237(0.4%)  Børge Holen 
2  (0.6%)  1318(0.2%)  Eric Gorr 
2  (0.6%)  2397(0.3%)  Michael Horowitz 
2  (0.6%)  50180   (6.4%)  Quennie
2  (0.6%)  1213(0.2%)  cool7 at hosting4days dot com 

2  (0.6%)  1796(0.2%)  Brady Mitchell 
2  (0.6%)  50180   (6.4%)  Evone Wong
2  (0.6%)  2034(0.3%)  Richard Kurth 
2  (0.6%)  2016(0.3%)  tedd 
2  (0.6%)  1494(0.2%)  George Pitcher 
2  (0.6%)  2728(0.3%)  It Maq 
2  (0.6%)  4337(0.6%)  Jeremy Mcentire 
2  (0.6%)  2514(0.3%)  bruce 
2  (0.6%)  3324(0.4%)  Greg Bowser 
2  (0.6%)  3323(0.4%)  Dan 
2  (0.6%)  3678(0.5%)  Zoltán Németh 
2  (0.6%)  2310(0.3%)  Rod Clay 
2  (0.6%)  8873(1.1%)  Hui Chen 
2  (0.6%)  7280(0.9%)  Mark Weaver 
2  (0.6%)  1731(0.2%)  Ryan A 
2  (0.6%)  8893(1.1%)  Dietrich Bollmann 
2  (0.6%)  1946(0.2%)  nihilism machine 

2  (0.6%)  668 (0.1%)  David Giragosian 
1  (0.3%)  6478(0.8%)  Suamya Srivastava 
1  (0.3%)  897 (0.1%)  Kai Kauer 
1  (0.3%)  3438(0.4%)  Dave Goodchild 
1  (0.3%)  1760(0.2%)  Shawn McKenzie 
1  (0.3%)  1110(0.1%)  admin at buskirkgraphics dot com
1  (0.3%)  591 (0.1%)  chetan rane 
1  (0.3%)  366 (0%)Jay Blanchard 
1  (0.3%)  1471(0.2%)  Rick Pasotto 
1  (0.3%)  292 (0%)Robert Burdo 
1  (0.3%)  3898(0.5%)  Peter Ford 
1  (0.3%)  1941(0.2%)  Thiago Pojda 
1  (0.3%)  4682(0.6%)  Greg Donald 
1  (0.3%)  1518(0.2%)  Sören Auer 
1  (0.3%)  2910(0.4%)  Salem Mccarther 
1  (0.3%)  983 (0.1%)  Rob Richards 
1  (0.3%) 

Re: [PHP] spider

2008-03-21 Thread TG

Good call, Ray.   And depending on how much you need to pull, you might also 
include  and  src values.  Also test to make sure there's an 
href value for the  tags, they could also be  without 
an href.

It gets really tricky when you start looking at javascript window.open or 
window.location type link sources.

-TG

- Original Message -
From: Ray Hauge <[EMAIL PROTECTED]>
To: tedd <[EMAIL PROTECTED]>
Cc: php-general@lists.php.net
Date: Fri, 21 Mar 2008 13:45:35 -0500
Subject: Re: [PHP] spider

> Have a look at something like this:
> 
> http://simplehtmldom.sourceforge.net/
> 
> I haven't used it, but if it works you should be able to pull up a list 
> of all the  tags quite easily through the DOM ala:
> 
> foreach($dom->find('a') as $node)
>echo $node->href . '';


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



Re: [PHP] spider

2008-03-21 Thread tedd

To get directory permissions, you'd really have to go through either FTP or a
terminal connection (telnet, etc).


Yes, but that's doing it programmatically, what about this?

What if you knew that a directory on a site was set to 0777 -- what 
damage could you cause?


I have seen scripts that clients purchase that require permissions 
for certain directories to be set to 0777 and left that way. The 
scripts don't change the permissions; write the file; and then change 
them back but rather just leave them set at 0777.


If a site is using such a script and you know what directories have 
to be set to 0777, then that's a security issue, isn't it?


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Re: MCrypt not decrypting simple text

2008-03-21 Thread Dan
Ok, looks like I'm not getting much intrest here, can anyone recomend which 
newsgroup I should post this under?  Is there a crypto group or anything of 
the like?:


- Dan

""Dan"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
I'm using MCrypt and I have two very simple functions.  All I'm doing is 
giving the function some text and a password, it encrypts the text and 
saves it as a text file on the server.  Then I at some later time run 
another php file which decrypts using the decrypt function given the text 
and the SAME password as the first time and all I get is garbage.  What am 
I doing wrong? What do I need to change so that I can get this to work the 
way I described?


function aes_128_encrypt($text,$password) {

  $size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
   $iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM);

   $text .= chr(3).chr(3).chr(3);

   return bin2hex(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $password, 
$text, MCRYPT_MODE_ECB, $iv));


} // End of function

and

function aes_128_decrypt($encrypted_text,$password) {

   $size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
   $iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM);

   return mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $password, pack("H*", 
$encrypted_text), MCRYPT_MODE_ECB, $iv);


} // End of function


- Dan 



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



Re: [PHP] Double click problem [SOLVED]

2008-03-21 Thread Jim Lucas

tedd wrote:

Hi gang:

This is probably trivial for most of you, but here's my solution to the 
problem I presented earlier.


The problem was, I just wanted to be certain that if a use clicked a 
button that they could only do it once. Sounds simple enough, huh?


Certainly, one can use javascript, but I wanted something that was basic 
php and html -- here's my solution with code (please provide critical 
review):


http://www.webbytedd.com/cc/submit-once/index.php

If the user clicks "Submit once", then that's the way it is until they 
quit their browser. If they don't quit their browser, then no amount of 
refresh will allow them to click the button again.


The "Reset Submit", of course, resets this condition but it's for demo 
purposes.


What I have not solved, and I don't think there is a solution (I could 
be wrong) is to prohibit the user from clicking the back button on their 
browser to reset this condition.


I've done a considerable amount of javascript reading, testing, and code 
search and have not found anything that works -- and -- I have even 
found places where the js community says that nothing will work to solve 
the back-button problem.


So, does anyone here know better? If so, please start a different thread.

Cheers,

tedd



It would require a little JS, but you could use the onUnload feature and pop up 
a warning that would tell them the problem(s) of leaving this page.  Then use 
the confirm() method from JS to either allow or deny them to leave the current page.


I don't know if you can limit this action to only take affect when they press 
the back button, but it might help in any event.



--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare


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



[PHP] relative linking in php

2008-03-21 Thread Sudhakar
i am using a self submitting for using php
" method="POST" id="test2"
name="registrationform"> the registration page starts with a lot of terms
and other details about the registration and then the form fields for the
user to fill the registration page. i have used php to validate the form,
presently when a user clicks the submit button and if there are any
validateions that need to be displayed to the user, then the user has to
scroll from the top of the page all the way till they see the form elements
with the validation message ex= Please enter your phone number.

my question is, as in html with relative linking ex  click
here
 
Text here

the page can be moved to an exact location, can this be done more or less
close to this relative linking using php so that the user need not scroll
from the top of the page to see the validation message.

NOTE = since i am using a self submitting form just before the first form
element i have created a blank table row and in this table row the php
validation message would appear if the user missed out some information. due
to this the user has to scroll from the top of the page to see the php
generated validation message. if i use the same php validation at the very
top of the page the error message will be at the top and the form fields at
the bottom and the user will have to scroll up and down to read the
validation message.

please advice.

thanks.


[PHP] problem with sessions config.

2008-03-21 Thread N . Boatswain

Hello guys; i'm having a problem with session behavior; i'm going straight to 
it, but first some considerations:
PHP Version 5.2.5IIF 5.1Running on localhost (XP machine)I start sessions at 
the top of every page. 

A the start of a test page, just as example, i do the assignment:   
$_SESSION["username"] = "aaa";

At the end of the same page i print it's value:  echo $_SESSION["username"];

And i get the layout: "aaa", as expecteed.

Then I redirect to another page. On that one, after initializating the session 
("session_start();") print again the $_SESSION["username"] content and the 
result is empty. If i try the same code on a server (all this is on my local 
machine), the code works as expected; so i think it is a configuration problem, 
here is my php.ini part that correspond to session configuration, so you can 
tell my if i'm doing anything wrong, long comments where removed:

[Session]; Handler used to store/retrieve data.session.save_handler = 
files;session.save_path = "/tmp" BC 13/12/07session.save_path="/tmp"; Whether 
to use cookies.session.use_cookies = 1;session.cookie_secure = ; This option 
enables administrators to make their users invulnerable to; attacks which 
involve passing session ids in URLs; defaults to 0.session.use_only_cookies = 
1; Name of the session (used as cookie name).session.name = PHPSESSID; 
Initialize session on request startup.session.auto_start = 1; Lifetime in 
seconds of cookie or, if 0, until browser is restarted.session.cookie_lifetime 
= 0; The path for which the cookie is valid.session.cookie_path = /; The domain 
for which the cookie is valid.session.cookie_domain =; Whether or not to add 
the httpOnly flag to the cookie, which makes it inaccessible to browser 
scripting languages such as JavaScript.session.cookie_httponly = ; Handler used 
to serialize data.  php is the standard serializer of 
PHP.session.serialize_handler = php; Define the probability that the 'garbage 
collection' process is started; on every session initialization.; The 
probability is calculated by using gc_probability/gc_divisor,; e.g. 1/100 means 
there is a 1% chance that the GC process starts; on each 
request.session.gc_probability = 1session.gc_divisor = 1000; After this 
number of seconds, stored data will be seen as 'garbage' and; cleaned up by the 
garbage collection process.session.gc_maxlifetime = 1440session.bug_compat_42 = 
0session.bug_compat_warn = 1; Check HTTP Referer to invalidate externally 
stored URLs containing ids.; HTTP_REFERER has to contain this substring for the 
session to be; considered as valid.session.referer_check =; How many bytes to 
read from the file.session.entropy_length = 0; Specified here to create the 
session id.session.entropy_file =;session.entropy_length = 
16;session.entropy_file = /dev/urandom; Set to {nocache,private,public,} to 
determine HTTP caching aspects; or leave this empty to avoid sending 
anti-caching headers.session.cache_limiter = nocache; Document expires after n 
minutes.session.cache_expire = 180session.use_trans_sid = 0; Select a hash 
function; 0: MD5   (128 bits); 1: SHA-1 (160 bits)session.hash_function = 0; 
Define how many bits are stored in each character when converting; the binary 
hash data to something readable.;; 4 bits: 0-9, a-f; 5 bits: 0-9, a-v; 6 bits: 
0-9, a-z, A-Z, "-", ","session.hash_bits_per_character = 5; The URL rewriter 
will look for URLs in a defined set of HTML tags.; form/fieldset are special; 
if you include them here, the rewriter will; add a hidden  field with 
the info which is otherwise appended; to URLs.  If you want XHTML conformity, 
remove the form entry.; Note that all valid entries require a "=", even if no 
value follows.url_rewriter.tags = 
"a=href,area=href,frame=src,input=src,form=,fieldset="

Well, thanks and sorry for my english;

Nicolás.


 
_
Watch “Cause Effect,” a show about real people making a real difference.  Learn 
more.
http://im.live.com/Messenger/IM/MTV/?source=text_watchcause