Location: PHPKode > projects > Ads Exchange Server > estigi_0.1.1_RC2/inc/users.inc.php
<?php

/***************************************************************************
 *                             user.inc.php
 *                            -------------------
 *   begin                : mier, mayo 2, 2007
 *   copyright            : (C)
 *   email                : hide@address.com
 *   Desc                 : Extra users managment
 *
 *
 ***************************************************************************/

 if ( !defined('IN_ADSERVER') ) {
		die("Hacking attempt");
	}

include_once("./inc/common.inc.php");

//Cambiar datos
$s_user_Id  = "<input name='email' type='hidden' value='".((isset($_POST['id_User']) && $_POST['id_User'] != "") ? $_POST['id_User'] : $session['id_User']) ."'>";

//Here you will change the permissions
if(isset($_POST['changeData']) && $_POST['changeData'] != ""){

//print_r($_POST);

//Get permission table list
$a_permission_List = explode("::", $_POST['permission_List']);
$s_set = "";

for($l = 0; $l < count($a_permission_List); $l++){
	$s_set .=  $a_permission_List[$l] . " = ". ((isset($_POST[$a_permission_List[$l]]) && $_POST[$a_permission_List[$l]] == "on") ? 1 : 0) . ($l < count($a_permission_List)-1 ? ", " : "");
}

//echo $s_set;

//This changes are made without password approval
//Change permissions on DB
$q = "UPDATE ".$db_Pre."permits
SET $s_set
WHERE id_User = '" . ((isset($_POST['id_User']) && $_POST['id_User'] != "") ? $_POST['id_User'] : $session['id_User']) . "'";

$q_Change_Permissions = mysql_query($q) or die("Unable to Change Permissions: " . mysql_error());

$s_Msgs .= "Permission changes made.";
}

//Permissions settings
$permissions = get_Permissions(((isset($_POST['id_User']) && $_POST['id_User'] != "") ? $_POST['id_User'] : $session['id_User']), $db_Pre);

$a_Keys = array_keys($permissions);
$permission_Boxes = "";
$s_permissions = implode("::", $a_Keys);

for($i = 0; $i < count($a_Keys); $i++){
	$permission_Boxes .= $a_Keys[$i] . " <input type='checkbox' name='".$a_Keys[$i]."' ".( $permissions[$a_Keys[$i]] == 1 ? "checked" : "").">";
}

$s_Warning .= $s_Msg;

?>

<form name="search_User" method="post" action="user.php">
<table class="all_Table">
	<tr>
		<td class="titles" colspan="2">
			Or modify somebody else
		</td>
	</tr>
	<tr>
		<td>
			Who?:
		</td>
		<td>
			<input name="who" type="text" maxlength="45" size="15">
		</td>
	</tr>
	<tr>
		<td colspan="2">
			Your search is by: <br />			
			<input type="checkbox" name="user_Name" checked> Username 
			<input type="checkbox" name="email"> email 
			<input type="checkbox" name="like"> Or something like this.
			<input type="submit" name="seachUsers" value="Search">
		</td>
	</tr>
</table>
</form>
<br />
<form name="change_Data" method="post" action="user.php">
<table>
	<tr>
		<td colspan="2" class="titles">
			User's Permission Table
		</td>
	</tr>
	<tr>
		<td class="all_Table">
			<?= $permission_Boxes; ?>
			<input type="hidden" value="<?= $s_permissions; ?>" name="permission_List">
			<input type="submit" name="changePermits" value="Commit Changes">
		</td>
	</tr>
</table>
Return current item: Ads Exchange Server