|
91
|
Programación / PHP / Re: Saber si mi script es vulnerable
|
en: 28 Abril 2007, 18:34 pm
|
Si se lo que es el SPAM pero lo k no entiendoe s como dicen que lo pudieron hacer si se fijan el noticia_nueva.php verifica si está iniciada la sesion y si no hay USERNAME lo redirecciona al header osea como pudieron meter las noticias <?php if (!isset($_SESSION)) { session_start(); } if ($_SESSION['Username'] == "") { header ("Location: http://www.dominican.com/main.php"); } Se me hace buena idea eso de utilizar el sleep() pero solo encuentran esa posibilidad de hackeo porke lo que se me hace AUN mas raro es que en la BD no tenian ni texto ni imagen NI ID!!!!! y todo es esta en NOT NULL y eso es lok se hme hace mas extraño, yo supongo que han d ehaber hackeado el HOST mas que mi SCRIPT PERO NO LO c :S Salu2
|
|
|
92
|
Programación / PHP / Re: Saber si mi script es vulnerable
|
en: 27 Abril 2007, 23:57 pm
|
jajajaj mano em tienes como loko intentanto hacer eso y no funcionaba xD xD
pero haber no entendi eso que me dijeron de la SPAMEADA
como filtro los POST o como hicieron para hacer el post si el que hace el POST está protejido bajo $_SESSION ??
|
|
|
93
|
Programación / PHP / Re: Saber si mi script es vulnerable
|
en: 27 Abril 2007, 21:32 pm
|
el ID es autoincrement y no entiendo en donde pueden meter la Inyeccíon SQL
si no tiene acceso masque al LOGIN!!!!
y el login no necesita Base de datos
entonces????
me podrian indicar donde???
gracias
|
|
|
94
|
Programación / PHP / Re: Saber si mi script es vulnerable
|
en: 24 Abril 2007, 00:58 am
|
Si Pueden copiar el CoDE y pegarle en dreamweaver para analizarlo, peus mejor
pero es urgente que medigan que está mal en mic ode, lo del a funcion de GetsqlValue lo mete el Dreamweaver
Salu2
|
|
|
95
|
Programación / PHP / Re: Saber si mi script es vulnerable
|
en: 24 Abril 2007, 00:49 am
|
entrar.php (verifica el USER y PASS) <?php require_once('Connections/Dominican.php'); if (!isset($_SESSION)) { session_start(); } $user = $_POST['User']; $pass = $_POST['Pass']; if($user == $Usuario1 && $pass == $Password1) { $_SESSION['Username'] = $user; header ("Location: ../main.php"); } elseif($user == $Usuario2 && $pass == $Password2) { $_SESSION['Username'] = $user; header ("Location: ../main.php"); }else{ echo "Usuario Y/O Password Incorrectos<br><strong>Favor de Verificarlos, (SOLO PARA ADMINISTRADORES DE LA WEB)</strong>"; }
?><style type="text/css"> <!-- body { background-color: #CCCCCC; } --> </style> <div align="center"> <p><br> <img src="http://www.dominican.com/iconos_web/1.jpg" width="9" height="9"> <a href="http://www.dominican.com/main.php"><< Atras</a> <img src="http://www.dominican.com/iconos_web/1.jpg" width="9" height="9"></p> <p> </p> </div> login.php (formulario del login, user pass) <?php if ($_SESSION['Username'] == '') { echo '<FORM action="sistema_noticia/entrar.php"
method=post> <INPUT type=hidden value=login
name=op><INPUT type=hidden name=t><INPUT type=hidden
name=f><INPUT type=hidden name=mode><INPUT type=hidden
name=redirect><FONT face=Arial
size=1> Usuario:<INPUT
name=User id="User" size=10 maxLength=25> Contraseña:<INPUT name=Pass type=password id="Pass" size=10 maxLength=20> <INPUT type=submit value=Entrar> </FONT> </FORM>'; } else { echo "<strong>Bienvenido <u>". $_SESSION['Username'] ."</u> </strong><a href=\"http://www.dominican.com/sistema_noticia/salir.php?doLogout=true\"> |Cerrar Sesion</a>|<a href=\"http://www.dominican.com/sistema_noticia/menu.php\">Menu de Noticias|</a>"; } ?> menu.php (el menu de el sistema) <?php require_once('Connections/Dominican.php'); ?> <?php if (!isset($_SESSION)) { session_start(); } if ($_SESSION['Username'] == "") { header ("Location: http://www.dominican.com/main.php"); } mysql_select_db($database_Dominican, $Dominican); $query_Recordset1 = "SELECT ID, Titulo FROM noticias ORDER By ID DESC"; $Recordset1 = mysql_query($query_Recordset1, $Dominican) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?><!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>.::|Menu-SIstema de Noticias|::.</title> <style type="text/css"> <!-- a:link { color: #0000FF; text-decoration: none; } a:visited { text-decoration: none; color: #0000FF; } a:hover { text-decoration: underline; color: #FF0000; } a:active { text-decoration: none; color: #0000FF; } .Estilo1 { color: #FF0000; font-weight: bold; } --> </style> <link href="../iconos_web/style.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- .Estilo2 { font-size: 16px; font-weight: bold; } .Estilo3 {font-size: 14px} .Estilo4 {color: #CCCCCC} .Estilo5 {font-size: 14px; font-weight: bold; } --> </style> </head>
<body> <p class="Estilo1"><?php $status = $_GET['status']; if($status == 1){ echo "Insertado Con Exito";} if($status == 2){ echo "Borrado Con Exito";} if($status == 3){ echo "Modificado Con Exito";} ?></p> <table width="311" border="0" align="center" bgcolor="#333333"> <tr> <td width="305" bgcolor="#666666"><div align="center" class="Estilo2 Estilo4"><strong>Menu De Noticias </strong></div></td> </tr> </table> <br /> <div align="center"></div> <table width="281" border="0" bgcolor="#333333"> <tr> <td width="141" height="15" bgcolor="#333333"><a href="../main.php"><strong>» Regresar atras</strong></a></td> <td width="130" bgcolor="#333333" class="Estilo3"><a href="noticia_nueva.php"><strong>» Crear Nueva Noticia </strong></a></td> </tr> </table> <br /> <br /> <br /> <hr> <table width="741" border="0" align="center"> <tr> <td width="731" height="160" valign="top" bgcolor="#333333"><table width="200" border="0" align="center" bgcolor="#333333"> <tr> <td bgcolor="#666666"><div align="center"><span class="Estilo5">Menu Noticias</span></div></td> </tr> </table> <table width="69%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#0000FF"> <tr> <td><div align="center"><strong>ID</strong></div></td> <td><div align="center"><strong>Titulo</strong></div></td> <td><div align="center"><strong>Borrar</strong></div></td> <td><div align="center"><strong>Modificar</strong></div></td> </tr> <?php do { ?> <tr> <td><div align="center"><?php echo $row_Recordset1['ID']; ?></div></td> <td><div align="center"><?php echo $row_Recordset1['Titulo']; ?></div></td> <td><div align="center"><a href="noticia_borrar.php?id=<?php echo $row_Recordset1['ID']; ?>"><img src="borrar.png" width="16" height="16" border="0" /></a></div></td> <td><div align="center"><a href="noticia_modificar.php?id=<?php echo $row_Recordset1['ID']; ?>"><img src="editar.png" width="16" height="16" border="0" /></a></div></td> </tr> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> </table></td> </tr> </table> <br /> </body> </html> <?php mysql_free_result($Recordset1); ?> noticia_modificar.php (modifica noticia existente) ?php require_once('Connections/Dominican.php'); ?> <?php if (!isset($_SESSION)) { session_start(); } if ($_SESSION['Username'] == "") { header ("Location: http://www.dominican.com/main.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_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE noticias SET Titulo=%s, Texto1=%s, Imagen=%s WHERE ID=%s", GetSQLValueString($_POST['Titulo'], "text"), GetSQLValueString($_POST['Texto1'], "text"), GetSQLValueString($_POST['Imagen'], "text"), GetSQLValueString($_POST['ID'], "int"));
mysql_select_db($database_Dominican, $Dominican); $Result1 = mysql_query($updateSQL, $Dominican) or die(mysql_error());
$updateGoTo = "menu.php?status=3"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); }
$colname_Recordset1 = "-1"; if (isset($_GET['id'])) { $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']); } mysql_select_db($database_Dominican, $Dominican); $query_Recordset1 = sprintf("SELECT * FROM noticias WHERE ID = %s", $colname_Recordset1); $Recordset1 = mysql_query($query_Recordset1, $Dominican) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?><!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>.::|Modificar Noticia|::.</title> <style type="text/css"> <!-- .Estilo2 {font-weight: bold} --> </style> <script type="text/javascript"> function codigo(a,b) { if(navigator.appName == 'Microsoft Internet Explorer') { if(seleccionado = document.selection.createRange().text) { document.selection.createRange().text = a + seleccionado + b ; document.m_formulario.Texto1.focus() ; } else { document.m_formulario.Texto1.focus() ; document.selection.createRange().text = a + b ; } } else { document.m_formulario.Texto1.value += a + b ; document.m_formulario.Texto1.focus() ; } } </script> <link href="../iconos_web/style.css" rel="stylesheet" type="text/css" /> </head>
<body> <form action="<?php echo $editFormAction; ?>" method="post" name="m_formulario" id="m_formulario"> <table align="center"> <tr valign="baseline"> <td align="right" valign="top" nowrap>Titulo:</td> <td valign="top"><input type="text" name="Titulo" value="<?php echo $row_Recordset1['Titulo']; ?>" size="32"></td> </tr> <tr valign="baseline"> <td align="right" valign="top" nowrap>BBCode</td> <td valign="top"><input type="button" onclick="codigo('[b]','[/b]')" value="[b]" onmouseover="ayuda1('Texto en negrita')" onmouseout="ayuda2()" class="eforo_formulario"> <input type="button" onclick="codigo('[i]','[/i]')" value="[i]" onmouseover="ayuda1('Texto en cursiva')" onmouseout="ayuda2()" class="eforo_formulario"> <input type="button" onclick="codigo('[u]','[/u]')" value="[u]" onmouseover="ayuda1('Texto subrayado')" onmouseout="ayuda2()" class="eforo_formulario"> <input type="button" onclick="codigo('[img]','[/img]')" value="[img]" onmouseover="ayuda1('Poner una imagen')" onmouseout="ayuda2()" class="eforo_formulario"> <input type="button" onclick="codigo('[url][/url]','[texto][/texto]')" value="[url]" onmouseover="ayuda1('Crear un enlace')" onmouseout="ayuda2()" class="eforo_formulario"> <input type="button" onclick="codigo('[hr]','')" value="[hr]" onmouseover="ayuda1('Colorear código (HTML, PHP, étc.)')" onmouseout="ayuda2()" class="eforo_formulario"><br /> <input type="button" class="" onclick="codigo('[centrar]','[/centrar]')" value="[centrar]"/> <input name="button2" type="button" class="eforo_formulario" onclick="codigo('[izquierda]','[/izquierda]')" onmouseover="ayuda1('Texto en negrita')" onmouseout="ayuda2()" value="[izquierda]" /> <input name="button" type="button" class="" onclick="codigo('[derecha]','[/derecha]')" value="[derecha]"/> <input name="button3" type="button" class="" onclick="codigo('[azul]','[/azul]')" value="[azul]"/> <br /> <input name="button4" type="button" class="" onclick="codigo('[rojo]','[/rojo]')" value="[rojo]"/> <input name="button5" type="button" class="" onclick="codigo('[verde]','[/verde]')" value="[verde]"/> <input name="button6" type="button" class="" onclick="codigo('[amarillo]','[/amarillo]')" value="[amarillo]"/> <input name="button7" type="button" class="" onclick="codigo('[negro]','[/negro]')" value="[negro]"/> <input name="button8" type="button" class="" onclick="codigo('[blanco]','[/blanco]')" value="[blanco]"/></td> </tr> <tr valign="baseline"> <td align="right" valign="top" nowrap>Texto1:</td> <td valign="top"><textarea name="Texto1" cols="50" rows="15"><?php echo $row_Recordset1['Texto1']; ?></textarea></td> </tr> <tr valign="baseline"> <td align="right" valign="top" nowrap>Imagen:</td> <td valign="top"><input type="text" name="Imagen" value="<?php echo $row_Recordset1['Imagen']; ?>" size="32"></td> </tr> <tr valign="baseline"> <td align="right" valign="top" nowrap> </td> <td valign="top"><input type="submit" value="Actualizar registro"></td> </tr> </table> <p align="center">Los Comandos Son Los Siguientes:<br /> <strong>[b] </strong>Texto En Negritas <span class="Estilo2"><em><strong>[/b]</strong></em></span><em><strong><br /> [i] </strong></em>Texto en Cursiva <em><strong>[/i]<br /> [u] </strong></em>Texto Subrayado <em><strong>[/u]<br /> [img] </strong></em>Poner Imagen <em><strong>[/img]<br /> [url]http://www.dominican.com[/url][texto]Visitar Dominican[/texto]</strong></em> Poner Un Enlace<br /> <span class="Estilo2">[hr]</span> Poner Una Linea<br /> <span class="Estilo2">[centrar] </span>Centrar el texto<span class="Estilo2">[/centrar]<br /> </span><strong>[izquierda]</strong> Direccionar el texto<strong>[/izquierda]</strong><br /> <strong>[derecha]</strong> Direccionar el texto<strong>[/derecha]</strong><span class="Estilo2"><br /> [azul] </span>Texto de Color <span class="Estilo2">[/azul] </span><br /> <span class="Estilo2">[rojo] </span>Texto de Color <span class="Estilo2">[/rojo]</span><br /> <span class="Estilo2">[verde] </span>Texto de Color <span class="Estilo2">[/verde]</span><br /> <span class="Estilo2">[amarillo] </span>Text de Color <span class="Estilo2">[/amarillo]</span><br /> <span class="Estilo2">[negro] </span>Texto de Color <span class="Estilo2">[/negro]</span><br /> <span class="Estilo2">[blanco] </span>Texto de Color <span class="Estilo2">[/blanco]</span><br /> <br /> <input type="hidden" name="MM_insert" value="form1"> </p> <p> <input type="hidden" name="MM_update" value="form1"> <input type="hidden" name="ID" value="<?php echo $row_Recordset1['ID']; ?>"> </p> </form> <p> </p> </body> </html> <?php mysql_free_result($Recordset1); ?> noticia_nueva.php (Meter nueva noticia) <?php require_once('Connections/Dominican.php'); ?> <?php if (!isset($_SESSION)) { session_start(); } if ($_SESSION['Username'] == "") { header ("Location: http://www.dominican.com/main.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 ($_POST['Submit'] != "") { $nombre_archivo = $_FILES['archivo_1']['name']; $Local_Resource = $_FILES['archivo_1']['tmp_name']; //script de prueba move_uploaded_file($Local_Resource, "../iconos_web/fotos_noticias/$nombre_archivo"); //fin prueba } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO noticias (Titulo, Texto1, Imagen) VALUES (%s, %s, %s)", GetSQLValueString($_POST['Titulo'], "text"), GetSQLValueString($_POST['Texto1'], "text"), GetSQLValueString("../iconos_web/fotos_noticias/".$nombre_archivo, "text"));
mysql_select_db($database_Dominican, $Dominican); $Result1 = mysql_query($insertSQL, $Dominican) or die(mysql_error());
$insertGoTo = "menu.php?status=1"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } ?><!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> <script type="text/javascript"> function codigo(a,b) { if(navigator.appName == 'Microsoft Internet Explorer') { if(seleccionado = document.selection.createRange().text) { document.selection.createRange().text = a + seleccionado + b ; document.m_formulario.Texto1.focus() ; } else { document.m_formulario.Texto1.focus() ; document.selection.createRange().text = a + b ; } } else { document.m_formulario.Texto1.value += a + b ; document.m_formulario.Texto1.focus() ; } } </script> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>.::|Noticia Nueva|::.</title> <link href="main_files/style.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- .Estilo1 {font-size: 14px} .Estilo2 { color: #00FF00; font-style: italic; font-weight: bold; } .Estilo4 {color: #00FF00} .Estilo5 {font-weight: bold} --> </style> <link href="../iconos_web/style.css" rel="stylesheet" type="text/css" /> </head>
<body> <form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="m_formulario" id="m_formulario"> <table align="center"> <tr valign="baseline"> <td colspan="2" align="right" valign="top" nowrap><div align="center" class="Estilo1">NuEvA NoTiCiA</div></td> </tr> <tr valign="baseline"> <td align="right" valign="top" nowrap>Titulo:</td> <td valign="top"><input type="text" name="Titulo" value="" size="32"></td> </tr> <tr valign="baseline"> <td align="right" valign="top" nowrap>BBCode:</td> <td valign="top"><input type="button" onclick="codigo('[b]','[/b]')" value="[b]" onmouseover="ayuda1('Texto en negrita')" onmouseout="ayuda2()" class="eforo_formulario"> <input type="button" onclick="codigo('[i]','[/i]')" value="[i]" onmouseover="ayuda1('Texto en cursiva')" onmouseout="ayuda2()" class="eforo_formulario"> <input type="button" onclick="codigo('[u]','[/u]')" value="[u]" onmouseover="ayuda1('Texto subrayado')" onmouseout="ayuda2()" class="eforo_formulario"> <input type="button" onclick="codigo('[img]','[/img]')" value="[img]" onmouseover="ayuda1('Poner una imagen')" onmouseout="ayuda2()" class="eforo_formulario"> <input type="button" onclick="codigo('[url][/url]','[texto][/texto]')" value="[url]" onmouseover="ayuda1('Crear un enlace')" onmouseout="ayuda2()" class="eforo_formulario"> <input type="button" onclick="codigo('[hr]','')" value="[hr]" onmouseover="ayuda1('Colorear código (HTML, PHP, étc.)')" onmouseout="ayuda2()" class="eforo_formulario"><br /> <input type="button" class="" onclick="codigo('[centrar]','[/centrar]')" value="[centrar]"/> <input name="button2" type="button" class="eforo_formulario" onclick="codigo('[izquierda]','[/izquierda]')" onmouseover="ayuda1('Texto en negrita')" onmouseout="ayuda2()" value="[izquierda]" /> <input name="button" type="button" class="" onclick="codigo('[derecha]','[/derecha]')" value="[derecha]"/> <input name="button3" type="button" class="" onclick="codigo('[azul]','[/azul]')" value="[azul]"/> <br /> <input name="button4" type="button" class="" onclick="codigo('[rojo]','[/rojo]')" value="[rojo]"/> <input name="button5" type="button" class="" onclick="codigo('[verde]','[/verde]')" value="[verde]"/> <input name="button6" type="button" class="" onclick="codigo('[amarillo]','[/amarillo]')" value="[amarillo]"/> <input name="button7" type="button" class="" onclick="codigo('[negro]','[/negro]')" value="[negro]"/> <input name="button8" type="button" class="" onclick="codigo('[blanco]','[/blanco]')" value="[blanco]"/></td> </tr> <tr valign="baseline"> <td align="right" valign="top" nowrap>Texto1:</td> <td valign="top"><textarea name="Texto1" cols="50" rows="15" wrap="virtual"></textarea></td> </tr> <tr valign="baseline"> <td align="right" valign="top" nowrap>Imagen:</td> <td> <p align="center"><input name="archivo_1" type="file" id="archivo_1"> </p> </td> </tr> <tr valign="baseline"> <td align="right" valign="top" nowrap> </td> <td valign="top"><input name="Submit" type="submit" id="boton" value="Insertar registro"></td> </tr> </table> <p align="center">Los Comandos Son Los Siguientes:<br /> <span class="Estilo2">[b] </span>Texto En Negritas <span class="Estilo2"><em><strong>[/b]</strong></em></span><em><strong><br /> <span class="Estilo4">[i]</span> </strong></em>Texto en Cursiva <span class="Estilo2"><em><strong>[/i]</strong></em></span><em><strong><br /> <span class="Estilo4">[u]</span> </strong></em>Texto Subrayado <span class="Estilo2"><em><strong>[/u]</strong></em></span><br /> <em><strong><span class="Estilo4">[img]</span> </strong></em>Poner Imagen <span class="Estilo2"><em><strong>[/img]</strong></em></span><em><strong><br /> <span class="Estilo4">[url]</span>http://www.dominican.com<span class="Estilo4">[/url][texto]</span>Visitar Dominican <span class="Estilo4">[/texto]</span></strong></em> Poner Un Enlace<br /> <span class="Estilo2">[hr]</span> Poner Una Linea<br /> <span class="Estilo2">[centrar] </span>Centrar el texto<span class="Estilo2">[/centrar]</span><br /> <span class="Estilo2">[izquierda] </span>Direccionar el texto<span class="Estilo2">[/izquierda]</span><br /> <span class="Estilo2">[derecha] </span>Direccionar el texto<span class="Estilo2">[/derecha]</span><br /> <span class="Estilo2">[azul] </span>Texto de Color <span class="Estilo2">[/azul] </span><br /> <span class="Estilo2">[rojo] </span>Texto de Color <span class="Estilo2">[/rojo]</span><br /> <span class="Estilo2">[verde] </span>Texto de Color <span class="Estilo2">[/verde]</span><br /> <span class="Estilo2">[amarillo] </span>Text de Color <span class="Estilo2">[/amarillo]</span><br /> <span class="Estilo2">[negro] </span>Texto de Color <span class="Estilo2">[/negro]</span><br /> <span class="Estilo2">[blanco] </span>Texto de Color <span class="Estilo2">[/blanco]</span><br /> <br /> <input type="hidden" name="MM_insert" value="form1"> </p> </form> <p> </p> </body>
</html>
noticia_borrar.php (borra la noticia, es muy sencillo) <?php require_once('Connections/Dominican.php'); ?> <?php if (!isset($_SESSION)) { session_start(); } if ($_SESSION['Username'] == "") { header ("Location: http://www.dominican.com/main.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; }
if ((isset($_GET['id'])) && ($_GET['id'] != "")) { $deleteSQL = sprintf("DELETE FROM noticias WHERE ID=%s", GetSQLValueString($_GET['id'], "int"));
mysql_select_db($database_Dominican, $Dominican); $Result1 = mysql_query($deleteSQL, $Dominican) or die(mysql_error());
$deleteGoTo = "menu.php?status=2"; if (isset($_SERVER['QUERY_STRING'])) { $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?"; $deleteGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $deleteGoTo)); } ?><!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>Documento sin título</title> </head>
<body> </body> </html>
salir.php (hacer logout, cerrar sesion) <?php 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['Username'] = NULL; unset($_SESSION['Username']);
$logoutGoTo = "http://www.dominican.com/main.php"; if ($logoutGoTo) { header("Location: $logoutGoTo"); exit; } } ?> Connections/Dominican.php (El Archivo de config.php) <?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" //>>>>>>|Datos Para el Admin de Las News|<<<<<<<<<<
//--------Usuario/Moderador [1]--------// $Usuario1 = "USER1"; $Password1 = "PASS1";
//--------Usuario/Moderador [2]--------// $Usuario2 = "USER2"; $Password2 = "PASS2";
//---------Numero de Noticias a Mostrar Por Paginas----------// $registros = 4;
//---------- Paginas de Numeracion Para Dar Salto de Linea < Anterior [1][2][3][4][5] etc.. ----------------// $abajo=17;
//-------Titulo De La Pagina antes de (|-| "Cargando...") ------// $titulo_cargando = "--> Dominican Está...";
//------- Titulo Antes Del "titulo" de la Primera noticia de cada pagina -----// $titulo_antes_titulo = "...::: Dominican :::...";
//>>>>>>>|Datos de la Conexion a la BD|<<<<<<<<<<<<< $hostname_Dominican = "localhost"; $database_Dominican = "noticias"; $username_Dominican = "noticias_user"; $password_Dominican = "noticias_pass";
//------------------------->> No Tocar de aki Para ABAJO, SOlo Modificar de aquí para arriba |^_^| $Dominican = mysql_pconnect($hostname_Dominican, $username_Dominican, $password_Dominican) or trigger_error(mysql_error(),E_USER_ERROR);
//Funcion BBCode function BBCode($palabra) { $palabra = htmlentities($palabra); $palabra = str_replace("[url]","<a href=\"", $palabra);
$palabra = str_replace("[/url]","\" target=\"_blank\">", $palabra); $palabra = str_replace("[img]","<img src=\"", $palabra);
$palabra = str_replace("[/img]","\">", $palabra); $palabra = str_replace("[texto]"," ", $palabra); $palabra = str_replace("[/texto]"," </a>", $palabra);
$palabra = str_replace("[hr]","<hr color='#FFFFFF' size='1'>", $palabra);
$palabra = str_replace("[b]","<b>", $palabra);
$palabra = str_replace("[/b]","</b>", $palabra); $palabra = str_replace("[centrar]","<center>", $palabra);
$palabra = str_replace("[/centrar]","</center>", $palabra);
$palabra = str_replace("[derecha]","<p align=\"right\">", $palabra); $palabra = str_replace("[/derecha]","</p>", $palabra); $palabra = str_replace("[izquierda]","<p align=\"left\">", $palabra); $palabra = str_replace("[/izquierda]","</p>", $palabra); $palabra = str_replace("[u]","<u>", $palabra);
$palabra = str_replace("[/u]","</u>", $palabra);
$palabra = str_replace("[i]","<i>", $palabra);
$palabra = str_replace("[/i]","</i>", $palabra);
$palabra = str_replace("[azul]","<font color='#0000FF'>", $palabra);
$palabra = str_replace("[rojo]","<font color='#FF0000'>", $palabra);
$palabra = str_replace("[verde]","<font color='#009D00'>", $palabra);
$palabra = str_replace("[amarillo]","<font color='#EEDC02'>", $palabra); $palabra = str_replace("[negro]","<font color='#000000'>", $palabra);
$palabra = str_replace("[/negro]","</font>", $palabra);
$palabra = str_replace("[blanco]","<font color='#FFFFFF'>", $palabra);
$palabra = str_replace("[/blanco]","</font>", $palabra);
$palabra = str_replace("[/amarillo]","</font>", $palabra); $palabra = str_replace("[/verde]","</font>", $palabra);
$palabra = str_replace("[/rojo]","</font>", $palabra);
$palabra = str_replace("[/azul]","</font>", $palabra); $palabra = nl2br($palabra); return $palabra;
} ?>
|
|
|
96
|
Programación / PHP / Re: Saber si mi script es vulnerable
|
en: 24 Abril 2007, 00:26 am
|
Hola es que siento que si publico el code quedaria aun mas vulnerable jejeje 1.- votos por IP?? eske mi sistema no tiene votos ni nada :S 2.- ok posteare el codigo pero es algo largo ya que son varios files :S 3.- No Paso las variables por $_GET todo es por $_POST y todo esta bajo contraseña por session if ($_POST['user'] == $usuario && $_POST['pass'] == $pass) mete en una variable de Session a el user bueno en unos momenos mas posteo el code salu2
|
|
|
97
|
Programación / PHP / Saber si mi script es vulnerable
|
en: 23 Abril 2007, 01:08 am
|
Hola aunke aprezca un intento de hacking o algo parecido no lo es asi
yo hice un SCRIPT de sistema de noticias
y no c que hicieron una inyeccion o que que me pusiern 900 noticias en unos instantes!!!! y yo tengo en el menú una tabla con un link a la derecha asi
borrar.php?id=id_noticia y los 900 no salia eso y es muy raro!!! ya que nadie conoce mi codigo :S
y queria ver si hay algún programa que verifique si se peude hacer inyecicon o algo :S
Salu2
|
|
|
|
|
|
|