Subversion Repositories Applications.projet

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 ddelon 1
<?php
2
/*
3
resetpassword.php
4
 
5
Copyright 2003  Patrick PAUL
6
Copyright 2003 David DELON
7
Copyright 2004  David VANTYGHEM
8
This program is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 2 of the License, or
11
(at your option) any later version.
12
 
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
GNU General Public License for more details.
17
 
18
You should have received a copy of the GNU General Public License
19
along with this program; if not, write to the Free Software
20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21
*/
22
 
23
 
24
if (($user = $this->GetUser()) && ($user["name"]==$this->GetConfigValue("admin")) && $this->GetConfigValue("admin"))
25
{
26
 
27
	if (($_REQUEST["action"] == "resetpass"))
28
	{
29
 
30
		$this->Query("update ".$this->config["table_prefix"]."users set ".
31
					"password = md5('".mysql_escape_string($_POST["password"])."') ".
32
					"where name = '".mysql_escape_string($_POST["name"])."' limit 1");
33
 
34
				$this->SetMessage("Mot de passe r&eacute;initialis&eacute; !");
35
				$this->Redirect($this->href());
36
	}
37
	else
38
	{
39
		$error="";
40
		//$error = "Il est interdit de r&eacute;initialiser le mot de passe de cet utilisateur ! Non mais !";
41
	}
42
 
43
	echo $this->FormOpen() ;
44
	$name=$_GET["name"];
45
	?>
46
	<input type="hidden" name="action" value="resetpass">
47
	<table>
48
		<tr>
49
			<td align="right"></td>
50
			<td><?php echo  $this->Format("R&eacute;initialisation du mot de passe"); ?></td>
51
		</tr>
52
		<?php
53
		if ($error)
54
		{
55
			echo "<tr><td></td><td><div class=\"error\">".$this->Format($error)."</div></td></tr>\n" ;
56
		}
57
		?>
58
		<tr>
59
			<td align="right">Login:</td>
60
			<td><input name="name" size="40" value="<?php echo  $name ?>"></td>
61
		</tr>
62
		<tr>
63
			<td align="right">Nouveau mot de passe:</td>
64
			<td><input type="password" name="password" size="40"></td>
65
		</tr>
66
		<tr>
67
			<td></td>
68
			<td><input type="submit" value="Reset password" size="40"></td>
69
		</tr>
70
	</table>
71
	<?php
72
	echo $this->FormClose() ;
73
}
74
else
75
{
76
	echo "<i>Vous n'avez pas les permissions n&eacute;cessaires pour ex&eacute;cuter cette action.</i>" ;
77
}
78
 
79
?>
80