Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php require_once('../../Connections/conecta_site.php'); ?>
- <?php
- if (!function_exists("GetSQLValueString")) {
- function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
- {
- if (PHP_VERSION < 6) {
- $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
- }
- //Inicia aqui
- $theValue = function_exists("mysqli_real_escape_string") ? mysqli_real_escape_string($theValue) : mysqli_real_escape_string($theValue);
- //Termina aqui
- 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"] == "form")) {
- $insertSQL = sprintf("INSERT INTO newsletter (nome, email) VALUES (%s, %s)",
- GetSQLValueString($_POST['nome'], "text"),
- GetSQLValueString($_POST['email'], "text"));
- //Inicia aqui
- $db_select = mysqli_select_db($STRING_DE_CONEXAO_COM_O_BANCO, "NOME_DO_SEU_BANCO");
- //Termina aqui
- //Inicia aqui
- $Result1 = mysqli_query($insertSQL, $db_select) or die(mysqli_error());
- //Termina aqui
- $insertGoTo = "newsletter.php";
- if (isset($_SERVER['QUERY_STRING'])) {
- $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
- $insertGoTo .= $_SERVER['QUERY_STRING'];
- }
- header(sprintf("Location: %s", $insertGoTo));
- }
- ?>
- <link href="css/estilos.css" rel="stylesheet" type="text/css" />
- <form method="POST" name="form" action="<?php echo $editFormAction; ?>"POST" >
- <ul>
- <li> <label class="name_newsletter" for="name">Nome:</label> <input type="nome" class="news_footer_name" name="nome" id="nome" maxlength="100" /></li>
- <li> <label class="email_newsletter" for="email">E-mali:</label> <input type="email" class="news_footer_mail" name="email" id="email" maxlength="100"/></li>
- <input class="btn_newsletter" type="submit" value="Cadastrar" id="btnSend">
- <input type="hidden" name="MM_insert" value="newsletter" />
- <input type="hidden" name="MM_update" value="newsletter" />
- <input type="hidden" name="MM_insert" value="form" />
- </form>
- </ul>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement