Jump to content


Photo

activate.php membership tutorial


  • Please log in to reply
3 replies to this topic

#1 tecdesign

tecdesign
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 28 March 2006 - 08:40 PM

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.




#2 tecdesign

tecdesign
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 29 March 2006 - 12:57 AM

by the way I am using php 4.41 and mysql 4.0.25

#3 tecdesign

tecdesign
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 29 March 2006 - 01:20 AM

I solved the problem. my table was called members not users. LOL it is always something stupid.

#4 AdRock

AdRock
  • Members
  • PipPipPip
  • Advanced Member
  • 911 posts

Posted 04 August 2006 - 12:52 AM

where did you find the tutorial?....i have been looking for ages but can't find one anywhere.
If your topic has been solved, please mark the topic as SOLVED.

This helps others from identifying which topics need help still




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users