Username Checking

From TMMwiki
Jump to: navigation, search
NATS 4
Sites Admin
The Sites Admin
Sites
Site Setup
Site Templates
Tour Setup
Join Options
No Cost Registration
Special Pricing Options
Join Option Rules
Post URL Usage
Post URLs in NATS4
Approval/Upgrade/Denial Variables
Approval/Upgrade/Denial Template Variables
Mobile Tours
Token Sites
ID Numbers
Site Partner
Site User Management
Configure Redirects
Split A-B Testing
Username Checking
Form Validation
Post-Biller Templates
Send Information To Special Biller
Join Option Box vs Button
Qualified Join Page Hits
Allowed languages
Customize Join Form
Package Plus
Token Plus
Signup Plus
Type-In Traffic
Coupon Codes
Setting Rules
Site Groups
ATVOD Verification Process

NATS 3
Sites Admin
Sites
Site Setup
Configure Redirects
ID Numbers
Automail
Site User Management
Username Checking
Join Form Errors
Free Pre-Initial Checkbox
Payouts Based on Program and Join Options
Payouts Based on Join Option and Per Option
Adding Extra Site Tours
Site Partner
Join Options
Multisite Access
Removing Join Options
Tour Setup
Site Undelete
Join Option Box vs Button
Redirecting Traffic to a Sponsor
Qualified Join Page Hits
Type-In Traffic
Allowed languages
Linkcode Decoding

Username Scripts

NATS can query your local database or password file with a PHP script to see if a particular username exists in your database. This script should take two variables: a site ID number and a username. If the username in question exists, the script should return "*exists*"; if the username doesn't exist, the script should return "*available*". For example:

<?php
//pull variables out of query string;
$siteid = $_GET['siteid'];
$username = $_GET['username'];

//initialize password file
$passwordfile = ' ';


//set password file based on site id
switch($siteid)
{
 
 //if siteid = 1, passwordfile = path to password file for site 1
  case 1:
    $passwordfile='/home/web/onesite/.htpasswd';
    break;
 
  case 2:
    $passwordfile='/home/web/differentsite/.htpasswd';
    break; 
}

//now that we know what file to open, open that file to read
$openfile = fopen($passwordfile, 'r');

//get the contents of the open file
$filecontents = fread($openfile, filesize($passwordfile));

//search file contents for username

if(strpos($filecontents, $username)===0) { echo '*available*'; }
else { echo '*exists*';}

 ?>

Email Scripts

NATS can also query your local database or password file with a PHP script that checks if a particular email address exists in your database. This is particularly useful for sites that only allow one member account per email address. If the email address in question exists, the script should return "*exists*" and if the email address does not exist, the script should return "*available*".

If you want to use the user post feature to return an email error, you can return *exists*,email in the response string of your PHP code and NATS will assign the following error:

"Sorry, Email address already taken. Please Choose Another." to the Smarty variable $errors['email'].

Implementing Your Script

To use your script, go to the Sites Admin and edit the tour you want the script to take effect on. On the Edit Tour page, go to Postback URLs and click Show/Hide Advanced Settings to expand the category. Under Username Post URL, enter your script's URL to make it take effect.

Username Post URL Field