Jump to content

activate.php membership tutorial


tecdesign

Recommended Posts

I have done everything it says in the tutorial yet it won't make the account activated here is my scripts

ACTIVATE.PHP
<?
/* Account activation script */

// Get database connection
include 'db.php';

// Create variables from URL.

$userid = $HTTP_GET_VARS['id'];
$code = $HTTP_GET_VARS['code'];

$sql = mysql_query("UPDATE users SET activated='1' WHERE userid='$userid' AND password='$code'");

$sql_doublecheck = mysql_query("SELECT * FROM users WHERE userid='$userid' AND password='$code' AND activated='1'");
$doublecheck = mysql_num_rows($sql_doublecheck);

if($doublecheck == 0){
echo "<strong><font color=red>Your account could not be activated!</font></strong>";
} elseif ($doublecheck > 0) {
echo "<strong>Your account has been activated!</strong> You may login below!<br />";
}

?>

Email

Dear adfasd asdfasdf
Thank you for registering at X Tec, you now have access to the forum, blog, and the X Tec knowledge base.

To confirm your registration please activate your account by clicking on the link below: [a href=\"http://www.tecdesign.co.nz/activate.php?id=12&code=22ca8686bfa31a2ae5f55a7f60009e14\" target=\"_blank\"]http://www.tecdesign.co.nz/activate.php?id...5f55a7f60009e14[/a]

Once you activate your memebership, you will be able to login
with the following information:
Username: asfds
Password: asdfasd

Thanks!
Matthew Jones

This is an automated response, please do not reply!

REGISTERIT.PHP

<?php

$dbh=mysql_connect ("localhost", "username", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("tecdnco_xtec");

$username = $HTTP_POST_VARS['username'];
$db_password = $HTTP_POST_VARS['password'];
$first_name = $HTTP_POST_VARS['first_name'];
$last_name = $HTTP_POST_VARS['last_name'];
$email_address = $HTTP_POST_VARS['email_address'];
$bizname = $HTTP_POST_VARS['bizname'];
$phone = $HTTP_POST_VARS['phone'];
$mobile = $HTTP_POST_VARS['mobile'];
$fax = $HTTP_POST_VARS['fax'];
$street_address = $HTTP_POST_VARS['street_address'];
$country = $HTTP_POST_VARS['country'];
$region = $HTTP_POST_VARS['region'];
$city = $HTTP_POST_VARS['city'];

$password = md5($db_password);

$sql = "INSERT INTO `members` (`username`, `password`, `first_name`, `last_name`, `email_address`, `bizname`, `phone`, `fax`, `street_address`, `country`, `city`, `region`, `mobile`)
VALUES (
'". $HTTP_POST_VARS['username'] ."',
'$password',
'". $HTTP_POST_VARS['first_name'] ."',
'". $HTTP_POST_VARS['last_name'] ."',
'". $HTTP_POST_VARS['email_address'] ."',
'". $HTTP_POST_VARS['bizname'] ."',
'". $HTTP_POST_VARS['phone'] ."',
'". $HTTP_POST_VARS['fax'] ."',
'". $HTTP_POST_VARS['street_address'] ."',
'". $HTTP_POST_VARS['country'] ."',
'". $HTTP_POST_VARS['city'] ."',
'". $HTTP_POST_VARS['region'] ."',
'". $HTTP_POST_VARS['mobile'] ."')";


$result = mysql_query($sql);

if(!$sql) {
echo "there has been a problem trying to register you as a user, please try again.";
}
else {
$userid = mysql_insert_id();
$subject = "Registration with X Tec";
$message = " Dear $first_name $last_name
Thank you for registering at X Tec, you now have access to the forum, blog, and the X Tec knowledge base.

To confirm your registration please activate your account by clicking on the link below: [a href=\"http://www.tecdesign.co.nz/activate.php?id=$userid&code=$password\" target=\"_blank\"]http://www.tecdesign.co.nz/activate.php?id...=$password[/a]

Once you activate your memebership, you will be able to login
with the following information:
Username: $username
Password: $db_password

Thanks!
Matthew Jones

This is an automated response, please do not reply!";

mail($email_address, $subject, $message,
"From: X Tec support@tecdesign.co.nz\n
X-Mailer: PHP/" . phpversion());
echo 'Your membership information has been mailed to your email address!
Please check it and follow the directions!';
}
?>

I am not sure what the problem is I have constantly checked the code and it makes sense to me but not to the server.


Link to comment
Share on other sites

  • 4 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.