My bad that I did not explain this more clearly since I’m a new to this PHP coding thing.
Let me explain myself:
I have a yahoo group with members who uses Paint Shop Pro, sort of like Photo Shop and with that group we share allot of tags, pictures backgrounds and fonts.
Let me explain what I am trying to accomplish:
I e-mail one of my member “Sally” a code number “123456789” to go join my website that contains a vast of public domain images and graphics for her project where she can download at no cost.
when she goes to the site to register, she is confronted with:
Enter Code number: (the one that was previously e-mailed to her)
Username
e-mail:
Password (this is encrypted as she will use this to log in later)
Once she register, Sally will get an e-mail to complete her registration
Once she complete her registration, she can normally sign in with username and password. (this portion is working fine and no code number is needed)
Now as for Mike who wants to register to my site (not a member of my yahoo group) does not have the code, he cannot register.
codenum and $codenum is what I am having trouble with.
Here is the php code to the signup.php
<?php
session_start();
require_once 'class.user.php';
$reg_user = new USER();
if($reg_user->is_logged_in()!="")
{
$reg_user->redirect('home.php');
}
if(isset($_POST['btn-signup']))
{
$uname = trim($_POST['txtuname']);
$email = trim($_POST['txtemail']);
$upass = trim($_POST['txtpass']);
$code = md5(uniqid(rand()));
$codeNum = trim($_POST['txtcodenum']);
$stmt = $reg_user->runQuery("SELECT * FROM tbl_users WHERE userEmail=:email_id, codeNum=:codeNum_id");
$stmt->(array(":codeNum_id"==$codenum));
$stmt->execute(array(":email_id"=>$email));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if($stmt->rowCount() > $codenum)
{
$msg = "
×
Sorry ! Wrong Code
";
}
else
if($stmt->rowCount() > 0)
{
$msg = "
×
Sorry ! email allready exists , Please Try another one
";
}
else
{
if($reg_user->register($uname,$email,$upass,$code))
{
$id = $reg_user->lasdID();
$key = base64_encode($id);
$id = $key;
$message = "
Hello $uname,
Welcome to groupnameyahoo Group Members webpage
To complete your registration please , just click following link
Click HERE to Activate :)
Thanks,
websitename - Moderator";
$subject = "Confirm Registration";
$reg_user->send_mail($email,$message,$subject);
$msg = "
×
Success! We've sent an email to $email.
Please click on the confirmation link in the email to create your account.
";
}
else
{
echo "sorry , Query could no execute...";
}
}
}
?>
Wizardpygal Tubes and Images
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
<link href="assets/styles.css" rel="stylesheet" media="screen">
<script src="js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script>
</div>
<div class="body">
<a href="index.html" class="logo"><img src="images/logo2.png" alt=""></a>
<p></p>
</div>
<?php if(isset($msg)) echo $msg; ?>
<form class="form-signin" method="post">
<font size="+2"><p>Login</p></font>
<input type="codenum" class="input-block-level" placeholder="Code Number" name="txtcodenum" required /><br>
<input type="text" class="input-block-level" placeholder="Username" name="txtuname" required />
<input type="email" class="input-block-level" placeholder="Email address" name="txtemail" required />
<input type="password" class="input-block-level" placeholder="Password" name="txtpass" required />
<hr />
<button class="btn btn-large btn-primary" type="submit" name="btn-signup">Sign Up</button>
<a href="index.php" style="float:right;" class="btn btn-large">Sign In</a>
</form>
</td>
</tr>
|
<center>© Copyright 2000 - 2016. websitenamel All rights reserved. All images and contents are copyright by their respected owners.</center>
<!-- </div> -->
</td>
</tr>
|
Once again, I do apologize for any inconvenience and thank you for your help and positive criticism for they are greatly appreciated for without them, I cannot learn.