Reply to Re: perl cgi vs php

Your name:

Reply:


Posted by Mike Placentra II on 01/23/08 01:30

On Jan 21, 4:20 pm, philip.kings...@yahoo.com wrote:
> What I need to do is to catch a URL on a linux box htpp://IP/something?LinkId=1234
> then I want to pop up a form to prompt for username and password.
> then I need to do a MD5 hex hash ie 'test' gives
> 5f4dcc3b5aa765d61d8327deb882cf99
> then I want the browser to point tohttps://IP/something?LinkId=1234&name=xxx&password=MD5hash

Hi Phil, I don't know if this is too late but --

Unless you want to use a shebang line, you should have PHP set up to
respond to all .php requests in your server first. The (non fast-) cgi
binary way of doing this in Apache would be to put this in .htaccess:

AddHandler php-cgi .php
Action php-cgi /path/to/php.cgi

A PHP script would differ from whatever perl html module you are using
there because you actually jump between PHP code and output (html)
code, so you want something like this:

------------------------------
<?php
if( isset( $_POST['name'] ) )
{
//...check password or whatever...

//forward request
header( "location: something?
LinkId={$_GET['LinkId']}&name={$_POST['name']}&pass=" .
md5( $_POST['password'] ) );
exit;
}
elseif( isset( $_GET['name'] ) )
{
//do whatever you wanted to do when authenticated
}
else { ?>
<form>
...
</form>
<?php } ?>
-----------------------------

Now you should take that example and figure out what is different
about how you need it, I.E. you probably want it to redirect to some
other URI instead of the same "something", and there should be enough
information in the example to figure out how to do that stuff.

Good Luck,
-Michael Placentra II | ZCE

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация