PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > perl cgi vs php
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
perl cgi vs php

Réponse
 
LinkBack Outils de la discussion
Vieux 21/01/2008, 21h20   #1
philip.kingsten@yahoo.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut perl cgi vs php

Hello phpers,

I have a task I want to carry out in php 4.3 rather than perl 5.6.
Maybe you people can me?
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 to https://IP/something?LinkId=1234&nam...ssword=MD5hash

I have very nearly done this in perl

Like so:
use Digest::MD5 qw(md5 md5_hex md5_base64);
my $LinkId = param( 'LinkId' );
print header,
start_html('Enter Logon Details'),
h1('Enter Details'),
# h1($CustomerId),
start_form (-action => "http://195.168.1.21//cgi-bin/tool3.cgi", -
method=>'GET'),
"What's your name? ",textfield('name'),p,
"What's your password? ",password_field('password'),p,
hidden(-name => "LinkId", -default => '$LinkId').
submit,
end_form,
hr;

That actually works, but the tool3.cgi although it has the 3 variables
populated as required password, the MD5 hash, username and LinkId and
I can build the https URL as required I cannot get the redirect to
work.

I either get an unful error message cannot execute tool3.cgi or
nothing happens.

So I would like you php people to give me some - cos it is after
9 pm in the UK and this is supposed to be deployed tomorrow morning
1st thing. As much as you wish - from nothing cos you think I
should read the manual and browse the tutorials (quite right too- I
will when I get some time) or few pointers to get me started or maybe
even some code ...

Thanks in anticipation ;-)

Phil



  Réponse avec citation
Vieux 23/01/2008, 01h30   #2
Mike Placentra II
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: perl cgi vs php

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
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 22h57.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,13282 seconds with 10 queries