Tente ae!
Código PHP:
<?php virtual('/Connections/sistemaCadastro.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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")) {
//confere se a senha combina
$cadastro = false;
if($_POST['usoSenha']== $_POST ['usosenha2']){
$cadastro = true;
}
}
if($cadastro) {
$insertSQL = sprintf("INSERT INTO usuarios (usuid, usuNome, usuEmail, usoSenha, usuCodigo, usuData) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['usuid'], "int"),
GetSQLValueString($_POST['usuNome'], "text"),
GetSQLValueString($_POST['usuEmail'], "text"),
GetSQLValueString(md5($_POST['usoSenha']), "text"),
GetSQLValueString($_POST['usuCodigo'], "text"),
GetSQLValueString($_POST['usuData'], "date"));
mysql_select_db($database_sistemaCadastro, $sistemaCadastro);
$Result1 = mysql_query($insertSQL, $sistemaCadastro) or die(mysql_error());
$insertGoTo = "login.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}else{
$msg_erro = 'As senhas digitadas nao conferem';
}
?>