Forum Moderators: coopster
<?php
include"conn.php";
$getinfo = mysql_query("SELECT member_id, firstname, lastname FROM members");
while ($row = mysql_fetch_assoc($getinfo)) {
$userid = $row['member_id'];
$firstname = $row['firstname'];
$lastname = $row['lastname'];
?>
<html>
<body>
<form id="changepw" name="changepw" method="post" action="editpw.php">
<table width="500" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<th width="200">Select Client</th>
<td width="200"><select name="userid">
<option value="$userid $firstname $lastname">$firstname $lastname</select>
</select> </td>
</tr>
<tr>
<th>Password</th>
<td><input name="password" type="password" class="textfield" id="password" /></td>
</tr>
<tr>
<th>Confirm Password </th>
<td><input name="cpassword" type="password" class="textfield" id="cpassword" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Change Password" /></td>
</tr>
</table>
</form>
</body>
</html>
<?php
session_start();
include_once('isadmin.php');
require_once('config.php');
include('conn.php');
if( isset($_SESSION['ERRMSG_ARR']) && is_array($_SESSION['ERRMSG_ARR']) && count($_SESSION['ERRMSG_ARR']) >0 ) {
echo '<ul class="err">';
foreach($_SESSION['ERRMSG_ARR'] as $msg) {
echo '<li>',$msg,'</li>';
}
echo '</ul>';
unset($_SESSION['ERRMSG_ARR']);
}
$user = ($_POST['userid']);
$password = ($_POST['password']);
$cpassword = ($_POST['cpassword']);
if($password == '') {
$errmsg_arr[] = 'Password missing';
$errflag = true;
}
if($cpassword == '') {
$errmsg_arr[] = 'Confirm password missing';
$errflag = true;
}
if( strcmp($password, $cpassword) != 0 ) {
$errmsg_arr[] = 'Passwords do not match';
$errflag = true;
}
mysql_query("UPDATE users SET passwd = '$password' WHERE member_id='$user'")
$result = @mysql_query($qry);
//Check whether the query was successful or not
if($result) {
header("location: admin-welcome.php");
exit();
}else {
die("Query failed");
}
?>
<?php
require_once('config.php');
include('conn.php');
$tbl_name="members";
echo( "<pre>" );
print_r( $_POST );
echo( "</pre>" );
if( isset($_SESSION['ERRMSG_ARR']) && is_array($_SESSION['ERRMSG_ARR']) && count($_SESSION['ERRMSG_ARR']) >0 ) {
echo '<ul class="err">';
foreach($_SESSION['ERRMSG_ARR'] as $msg) {
echo '<li>',$msg,'</li>';
}
echo '</ul>';
unset($_SESSION['ERRMSG_ARR']);
}
$user = ($_POST['userid']);
$password = ($_POST['password']);
$cpassword = ($_POST['cpassword']);
if($password == '') {
$errmsg_arr[] = 'Password missing';
$errflag = true;
}
if($cpassword == '') {
$errmsg_arr[] = 'Confirm password missing';
$errflag = true;
}
if( strcmp($password, $cpassword) != 0 ) {
$errmsg_arr[] = 'Passwords do not match';
$errflag = true;
}
// Cycle through each member and check that it needs to be added to the db
$useruploadids = mysql_query( "SELECT member_id FROM members" );
while ($row = mysql_fetch_assoc($useruploadids))
{
// Check that the member was sent from the last form
if( isset( $_POST['userid_'.$row['member_id']] ) && $_POST['userid_'.$row['member_id']] == "y" )
{
// update data in mysql database
$sql="UPDATE {$tbl_name} SET passwd='.md5{$password}' WHERE member_id='{$row['member_id']}'";
$result=mysql_query($sql) or die( mysql_error() );
}
}
$result = @mysql_query($qry);
//Check whether the query was successful or not
if($result) {
header("location: admin-welcome.php");
exit();
}else {
die("Query failed");
}
?>
$sql="UPDATE {$tbl_name} SET passwd='.md5{$password}' WHERE member_id='{$row['member_id']}'";