Username Checking

From Tmmwiki

Jump to: navigation, search
NATS 4
Sites Admin
The Sites Admin
Sites
Sites Setup
NATS4 Post URLs
Token Sites
ID Numbers
Site Partner
Site User Management
Tour Redirection
Username Checking
NATS4 Post-Biller Templates
Join Option Box vs Button
Qualified Join Page Hits
Type-In Traffic
Allowed languages

NATS 3
Sites Admin
NATS Sites
Site Setup
Tour Redirection
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

NATS can query your local database or password file with a script to see if a username exists. The script should take variables: a site ID number and a username. If the username 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*';}

 ?>

Go to the Sites Admin, edit or create a site, and enter the URL to your script in the Userpost URL field.

products