J
JamesPierre
Dseda
Verificado
Verificación en dos pasos activada
Verificado por Whatsapp
Hola amigos, les pido de porfa que me hechen una mano, tengo un script de php de sistema de noticias, pero a este quiero quitarle el upload de imagenes, les pego el codigo para que lo chekeen y me digan que linea se tiene que retirar...
Les estaré muy agradecido...
Les estaré muy agradecido...
PHP:
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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")) {
if(is_uploaded_file($_FILES['foto']['tmp_name'])) { // verifica haya sido cargado el archivo
$ruta= 'images/'.rand(000,999).$_FILES['foto']['name'];
move_uploaded_file($_FILES['foto']['tmp_name'], $ruta);
}
$insertSQL = sprintf("INSERT INTO noticias (titulo, subtitulo, descripcion, foto, fecha) VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($_POST['titulo'], "text"),
GetSQLValueString($_POST['subtitulo'], "text"),
GetSQLValueString($_POST['descripcion'], "text"),
GetSQLValueString($ruta, "text"),
GetSQLValueString($_POST['fecha'], "text"));
mysql_select_db($database_cn, $cn);
$Result1 = mysql_query($insertSQL, $cn) or die(mysql_error());
$insertGoTo = "noticias.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>