File: /home/ednermusika/ednergranados.com/admin/curriculum_cambios.php
<?php require_once('../Connections/con_edner.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE curriculum SET usu_consecutivo=%s, cur_desc=%s, cur_fecha=%s, cur_activo=%s WHERE cur_consecutivo=%s",
GetSQLValueString($_POST['usu_consecutivo'], "int"),
GetSQLValueString($_POST['cur_desc'], "text"),
GetSQLValueString($_POST['cur_fecha'], "date"),
GetSQLValueString($_POST['cur_activo'], "int"),
GetSQLValueString($_POST['cur_consecutivo'], "int"));
mysql_select_db($database_con_edner, $con_edner);
$Result1 = mysql_query($updateSQL, $con_edner) or die(mysql_error());
$updateGoTo = "curriculum_admin.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_curriculum = "-1";
if (isset($_GET['cur_consecutivo'])) {
$colname_curriculum = $_GET['cur_consecutivo'];
}
mysql_select_db($database_con_edner, $con_edner);
$query_curriculum = sprintf("SELECT cur_consecutivo, cur_desc, cur_fecha, cur_activo, CURDATE() as FECHA_HOY FROM curriculum WHERE cur_consecutivo = %s", GetSQLValueString($colname_curriculum, "int"));
$curriculum = mysql_query($query_curriculum, $con_edner) or die(mysql_error());
$row_curriculum = mysql_fetch_assoc($curriculum);
$totalRows_curriculum = mysql_num_rows($curriculum);
//initialize the session
if (!isset($_SESSION)) {
session_start();
}
?>
<!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>Untitled Document</title>
<link href="css/admin.css" rel="stylesheet" type="text/css" />
<link href="css/calendario.css" rel="stylesheet" type="text/css" />
<script src="calendario/mootools.v1.1.js" type="text/javascript"></script>
<script src="calendario/calendario.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript" src="editor/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups",
// Theme options
theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,|,insertdate,inserttime,preview",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : false,
// Example word content CSS (should be your site CSS) this one removes paragraph margins
content_css : "../css/interiores.css",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js",
// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
}
});
function MM_callJS(jsStr) { //v2.0
return eval(jsStr)
}
</script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><h1>curriculum</h1></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><a href="curriculum_admin.php" class="ligas_menu_interiores">« Regresar</a></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td><hr class="hr_principal" /></td>
</tr>
</table>
<blockquote>
<blockquote>
<form action="<?php echo $editFormAction; ?>" method="POST" name="form1" id="form1">
<table width="913">
<tr valign="baseline">
<td colspan="2" nowrap="nowrap"><h3>Modificar</h3></td>
</tr>
<tr valign="baseline">
<td width="122" nowrap="nowrap"><h6> </h6></td>
<td width="779"><input type="hidden" name="cur_consecutivo" value="<?php echo $row_curriculum['cur_consecutivo']; ?>" size="32" />
<input type="hidden" name="usu_consecutivo" value="<?php echo $_SESSION['USUARIO'] ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap"></td>
<td><p>
<input name="cur_fecha" type="hidden" id="cur_fecha" class="ncalendar" value="<?php echo $row_curriculum['cur_fecha']; ?>" size="10" maxlength="10" />
</p></td>
</tr>
<tr valign="baseline">
<td valign="top" nowrap="nowrap"><h4>Contenido:</h4></td>
<td><textarea name="cur_desc" cols="100" rows="20"><?php echo $row_curriculum['cur_desc']; ?></textarea>
</td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap"><h4>Activo:</h4></td>
<td><select name="cur_activo" id="cur_activo">
<option value="1" <?php if (!(strcmp(1, $row_curriculum['cur_activo']))) {echo "selected=\"selected\"";} ?>>SI</option>
<option value="0" <?php if (!(strcmp(0, $row_curriculum['cur_activo']))) {echo "selected=\"selected\"";} ?>>NO</option>
</select></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap"><h6> </h6></td>
<td><input name="guardar" type="button" class="boton_panel" id="guardar" onclick="MM_callJS('f_enviar();')" value="Guardar" />
<input name="cancelar" type="button" class="boton_panel" id="cancelar" onclick="MM_callJS('history.back();')" value="Cancelar" /></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1" />
</form>
</blockquote>
<p> </p>
</blockquote>
</body>
<script type="text/javascript">
function f_validar ( )
{
var retorno = true;
with ( document.form1 )
{
if ( cur_fecha.value == '' )
{
alert ( 'Por favor proporcione la fecha' );
cur_encabezado.focus ( );
retorno = false;
}
else if ( cur_desc.value == '' )
{
alert ( 'Por favor proporcione el Contenido' );
cur_desc.focus ( );
retorno = false;
}
}
return retorno
}
function f_enviar()
{
with (document.form1)
{
if ( f_validar ( ) )
{
submit ( );
}
}
}
</script>
</html>
<?php
mysql_free_result($curriculum);
?>