Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
alguém me pode ajudar é que me esta a duplicar os dados
segue-se os código
alguem me pode dizer onde esta o erro
<?php require_once('Connections/ola.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "5";
$MM_donotCheckaccess = "false";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && false) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "admin_membros.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
$MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?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;
}
}
?>
<!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">](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
// included database information
include('connections/ola.php');
if(!isset($_POST['join'])){
echo "<form method=\"post\" action=\"verificacao.php\">
<label>VEREFICACAO</label><br/><input name=\"username\"/><br/>
<input type=\"submit\" name=\"join\" value=\"verificacao\"/>
</form>";$user = mysql_real_escape_string($_POST['username']);
$condb;
$seldb;
$sql=("SELECT * FROM tb_users WHERE username='".$_SESSION['MM_Username']."'") or die("ERRO:".mysql_error());
$con = mysql_query($sql)or die("CODIGO DE VERIFICACAO ENCONTRA-SE ERRADA. MySQL erro: ".mysql_error());
$result = (mysql_fetch_array($con));
if($_POST['username'] == $result['verificacao']){
$con = mysql_query("UPDATE tb_users SET idnivel=4, registado='$user' WHERE username='".$_SESSION['MM_Username']."'") or die ("Registo ja existe volte a tentar - <a href=\"verificacao.php\">Volta a tentar</a>".mysql_error());
echo "verificao feita com sucesso- <a href=\"index.php\">entrar</a>.";
mysql_query("INSERT INTO usercidade (id_user,id_cidade)(SELECT tb_users.id,cidades.id FROM tb_users,cidades where tb_users.username='".$_SESSION['MM_Username']."')") or die ("ERRO".mysql_error
());
mysql_query("INSERT INTO cidaderecursos (id_cidade,id_recursos)(SELECT cidades.id,recursos.id FROM tb_users,cidades,recursos where tb_users.username='".$_SESSION['MM_Username']."')") or die ("ESTE NAO FUNCA".mysql_error());
} else {
echo "Error - <a href=\"verificacao.php\">Volta a tentar</a>";
}
}
?>Carregando comentários...