1
Personal my question is the following, I have the page criareditarevento.php
that updates information from a registration system, but I need to make the update message open inside the page main.php
which is the page where the switch ($_GET['pag'])
pattern.
PAGE CREATEDIAREVENTO.PHP
<?
session_start();
include("config.php");
$ip = $_SERVER['REMOTE_ADDR'];
$sqlcontent = mysql_query("select * from usr_config");
$content = mysql_fetch_array($sqlcontent);
if(!isset($_SESSION[usr_name]) || empty($_SESSION[usr_name]) || !isset($_SESSION[usr_level]) || empty($_SESSION[usr_level]))
{
session_destroy();
session_unset();
die('
<div align="center">
<font face="verdana" size="2" color="#000">Você precisa estar logado para visualizar essa página...</font>
</div>
');
}
include("func.php");
$update = clean($_GET[update]);
$getprof = mysql_query("select * from usr_users where username = '$_SESSION[usr_name]'");
$teste = mysql_query("select * from usr_users where username = '$_SESSION[usr_name]'");
$prof = mysql_fetch_array($getprof);
?>
<? if(!$update) { ?>
</font>
<form action="criareditarevento.php?update=update" method="post">
<font color="#FFFFFF">
<b><u><font size="1">Sua Conta</font></u></b><font size="1"><br />
<font color="#000000"><br />
Nome: <? echo("<b>$_SESSION[usr_name]</b>");?><br />
<br />
Email:<br />
</font></font></font><font color="#000000" size="1" face="Verdana">
<input class="subbutton" name="email" type="text" value="<? echo("$prof[email]");?>" size="40"?>
</font><font size="1" color="#000000"><br />
Site/Blog:<br />
</font><font color="#000000" size="1" face="Verdana">
<input class="subbutton" name="avator" type="text" value="<? echo("$prof[avator]");?>" size="50"?>
</font><font size="1" color="#000000"><br>
Hobbie:<br />
</font><font color="#000000" size="1" face="Verdana">
<input class="subbutton" name="hobbie" type="text" value="<? echo("$prof[hobbie]");?>" size="50"?>
</font><font size="1" color="#000000"><br />
<br />
<u><b>Trocar senha</b></u><br />
<em>Se não quiser trocar a Senha, Não
preencha os Campos Abaixo</em><br />
<br />
Atual Senha:<br />
</font><font color="#000000" size="1" face="Verdana">
<input class="subbutton" name="oldpw" type="password" size="30" />
</font><font size="1" color="#000000">
<br />
Nova Senha:<br />
</font><font color="#000000" size="1" face="Verdana">
<input class="subbutton" name="new1" type="password" size="30" />
</font><font size="1" color="#000000">
<br />
Repetir Nova Senha:<br />
</font><font color="#000000" size="1" face="Verdana">
<input class="subbutton" name="new2" type="password" size="30" />
</font><font size="1" color="#000000">
<br />
<br />
</font><font color="#000000" size="1" face="Verdana">
<input class="subbutton" type="submit" value="Atualizar" />
</font>
</form>
<font size="1" color="#000000">
<? }
elseif($update==update)
{
$email = clean($_POST[email]);
$avator = clean($_POST[avator]);
$hobbie = clean($_POST[hobbie]);
$updateemail = mysql_query("update usr_users set email = '$email', avator = '$avator', hobbie = '$hobbie' where username = '$_SESSION[usr_name]'");
$oldpw = clean($_POST[oldpw]);
$new1 = clean($_POST[new1]);
$new2 = clean($_POST[new2]);
if($oldpw!="")
{
$checkpass = md5($oldpw);
$check2 = mysql_query("select * from usr_users where password = '$checkpass' and username = '$_SESSION[usr_name]'");
$check = mysql_num_rows($check2);
if($check==1)
{
if($new1==$new2)
{
$password = md5($new1);
$updatepass = mysql_query("update usr_users set password = '$password' where username = '$_SESSION[usr_name]'");
echo("Your password has been updated!<br />");
}
else echo("The two passwords do not match!");
}
else echo("The password you entered does not match your current password.");
}
echo("Your Preferences have been updated!");
} ?>
</font><font size="1" color="#FFFFFF"> </font>
</div></td>
MAIN PAGE.PHP:
<?php
switch ($_GET['pag'])
{
case "criareditarevento": include("criareditarevento.php"); break;
case "teste2": include("teste2.php"); break;
case "desconectar": include("desconectar.php"); break;
default: include("principal.php"); break;
}
?>
Waiting for help :D
It is unclear what you want to do. the main.php page will be called after the update?
– Emerson Barcellos
Try to change
<form action="criareditarevento.php?update=update" method="post">
for<form action="main.php?page=criareditarevento&update=update" method="post">
– Alisson Acioli
> Thanks <b>Alisson Acioli</b>, it worked :D
– Paulo Pimentel