hello,<br>I implemented en authentication with Authenticator.php, I use a postgres database to register users and passwords,<br>here are the modified scripts:<br><br>login.html <br><br><span style="font-family: monospace;">
<html><br><head><br><title>*****</title><br><link href="samplelogin.css" rel="stylesheet" type="text/css"><br></head><br><body><br><form method="POST">
<br><input type='hidden' name='sid' value='[$SID$]'><br><br><div id="conteneur" name="conteneur"><br><div id="TitleLayer" name="TitleLayer">
<br><br><b><u><center><FONT SIZE="+1">Please authenticate to access*****</center></u></br><br></div><br><br><div id="IconLayer"><br><IMG SRC="./logo1.jpg" align = middle >
<br></div><br><br><div id="InboxLayer" name="InboxLayer"><br><TABLE><br><TR><TD>User :</TD><TD><input type="text" name="username" value=""></TD></TR>
<br><TR><TD>Password : </TD><TD><input type="password" name="password" value=""></TD></TR><br><TR><TD><input type="submit" name="submit" value="submit"></TD><TD><a href="
help.html" target="_blank">?</TD></TR><br></TABLE><br></div><br></div><br><br></form><br></body><br></html><br><br><br></span>index.phtml <br><span style="font-family: monospace;">
<br><br><?php<br>/*<br> * <br> */<br>include( "../../htdocs/chameleon.php" );<br><br>$szTemplate = "./template.html";<br>$szMapFile = "../map/chameleon.map";<br><br>class SampleApp extends Chameleon
<br>{<br> function SampleApp()<br> {<br> parent::Chameleon();<br> $this->moMapSession = new MapSession_RW;<br> $this->moMapSession->setTempDir( getSessionSavePath());<br> }<br>}<br>//creation d'une nouvelle session
<br>$oApp = new SampleApp();<br>//appel pour l'authetification<br>$oApp->moAuthenticator = new Authenticator('login.html' );<br>//renseignement des chemins pour les fichiers importants<br>$oApp->registerSkin( 'skins/sample' );
<br>$oApp->CWCInitialize( $szTemplate, $szMapFile );<br>//acceptation des widgets ayant un niveau de maturité alpha (developpement)<br>$oApp->mnMinimumMaturityLevel = MATURITY_ALPHA;<br>$oApp->CWCExecute();<br>?>
<br><br><br></span>in the file Authenticator.php :<br><br><span style="font-family: monospace;">function Authenticator($szLoginTemplate) {<br>
$this->mszLoginTemplate = $szLoginTemplate; <br>
}<br>
<br>
function authenticate( $user, $password )<br>
{<br>
$_SESSION['CWCAuthentication'] = false;<br>
<br>
$user="'$user'";<br>
$password="'$password'";<br>
<br>
$_SESSION['user'] = $user;<br>
<br>
//echo $user."</br>";<br>
//echo $password."</br>";<br>
<br>
$conn = pg_connect("host=** port=** dbname=** user=** password=***");<br>
<br>
if (!$conn) {<br>
return "Autentification error occured.\n";<br>
exit;<br>
}<br>
<br>
$result = pg_query($conn, "SELECT *** FROM *** where (****=$user and ****=$password)");<br>
<br>
<br>
$nb_resultat = pg_num_rows($result);<br>
<br>
//echo $nb_resultat."</br>";<br>
<br>
<br>
if ($nb_resultat==1) <br>
{<br>
<br>
$_SESSION['CWCAuthentication'] = true;<br>
<br>
<br>
}<br>
<br>
else {$_SESSION['CWCAuthentication'] = false;}<br>
<br>
<br>
return $_SESSION['CWCAuthentication'];<br>
}<br>
</span><br><br>cheers<br>dominique<br><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">----------------------------------------------------------
<br><br>Message: 1<br>Date: Wed, 28 Nov 2007 12:03:53 -0800 (PST)<br>From: Minerva Duran Martinez <<a href="mailto:mine_tod@yahoo.com.mx">mine_tod@yahoo.com.mx</a>><br>Subject: [Chameleon] I need help with Authenticator.php
<br>To: <a href="mailto:chameleon@lists.maptools.org">chameleon@lists.maptools.org</a><br>Message-ID: <<a href="mailto:554011.93015.qm@web34413.mail.mud.yahoo.com">554011.93015.qm@web34413.mail.mud.yahoo.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br><br>Hi<br><br>I need help,<br>Someone Authenticator.php implemented in their applications chameleon, because I want to implement but I don't know as.<br><br>Regards,
<br><br>Minerva<br><br><br><br></blockquote></div><br>