Ver Mensaje Individual
  #8 (permalink)  
Antiguo 22/06/2008, 19:54
Avatar de nicolyto77
nicolyto77
 
Fecha de Ingreso: marzo-2007
Ubicación: Buenos Aires
Mensajes: 782
Antigüedad: 17 años, 10 meses
Puntos: 12
Exclamación Respuesta: Conteo de Mensajes

Aca el codigo de la primer parte:

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 "foro.php";
  if (
$logoutGoTo) {
    
header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?php
function GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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 respuestas (id, autor, email, avatar, pais, rango, mensajes, firma, ip, mensaje, fecha, id_foro) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['id'], "int"),
                       
GetSQLValueString($_POST['autor'], "text"),
                       
GetSQLValueString($_POST['email'], "text"),
                       
GetSQLValueString($_POST['avatar'], "text"),
                       
GetSQLValueString($_POST['pais'], "text"),
                       
GetSQLValueString($_POST['rango'], "int"),
                       
GetSQLValueString($_POST['mensajes'], "int"),
                       
GetSQLValueString($_POST['firma'], "text"),
                       
GetSQLValueString($_POST['ip'], "text"),
                       
GetSQLValueString($_POST['mensaje'], "text"),
                       
GetSQLValueString($_POST['fecha'], "date"),
                       
GetSQLValueString($_POST['id_foro'], "int"));

  
mysql_select_db($database_FS$FS);
  
$Result1 mysql_query($insertSQL$FS) or die(mysql_error());

  
$insertGoTo "foro.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}

$colname_rsUserID "-1";
if (isset(
$_SESSION['MM_Username'])) {
  
$colname_rsUserID = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
}
mysql_select_db($database_FS$FS);
$query_rsUserID sprintf("SELECT * FROM registro WHERE username = '%s'"$colname_rsUserID);
$rsUserID mysql_query($query_rsUserID$FS) or die(mysql_error());
$row_rsUserID mysql_fetch_assoc($rsUserID);
$totalRows_rsUserID mysql_num_rows($rsUserID);

$maxRows_DetailRS1 25;
$pageNum_DetailRS1 0;
if (isset(
$_GET['pageNum_DetailRS1'])) {
  
$pageNum_DetailRS1 $_GET['pageNum_DetailRS1'];
}
$startRow_DetailRS1 $pageNum_DetailRS1 $maxRows_DetailRS1;

mysql_select_db($database_FS$FS);
$recordID $_GET['recordID'];
$query_DetailRS1 "SELECT * FROM foro WHERE id = $recordID";
$query_limit_DetailRS1 sprintf("%s LIMIT %d, %d"$query_DetailRS1$startRow_DetailRS1$maxRows_DetailRS1);
$DetailRS1 mysql_query($query_limit_DetailRS1$FS) or die(mysql_error());
$row_DetailRS1 mysql_fetch_assoc($DetailRS1);

if (isset(
$_GET['totalRows_DetailRS1'])) {
  
$totalRows_DetailRS1 $_GET['totalRows_DetailRS1'];
} else {
  
$all_DetailRS1 mysql_query($query_DetailRS1);
  
$totalRows_DetailRS1 mysql_num_rows($all_DetailRS1);
}
$totalPages_DetailRS1 ceil($totalRows_DetailRS1/$maxRows_DetailRS1)-1;

mysql_select_db($database_FS$FS);
$query_rsRespuestas "SELECT * FROM respuestas WHERE id_foro = $recordID";
$rsRespuestas mysql_query($query_rsRespuestas$FS) or die(mysql_error());
$row_rsRespuestas mysql_fetch_assoc($rsRespuestas);
$totalRows_rsRespuestas mysql_num_rows($rsRespuestas);

?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  
session_start();
}

$loginFormAction $_SERVER['PHP_SELF'];
if (isset(
$_GET['accesscheck'])) {
  
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset(
$_POST['username'])) {
  
$loginUsername=$_POST['username'];
  
$password=$_POST['password'];
  
$MM_fldUserAuthorization "";
  
$MM_redirectLoginSuccess "index.php";
  
$MM_redirectLoginFailed "login_error.php";
  
$MM_redirecttoReferrer true;
  
mysql_select_db($database_FS$FS);
  
  
$LoginRS__query=sprintf("SELECT username, password FROM registro WHERE username='%s' AND password='%s'",
    
get_magic_quotes_gpc() ? $loginUsername addslashes($loginUsername), get_magic_quotes_gpc() ? $password addslashes($password)); 
   
  
$LoginRS mysql_query($LoginRS__query$FS) or die(mysql_error());
  
$loginFoundUser mysql_num_rows($LoginRS);
  if (
$loginFoundUser) {
     
$loginStrGroup "";
    
    
//declare two session variables and assign them
    
$_SESSION['MM_Username'] = $loginUsername;
    
$_SESSION['MM_UserGroup'] = $loginStrGroup;          

    if (isset(
$_SESSION['PrevUrl']) && true) {
      
$MM_redirectLoginSuccess $_SESSION['PrevUrl'];    
    }
    
header("Location: " $MM_redirectLoginSuccess );
  }
  else {
    
header("Location: "$MM_redirectLoginFailed );
  }
}
[
B]
if (
array_key_exists('Submity'$_POST))
{
mysql_query("UPDATE registro SET resp=resp+1 where username='username'");
}[/
B]

$ip=$_SERVER['REMOTE_ADDR'];
$fecha=date("d/m/Y");

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Topic</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="image/mm_health_nutr.css" type="text/css" />
<script language="JavaScript" type="text/javascript">
//--------------- LOCALIZEABLE GLOBALS ---------------
var d=new Date();
var monthname=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
//Ensure correct for language. English is "January 1, 2004"
var TODAY = monthname[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear();
//---------------   END LOCALIZEABLE   ---------------
</script>
<style type="text/css">
<!--
.Estilo1 {
    color: #FF0000;
    font-weight: bold;
    font-size: 12px;
}
.Estilo2 {color: #FF0000}
.Estilo3 {color: #003399}
.Estilo4 {color: #0000FF}
.Estilo5 {
    color: #FF0000;
    font-style: italic;
    font-family: "Courier New", Courier, monospace;
}
.Estilo6 {
    color: #006600;
    font-weight: bold;
}
-->
</style>

<script language="Javascript" type="text/javascript" src="tiny_mce/tiny_mce.js">
</script>
  <script type="text/javascript">
             tinyMCE.init({
             mode : "textareas",
             themes : "advanced",
             theme_advanced_toolbar_location : "top",
             elements : "comment" });
          </script>
});
</script>

</head>
Saludos
__________________
CabaSoft Networks