este es de cuando se registra lo que hace es enviar un mail que lleva un numero de verificacion para completar el registro.
Código:
<?
// send email
$myname = $contact_name;
$myemail = $contact_email;
$contactname = $signup[rname];
$contactemail = $signup[email];
$message = "Hello ".$signup[fname].",<BR>".
"Greetings to our newest member! Here is your login info:<BR><BR>".
"username: ".$signup[username]."<BR>".
"password: ".$signup[password]."<BR>".
"activation code: ".$acode."<br><br>".
"<B>To activate your account, simply visit this address: <a href='".$siteUrl."activate.php?username=".$signup[username]."&acode=".$acode."'>".$siteUrl."activate.php?username=".$signup[username]."&acode=".$acode."</a></b><br><br>".
"When you log in, your first step should be to enter your websites to advertise. Don't forget your password!";
$subject = "Welcome to $title";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$contact_email."\r\n";
$headers .= "To: ".$contactemail."\r\n";
$headers .= "Reply-To: ".$contact_name."\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: Just My Server";
mail($contactemail, $subject, $message, $headers);
$signup[username] = "";
echo "You should be receiving an activation email from us shortly.";
?>
Y este es el que se supone que valida los usuarios.
Código:
<?php
session_start();
require 'dconn.php';
$connection = mysql_connect($db_server, $db_user,$db_pass) or die(mysql_error());
mysql_select_db($db_name, $connection) or die(mysql_error());
$uname = $_POST['uname'];
$password = $_POST['password'];
//establecer la consulta
$query = "SELECT * FROM $user_table WHERE username='$uname' AND password='$password'";
//ejecutar la consulta y obtener el número de filas afectadas
$result = mysql_query($query, $connection) or die('error making query');
$affected_rows = mysql_num_rows($result);
//si no es exactamente uno de los resultados, el usuario es validado. De lo contrario, es válido
if($affected_rows == 1) {
$result = mysql_query("SELECT userid, verified, username AS uuname FROM $user_table where username='$uname'",$connection);
if ($myrow = mysql_fetch_array($result)) {
if ($myrow["verified"] == 'n') {
die("You have not yet verified your account.");
}
$_SESSION["id"]=$myrow['userid'];
$_SESSION["username"]=$myrow['uuname'];
header("Location: start.php?option=main");
} else {
echo "No se encontraron sus datos por favor<a href='index.php'>Registrese</a>";
}
} else {
echo mysql_error();
header ("Location: index.php?invalid=invalid+username/password");
}
?>
Y este los activa
Código:
<?
require 'require.inc.php';
$j_name=$username;
// activate.php - activate user
$acode = addslashes($acode);
$checkql = mysql_query("select * from $user_table WHERE username='$j_name' AND verified!='y' AND activationcode='$acode'");
if (mysql_num_rows($checkql) > 0) {
$userrow = mysql_fetch_array($checkql);
mysql_query("UPDATE $user_table SET verified = 'y' where username = '$j_name' AND activationcode='$acode'") or die("There was an error validating your existence, please contact an admin.");
mysql_query("UPDATE $user_table SET points=points+100 WHERE username='".$userrow["ref"]."'");
// print result
?>
<center>
<font size=-1>You Are Now Activated! <BR>
<a href='index.php'>Go back to the main page to log in</a>.</font>
</center>
<?
} else {
die ("Either your username does not exist, you are already validated, or you supplied the wrong activation code.");
}
// close database connection
mysql_close($connection);
?>
y aca el index donde empieza todo
Código:
<?php
require 'require.inc.php';
// Unset all of the session variables.
@session_unset();
// Finally, destroy the session.
@session_destroy();
/*
if ($_GET('signup')) {
error("SIGNUP");
echo "Error Checking<br>";
while(list($name, $value) = each($signup)) {
echo "$name - $value<br>";
}
}
*/
if (@$signup) {
if (@$signup[repassword] != @$signup[password]) {
$err_msg = "Your passwords do not match.";
error($err_msg);
}
if(!eregi("^[_\.0-9a-z-]+$",@$signup[username])) {
$err_msg = "Invalid Username! Usernames can consist of letters and numbers only.";
error($err_msg);
}
if(!eregi("^[_\.0-9a-z-]+$",@$signup[password])) {
$err_msg = "Invalid Password! Passwords can consist of letters and numbers only.";
}
if(!@$signup[password] || !@$signup[username] || !@$signup[email] || !@$signup[username]) {
$err_msg = "Oops! You forgot some important fields!"; }
if (mysql_num_rows(mysql_query("Select username from $user_table where username = '$signup[username]'")) > 0) {
$err_msg = "Oops! Someone already has that username.";
}
if (!@$err_msg) {
srand((double)microtime()*1000000);
$acode = rand(100000, 199999);
$usercheck = @mysql_query("INSERT INTO $user_table (username, realname, email, password, verified, activationcode, type, points, joindate, ref) values('$signup[username]','$signup[rname]',
'$signup[email]','$signup[password]', 'n', $acode, 'free', $signPoints, ".time().", '$signup[ref]')");
// done, you are entered correctly, Now Enter the points and URL info
$sql = "Select userid from $user_table where username='$signup[username]'";
$result = mysql_query( $sql );
if ( $result != false )
{
while ( $data = mysql_fetch_assoc( $result ) )
{
$point_set = $data['id'];
}
} else {
echo mysql_error();
}
if (!@$usercheck) {
$err_msg = "Database error:<br>There was an error entering your account.<br>It is possible that username already exists, please try another one.<br>";
} else {
include ("reg.php");
exit;
}
}
if (!@$err_msg) {
// done, you are entered correctly
}
} else {
}
?>
<html>
<head><title>
<? echo $title; ?> - Surf Exchange Engine
</title>
<META NAME="keywords" CONTENT="free surf manual surf exchange money get paid traffic visitors hits">
<META NAME="description" CONTENT="Generate crazy hits to your website by visiting others, and earning money!">
</head>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<BODY aLink="#333333" bgColor="white" link="#333333" text="#000000" vLink="#333333">
<basefont face='tahoma'><table width=100% background='images/1.jpg' cellpadding="0" cellspacing="0" style="background-repeat: no-repeat">
<tr valign="middle">
<td colspan="2" valign='middle'> <br>
<blockquote> <b><font face="Verdana, Arial, Helvetica, sans-serif" color="#000099" size=6>
<? echo $title; ?></font></b> </blockquote>
</td>
</tr>
<tr>
<td width=60% bgcolor="#FFFFFF" align="center"><small>(<a href='reset.php'>I've lost my password</a>)</small></td>
<td width="40%" align="right" class="nowrapbg" background="images/logback.jpg" style="background-repeat: no-repeat"><small>
<form action='validate.php' method=post>
<font size="2">Username:
<input name="uname" type="text" size="6">
Password:
<input name="password" type="password" size="7">
<input type="image" border="0" name="imageField" src="images/arrow.gif" width="17" height="17">
</font>
</form>
</small></td>
</tr>
</table><font color=red><? echo @$invalid; echo "<br>"; ?></font>
<? echo $mainText;
if (@!$signup[ref]) { $signup[ref] = $ref; } ?>
<? if (@$err_msg) echo "<br><font color=red size=2>$err_msg</font><br>"; ?>
<form name="form" action="<? echo $PHP_SELF; ?>" method="POST">
<input type="hidden" name="signup" value="true">
<input type="hidden" name="signup[ref]" value="<? echo $signup[ref]; ?>">
<table width=100% cellpadding="2" cellspacing="0" align=center>
<tr>
<td colspan=2 bgcolor="#CCCCFF"><b>Please Enter Your
Information:</b></td>
<tr><td>Real Name:</td><td><input type="text" name="signup[rname]" maxlength="36" size="25" value="<? echo @$signup[rname]; ?>"></td></tr><tr><td> E-mail:</td><td><input type="text" name="signup[email]" maxlength="255" size="25" value="<? echo @$signup[email]; ?>"></td></tr>
<tr>
<td colspan = 2 bgcolor="#CCCCFF"> <b>Please supply
a Username and Password</b></td>
</tr><tr><td> Username:</td><td>
<input type="text" name="signup[username]" maxlength="10" size=25 value="<? echo @$signup[username]; ?>"></td></tr><tr><td> Password:</td><td> <input type="password" name="signup[password]" maxlength=10 size="25"></td></tr><tr> <td> Re-Enter Password:</td><td>
<input type="password" name="signup[repassword]" size=25></td></tr>
<tr align="center">
<td colspan=2>Press the button below ONCE to continue the process it will
take a few seconds, please be patient! </td>
</tr>
<tr align="center">
<td colspan=2>
<input name="submit2" type="submit" value="Signup">
</td>
</tr></table></form>
<tr><td width="800" align="center"> <CENTER>
<table>
<tr>
<td class="font" align=center><a href="contact.php" target=_blank>-contact us-</a> <a href="privacy.htm" target="_blank">-privacy policy-</a> <a href="spam.htm" target="_blank">-spam policy-</a><br>
This has been a Sabu production</td>
</tr>
</table>
</CENTER></td></tr>
</body></html>
todo funciona perfecto manda el mail con el correo y todo pero al momento de hacer clik al link de validar sale el erro de que ya fue activado o no existe como dije en el primer post.
Y probando lo que me dijiste me salio esto.
Parse error: syntax error, unexpected T_VARIABLE in /home/shruken1/public_html/traficogratis.cz.cc/activate.php on line 5