Ver Mensaje Individual
  #2 (permalink)  
Antiguo 02/11/2009, 07:43
kadas99
 
Fecha de Ingreso: julio-2009
Ubicación: Argentina!
Mensajes: 324
Antigüedad: 15 años, 7 meses
Puntos: 4
Respuesta: Problemita con puntuacion

CONTINUACION



Guarda_calificacion.php

Código PHP:
<?php
require("template.php");
$comentario=$_REQUEST['message'];
$subject1=$comentario;
$eviltags = array

(
'<','body:','>','</','/');
for(
$i=0;$i<sizeof($eviltags);$i++){
if(
strstr($subject1$eviltags[$i])){
unset(
$subject1);
die(
" <div align=\"center\">    <br />
  <table width=\"80%\" style=\"border-top-style:solid;border-right-style:solid;border-bottom-style:none;border-left-style:solid;border-top-color:#000000;border-right-color:#000000;border-bottom-color:#000000;border-left-color:#000000;border-top-width: 1px;border-right-width:1px;border-bottom-width:1px;border-left-width:1px;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
    <tr>
      <td height=\"21\" background=\"mas_buscados_titulo_fondo.jpg\"><div align=\"center\" class=\"Estilo3\">Error</div></td>
      </tr>
  </table>
  <table style=\"border-top-style:none;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:#000000;border-right-color:#000000;border-bottom-color:#000000;border-left-color:#000000;border-top-width: 1px;border-right-width:1px;border-bottom-width:1px;border-left-width:1px;\" width=\"80%\"  cellspacing=\"0\" cellpadding=\"0\">
    <tr>
      <td bgcolor=\"#ffe8ac\"><div align=\"center\"><span class=\"Estilo2\"><br>
            <strong>Su comentario contiene caracteres no validos.</strong><br>
      </span><br />
          <input type=\"submit\" value=\"Volver\" onClick=\"history.go(-1)\" />
        </div><br></td>
      </tr>
  </table>
  </div>"
);
}
}

$clave=$_REQUEST['clave'];
$tipopuntuacion $_REQUEST['tipopuntuacion'];

if (
$tipopuntuacion == '+1') {
    
$puntaje=1;
    }
else if (
$tipopuntuacion == 'neutro') {
    
$puntaje=0;
    }
else if (
$tipopuntuacion == '-1') {
    
$puntaje2;
    }


$sql="UPDATE puntajes SET clave2='0', puntaje='$puntaje', comentariocomprador='$comentario' WHERE clave='$clave'";
$res=mysql_query($sql) or die($error="No se pudo guardar su respuesta");
$lugarlog=1;
logbases();
if(
$res==FALSE){
die(
$error="No se pudo guardar su respuesta");
}

$contador 0;
$positivo NULL;
$neutro NULL;
$negativo NULL;

$sql="SELECT * FROM puntajes WHERE clave = '$clave'";
$res=mysql_query($sql);
$resultado=mysql_fetch_array($res);
$lugarlog=2;
logbases();


$useridvendedor=$resultado[useridvendedor];


$sql="SELECT * FROM puntajes WHERE useridvendedor = '$useridvendedor' and clave2 = '0'";
$res=mysql_query($sql);
$lugarlog=3;
logbases();

while (
$resultado=mysql_fetch_array($res)){
$lugarlog=4;
logbases();

$puntaje=$resultado[puntaje];


$contador=$contador+1;


if (
$puntaje == ){
$positivo=$positivo+1;
}
if (
$puntaje == ){
$neutro=$neutro+1;
}
if (
$puntaje == ){
$negativo=$negativo+1;
}
}

if (
$positivo !==NULL){
$total1=$positivo/$contador*100;
}
if (
$negativo !==NULL){
$total3=$negativo/$contador*100;
}
if (
$neutro !==NULL){
$total2=$neutro/$contador*100;
}
if (
$negativo !==NULL){
$total3=$negativo/$contador*100;
}

$sql="UPDATE porcentaje SET positivo='$total1', neutro='$total2', negativo='$total3', votos='$contador' WHERE userid='$useridvendedor'";
$res=mysql_query($sql);

$lugarlog=5;
logbases();
if(
$res==FALSE){
die(
$error="No se pudo guardar su respuesta");
}



echo 
"<table width='50%' style=\"border-top-style:solid;border-right-style:solid;border-bottom-style:none;border-left-style:solid;border-top-color:#000000;border-right-color:#000000;border-bottom-color:#000000;border-left-color:#000000;border-top-width: 2px;border-right-width:2px;border-bottom-width:2px;border-left-width:2px;\" border='0' align='center' bgcolor='#FFFFCC' background=\"mas_buscados_titulo_fondo.jpg\" cellpadding='0' cellspacing='0'>
    <tr>
      <td><center><strong>Su calificacion a sido ingresada</strong></center>

      </td>
    </tr>
  </table>
<table width='50%' style=\"border-top-style:none;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:#000000;border-right-color:#000000;border-bottom-color:#000000;border-left-color:#000000;border-top-width: 2px;border-right-width:2px;border-bottom-width:2px;border-left-width:2px;\" border='0' align='center' bgcolor='#FFE8AC'  cellpadding='0' cellspacing='0'>
<tr>
<td>
<form id='form1' name='form1' method='post' action='dar_puntos.php'>
<center><input type='submit' name='volver2' id='volver2' value='Volver' /></center>
</form>
</td>
</tr>
</table>"
;





function 
logbases() {
        global 
$lugarlog;
$fechalog=date("Y-m-d");
$mysql_errno_logmysql_errno();
$mysql_error_log mysql_error();
$programa "GUARDA_CALIFICACION.PHP"
$errorlog $lugarlog;
if (
mysql_errno() !== 0){
$sql="SELECT * FROM log  where fecha  = '$fechalog' and nroerror = '$mysql_errno_log' and msgerror = '$mysql_error_log' and lugarlog = '$errorlog'";
$res1h=mysql_query($sql);
if (
$reslh !== FALSE){
$reg1=mysql_num_rows($res1h);
}else{
$reg1=0;
}
if  (
$reg1 <= 0){
$sql="INSERT ignore INTO log (fecha,nroerror,msgerror,programa,lugarlog)    VALUES ('$fechalog','$mysql_errno_log','$mysql_error_log','$programa','$errorlog')";
mysql_query($sql) or die ("<table width=\"50%\" border=\"0\" style=\"border-top-style:solid;border-right-style:solid;border-bottom-style:none;border-left-style:solid;border-top-color:#000000;border-right-color:#000000;border-bottom-color:#000000;border-left-color:#000000;border-top-width: 1px;border-right-width:1px;border-bottom-width:1px;border-left-width:1px;\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
  <tr>
    <td height=\"21\" background=\"mas_buscados_titulo_fondo.jpg\"><div align=\"center\"><strong>Error</strong></div></td>
  </tr>
</table>
<table width=\"50%\" border=\"0\" style=\"border-top-style:none;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:#000000;border-right-color:#000000;border-bottom-color:#000000;border-left-color:#000000;border-top-width: 1px;border-right-width:1px;border-bottom-width:1px;border-left-width:1px;\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" >
  <tr>
    <td bgcolor=\"#FFE8AC\"><div align=\"center\"><strong><br />Problema insertando LOG</strong></div></td>
  </tr>
  <input type=\"button\" value=\"volver\" onClick=\"history.go(-1)\">
</table>"
);
}
}


mysql_close();


?>

Otra cosa que recuerdo, desde que no funciona, el form del Calificar.html estaba llamandose a si mismo, es decir action="calificar.html" cuando yo lo tenia como action="guarda_calificacion.php", y les juro que nadie nadie toco eso! (Hay fantasmas en mi pc? )

Un abrazo