Viewing file: consulta_modificar_experiencias_B.php (17.11 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/*
//prevents caching
header("Expires: Sat, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: post-check=0, pre-check=0",false);
session_cache_limiter();
session_start();
require('config.php');
require('functions.php');
*/
//check for administrative rights
/*
if (allow_access(Administrators) != "yes")
{
include ('no_access.php');
exit;
}
*/
//make connection to dbase
/*********************************************************************************
* Se le realizarán modificaciones para hacer que consulte sobre reg_organizaciones
**********************************************************************************/
$table_name="experiencias";
$connection = @mysql_connect($server, $dbusername, $dbpassword)
or die(mysql_error());
$db = @mysql_select_db($db_name,$connection)
or die(mysql_error());
//build and issue the query
$sql ="SELECT * FROM $table_name";
$result = @mysql_query($sql,$connection) or die(mysql_error());
?>
<head>
<meta http-equiv="Content-Language" content="en-us">
<link rel="stylesheet" type="text/css" href="adminpage.css">
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<table border="0" width="100%" id="table1">
<tr>
<!-- Antes era center -->
<td align="left">
<!-- En la siguiente tabla se necesita definir el tamaño por porcentaje y no por pixeles -->
<table border="0" width="100%" id="table2" cellspacing="0" cellpadding="4">
<tr>
<td width="180"><b><font size="4"></font></b> </td>
<!--
<td align="right"><i> |
</i><a href="../listado_experiencias.php?id=<?//php echo $_SESSION[id]; ?>">Regresar</a><i> | </i></td> -->
</tr>
<tr>
<td width="180"><b>Logueado como <?php echo $_SESSION[user_name]; ?></b></td>
<td align="right"></td>
</tr>
<tr>
<td width="180"> </td>
<td align="right"><i></i></td>
</tr>
<tr>
<td width="80" valign="top">
<table border="0" width="100%" id="table3" cellspacing="0" cellpadding="0">
<tr>
<td width="38%" valign="top">
<table border="0" width="100%" id="table38" cellspacing="0" cellpadding="0">
<tr>
<td>
<!-- Creacion de funcionarios -->
<?php
$usuarioC=$_SESSION[user_name];
if ($_POST[alter2] == "add")
{
}else
{
}
?>
</td>
</tr>
<tr>
<td>
<?php
if ($_POST[alter2] == "add")
{
echo "<option>Users</option>";
$i = 0;
while ($i < $num_groups)
{
echo "<option value=\"$group_array[$i]\">$group_array[$i]</option>";
$i++;
}
echo "<option></option>";
$i = 0;
while ($i < $num_groups)
{
echo "<option value=\"$group_array[$i]\">$group_array[$i]</option>";
$i++;
}
echo "<option></option>";
$i = 0;
while ($i < $num_groups)
{
echo "<option value=\"$group_array[$i]\">$group_array[$i]</option>";
$i++;
}
}
?>
</tr>
<tr>
<td><font size="1" face="Tahoma">
<?php
if ($_POST[alter1] == "modify" || $_POST[user] != "")
{
}
else{
}
?>
</td>
<?php
if (($_POST[alter1] == "modify") || ($_POST[user] != ""))
{
?>
<tr>
<td>
<font size="1" face="Tahoma">
<form name="myform" id="myform" action="<?php $PHP_SELF; ?>" method="POST">
<table border="0" width="100%" id="table41" cellspacing="0" cellpadding="0" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF">
<tr>
<td width="140">Username:</td>
<td><font size="1" face="Tahoma">
<select size="1" name="username" onChange="document.myform.submit()">
<?php
if ($_POST[user] != "")
{
echo "<option>$_POST[user]</option>";
echo "<option value=\"\"></option>";
}
else
{
echo "<option></option>";
}
//require the config file
require ("../config.php");
//make the connection to the database
$connection = @mysql_connect($server, $dbusername, $dbpassword) or die(mysql_error());
$db = @mysql_select_db($db_name,$connection)or die(mysql_error());
//build and issue the query
$sql ="SELECT * FROM $table_name";
$result = @mysql_query($sql,$connection) or die(mysql_error());
while ($sql = mysql_fetch_object($result))
{
$uname = $sql -> user;
echo "<option value=\"$uname\">$uname</option>";
}
if ($_POST[user] != "")
{
//require the config file
require ("../config.php");
//make the connection to the database
$connection = @mysql_connect($server, $dbusername, $dbpassword) or die(mysql_error());
$db = @mysql_select_db($db_name,$connection)or die(mysql_error());
//build and issue the query
$sql ="SELECT * FROM $table_name";
$result = @mysql_query($sql,$connection) or die(mysql_error());
while ($sql = mysql_fetch_object($result))
{
$id = $sql -> id;
$organizacion = $sql -> organizacion;
$nombre_ex = $sql -> nombre_ex;
$tipo = $sql -> tipo;
$fecha = $sql -> fecha;
$loc1 = $sql -> loc1;
$terr1 = $sql -> terr1;
$loc2 = $sql -> loc2;
$terr2 = $sql -> terr2;
$loc3 = $sql -> loc3;
$terr3 = $sql -> terr3;
$loc4 = $sql -> loc4;
$terr4 = $sql -> terr4;
$loc5 = $sql -> loc5;
$terr5 = $sql -> terr5;
$participantes = $sql -> participantes;
$personas = $sql -> personas;
$zona = $sql -> zona;
$desarrollo = $sql -> desarrollo;
$experiencia = $sql -> experiencia;
$metodologia = $sql -> metodologia;
$resultados = $sql -> resultados;
$facilitador = $sql -> facilitador;
$obstaculizante = $sql -> obstaculizante;
$positiva = $sql -> positiva;
$negativa = $sql -> negativa;
$id_organizacion = $sql -> id_organizacion;
}
echo "<option>$g_1</option>";
$i = 0;
while ($i < $num_groups)
{
echo "<option value=\"$group_array[$i]\">$group_array[$i]</option>";
$i++;
}
echo "<option>$g_2</option>";
$i = 0;
while ($i < $num_groups)
{
echo "<option value=\"$group_array[$i]\">$group_array[$i]</option>";
$i++;
}
echo "<option>$g_3</option>";
$i = 0;
while ($i < $num_groups)
{
echo "<option value=\"$group_array[$i]\">$group_array[$i]</option>";
$i++;
}
}
}
if ($_POST[alter] == "options")
{
}
else
{
}
if ($_POST[alter] == "options")
{
//require the config file
require ("../config.php");
//make the connection to the database
$connection = @mysql_connect($server, $dbusername, $dbpassword) or die(mysql_error());
$db = @mysql_select_db($db_name,$connection)or die(mysql_error());
//build and issue the query
$sql ="SELECT nombre_ex FROM $table_name";
$result = @mysql_query($sql,$connection) or die(mysql_error());
while ($sql = mysql_fetch_object($result))
{
$uname = $sql -> user;
if ($uname != $_SESSION[user_name])
{
echo "<option value=\"$uname\">$uname</option>";
}
}
//require the config file
require ("../config.php");
//make the connection to the database
$connection = @mysql_connect($server, $dbusername, $dbpassword) or die(mysql_error());
$db = @mysql_select_db($db_name,$connection)or die(mysql_error());
//build and issue the query
$sql ="SELECT user FROM trash ORDER BY nombre";
$result = @mysql_query($sql,$connection) or die(mysql_error());
while ($sql = mysql_fetch_object($result))
{
$uname = $sql -> user;
if ($uname != $_SESSION[user_name])
{
echo "<option value=\"$uname\">$uname</option>";
}
}
//require the config file
require ("../config.php");
//make the connection to the database
$connection = @mysql_connect($server, $dbusername, $dbpassword) or die(mysql_error());
$db = @mysql_select_db($db_name,$connection)or die(mysql_error());
//build and issue the query
$sql ="SELECT user FROM $table_name";
$result = @mysql_query($sql,$connection) or die(mysql_error());
while ($sql = mysql_fetch_object($result))
{
$uname = $sql -> user;
if ($uname != $_SESSION[user_name])
{
echo "<option value=\"$uname\">$uname</option>";
}
}
?>
</select></font></td>
</tr>
<tr>
<td>
<font size="1" face="Tahoma">
<input type="text" name="oct1" size="3" maxlength="3"></font>.<font size="1" face="Tahoma"><input type="text" name="oct2" size="3" maxlength="3"></font><font face="Tahoma">.</font><font size="1" face="Tahoma"><input type="text" name="oct3" size="3" maxlength="3"><font face="Tahoma">.</font><input type="text" name="oct4" size="3" maxlength="3"></font></td>
</tr>
<tr>
<td>
<font size="1" face="Tahoma">
<?php
//require the config file
require ("../config.php");
//make the connection to the database
$connection = @mysql_connect($server, $dbusername, $dbpassword) or die(mysql_error());
$db = @mysql_select_db($db_name,$connection)or die(mysql_error());
//build and issue the query
$sql ="SELECT * FROM banned WHERE type = 'user'";
$result = @mysql_query($sql,$connection) or die(mysql_error());
while ($sql = mysql_fetch_object($result))
{
$banned = $sql -> no_access;
echo "<option value=\"$banned\">$banned</option>";
}
//require the config file
require ("../config.php");
//make the connection to the database
$connection = @mysql_connect($server, $dbusername, $dbpassword) or die(mysql_error());
$db = @mysql_select_db($db_name,$connection)or die(mysql_error());
//build and issue the query
$sql ="SELECT * FROM banned WHERE type = 'ip'";
$result = @mysql_query($sql,$connection) or die(mysql_error());
while ($sql = mysql_fetch_object($result))
{
$banned = $sql -> no_access;
echo "<option value=\"$banned\">$banned</option>";
}
}
?>
</td>
</tr>
<tr>
<td width="38%">
</td>
</tr>
<tr>
<td width="38%">
</td>
</tr>
<tr>
<td width="38%">
</td>
</tr>
<tr>
<td width="38%">
</td>
</tr>
<tr>
<td width="38%">
</td>
</tr>
<tr>
<td width="38%">
</td>
</tr>
<tr>
<td width="38%">
</td>
</tr>
<tr>
<td width="38%">
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td valign="top">
<?php
if ($user_det == "")
{
if (!isset($_GET['max_results']))
{
$max_results = 5;
}else{
$max_results = $_GET['max_results'];
}
if(!isset($_GET['page'])){
$page = 1;
} else {
$page = $_GET['page'];
}
if (isset($_GET['search']))
{
$s_string = $_GET['search'];
$explodeit = explode(" ", "$s_string");
$c = count($explodeit);
if ($c > 1)
{
for ($i=0; $i<$c; $i++)
{
$search = $explodeit[$i]."+";
}
}else{
$search = $s_string;
}
}
echo "Número de resultados por página: <a href=\"".$_SERVER['PHP_SELF']."?page=$page&max_results=5&search=$search\">5</a>";
echo " <a href=\"".$_SERVER['PHP_SELF']."?page=$page&max_results=10&search=$search\">10</a><br>";
// Figure out the limit for the query based
// on the current page number.
$from = (($page * $max_results) - $max_results);
// Perform MySQL query on only the current page number's results
if (!isset($_GET['search']))
{
$set_lim = "SELECT * FROM $table_name ORDER BY organizacion LIMIT $from, $max_results";
}else{
$search = $_GET['search'];
$set_lim = "SELECT * FROM $table_name WHERE nombre_ex LIKE '%$search%' ".
"ORDER BY organizacion LIMIT $from, $max_results";
/* $set_lim = "SELECT * FROM $table_name WHERE funcionariocreador='$usuarioC' ORDER BY nombre LIMIT $from, $max_results"; */
/* || direccion LIKE '%$search%' || localidad LIKE '%$search%' || email LIKE '%$search%' ORDER BY nombre LIMIT $from, $max_results"; */
/*and user LIKE '%$search%' || acronimo LIKE '%$search%' || nombre LIKE '%$search%' */
}
$set_res = @mysql_query($set_lim,$connection) or die(mysql_error());
while ($set_lim = mysql_fetch_object($set_res))
{
$id = $set_lim -> id;
$organizacion = $set_lim -> organizacion;
$nombre_ex = $set_lim -> nombre_ex;
$tipo = $set_lim -> tipo;
$fecha = $set_lim -> fecha;
$loc1 = $set_lim -> loc1;
$terr1 = $set_lim -> terr1;
$loc2 = $set_lim -> loc2;
$terr2 = $set_lim -> terr2;
$loc3 = $set_lim -> loc3;
$terr3 = $set_lim -> terr3;
$loc4 = $set_lim -> loc4;
$terr4 = $set_lim -> terr4;
$loc5 = $set_lim -> loc5;
$terr5 = $set_lim -> terr5;
$participantes = $set_lim -> participantes;
$personas = $set_lim -> personas;
$zona = $set_lim -> zona;
$desarrollo = $set_lim -> desarrollo;
$experiencia = $set_lim -> experiencia;
$metodologia = $set_lim -> metodologia;
$resultados = $set_lim -> resultados;
$facilitador = $set_lim -> facilitador;
$obstaculizante = $set_lim -> obstaculizante;
$positiva = $set_lim -> positiva;
$negativa = $set_lim -> negativa;
$id_organizacion = $set_lim -> id_organizacion;
if ($p_change == 1)
{$p_change = "Yes";}else{$p_change = "No";}
if ($verif_d == "0")
{$verif_d= "No";}else{$verif_d= "Yes";}
echo "<br><table border=\"0\" width=\"100%\" id=\"table5\" cellpadding=4 cellspacing=0 bgcolor=\"#ffffff\">";
echo "<tr>";
echo "<td width=\"100\"><b><a href=\"".$SERVER['PHP_SELF']."?user_det=$id&ret_page=$page&ret_max=$max_results&search=$search\">$nombre_ex</a></b></td>";
echo "<td width=\"80\">id:</font></td>";
echo "<td>$id</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"100\"> </td>";
echo "<td width=\"100\">Tipo:</td>";
echo "<td>$tipo</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"100\"> </td>";
echo "<td width=\"100\">Fecha:</td>";
echo "<td>$fecha</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"100\"> </td>";
echo "<td width=\"100\">Localizacion 1:</td>";
echo "<td>$loc1</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"100\"> </td>";
echo "<td width=\"100\">Localizacion 2:</td>";
echo "<td>$loc2</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"100\"> </td>";
echo "<td width=\"100\"><form name='formula' method='POST' action='elige_formulario_modificar_experiencias.php'><input type='hidden' name='id' value='{$id}'>".
"<input type='submit' name='actualizar' value='Editar'></form></td>";
echo "</tr>";
echo "</table>";
}
// Figure out the total number of results in DB:
if (!isset($_GET['search']))
{
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM experiencias"),0);
}
else{
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM experiencias"),0);
// WHERE funcionariocreador='$usuarioC' and user LIKE '%$search%' || acronimo LIKE '%$search%' || direccion LIKE '%$search%' || localidad LIKE '%$search%' || email LIKE '%$search%'"),0);
}
// Figure out the total number of pages. Always round up using ceil()
$total_pages = ceil($total_results / $max_results);
// Build Page Number Hyperlinks
echo "<center>Elija página<br />";
// Build Previous Link
if($page > 1){
$prev = ($page - 1);
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev&max_results=$max_results&search=$search\"><< </a> ";
}
for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "$i ";
} else {
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i&max_results=$max_results&search=$search\">$i</a> ";
}
}
// Build Next Link
if($page < $total_pages){
$next = ($page + 1);
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next&max_results=$max_results&search=$search\"> >></a>";
}
echo "</center>";
}else{
echo "<b>Details for $user_det</b><br>";
$dsql = "SELECT * FROM $table_name WHERE user = '$user_det' and funcionariocreador='$usuarioC'" ;
$dresults = @mysql_query($dsql,$connection) or die(mysql_error());
while ($dsql = mysql_fetch_object($dresults))
{
/*
$fname = $dsql -> firstname;
$lname = $dsql -> lastname;
$uname = $dsql -> user;
$p_change = $dsql -> pchange;
$verif_d = $dsql -> verified;
$last = $dsql -> last_login;
$re_direct = $dsql -> redirect;
$groupA = $dsql -> group1;
$groupB = $dsql -> group2;
$groupC = $dsql -> group3;
$e_mail = $dsql -> email;
*/
$user= $set_lim -> user;
$acronimo= $set_lim -> acronimo;
$direccion= $set_lim -> direccion;
$localidad= $set_lim -> localidad;
$email= $set_lim -> email;
$nombre= $set_lim -> nombre;
if ($p_change == "0")
{
$p_change = "No";
}else{
$p_change = "Yes";
}
if ($verif_d == "0")
{
$verif_d = "No";
}else{
$verif_d = "Yes";
}
?>
<center>
<a href="<?php echo $_SERVER['PHP_SELF']."?page=$ret_page&max_results=$ret_max&search=$search"; ?>">Volver
a listado</a>
</center>
<?php
}}
if ($search != "")
{
if ($ret_max)
{ $page=$ret_page; $max_results=$ret_max; }
echo "<center><a href=\"".$_SERVER['PHP_SELF']."?page=$page&max_results=$max_results\">Exit Search</a>";
}else{
echo "<br><br>";
}
?>
<center>
<form method="GET" action="<?php echo $_SERVER['PHP_SELF']."?page=$page&max_results=$max_results&search="; ?>">
<p>Buscar
<input type="text" name="search" size="20"><input type="submit" value="Submit" name="B1"></p>
</form>
</center>
</td>
</tr>
</table>
<br><br>
<hr noshade height=1 color="#cccccc" width="90%">
<div align="center">Secretaria Distrital de Ambiente </div>
|