Cita:
Iniciado por glx Gracias por las respuestas, sin entender el porque de la solucion propuesta realice el cambio y todo sigue igual.
No logro entender esta sentencia, por lo tanto no puedo razonar el criterio aplicado.
action="guardar.php?accion=guardar"
Generalmente encuentro action=xxxx.php pero lo que sigue despues me marea ?accion=guardar
ok te lo voy a explicar detalladamente y pasito a pasito presta atencion
crea una base de datos y llamala users
user.sql
CREATE TABLE `users` (
`ID` int(11) NOT NULL auto_increment,
`Username` varchar(255) NOT NULL,
`Password` varchar(255) NOT NULL,
`Temp_pass` varchar(55) default NULL,
`Temp_pass_active` tinyint(1) NOT NULL default '0',
`Email` varchar(255) NOT NULL,
`Active` int(11) NOT NULL default '0',
`Level_access` int(11) NOT NULL default '2',
`Random_key` varchar(32) default NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `Username` (`Username`),
UNIQUE KEY `Email` (`Email`)
) ENGINE=MyISAM;
ok ahora crea un formulario .html y llamalo registrar.html
al primero lo llamaremos registrar.html
registrar.html
Código PHP:
Ver original<?php
require_once('db.php');
include('functions.php');
if(isset($_POST['register'])) {
if($_POST['username']!='' && $_POST['password']!='' && $_POST['password']==$_POST['password_confirmed'] && $_POST['email']!='' && valid_email($_POST['email'])==TRUE && checkUnique('Username', $_POST['username'])==TRUE && checkUnique('Email', $_POST['email'])==TRUE)
{
{//there's only one MATRIX :PP
$subject = "Activation email from ourdomainhere.com";
$message = "Dear ".$row['Username'].", this is your activation link to join our website. In order to confirm your membership please click on the following link: http://www.ourdomainhere.com/confirm.php?ID=".$row['ID']."&key=".$row['Random_key']." Thank you for joining";
if(mail($row['Email'], $subject, $message, $headers)) {//we show the good guy only in one case and the bad one for the rest.
$msg = 'Account created. Please login to the email you provided during registration and confirm your membership.';
}
else {
$error = 'I created the account but failed sending the validation email out. Please inform my boss about this cancer of mine';
}
}
else {
$error = 'You just made possible the old guy (the impossible). Please inform my boss in order to give you the price for this.';
}
}
else {
$error = 'There was an error in your data. Please make sure you filled in all the required data, you provided a valid email address and that the password fields match';
}
}
?>
<?php if(isset($error)){ echo $error;}?> <?php if(isset($msg)){ echo $msg;} else {//if we have a mesage we don't need this form again.?> <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
Username: <input type="text" id="username" name="username" size="32" value="<?php if(isset($_POST['username'])){echo $_POST['username'];}?>" /><br />
Password: <input type="password" id="password" name="password" size="32" value="" /><br />
Re-password: <input type="password" id="password_confirmed" name="password_confirmed" size="32" value="" /><br />
Email: <input type="text" id="email" name="email" size="32" value="<?php if(isset($_POST['email'])){echo $_POST['email'];}?>" /><br />
<input type="submit" name="register" value="register" /><br />
</form>
<? } ?>
ok ahora crearemos 4 archivos de tipo .php
aqui los 4 archivos
confirm.php
Código PHP:
Ver original<?php
require_once('db.php');
include('functions.php');
if($_GET['ID']!='' && numeric
($_GET['ID'])==TRUE && strlen($_GET['key'])==32 && alpha_numeric
($_GET['key'])==TRUE) {
{
if($row['Active']==1)
{
$error = 'This member is already active !';
}
elseif($row['Random_key']!=$_GET['key'])
{
$error = 'The confirmation key that was generated for this member does not match with the one entered !';
}
else
{
$msg = 'Congratulations ! You just confirmed your membership !';
}
}
else {
$error = 'User not found !';
}
}
else {
$error = 'Invalid data provided !';
}
{
echo $error;
}
else {
echo $msg;
}
?>
confir_passwoord.php
Código PHP:
Ver original<?php
require_once('db.php');
include('functions.php');
{
if($row['Temp_pass']==$_GET['new'] && $row['Temp_pass_active']==1)
{
$msg = 'Your new password has been confirmed. You may login using it.';
}
else
{
$error = 'The new password is already confirmed or is incorrect';
}
}
else {
$error = 'You are trying to confirm a new password for an unexisting member';
}
{
echo $error;
}
else {
echo $msg;
}
?>
sigo en la proxima cita continuar