-
Erro no meu formulario
Galera , estou com um poblema no meu formulario esta dando um erro na hora da visualização dele.
Parse error: syntax error, unexpected ';' in C:\wamp\www\Cadastro.php on line 51
Codigos dele Sao
Php
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';
}
?>
HTML
Código HTML:
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php if(isset( $msg_erro)):?>
<p><?php echo $msg_erro;?></p>
<?php endif; ?>
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Login id:</td>
<td><input type="text" name="usuid" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Nome:</td>
<td><input type="text" name="usuNome" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Email:</td>
<td><input type="text" name="usuEmail" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Senha:</td>
<td><input type="text" name="usoSenha" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Confirme a Senha:</td>
<td><input type="text" name="usoSenha2" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Cadastrar" /></td>
</tr>
</table>
<input type="hidden" name="usuCodigo" value="<?php echo md5(uniqid(microtime()));?>" />
<input type="hidden" name="usuData" value="" />
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p> </p>
</body>
</html>
agradeço des de já.
-
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';
}
?>
-
-
Poderia postar o erro que deu, não entendi o que você falou !
-
Nothing Found For Cadastro Php
Dai aparece a pagia do local Host
-
Este erro significa que a pagina cadastro.php não existe ou não esta no endereço fornecido, veja se vc digitou corretamente a URL de onde estão seus arquivos!
--------------------edit---------------------------
Olha, reveja seu tutorial, pois alguma coisa vc está fazendo de errado, ou o seu tutorial está errado.
Como assim ? vc está fazendo seu site em outro documento e o cadastro é no local host?
-
é nao entendi , tipo eu to fazendo meu site em outro documento , esse do cadastro é no locahost
to usando o wampserve
seguinte um tutorial, eu fiz tudo que tava no video ai deu aquele erro.
agora com esse codigo da esse erro
o cadastro.php ta dentro da pasta www do whamps
Editado
é eu fiz tudo que manda no tutorial Revi algumas vezes , a pagina do cadastro ta no local Host, engraçado que no programa ta tudo ok o Design do formulario o poblema é o codigo php tem algum erro eu acho ;s
obrigado pela ajuda
olha coloquei uma index no site com um link pra pagina de cadastro
[Only registered and activated users can see links. Click Here To Register...]
veja o que acontece
-
Olha neste caso só pode ser 2 coisas, ou sua hospedagem não tem suporte para php, ou vc salvou a página de cadastro com a extensão html.
-
Editado
Galera meu erro agora é o seguinte, na hora de testa no navegador nao roda meu formulario
Código PHP:
<? virtual('/Connections/sitemaCadastro.php'); ?>
<?
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
//confere se asenha combina
$cadastro = false;
if($_POST['usuSenha']== $_POST['usuSenha2']){
$cadastro = true;
}
if($cadastro){
$insertSQL = sprintf("INSERT INTO `user` (usuNome, usuEmail, usuSenha, usuCodigo, usuData) VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($_POST['usuNome'], "text"),
GetSQLValueString($_POST['usuEmail'], "int"),
GetSQLValueString(md5($_POST['usuSenha']), "text"),
GetSQLValueString($_POST['usuCodigo'], "int"),
GetSQLValueString($_POST['usuData'], "date"));
mysql_select_db($database_sitemaCadastro, $sitemaCadastro);
$Result1 = mysql_query($insertSQL, $sitemaCadastro) 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';
}
}
?>
Código HTML:
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<p>
<? if(isset( $msg_erro)):?>
</p>
<p><? echo $msg_erro;?></p>
<? endif;?>
<form action="<? echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Nome:</td>
<td><input type="text" name="usuNome" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Email:</td>
<td><input type="text" name="usuEmail" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Senha:</td>
<td><input type="text" name="usuSenha" value="" size="32" /></td>
<tr valign="baseline">
<td nowrap="nowrap" align="right">ConfSenha:</td>
<td><input type="text" name="usuSenha2" value="" size="32" /></td>
</tr>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Cadastrar" /></td>
</tr>
</table>
<input type="hidden" name="usuCodigo" value="<? echo md5(uniqid(microtime()));?>" />
<input type="hidden" name="usuData" value="" />
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p> </p>
</body>
</html>
no caso ta tudo diretinho os codigos de php, se a senha estiver errada aparece uma mensagem avisando de acordo com o codigo, mais nao hora do teste nao, so clicar em cadastra aparece o erro
Forbidden
You don't have permission to access /< on this server.
e vai pra essa pagina <? echo $editFormAction; ?>
que nao era pra acontecer pos o codigo manda ir para a pagina login.php após o cadastro , entao eu nao tou entendendo