Perdon, pero ese salia en la pagina anterior a la que envia los mensajes jeje
Lo otro no he podido resolverlo... no puedo ni entender porque no funciona
Aqui la pagina Completa:
Código PHP:
<?php require_once('Connections/FS.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
}
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);
$logoutGoTo = "index.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?><?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO mps (id, id_usuario, asunto, autor, mensaje, fecha) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['id'], "int"),
GetSQLValueString($_POST['id_usuario'], "int"),
GetSQLValueString($_POST['asunto'], "text"),
GetSQLValueString($_POST['autor'], "text"),
GetSQLValueString($_POST['mensaje'], "text"),
GetSQLValueString($_POST['fecha'], "date"));
mysql_select_db($database_FS, $FS);
$Result1 = mysql_query($insertSQL, $FS) or die(mysql_error());
$insertGoTo = "mp.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
$colname_rsUserID = "-1";
if (isset($_GET['id'])) {
$colname_rsUserID = $_GET['id'];
}
mysql_select_db($database_FS, $FS);
$query_rsUserID = sprintf("SELECT * FROM registro WHERE id = %s", GetSQLValueString($colname_rsUserID, "int"));
$rsUserID = mysql_query($query_rsUserID, $FS) or die(mysql_error());
$row_rsUserID = mysql_fetch_assoc($rsUserID);
$totalRows_rsUserID = mysql_num_rows($rsUserID);
mysql_select_db($database_FS, $FS);
$query_rsUsuarios = "SELECT * FROM registro ORDER BY username ASC";
$rsUsuarios = mysql_query($query_rsUsuarios, $FS) or die(mysql_error());
$row_rsUsuarios = mysql_fetch_assoc($rsUsuarios);
$totalRows_rsUsuarios = mysql_num_rows($rsUsuarios);
?><style type="text/css">
<!--
body,td,th {
font-size: 12px;
color: #663300;
}
body {
background-color: #F4FFE4;
}
-->
</style>
<?php
mysql_free_result($rsUserID);
mysql_free_result($rsUsuarios);
?>
<p>Enviar mensajes....
<?php if ($totalRows_rsUserID > 0) { // Show if recordset not empty ?>
Gracias <strong><?php echo $row_rsUserID['username']; ?></strong>
<?php } // Show if recordset not empty ?>
</p>
<p>
<?php if ($totalRows_rsUserID > 0) { // Show if recordset not empty ?>
<a href="<?php echo $logoutAction ?>">Desconectar</a>
<?php } // Show if recordset not empty ?>
</p>
<hr />
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">¿A quien?</td>
<td><label>
<select name="id_usuario">
<?php
do { ?>
<option value="<?php echo $row_rsUsuarios['id']; ?>"><?php echo $row_rsUsuarios['username']; ?></option>
<?php
} while ($row_rsUsuarios = mysql_fetch_assoc($rsUsuarios));
?>
</select>
</label></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Temario:</td>
<td><input type="text" name="asunto" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Autor:</td>
<td><input type="text" name="autor" value="<?php echo $row_rsUserID['username']; ?>" size="32" readonly="readonly" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right" valign="top">Mensaje:</td>
<td><textarea name="mensaje" cols="50" rows="5"></textarea> </td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Fecha:</td>
<td><input name="fecha" type="text" value="<?php date("d-m-Y"); ?>" size="15" maxlength="20" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Envia tu SMS" /></td>
</tr>
</table>
<input type="hidden" name="id" value="" />
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p><a href="mp.php"><strong>Volver</strong></a></p>
Ahi corregi unas cositas, pero sigue igual. Esa es toda la web jeje.
Saludos