<% if (!preg_match('/bboard/', $_SERVER['REQUEST_URI'])) { /* * Session Management for PHP3 * * Copyright (c) 1998-2000 NetUSE AG * Boris Erdmann, Kristian Koehntopp * * $Id: prepend.php3,v 1.4 2001/07/14 20:24:55 kk Exp $ * */ $_PHPLIB = array(); $_PHPLIB["libdir"] = "/var/www/vhosts/softaps.com/httpdocs/phplib/"; require($_PHPLIB["libdir"] . "db_mysql.inc"); /* Change this to match your database. */ require($_PHPLIB["libdir"] . "ct_sql.inc"); /* Change this to match your data storage container */ require($_PHPLIB["libdir"] . "session.inc"); /* Required for everything below. */ require($_PHPLIB["libdir"] . "auth.inc"); /* Disable this, if you are not using authentication. */ require($_PHPLIB["libdir"] . "perm.inc"); /* Disable this, if you are not using permission checks. */ require($_PHPLIB["libdir"] . "user.inc"); /* Disable this, if you are not using per-user variables. */ /* Additional require statements go below this line */ # require($_PHPLIB["libdir"] . "menu.inc"); /* Enable to use Menu */ require($_PHPLIB["libdir"] . "greg.inc"); /* Enable to use Menu */ /* Additional require statements go before this line */ require($_PHPLIB["libdir"] . "local.inc"); /* Required, contains your local configuration. */ require($_PHPLIB["libdir"] . "page.inc"); /* Required, contains the page management functions. */ } %> <% page_open( array("sess" => "SOFTAPS_NC_Session", "auth" => "SOFTAPS_Default_Auth", "perm" => "SOFTAPS_Perm")); if (isset($perm) && $perm->have_perm("admin")) $admin=1; include "$Root_dir/includes/validate_email.php"; include "common.php"; %> <% $months = array ('','January','February','March','April','May','June','July','August','September','October','November','December'); $currentyear = date("Y",time()); $data = new DB_SOFTAPS; $db = new DB_SOFTAPS; $dbd = new DB_Data; %> Account Profile :: <% echo $Company_name %>
SofTap Permanent Cosmetics
<% include $Header_admin; %> <% function fill_data() { global $input, $membervars; global $password, $username, $perms, $user_id; global $months, $currentyear, $data, $db, $valid, $edit; global $Company_name, $Domain_name, $Root_dir; # fill up data with current user information $query = "select * from data where user_id='".$user_id."'"; $data->query($query); $query = "select * from auth_user where user_id='".$user_id."'"; $db->query($query); if ($data->num_rows() > 0 && $db->num_rows() > 0) { $data->next_record(); $db->next_record(); foreach ($membervars as $val) { $input[$val] = $data->f($val); } $password = $db->f("password"); $username = $db->f("username"); $perms = $db->f("perms"); } else { $error = 1; my_error ("

Sorry, there is no data for the record you are wanting to edit.

\n"); unset($save); unset($success); exit(); } } function check_data() { global $input; global $password, $username, $perms, $user_id; global $months, $currentyear, $data, $db, $valid, $edit; global $Company_name, $Domain_name, $Root_dir; global $badphone, $badzip, $badbusinessid; $input[firstname] = ucfirst($input[firstname]); $input[lastname] = ucfirst($input[lastname]); $username = strtolower($username); # check validity of submission $valid = 1; if (!$edit) { # these checks are for new submissions only if (!empty($input[email])) { $data->query("select user_id from data where email like '$input[email]'"); if ($data->num_rows() > 0) { $valid = 0; $data->next_record(); $user_id = $data->f("user_id"); print "

Sorry, this submission contains an email address that is the same as one already contained in our Account Center. If this message is in error, please email webmaster@$Domain_name with your name and the email address you put on your application.


\n"; } } if ($valid == 1) { $db->query("select username from auth_user where username = '$username'"); if ($db->num_rows() > 0) { $valid = 0; print "

Sorry, this submission contains a username that is the same as one already contained in our Account Center. You can change the information and resubmit below. If this message is in error, please email webmaster@$Domain_name with your name and the username you put on your application.


\n"; } } if ($valid == 1) { if (!eregi("(^[a-z0-9 _\-]+$)",$username)) { $valid = 0; print "

Sorry, the username you have selected is invalid. Usernames can contain alphanumerics, spaces, underlines and dashes only. Please enter a new username below.


\n"; unset($username); } } } if ($valid == 1) { if ( empty($input["lastname"]) || empty($input["firstname"]) || empty($input["phone"]) || empty($input["address"]) || empty($input["city"]) || empty($input["state"]) || empty($input["zip"]) || empty($input["company"]) ) { $valid = 0; print "

Sorry, your submission is missing some data for required fields. Please look at the form below and make sure you filled out all form fields that are marked with a red asterisk.


\n"; } } # remove leading "1-" if they put it there $input["phone"] = preg_replace("/^1\-?/","",$input["phone"]); $phonesave = $input["phone"]; #remove any non-digit characters from the phone number $input["phone"] = preg_replace("/\D/","",$input["phone"]); # pick off the area code, first 3 and last 4 digits if (preg_match("/^(\d{3})(\d{3})(\d{4})$/",$input["phone"],$matches)) { $input["phone"] = $matches[1].'-'.$matches[2].'-'.$matches[3]; } else { $badphone = 1; $input["phone"] = $phonesave; $valid = 0; print "

Sorry, the phone number must be in the form xxx-xxx-xxxx. Please check your entry below and resubmit.


\n"; } if ($valid == 1 && !preg_match("/^\d{5}(\-\d{4})?$/",$input["zip"])) { $badzip = 1; $valid = 0; print "

Sorry, the zip code must be a 5 digit number followed optionally by a hyphen and 4 digits. Please check your entry below and resubmit.


\n"; } /* if ($valid == 1 && !preg_match("/^\d{2}\-\d{7}$/",$input["businessid"])) { $badbusinessid = 1; $valid = 0; print "

Sorry, a Business ID (the same as your Federal Tax ID) must be entered in the form xx-xxxxxxx. Please check your entry below and resubmit.


\n"; } */ if ($valid == 1) { if (!$edit && (empty($username) || empty($password))) { $valid = 0; print "

Sorry, your submission is missing some data for username and/or password. Please look at the form below and make sure you filled out all form fields that are marked with a red asterisk.


\n"; } } if ($valid == 1) { if (!empty($input[email]) && !validate_email($input[email])) { $valid = 0; print "

Sorry, your email address appears to be invalid. Please correct it below and resubmit.


\n"; } } if ($valid == 0) unset($save); } function adduser() { global $input, $membervars; global $password, $username, $perms, $user_id; global $months, $currentyear, $data, $db, $valid, $edit; global $Company_name, $Domain_name, $Root_dir; ## Create a user_id and insert the user... $hash_secret = 'zapper19'; $user_id=md5(uniqid($hash_secret)); $query = "insert into auth_user values('$user_id','$username','$password','$perms')"; $db->query($query); if ($db->affected_rows() == 0) { my_error("Failed: $query"); } $date_added = date("Y-m-d",time()); $query = "insert into data set user_id = '$user_id'"; foreach ($membervars as $val) { $query .= ", $val='".$input[$val]."'"; } $data->query("$query"); %>

Thank you for creating a new account for <%echo "$input[company], $input[firstname] $input[lastname]"%> on <% echo $Company_name %>.

You may now login or continue to the <%echo $Company_name%> home page.

Account Center Home

<% // if ($data->affected_rows() > 0) { $success = 1; # email the admininstrator require("$Root_dir/includes/n_mail.php"); $message = "

A new account was created for the $Company_name web site.
View the Profile Sheet on $input[firstname] $input[lastname].

This email was automatically generated by the $Company_name Account Center

\n"; if (empty($email)) { $fromemail = "memberships@$Domain_name"; } else { $fromemail = $email; } n_mail($fromemail,"memberships@$Domain_name","[Account Center] New Account - $input[firstname] $input[lastname]", $message, "Content-Type: text/html;charset=\"iso-8859-1\"\nMime-Version: 1.0"); $message = "You have successfully created a new account for $Company_name. You can view and edit your Account Profile in the Account Center (http://www.$Domain_name\/members/). Here are the username and password you signed up with. Please keep a record of this for logging in to the site. Username: $username Password: $password This email was automatically generated by the $Company_name Account Center"; if (!empty($email)) { n_mail("memberships@$Domain_name",$email,'[Account Center] New Account Confirmation', $message, "Mime-Version: 1.0"); } } function saveedit() { global $input, $membervars; global $password, $username, $perms, $user_id, $PHP_SELF; global $months, $currentyear, $additional_headers, $data, $db, $valid, $edit; global $Company_name, $Domain_name, $Root_dir; $query = "update auth_user set perms='$perms' where user_id='$user_id'"; $data->query("$query"); $query = "update data set"; foreach ($membervars as $val) { $query .= " $val='".$input[$val]."',"; } $query = substr($query, 0, -1); // remove last comma $query .= " where user_id='$user_id'"; $data->query("$query"); $success = 1; print "

Your changes were successfully saved to the Account Center.

"; print "\n"; } %> <% function showform() { global $input, $permlevels; global $password, $username, $perms, $user_id; global $months, $currentyear, $data, $db, $valid, $edit; global $auth, $admin, $PHP_SELF, $save; global $Company_name, $Domain_name, $Root_dir; global $badphone, $badzip, $badbusinessid; %> <% if ($admin && $user_id) { %>

Admin Mode

<% } %>
<% if (empty($perms)) $perms = 'retail'; // if (isset($perm) && $perm->have_perm("admin")) { if ($admin) { %> <% } else { %> <% } %>
* Company: <% if ($valid == 0 && isset($valid) && empty($input["company"])) print "Please enter the company name
\n"; %>">
Business ID:
(Federal Tax ID)
">(xx-xxxxxxx)
* First Name: <% if ($valid == 0 && isset($valid) && empty($input["firstname"])) print "Please enter your first name
\n"; %>">
* Last Name: <% if ($valid == 0 && isset($valid) && empty($input["lastname"])) print "Please enter your last name
\n"; %>">
* Address: <% if ($valid == 0 && isset($valid) && (empty($input["address"]) || empty($input["state"]) || empty($input["zip"]))) print "Please enter the business address
\n"; %>
Street
">
City State Zip
"> <% if ($valid == 0 && isset($badzip)) print "Please enter your zip code in the form xxxxx
\n"; %>">
Country:
* Phone: <% if ($valid == 0 && isset($valid) && empty($input["phone"])) print "Please enter the business phone
\n"; if ($valid == 0 && isset($badphone)) print "Please enter your phone number in the form xxx-xxx-xxxx
\n"; %>">(xxx-xxx-xxxx)
Email Address: <% if ($valid == 0 && isset($valid) && (!empty($input["email"]) && !validate_email($input["email"]))) print "The email address you entered is not valid
\n"; %>">
* Permission Level:
<% if ($edit) { print "\n"; print "\n"; print "\n"; } %> <% if ($edit) { %>

Username and Password

<% } else { %>

Select a Username and Password

<% } %>
* Username: <% if ($edit) { %> <% echo $username %> [Change Username] <% } else { %> <% if ($valid == 0 && isset($valid) && empty($username)) print "Please enter a valid username
\n"; %> <% } %>
* Password: <% if ($edit) { %> ***** [Change Password] <% } else { %> <% if ($valid == 0 && isset($valid) && empty($password)) print "Please enter a password
\n"; %> <% } %>

<% } # end of function showform %> <% if ($disable_new_membership) { %>

New account additions are temporarily disabled for maintenance. Please try back soon.

<% } else { if ($save) { check_data(); if ($valid) { if ($edit) { saveedit(); } else { adduser(); } } } if ($edit && (!$auth->is_authenticated() || $auth->auth["uname"] == 'nobody')) { my_error("You must login first before you can edit your Account Profile."); } else if ($edit && ($user_id != $auth->auth["uid"] && !$admin)) { my_error("Sorry, you do not have permission to edit the account profile of ".$auth->auth["firstname"].' '.$auth->auth["lastname"]."."); } else { if (!$valid) { if ($edit) { if (!isset($save)) fill_data(); print "

Account Edit

\n"; showform(); } else { // this is where new accounts are added // if ($admin) { print "

New Account

Please fill out the information below to create an account on $Company_name. Required fields are marked by a red asterisk.

If you have already created this account, please do not create a new account. If you cannot remember your username or password, go to the Username/Password Lookup Page.

\n"; showform(); // } else { // print "

You must be an administrator to create new accounts.

\n"; // } } } } } %> <% include $Footer_admin; %>
Copyright SofTap® Permanent Cosmetics 2002, All rights reserved.
 
Click here to advertise with SofTap <% page_close(); %>