Me gustaria si es posible me sacaran de un mareo de cabeza que tengo, con el dichoso codigo.
Les esplico, estoy creando una web, en la que inserto noticias, el problema que tengo es que al meter las noticias en codigos como scrips, html, iframes, el codigo que le meto lo cambia todo, les dejo un ejemplo:
Yo le inserto este codigo;
Código:
Código HTML:
<script language="javascript" type="text/javascript">iwsrcplus="http://codenew.impresionesweb.com/r/banner_iw.php?idrotador=39283&tamano=300x250&lgid="+((new Date()).getTime() % 2147483648) + Math.random(); document.write("<scr"+"ipt language=javascript type=text/javascript src="+iwsrcplus+"></scr"+"ipt>");</script><noscript><iframe src="http://alt.impresionesweb.com/noscript.php?tam=300x250&idp=39283&ref=39283&cod=49474" width="300" height="250" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"></iframe></noscript>
Y la programacion al darle a guardar a la base de datos me lo modifica a este otro;
Código:
Código HTML:
iwsrcplus="http://codenew.impresionesweb.com/r/banner_iw.php?idrotador=39283&tamano=300x250&lgid="+((new Date()).getTime() % 2147483648) + Math.random(); document.write("");
Código:
Código PHP:
<?
$id_image = 0; //id para las imagenes
$k = 'noticias';
if($_POST['act']=='add'){ // Agregar
$ins = new insert('noticias',$con); //insert($nombre_tabla,$con);
foreach($_POST as $key => $val){
$ins->col[$key] = $val;
}
$ins->update();
// Agregamos imagen/es
$id_image=mysql_insert_id();
add_image($k,$id_image,'foto',300);
echo '<script>
alert("La noticia se agregó correctamente");
document.location.href="index.php?sec=noticias";
</script>';
}elseif($_POST['act']=='edit'){ // Editar
$upd = new doupdate('noticias',$con,'id',$_GET['id']);
foreach($_POST as $key => $val){
$upd->col[$key] = $val;
}
$upd->update();
// Agregamos imagen/es
$id_image=$_GET['id'];
add_image($k,$id_image,'foto',300);
echo '<script>
alert("La noticia se modificó correctamente");
document.location.href="index.php?sec=noticias&id='.$_GET['id'].'";
</script>';
}
////////////////////////////////////////////////////////////////////////////////////////
if(is_numeric($_GET['id'])){ // Editar
$q->exec('SELECT * FROM noticias WHERE id='.$_GET['id']);
$rw=$q->data;
$act='edit';
$boton = 'guardar';
}else{ // Agregar
$act='add';
$boton = 'agregar';
}
?>
<table class="texto" align="center" border="0" cellpadding="0" cellspacing="4" width="688">
<tr><td><hr size="1"></td></tr>
<tr><td><img src="imagenes/imagen-flecha.gif" align="texttop" border="0" height="14" width="15"> SECCION<font class="textoc">NOTICIAS</font></td></tr>
<tr><td><hr size="1"></td></tr>
<tr>
<td>EDITAR<font class="textoc">NOTICIAS</font><br><br>
<form name="add" method="post" enctype="multipart/form-data">
<table class="texto" border="0" cellpadding="0" width="600">
<tr>
<td><img src="imagenes/imagen-flecha.gif" align="texttop" border="0"> Título: (*) </td>
<td><input class="input" size="28" name="titulo" value="<?=$rw['titulo']?>"></td>
</tr>
<tr>
<td><img src="imagenes/imagen-flecha.gif" align="texttop" border="0"> Texto: (*) </td>
<td><textarea class="input" cols="60" rows="6" name="texto"><?=$rw['texto']?></textarea><tr>
<td><img src="imagenes/imagen-flecha.gif" align="texttop" border="0"> Url: ( Sin http:// ) </td>
<td><input name="url" class="input" id="url" value="<?=$rw['url']?>" size="28"></td>
</tr
></tr>
<tr>
<td><img src="imagenes/imagen-flecha.gif" align="texttop" border="0"> Foto: (*) </td>
<td><input class="input" type="file" name="foto"></td>
</tr>
<tr>
<td></td>
<td align="left"><br><input src="imagenes/boton-<?=$boton?>.gif" type="image"></td>
</tr>
<input type="hidden" name="act" value="<?=$act?>">
</form>
</table>
<br>
<a href="index.php?sec=list&s=noticias" class="link"><b>Volver a Noticias</b></a></form>
</td>
</tr>