Titulo (esta opción ya esta por defecto).
descripción (solo textos y símbolo)
campo1: (insertar ids de los videos youtube)
campo2: (solo textos y simbolo)
img : (url de img exterior, por ejemplo de youtube o twitpic y que no se guarde en mi servidor)
No soy bueno en php ni en mysql por favor me ayudarían con este lio, tengo el codigo del sql y php para q lo puedan analizar y agregar los campos necesarios.
Saludos y agradesco su ayuda.
Codigo PHP Y HTML: (este codigo esta funcionando perfectamente pero solo en frases lo que quiero es agregar campos para implementar nuevas funciones.)
Código:
<?php include_once dirname(__FILE__) . '/config.php'; function validarDatos($campo) { $badHeads = array( ".com", ".net", ".org", ".com.ar", "html", "php", "<a href=", "</a>", "[url=", "[link="); foreach ($badHeads as $valor) { if (strpos(strtolower($campo), strtolower($valor)) !== false) { header("Location: mes/"); exit; } } } function the_permalink() { return URL . $_SERVER["REQUEST_URI"]; } /* creo la frase */ if (isset($_POST["crear"])) { $frase = strip_tags(trim($_POST['post'])); $frase = str_replace(array('script', "'", 'refresh', 'document.location', 'CONTENT="0;'), array('error', "'", 'error', 'error', 'error'), $frase); validarDatos($frase); if (!empty($frase) && $frase != 'Escribe tu frase aquí...') { session_start(); { $db = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); /* sumo uno al total */ $stmt = $db->prepare("INSERT INTO pagina (titulo, dia) VALUES (?, CURDATE())"); $stmt->bind_param("s", $frase); $stmt->execute(); $stmt->close(); $id = $db->insert_id; if ($id) $db->query('UPDATE config SET total=total+1 WHERE id=1'); $db->close(); echo "<script type='text/javascript'>top.location.href = 'frase.php?id=$id/?r';</script>"; exit(); } } } $id_p = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; if (!$id_p) { header('Location: /tend/'); exit; } /* guardo el 50 / 50 */ $rand = rand(0, 1); if ($rand) { $db = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); /* Le aumento una visita al rating */ $db->query('UPDATE pagina SET rating=rating+1 WHERE id=' . $id_p); } if (!isset($db)) $db = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); ?> <!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" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en" lang="en"><head> <?php $rmt = $db->query('SELECT * from pagina WHERE id=' . $id_p . ' LIMIT 1'); if (!empty($rmt)) { $rowarea = $rmt->fetch_array(); $titulo_web = $rowarea['titulo']; $titulo2_web = $rowarea['titulo']; $rmt->close(); } else { /* Sino encuentro la frase redirecciono */ header('Location: /tend/'); exit; } ?> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title><?php echo str_replace('&#39;', '\'', htmlspecialchars($titulo_web)) ?></title> <link rel="stylesheet" href="css2.css" type="text/css" media="screen"> </head> <body> <div class="container"> <div class="home_post"> <div class="bx-ms"> <?php print $error; ?> <!-- google_ad_section_start--> <?php echo nl2br(str_replace('&#39;', '\'', htmlspecialchars($rowarea['titulo']))) ?> <!-- google_ad_section_end--> </div> <div class="bk"> <form action="frase.php" method="post"> <textarea class="notebook" name="post" id="frase"> </textarea> <input type="submit" name="crear" value="Crear" /> </form> </div> </div> </div> </body> </html>
Codigo SQL
Código:
CREATE TABLE IF NOT EXISTS `config` ( `id` tinyint(1) NOT NULL AUTO_INCREMENT, `total` int(10) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Volcado de datos para la tabla `config` -- INSERT INTO `config` (`id`, `total`) VALUES (1, 176218); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `pagina` -- CREATE TABLE IF NOT EXISTS `pagina` ( `id` bigint(255) NOT NULL AUTO_INCREMENT, `titulo` varchar(200) NOT NULL, `rating` int(7) NOT NULL, `dia` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `rating` (`rating`), KEY `dia` (`dia`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;