5tarl0rd

Current Path : /home/tiporg/www/manage/
Upload File :
Current File : /home/tiporg/www/manage/edit_user.php

<?php

include("classes/access_user_class.php"); 

header("Cache-Control: public");



$page_protect = new Access_user;

 //$page_protect->login_page = "login.php"; 

$page_protect->access_page(); 



if (isset($_GET['action']) && $_GET['action'] == "log_out") {

	$page_protect->log_out(); // the method to log off

}





$response = new Response();

$message = array();



	$user_id = $_GET["id"];



	$result = mysql_query(" SELECT * FROM users 

							WHERE id = $user_id");

	if(mysql_num_rows($result) != 0)

	{

		$rec = mysql_fetch_array($result);

		$name=$rec["login"];

		$email=$rec["email"];

		//$list_id=  $rec["list_id"];

			

		if ($rec["active"] == 'y')

		{

			$checked='checked="checked"';

		}



	}



if(isset($_POST["Submit"]))

{

	if($_POST['status'] != 'y') 

	{

		 $status = 'n';

	}

	else

	{

		 $status = 'y';

	}	



	$name = $_POST["name"];

	$email = $_POST["email"];



	$result = mysql_query("UPDATE users SET login='$name',email='$email',active='$status' WHERE id=".$user_id) 

	or die(mysql_error());  

	$message= "User Successfully Edited";

	$response->Redirect("users.php?id=".$_POST['gid']."&mess=$message");

}







?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Edit User</title>

<link href="css/main.css" rel="stylesheet" type="text/css" />

<script language="javascript" src="js/validator.js" type="text/javascript"></script>

</head>

<body >

<?php include("includes/header.php");?>

<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr>

    <td rowspan="3" align="left" background="images/white_left_bar.gif"></td>

    <td align="center"></td>

    <td width="1%" rowspan="3" align="right" background="images/white_right_bar.gif">&nbsp;</td>

  </tr>

  <tr>

    <td>&nbsp;</td>

  </tr>

  <tr>

    <td width="99%"><table width="98%" border="0" align="center" cellpadding="2" cellspacing="2">

        <tr>

          <td width="20%" valign="top"><?php require_once("includes/left_column.php");?></td>

          <td width="80%" valign="top"><table width="100%" border="0" align="center" cellpadding="2" cellspacing="2" bordercolor="#cccccc" class="tableBorder">

              <tr>

                <td align="center" bgcolor="#EFEFEF" class="boldText">Edit  User</td>

              </tr>

              <tr>

                <td align="left" background="#F6F6F6" class="boldBodyText"><form action="" method="post" enctype="multipart/form-data" name="navform" id="navform">

                    <table width="100%" border="0" cellpadding="2" cellspacing="2" class="bodyTableBorderDarkGray">

                      <tr>

                        <td ><table width="100%" border="0" cellpadding="0" cellspacing="0">

                            <tr height="20">

                              <td  ><table width="100%" bgcolor="#F8F8F8" class="bodyTableBorderGray">

                                  <tr>

                                    <td width="21%">Name:</td>

                                    <td width="79%"><input name="name" type="text" id="name" value="<?php echo $name; ?>" size="50" /></td>

                                  </tr>

                                  <tr>

                                    <td>Email:</td>

                                    <td><input name="email" type="text" id="email" value="<?php echo $email; ?>" size="50" /></td>

                                  </tr>

                                 

                                </table></td>

                            </tr>

                            <tr>

                              <td align="right" class="mainText12"></td>

                            </tr>

                          </table></td>

                      </tr>

                    </table>

                    <div ><img src="images/spacer1x1.gif" width="1" height="5" /></div>

                    <table width="100%" class="bodyTableBorderDarkGray">

                      <tr>

                        <td><table width="100%" bgcolor="#F8F8F8" class="bodyTableBorderGray">

                            <tr>

                              <td width="21%" align="left" class="mainText">Status:</td>

                              <td width="23" align="left" nowrap="nowrap"><input name="status" type="checkbox" id="status" value="1" <?php echo $checked; ?>/>

                                &nbsp;Enabled</td>

                            </tr>

                            <tr>

                              <td align="left" class="mainText">&nbsp;</td>

                              <td align="left">&nbsp;</td>

                            </tr>

                            <tr>

                              <td colspan="2" align="center"><input type="submit" name="Submit" id="Submit" value="     Submit     " /></td>

                            </tr>

                          </table></td>

                      </tr>

                    </table>

					<input type="hidden" name="gid" value="<?php echo $_REQUEST['gid'];?>" />

                  </form></td>

              </tr>

            </table></td>

        </tr>

      </table></td>

  </tr>

  <tr>

    <td ><img src="images/white_left_bottom_corner.gif" width="9" height="9" /></td>

    <td width="99%" background="images/white_bottom_bar.gif"><img src="images/white_bottom_bar.gif" width="4" height="9" /></td>

    <td width="1%"><img src="images/white_right_bottom_corner.gif" width="9" height="9" /></td>

  </tr>

</table>

</body>

<script language="javascript">

 		

	    var valid = new Validator("navform");

		

		 </script>

</html>


5tarL0rd By 5tarl0rd Being Anonymous