Category Archives: User Management

Free URL submit PHP Scripts Management

PHP URL submit scripts which allows users to submit website to over 130 search Engines for free in one time only, no lost your time in one click your site are lished in the most important engines.

 

 

<?php

 /*

 (c) 2006 Reed Morse <firstname.lastname at gmail.com>
 and Pau Santesmasses  <firstname at lastname.net>

*/


if (!isset ($_SESSION)) session_start();
$_SESSION['action'] = 'home';

$where = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];
$where = substr_replace($where, "", -9); // Remove /home.php

if(isset($_SESSION['posturl'])){
 $posturl = $_SESSION['posturl'];
} else {
 $posturl = '';
}


require("functions.php");
require("configuration.php");

connect();
authenticate();

// There is really a better way to do this sql
$user_query = "SELECT * FROM `".$user_table."`";
$user_result = mysql_query($user_query);
$user = mysql_fetch_array($user_result);
$tab = strtolower($user['mode']);

echo '
 <form action="create.php" method="post" onsubmit="return false">
 <input name="selectedTab" id="selectedTab" type="hidden" value="'
.$tab.'" readonly="readonly" />
 <img id="main-spinner" src="skin/'
.$user['theme'].'/spinner.gif" />
 <h2 id="superCenteredText">Choose one of these methods to generate your Shorty</h2>

 <div id="tabbedModes">

 <ul id="tabs">
 <li id="autoTab"><a href="#">Auto</a></li>
 <li id="keywordsTab"><a href="#">Keywords</a></li>
 <li id="randomTab"><a href="#">Random</a></li>
 </ul>

 <div>
 <p><span>1. </span>Enter URL</p>
 <input type="text" name="url" value="'
.$posturl.'" id="int-url" />
 <p><span>2. </span>If you want you can add a keyword to further customize your URL</p>
 <fieldset id="auto">
 <label>'
.$where.'/<span id="namespace"></span>
 <input type="text" value="" name="descriptor" id="descriptor" />
 </label>
 </fieldset>
 <p><span>3. </span>Click this button to generate your Shorty</p>
 <input type="submit" value="GET SHORTY!" name="auto" id="autoBtn" />

 <p><span>4. </span>Control-click or right-click to copy your Shorty</p>
 <div id="response1"></div>

 <p><input type="checkbox" name="prefMethod" value="auto" id="autoCheckbox" />
 <label for="autoCheckbox">Set <strong>Auto</strong> as my preferred Shorty method</label></p>
 </div>

 <div>
 <p><span>1. </span>Enter URL</p>
 <input type="text" name="url" value="'
.$posturl.'" id="desc-url" />

 <p><span>2. </span>Enter <strong>at least one</strong> keyword below to create a customized version of your URL</p>
 <fieldset id="keywords">
 <label>'
.$where.'/
 <input type="text" value="" name="key-1" id="key1" /> /
 <input type="text" value="" name="key-2" id="key2" /> /
 <input type="text" value="" name="key-3" id="key3" /> /
 <input type="text" value="" name="key-4" id="key4" />
 </label>
 </fieldset>
 <p><span>3. </span>Click this button to generate your Shorty</p>
 <input type="submit" value="GET SHORTY!" name="keywords" id="keywordBtn" />

 <p><span>4. </span>Control-click or right-click to copy your Shorty</p>
 <div id="response2"></div>

 <p><input type="checkbox" name="prefMethod" value="keywords" id="keywordsCheckbox" />
 <label for="keywordsCheckbox">Set <strong>Keywords</strong> as my preferred Shorty method</label></p>
 </div>

 <div>
 <p><span>1. </span>Enter URL</p>
 <input type="text" name="url" value="'
.$posturl.'" id="rand-url" />

 <p><span>2. </span>Click this button to generate your Shorty</p>
 <input type="submit" value="GET SHORTY!" name="submitrandom" id="randomBtn" />

 <p><span>3. </span>Control-click or right-click to copy your Shorty</p>

 <div id="response3"></div>

 <p><input type="checkbox" name="method" value="random" id="randomCheckbox" />
 <label for="randomCheckbox">Set <strong>Random</strong> as my preferred Shorty method</label></p>
 </div>
 </form>
 <script type="text/javascript" language="javascript" charset="utf-8">
 // <![CDATA[
 menu.unfold("homeOption");
 new accordion("tabbedModes");
 buttonCollector.init("tabbedModes")
 creator.init()
 // ]]>
 </script>
'
;
?>

&amp;nbsp;

 

PHP Scripts for Usermanage User Management

User Manage is a compact suite which can easily be used to any PHP script. We modeled it like a puzzle: there is the “core” that handles basic authentication, and then there are other modules that handle utility functions (e.g. a database handler that help top-level modules like the permissions handler). With usermanage, developers can build applications with the standard user authentication complete, and developers can drop-in modules to handle extra user information and add functionality.

 

<?php
// ----------------------------------------------------------------------
// LEMP - Lightweight Efficient Modular PHP Application Framework
//  @copyright 2002-2003 The CGI Open Source Federation. (http://cosf.sf.net)
//  @version $Id: config.php,v 1.37 2004/05/16 20:11:26 cogs Exp $
// ----------------------------------------------------------------------
// LICENSE
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// You should have recieved the lincence included with the disribution.
// If not visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// DO NOT EDIT ANYTHING ABOVE
// ----------------------------------------------------------------------
// If handler is not: mysql then 'auth/db/' . $db['handler'] . '.php' will be loaded (if exists).
$db['type']     = 'mysql'; // What should we use to handle database interactions?
$db['host']     = 'localhost'; // example - mysql.mysqlhost.com or localhost
$db['username'] = 'your_username'; // Database user name
$db['password'] = 'your_password'; // Database password
$db['database'] = 'your_database'; // Name of the database database to use
$db['prefix']   = 'user'; // Table names will start with [prefix]_tablename.  This cannot contain any underscores.

// Remove everything below (except the ? > tag) if the auth module is not used.
// General auth config
$auth_config['session_name']       = 'authok'; // The name of the cookie that User Manage uses.
$auth_config['session_expire']     = 4000; // How long should the cookie stay on the client's computer?
$auth_config['session_expire_ext'] = 2592000; // How long should a cookie last if the user requests a persistent login.

// Object Schematics:
$objects['auth']['file'] = 'auth.php';

// Set default to whichever class you want created if creat_obj is called w/o any parameters.
$objects['default'] = 'auth';

// Table schematics.  If your are using a shared table, change uid, uname, pass, and sid to the matching columns.
$tables['auth_user_info']['_name'] = $db['prefix'] . '_user_info'; // Table name.
$tables['auth_user_info']['uid']   = 'uid';
$tables['auth_user_info']['uname'] = 'uname';
$tables['auth_user_info']['pass']  = 'pass';
$tables['auth_user_info']['sid']   = 'sid';

// Static/Extendible config vars.  See Documentation.
$config_vars['static'][] = 'auth_config';

// Optional, usually does not need change.
define ('AUTH_DUP_UNAME',       'Form Error: Username already exists');
define ('AUTH_PW_MISMATCH',     'Form Error: The entered passwords do not match');
define ('AUTH_PW_NOT_ENTERED',  'Form Error: One or both passwords were not entered');
define ('AUTH_PW_SHORT',        'Form Error: Password length is too long');
define ('AUTH_PW_LONG',         'Form Error: Password length is too short');
define ('AUTH_INCORRECT_UID',   'Form Error: No Such UID or UID is unset');
define ('AUTH_NOT_LOGED_IN',    'Permission Denied: Must login');
define ('AUTH_SESSION_TIMEOUT', 'Permission Denied: Session timed out');
define ('AUTH_UNAME_NOT_FOUND', 'Could Not Authenticate: No Such User');
define ('AUTH_BAD_PW',          'Could Not Authenticate: Bad Password');

?>

&amp;nbsp;

Scripts for A Simple-Login-Class

These classes are to make a simple Login -, and session management possible. With only three different calls the entire log in and session management can be solved. It acts in the detail over: slcLogIn() provides a log in object slcIfUserOk() examines for permitted user and provides if necessary a session slcLogOut() destroys the session variables and terminates the session slcDocumentExamine() examines whether the current user the side see may. Needs MySQL!(Sorry for my Bad English!)

 

<?php
class slcLogIn {

 //###### A SimpleLoginClass ######################################
 //# This classes examined whether the user in the table is       #
 //#                                                              #
 //#      THE Classes, Propertys and Methods                      #
 //#                                                              #
 //# Version :     0.1                                            #
 //# last update : 14.march 2004                                  #
 //#                                       by FrankPacher@gmx.de  #
 //################################################################
 //#             THE CLASS USES A MySQL DATABASE                  #
 //################################################################

 //-- Propertys for using in Sessionmanagement
 var $sLName;                 //lastName
 var $sFName;                 //firstname
 var $sUName;                 //loginname
 var $sPass;                  //Password
 var $sGroup;                 //Usergroup
 var $sUserID;                //UserID
 var $sDocuments;             //Numbers of the sides,
 //which permitted or forbidden are
 // (with ';' separate
 //   and '+' for permitted and/or.  '-' forbade for
 //   exp. +352; -54; +9;)
 //  for more details see section '$slc_field_UsrAllowDocuments' in
 //  file 'login_config_fields.php'
 var $sEMail;                 //User-eMail
 var $sNewUser;               //does the user announce itself that first times in?
 //-- Propertys only for Login
 var $sC_HostName;           //Hostname  (exp. localhost)
 var $sC_UserName;           //Username  (exp. root)
 var $sC_PassWord;           //Password
 var $sC_DataBaseName;       //Name of Database in MySQL (exp. db335EXAMPLE)
 var $sC_DataBaseConnectID;  //ID for Connect to MySQL
 var $cC_EventCursor;        //SQL-Cursor
 var $cC_ConnError;          //connect-Error
 var $cC_SelError;           //select-Error
 var $sC_Tablename;          //name of the table those indicated to login users contains

//******< Constractor >*****************************************************
function slcLogIn(){
 //from config-file
 require_once("login_config_database.php");
 // propertys for connecting to database (i'm using php-mysql-functions)
 $this->sC_HostName=$slc_hostname;
 $this->sC_UserName=$slc_username;
 $this->sC_PassWord=$slc_password;
 $this->sC_DataBaseName=$slc_database;
 // connecting database
 $this->cC_ConnError = $this->MakeConnectID();
 $this->cC_SelError = $this->SelectDB();
}
//--- create DB-ID
//          RETURN : 0 - Error
//                   1 - OK
function MakeConnectID() {
 $Ret = 0;
 $database = @mysql_connect($this->sC_HostName,$this->sC_UserName,$this->sC_PassWord);
 if ($database) {
 //connect ok
 $this->sC_DataBaseConnectID = $database;
 $Ret = 1;
 }
 else    {
 //connect failture
 $Ret = 0;
 }
 return $Ret;
}
//--- select DB
//           RETURN : 0 - Error
//                    1 - OK
function SelectDB() {
 $Ret = 0;
 $Ret = @mysql_select_db($this->sC_DataBaseName,$this->sC_DataBaseConnectID);
 if ($Ret) {
 //select ok
 $Ret = 1;
 }
 else {
 //select failture
 $Ret = 0;
 }
 return $Ret;
}
//--------------------------------------------------------------------------------------------------------------------
//--- Create SQL-Cursor for User-Details
//           RETURN : 0 - Error
//                    1 - OK
function MakeSQLCursor($find_UsrId, $find_GroupID) {
 //from config-file
 require("login_config_fields.php");
 require("login_config_basics.php");
 $find_UsrId = settype($find_UsrId,'integer');
 $find_GroupID = settype($find_GroupID,'integer');
 $Ret = 0;
 $SqlSelect ="SELECT ".$slc_field_UsrLastName.",
 "
.$slc_field_UsrFirstName.",
 "
.$slc_field_UsrLoginName.",
 "
.$slc_field_UsrPassword.",
 "
.$slc_field_UsrGroup.",
 "
.$slc_field_UsrId.",
 "
.$slc_field_UsrAllowDocuments.",
 "
.$slc_field_UsrEMail.",
 "
.$slc_field_UsrNewInDatabase."
 FROM "
.$this->sC_Tablename."
 WHERE "
.$slc_field_UsrId."= ".$find_UsrId."
 AND "
.$slc_field_UsrGroup." =".$find_GroupID;
 $SqlQuery  = @mysql_query($SqlSelect, $this->sC_DataBaseConnectID);
 if ($SqlQuery) {
 $Ret = 1;
 }
 else {
 $Ret = 0;
 return $Ret;
 }
 $count = @mysql_num_rows($SqlQuery);
 if ($count <> 1) {
 $Ret = 0;
 }
 else {
 $this->cC_EventCursor = $SqlQuery;
 $Ret = 1;
 }
 return $Ret;
}
//---------------------------------------------------------------------
//-- supplies the user data for the Sessession cookie
//       RETURN :  0 - Error
//                 1 - OK
//-----------------------------------------------------------------------
function GetUserData($find_UsrId, $find_GroupID){
 //from config-file
 require("login_config_fields.php");

 $this->sUserID = ' ';
 $Ret = $this->MakeSQLCursor($find_UsrId, $find_GroupID);
 if ($Ret == 0) {
 return 0;
 }
 while ($oRow = @mysql_fetch_object($this->cC_EventCursor)) {
 $this->sUserID = $oRow->$slc_field_UsrId;
 $this->sLName = $oRow->$slc_field_UsrLastName;
 $this->sFName = $oRow->$slc_field_UsrFirstName;
 $this->sZugang = $oRow->$slc_field_UsrAllowDocuments;
 $this->sEMail=$oRow->$slc_field_UsrEMail;
 $this->sNewUser=$oRow->$slc_field_UsrNewInDatabase;
 return 1;
 }
}
//---------------------------------------------------------------------
//-- Is the Login ok?
//       Parameters:  $Nick  - Login-Name
//                    $Pass  - Password
//                    $Group - User Group
//                    $SessionStart - start the Session and set Session-ID
//                                    and set Session-Variables AFTER successfully
//                                    Login
//                                    !! NOTE:
//                                    with set from $SessionStart=TRUE :
//                                    before call the class of this class NO
//                                    announcement may have been
//                                    sent to the Client!!!
//                                    (!!also a blank BEFORE <?php in the source text
//                                    is immediately sent to the Browser!!)
//                                    Standard is FALSE
//       RETURN:     1  OK
//                   0  User is NOT is in the data base, login is rejected
//                   -1 SessionStart failture
//-----------------------------------------------------------------------
function slcIfUserOk($Nick,$Pass,$Group,$SessionStart=False){

 $this->sUName=$Nick;
 $this->sPass=$Pass;
 $this->sGroup=$Group;

 //from config-file
 require("login_config_fields.php");
 require("login_config_basics.php");

 $this->sC_Tablename=$slc_tablename;
 $Ret = 0;

 //--------------- Login Section ------------------------------------------------------
 $SqlSelect ="SELECT ".$slc_field_UsrId."
 FROM "
.$this->sC_Tablename."
 WHERE "
.$slc_field_UsrLoginName."='".$this->sUName."'
 AND "
;
 if($slc_IsPasswordMD5)
 {
 //MD5 coded
 $SqlSelect = $SqlSelect.$slc_field_UsrPassword."='".MD5($this->sPass);
 }
 else
 {
 //not MD5 coded
 $SqlSelect = $SqlSelect.$slc_field_UsrPassword."='".$this->sPass;
 }
 $SqlSelect = $SqlSelect."' AND ".$slc_field_UsrGroup." =".$this->sGroup;

 $SqlQuery  = @mysql_query($SqlSelect,$this->sC_DataBaseConnectID);
 if ($SqlQuery) {
 $Ret = 1;
 }
 else {
 $Ret = 0;
 return $Ret;
 }
 $menge = @mysql_num_rows($SqlQuery);
 if ($menge == 1) {
 //determine UserID
 while ($oRow = @mysql_fetch_object($SqlQuery)) {
 $this->sUserID = $oRow->$slc_field_UsrId;
 }
 //
 $Ret = $this->GetUserData($this->sUserID,$Group);
 }
 else {
 $Ret = 0;
 return $Ret;
 }
 //--------- Session Section ----------------------------------------------------
 if ($SessionStart){
 $Ret = -1;
 //from config-file
 require("login_config_sessions.php");
 //start session
 $temp=session_start();
 if($temp){
 $Ret = 1;
 }
 else {
 $Ret = -1;
 Return $Ret;
 }
 //set session-variables
 $_SESSION['UserNickName'] = $this->sUName;
 $_SESSION['UserLastName'] = $this->sLName;
 $_SESSION['UserFirstName'] = $this->sFName;
 $_SESSION['UserGroup'] = $this->sGroup;
 $_SESSION['UserID'] = $this->sUserID;
 $_SESSION['SiteAccessRights'] = $this->sDocuments;
 $_SESSION['ClientIP']= getenv('REMOTE_ADDR');
 $_SESSION['eMail']= $this->sEMail;
 $_SESSION['NewUser']= $this->sNewUser;
 }
 return $Ret;
}
//-- LogIn-Class end
}
//###############################################################################################


class slcLogOut {
 //###### A SimpleLoginClass ######################################
 //# This classes terminates a session                            #
 //#                                                              #
 //#      THE Classes, Propertys and Methods                      #
 //#                                                              #
 //# Version :     0.1                                            #
 //# last update : 14.march 2004                                  #
 //#                                       by FrankPacher@gmx.de  #
 //################################################################
 //#             THE CLASS USES A MySQL DATABASE                  #
 //################################################################
function slcLogOut() {
 //###################################################################
 //# Close the Session and unset Session-ID                          #
 //#   !! NOTE:                                                      #
 //#   before call of this class NO announcement may have been       #
 //#   sent to the Client!!!                                         #
 //#        (also a blank BEFORE <?php in the source text            #
 //#         is immediately sent to the Browser!)                    #
 //#                                                                 #
 //#                                                                 #
 //#     Return :  0 - Logout failture                               #
 //#               1 - OK                                            #
 //###################################################################

 $Ret = 0;
 //from config-file
 require("login_config_sessions.php");
 //start session
 $temp=session_start();
 if($temp){
 $Ret = 1;
 }
 else {
 $Ret = 0;
 Return $Ret;
 }
 //unset session-variables (for php-version < 4.3.x)
 $_SESSION['UserNickName'] = NULL;
 $_SESSION['UserLastName'] = NULL;
 $_SESSION['UserFirstName'] = NULL;
 $_SESSION['UserGroup'] = NULL;
 $_SESSION['UserID'] = NULL;
 $_SESSION['SiteAccessRights'] = NULL;
 $_SESSION['ClientIP']= NULL;
 $_SESSION['eMail']= NULL;
 $_SESSION['NewUser']= NULL;
 //destroy the session
 $temp = session_destroy();
 if($temp){
 $Ret = 1;
 }
 else {
 $Ret = 0;
 }
 //
 Return $Ret;
}
//-- LogOut-Class end
}
//################################################################################################
//-- Site-Examine-Class

class slcDocumentExamine {
 //###### A SimpleLoginClass #############################################
 //# This classes examine the Document for View                          #
 //# ONLY using with using sessions                                      #
 //# See '$slc_field_UsrAllowDocuments' in file 'login_config_fields.php #
 //#      THE Classes, Propertys and Methods                             #
 //#                                                                     #
 //# Version :     0.1                                                   #
 //# last update : 14.march 2004                                         #
 //#                                       by FrankPacher@gmx.de         #
 //#######################################################################
 //#             THE CLASS USES A MySQL DATABASE                         #
 //#######################################################################
function slcDocumentExamine($SiteNumber='') {
 $Ret = false;
 //from config-file
 require("login_config_basics.php");
 require("login_config_sessions.php");
 //start session
 $temp=session_start();
 if($temp){
 }
 else {
 $Ret = false;
 Return $Ret;
 }
 //
 if($SiteNumber==''){
 $Ret=$slc_IsEmptyAllow;
 return $Ret;
 }
 else {
 if(! is_string($SiteNumber)){
 $SiteNumber=strval($SiteNumber);
 }
 $SiteNumber = $SiteNumber.';';
 //
 $DocumentRights = $_SESSION['SiteAccessRights'];
 if(empty($DocumentRights)){
 $Ret=$slc_IsEmptyAllow;
 return $Ret;
 }
 //
 $TestP=strpos($DocumentRights,'+'.$SiteNumber);
 if($TestP){
 $Ret=true;
 return $Ret;
 }
 $TestN=strpos($DocumentRights,'-'.$SiteNumber);
 if($TestN){
 $Ret=false;
 return $Ret;
 }
 }
 return $Ret;
}
//-- Site-Examine-Classe end
}
?>

&amp;nbsp;

Scripts for web hosting client manager

Developing a web hosting clientele can be difficult at first. Sign-ups are not very frequent, but as time passes by and your advertizing kicks in, the numbers start showing promise. Then suddenly one day: “did mypage.org pay for their renewal?” and “why is moocher.ca getting free hosting? Didn’t their credit card expire 3 years ago?” I wrote this script to try and avoid that. Looking through emailed invoices, and even through paypal accounts can be tedious to the point where neglect becomes an attractive option. Web Hosting Client Manager allows you to see the clients that signed up on a month by month basis. Say goodbye to renewing domains for no reason, and forgetting about faithful clients.

 

<?
$db_name = "webhost_clients";
$db_host = "localhost";

$db_user = $HTTP_COOKIE_VARS["db_user"];
$db_pass = $HTTP_COOKIE_VARS["db_pass"];

function param($Name)
 {
 global $HTTP_GET_VARS;
 global $HTTP_POST_VARS;
 global $HTTP_COOKIE_VARS;

 if(isset($HTTP_GET_VARS[$Name]))
 return($HTTP_GET_VARS[$Name]);

 if(isset($HTTP_POST_VARS[$Name]))
 return($HTTP_POST_VARS[$Name]);

 if(isset($HTTP_COOKIE_VARS[$Name]))
 return($HTTP_COOKIE_VARS[$Name]);

 return("");
 }

$logged_in = false;
if(@mysql_connect($db_host, $db_user, $db_pass) !== false &amp;&amp;
 ($db_name != "" &amp;&amp; $db_pass != ""))
 {
 $logged_in = true;

 mysql_select_db($db_name);

 $save = param("save");
 $client_id = param("client_id");
 $site_id = param("site_id");

 $client_name = param("client_name");
 $client_email = param("client_email");
 $client_phone_number = param("client_phone_number");

 if($client_id > 0 &amp;&amp; $save == "0")
 {
 $update = "update clients set " .
 "name = '" . $client_name . "', " .
 "email = '" . $client_email . "', " .
 "phone_number = '" . $client_phone_number . "' " .
 "where id = " . $client_id;

 mysql_query($update);
 }

 if($client_id == "0" &amp;&amp; $site_id == "0" &amp;&amp; $save == "0")
 {
 $insert = "insert into clients (name, email, phone_number) values (" .
 "'" . $client_name . "', " .
 "'" . $client_email . "', " .
 "'" . $client_phone_number . "')";

 mysql_query($insert);

 $client_id = mysql_insert_id();
 }

 $site_name = param("site_name");
 $site_user = param("site_user");
 $site_creation_day = param("site_creation_day");
 $site_creation_month = param("site_creation_month");
 $site_creation_year = param("site_creation_year");
 $site_creation_date = $site_creation_year . "-" .
 $site_creation_month . "-" .
 $site_creation_day;
 $site_mothly_fee = 0.0;
 $site_annual_fee = 0.0;
 $fee = param("fee");
 if($fee == "monthly")
 $site_mothly_fee = param("site_fee");
 else
 $site_annual_fee = param("site_fee");
 $name_vendor_id = param("name_vendor_id");
 $processor_id = param("processor_id");

 if($site_id > 0 &amp;&amp; $save == "0")
 {
 $update = "update sites set " .
 "name = '" . $site_name . "', " .
 "user = '" . $site_user . "', " .
 "creation_date = '" . $site_creation_date . "', " .
 "monthly_fee = " . $site_mothly_fee . ", " .
 "annual_fee = " . $site_annual_fee . ", " .
 "client_id = " . $client_id . ", " .
 "name_vendor_id = " . $name_vendor_id . ", " .
 "processor_id = " . $processor_id .
 " where id = " . $site_id;

 mysql_query($update);
 }

 if($site_id < 0)
 {
 $deleted_domain = param("deleted_domain_" . (-$site_id));

 $deleted_client_id = mysql_query("select client_id from sites where id = " . (-$site_id) .
 " and name = '" . $deleted_domain . "'");

 if($deleted_client_id = mysql_fetch_assoc($deleted_client_id))
 {
 $number_of_sites = mysql_query("select count(id) as coun from sites where client_id = " . $deleted_client_id["client_id"]);
 $number_of_sites = mysql_fetch_assoc($number_of_sites);

 if($number_of_sites["coun"] == 1)
 mysql_query("delete from clients where id = " . $deleted_client_id["client_id"]);

 mysql_query("delete from sites where id = " . (-$site_id));
 }
 }

 if($site_id == "0" &amp;&amp; $save == "0")
 {
 $insert = "insert into sites " .
 "(name, user, creation_date, monthly_fee, annual_fee, client_id, name_vendor_id, processor_id) "  .
 "values (" .
 "'" . $site_name . "', " .
 "'" . $site_user . "', " .
 "'" . $site_creation_date . "', " .
 $site_mothly_fee . ", " .
 $site_annual_fee . ", " .
 $client_id . ", " .
 $name_vendor_id . ", " .
 $processor_id . ")";

 mysql_query($insert);
 }

 $month = param("month");
 $date = getDate();
 if($month == "")
 $month = $date["mon"];

 $month_filter1 = "";
 $month_filter2 = "";
 $month_filter3 = " * 12";
 if($month != 0)
 {
 $month_filter1 = " and MONTH(creation_date) = " . $month;
 $month_filter2 = " where MONTH(creation_date) = " . $month;
 $month_filter3 = "";
 }

 $select = "select clients.id as client_id, clients.name as client_name, email, phone_number, " .
 "sites.id as site_id, sites.name as site_name, user, monthly_fee, annual_fee, name_vendor_id, processor_id, " .
 "creation_date, DAYOFMONTH(creation_date) as creation_day, MONTH(creation_date) as creation_month, YEAR(creation_date) as creation_year, " .
 "processors.name as processor_name, name_vendors.name as name_vendor_name " .
 "from (clients left outer join sites on clients.id = sites.client_id), processors, name_vendors " .
 "where sites.processor_id = processors.id and sites.name_vendor_id = name_vendors.id " .
 $month_filter1 .
 " order by clients.name, sites.name";
 $client_sites  = mysql_query($select);

 $select = "select id, name, email, phone_number from clients order by name";
 $clients = mysql_query($select);

 $select = "select name, id from processors";
 $processors = mysql_query($select);

 $select = "select name, id from name_vendors";
 $name_vendors = mysql_query($select);

 $select = "select ifnull(sum(monthly_fee), 0.00)" . $month_filter3 . " + 0.00 as sum from sites";
 $monthly_fee = mysql_query($select);
 $monthly_fee = mysql_fetch_assoc($monthly_fee);

 $select = "select ifnull(sum(annual_fee), 0.00) as sum from sites " . $month_filter2;
 $annual_fee = mysql_query($select);
 $annual_fee = mysql_fetch_assoc($annual_fee);
 }
?>

<html>
<head>
<title>web hosting client manager</title>

<style>
a {color:000000;}

.headings {font-family:'arial, sans-serif, verdana'; font-weight:bold; color:555555;}
</style>

<? if($logged_in == true) { ?>
<script>
function SelectClient(client_id)
 {
 if(document.whcm.site_id.value == '')
 document.whcm.site_id.value = '0';

 switch(client_id)
 {
 <? while($client = mysql_fetch_assoc($clients)) { ?>
 case '<?= $client["id"] ?>':
 document.whcm.client_name.value = '<?= $client["name"] ?>';
 document.whcm.client_email.value = '<?= $client["email"] ?>';
 document.whcm.client_phone_number.value = '<?= $client["phone_number"] ?>';
 break;
 <? } ?>
 default:
 document.whcm.client_name.value = '';
 document.whcm.client_email.value = '';
 document.whcm.client_phone_number.value = '';
 }
 }

function SelectValue(SelectName, Value)
 {
 eval('SelectObject = document.whcm.' + SelectName + ';');
 for(index = 0; index < SelectObject.length; index++)
 {
 if(SelectObject[index].value == Value)
 SelectObject.selectedIndex = index;
 }
 }
</script>
<? } // if $logged_in == true ?>
</head>

<body bgcolor="eecc99" <? if($save == "0") { ?>onload="document.whcm.submit();"<? } ?>>
<a name="edit"></a>
<form name="whcm" method="post">
<input type="hidden" name="save" />
<input type="hidden" name="site_id" value="0" />
<table align="center" bgcolor="eeeeee">

<? if($logged_in == true) { ?>

<tr>
<td>
 <table width="100%" cellpadding="5" bgcolor="eecc99">

 <tr>
 <td valign="top">
 <table>
 <tr>
 <td></td>
 <td>
 <select name="client_id"
 onchange="SelectClient(document.whcm.client_id[document.whcm.client_id.selectedIndex].value);">
 <option value="0">New Client</option>
 <?
 @mysql_data_seek($clients, 0);
 while($client = mysql_fetch_assoc($clients)) {
 ?>
 <option value="<?= $client["id"] ?>"><?= $client["name"] ?></option>
 <? } // while $client = mysql_fetch_assoc($clients) ?>
 </select>
 </td>
 </tr>

 <tr>
 <td>Client Name</td>
 <td><input type="text" name="client_name" /></td>
 </tr>

 <tr>
 <td>Client Email</td>
 <td><input type="text" name="client_email" /></td>
 </tr>

 <tr>
 <td>Client Phone Number</td>
 <td><input type="text" name="client_phone_number" /></td>
 </tr>
 </table>
 </td>
 <td align="right" valign="top">
 <table>
 <tr>
 <td>Site Name</td>
 <td><input type="text" name="site_name" /></td>
 </tr>

 <tr>
 <td>Name Vendor</td>
 <td>
 <select name="name_vendor_id">
 <? while($name_vendor = mysql_fetch_assoc($name_vendors)) { ?>
 <option value="<?= $name_vendor["id"] ?>"><?= $name_vendor["name"] ?></option>
 <? } // while $name_vendor = mysql_fetch_assoc($name_vendors) ?>
 </select>
 </td>
 </tr>

 <tr>
 <td>Site User</td>
 <td><input type="text" name="site_user" /></td>
 </tr>

 <tr>
 <td>
 <input type="radio" name="fee" value="monthly" />
 monthly
 &amp;nbsp;&amp;nbsp;
 <input type="radio" name="fee" value="annual" />
 annual
 &amp;nbsp;&amp;nbsp;
 fee
 </td>
 <td>
 <input type="text" name="site_fee" />
 </td>
 </tr>

 <tr>
 <td>Processor</td>
 <td>
 <select name="processor_id">
 <? while($processor = mysql_fetch_assoc($processors)) { ?>
 <option value="<?= $processor["id"] ?>"><?= $processor["name"] ?></option>
 <? } // while $processor = mysql_fetch_assoc($processors) ?>
 </select>
 </td>
 </tr>

 <tr>
 <td>Site Creation Date</td>
 <td>
 <input type="text" size="2" name="site_creation_day" value="<?= $date["mday"] ?>" />
 &amp;nbsp;
 <select name="site_creation_month">
 <option value="1" <? if($date["mon"] == "1") { ?>selected<? } ?>>January</option>
 <option value="2" <? if($date["mon"] == "2") { ?>selected<? } ?>>February</option>
 <option value="3" <? if($date["mon"] == "3") { ?>selected<? } ?>>March</option>
 <option value="4" <? if($date["mon"] == "4") { ?>selected<? } ?>>April</option>
 <option value="5" <? if($date["mon"] == "5") { ?>selected<? } ?>>May</option>
 <option value="6" <? if($date["mon"] == "6") { ?>selected<? } ?>>June</option>
 <option value="7" <? if($date["mon"] == "7") { ?>selected<? } ?>>July</option>
 <option value="8" <? if($date["mon"] == "8") { ?>selected<? } ?>>August</option>
 <option value="9" <? if($date["mon"] == "9") { ?>selected<? } ?>>September</option>
 <option value="10" <? if($date["mon"] == "10") { ?>selected<? } ?>>October</option>
 <option value="11" <? if($date["mon"] == "11") { ?>selected<? } ?>>November</option>
 <option value="12" <? if($date["mon"] == "12") { ?>selected<? } ?>>December</option>
 </select>
 &amp;nbsp;
 <input type="text" size="4" name="site_creation_year" value="<?= $date["year"] ?>" />
 </td>
 </tr>
 </table>
 </td>
 </tr>
 </table>
</td>
</tr>

<tr>
<td>
 <table width="100%" cellpadding="5">
 <tr>
 <td>
 <input type="button" value="add site"
 onclick="SelectValue('client_id', '0');
 SelectClient('0');
 document.whcm.site_id.value = '0';
 document.whcm.site_name.value = '';
 document.whcm.site_user.value = '';
 document.whcm.site_fee.value = '';
 document.location.hash = '#edit';"/>
 </td>

 <td align="right">
 <input type="button" value="save"
 onclick="document.whcm.save.value = '0';
 document.whcm.submit();" />
 &amp;nbsp;
 <input type="button" value="cancel"
 onclick="document.whcm.reset();" />
 &amp;nbsp;
 <input type="button" value="log out"
 onclick="document.cookie = 'db_user=';
 document.cookie = 'db_pass=';
 document.whcm.submit();" />
 </td>
 </tr>
 </table>
</td>
</tr>

<tr>
<td>
 <table width="100%" cellpadding="5" bgcolor="eecc99">
 <tr>
 <td></td>
 <td valign="top">Client Name &amp; <br /> Contact Info</td>
 <td valign="top">Domain &amp; User</td>
 <td valign="top">Name Vendor</td>
 <td valign="top">Monthly <br /> Payment</td>
 <td valign="top">Annual <br /> Payment</td>
 <td valign="top">Payment <br /> Method</td>
 <td valign="top">Account Creation <br /> Date</td>
 </tr>
 <?
 $client_id = "";

 while($client_site = mysql_fetch_assoc($client_sites))
 {
 ?>

 <tr>
 <td>
 <? if($client_id != $client_site["client_id"]) { ?>
 <input type="button" value="add site"
 onclick="SelectValue('client_id', '<?= $client_site["client_id"] ?>');
 SelectClient('<?= $client_site["client_id"] ?>');
 document.whcm.site_id.value = '0';
 document.whcm.site_name.value = '';
 document.whcm.site_user.value = '';
 document.whcm.site_fee.value = '';
 document.location.hash = '#edit';"/>
 <? } ?>
 </td>

 <td>
 <? if($client_id != $client_site["client_id"]) { ?>
 <a href="mailto:<?= $client_site["email"] ?>">
 <?= $client_site["client_name"] ?></a>
 <? } ?>
 </td>

 <td>
 <a href="http://<?= $client_site["site_name"] ?>">
 <?= $client_site["site_name"] ?></a>
 </td>

 <td>
 <?= $client_site["name_vendor_name"] ?>
 </td>

 <td>
 <? if($client_site["monthly_fee"] != 0.00) { ?>
 $<?= $client_site["monthly_fee"] ?>
 <? } ?>
 </td>

 <td>
 <? if($client_site["annual_fee"] != 0.00) { ?>
 $<?= $client_site["annual_fee"] ?>
 <? } ?>
 </td>

 <td>
 <?= $client_site["processor_name"] ?>
 </td>

 <td>
 <?= $client_site["creation_date"] ?>
 </td>

 <td>
 <input type="button" value="edit"
 onclick="SelectValue('client_id', '<?= $client_site["client_id"] ?>');
 SelectClient('<?= $client_site["client_id"] ?>');
 document.whcm.site_id.value = '<?= $client_site["site_id"] ?>';
 document.whcm.site_name.value = '<?= $client_site["site_name"] ?>';
 SelectValue('name_vendor_id', '<?= $client_site["name_vendor_id"] ?>');
 document.whcm.site_user.value = '<?= $client_site["user"] ?>';
 <? if($client_site["annual_fee"] != 0) { ?>
 document.whcm.site_fee.value = '<?= $client_site["annual_fee"] ?>';
 document.whcm.fee[1].checked = true;
 <? } else { ?>
 document.whcm.site_fee.value = '<?= $client_site["monthly_fee"] ?>';
 document.whcm.fee[0].checked = true;
 <? } ?>
 SelectValue('processor_id', '<?= $client_site["processor_id"] ?>');
 document.whcm.site_creation_day.value = '<?= $client_site["creation_day"] ?>';
 SelectValue('site_creation_month', '<?= $client_site["creation_month"] ?>');
 document.whcm.site_creation_year.value = '<?= $client_site["creation_year"] ?>';
 document.location.hash = '#edit';" />
 </td>

 <td>
 <input type="button" value="delete"
 onclick="document.whcm.site_id.value = '-<?= $client_site["site_id"] ?>';
 document.whcm.submit();" />
 </td>
 </tr>

 <tr>
 <td>
 </td>

 <td>
 <? if($client_id != $client_site["client_id"]) { ?>
 <?= $client_site["phone_number"] ?>
 <?
 $client_id = $client_site["client_id"];
 }
 ?>
 </td>

 <td>
 <?= $client_site["user"] ?>
 </td>

 <td align="right" colspan="7"><input type="text" name="deleted_domain_<?= $client_site["site_id"] ?>" /></td>
 </tr>
 <? } ?>

 <tr>
 <td colspan="2">
 <select name="month"
 onchange="document.whcm.save.value = '';
 document.whcm.submit();">
 <option value="0">All Sites</option>
 <option value="1" <? if($month == "1") { ?>selected<? } ?>>January</option>
 <option value="2" <? if($month == "2") { ?>selected<? } ?>>February</option>
 <option value="3" <? if($month == "3") { ?>selected<? } ?>>March</option>
 <option value="4" <? if($month == "4") { ?>selected<? } ?>>April</option>
 <option value="5" <? if($month == "5") { ?>selected<? } ?>>May</option>
 <option value="6" <? if($month == "6") { ?>selected<? } ?>>June</option>
 <option value="7" <? if($month == "7") { ?>selected<? } ?>>July</option>
 <option value="8" <? if($month == "8") { ?>selected<? } ?>>August</option>
 <option value="9" <? if($month == "9") { ?>selected<? } ?>>September</option>
 <option value="10" <? if($month == "10") { ?>selected<? } ?>>October</option>
 <option value="11" <? if($month == "11") { ?>selected<? } ?>>November</option>
 <option value="12" <? if($month == "12") { ?>selected<? } ?>>December</option>
 </select>
 </td>

 <td colspan="2"></td>

 <td>$<?= $monthly_fee["sum"] ?></td>

 <td>$<?= $annual_fee["sum"] ?></td>

 <td colspan="4" align="right">$<?= bcadd($monthly_fee["sum"], $annual_fee["sum"], 2) ?></td>
 </tr>
 </table>
</td>
</tr>

<tr>
<td>
 <table width="100%" cellpadding="5">
 <tr>
 <td>
 <input type="button" value="add site"
 onclick="SelectValue('client_id', '0');
 SelectClient('0');
 document.whcm.site_id.value = '0';
 document.whcm.site_name.value = '';
 document.whcm.site_user.value = '';
 document.whcm.site_fee.value = '';
 document.location.hash = '#edit';"/>
 </td>

 <td align="right">
 <input type="button" value="save"
 onclick="document.whcm.save.value = '0';
 document.whcm.submit();" />
 &amp;nbsp;
 <input type="button" value="cancel"
 onclick="document.whcm.reset();" />
 &amp;nbsp;
 <input type="button" value="log out"
 onclick="document.cookie = 'db_user=';
 document.cookie = 'db_pass=';
 document.whcm.submit();" />
 </td>
 </tr>
 </table>
</td>
</tr>

<? } // If $logged_in == true ?>

<? if($logged_in == false) { ?>

<tr>
<td>User Name </td>
<td><input type="text" name="db_user" /></td>
</tr>

<tr>
<td>Password</td>
<td><input type="password" name="db_pass" /></td>
</tr>

<tr>
<td colspan="2" align="right">
<input type="button" value="log in"
 onclick="document.cookie = 'db_user=' + document.whcm.db_user.value;
 document.cookie = 'db_pass=' + document.whcm.db_pass.value;
 document.whcm.submit();">
</td>
</tr>


<? } // If $logged_in == false ?>

</table>
</form>
</body>
</html>

&amp;nbsp;

Secure – User/Group Management Software Management PHP

Secure is a standalone user/group management system written in PHP that provides a customizable interface for user logins, user data and various other user associated functionality. Secure is the perfect tool for websites wishing to provide secure private user areas. Furthermore, Secure is powered by FORMfields and is therefore easily integrated with any FORMfields project.

 

<? /* BEGIN - SECTION 1 */ ?>
<?php
 // NOTE: THIS EXAMPLE REQUIRES FORMfields Lib 2.0 OR LATER

 require_once(dirname(__FILE__) . "/../globals.php");

 verifyMembership(GROUP_ADMIN);

 define("FF_EMAIL_LOG_ON", true);
 define("FF_EMAIL_LOG_DIR", "email");

 // Most PHP installs defaulted to 30 secs, so use 25 to be safe
 define("MAX_EXECUTION_MICROSECS", 25000000);

 $ffForm = new FfForm();
 $ffForm->addField(new TextField("from", "From Address", REQUIRED, 255, 1, 30));
 $ffForm->formFields["from"]->setHelp(htmlspecialchars("Examples: John Smith <john@hotmail.com> or john@hotmail.com."));
 $ffForm->addField(new TextAreaField("to", "To Addresses", REQUIRED, 100000, 1, 15, 80));
 $ffForm->formFields["to"]->setHelp("Please separate all email addresses with a new line.");
 $ffForm->addField(new TextField("subject", "Subject", REQUIRED, 50, 3, 30));
 $ffForm->addField(new TextAreaField("message", "Body of HTML Email", REQUIRED, 10000, 1, 15, 80));
 $ffForm->formFields["message"]->setHelp(htmlspecialchars("Note: All new lines will automatically be converted to <br />'s."));
 $ffForm->addField(new IntegerField("sleep", "Microseconds To Sleep Between Emails", REQUIRED, 9, 1, 10, 999999999, 1));
 $ffForm->addField(new IntegerField("offset", "Starting Email Offset", REQUIRED, 6, 1, 4, 999999, 0));
 $ffForm->addField(new SubmitField("_submit", "Submit"));
 if (SECURE_DEMO_MODE)
 $ffForm->formFields["_submit"]->setEnabled(false);
 $ffForm->addField(new SubmitField("cancel", "Cancel"));

 $ffForm->getParameters();

 if (!SECURE_DEMO_MODE &amp;&amp; $ffForm->getValue("_submit")) {
 if ($ffForm->checkValues()) {
 $_SESSION["mailer_ffForm"] = $ffForm;
 $_SESSION["mailer_emails"] = split("\n", $ffForm->getValue("to"));
 $_SESSION["mailer_offset"] = $ffForm->getValue("offset");
 $_SESSION["mailer_microsToSleep"] = $ffForm->getValue("sleep");
 } else {
 $_SESSION["mailer_ffForm"] = null;
 $_SESSION["mailer_emails"] = null;
 $_SESSION["mailer_offset"] = null;
 $_SESSION["mailer_microsToSleep"] = null;
 }
 } else if ($ffForm->getValue("cancel")) {
 header("Location: index.php");
 } else if ($_SESSION["mailer_ffForm"]) {
 $ffForm = $_SESSION["mailer_ffForm"];
 if ($_SESSION["mailer_microsToSleep"] > MAX_EXECUTION_MICROSECS) {
 usleep(MAX_EXECUTION_MICROSECS);
 $_SESSION["mailer_microsToSleep"] = $_SESSION["mailer_microsToSleep"] - MAX_EXECUTION_MICROSECS;
 } else {
 $to = $_SESSION["mailer_emails"][$_SESSION["mailer_offset"]];
 $from = $ffForm->getValue("from");
 $subject = $ffForm->getValue("subject");
 $msgHeader = preg_replace("/\\n/", "<br />", $ffForm->getValue("message"));
 $useHtml = true;
 $mailForm = new FfForm();
 $mailForm->email($to, $subject, $from, $cc, $bcc, $msgHeader, $msgFooter, $attachments, $useHtml, $cssFile);

 // Write to file in case process hangs and we want to
 // resume mailing by viewing log file
 if (FF_EMAIL_LOG_ON) {
 $fHandle = fopen(FF_EMAIL_LOG_DIR . "/email_" . $_REQUEST["PHPSESSID"] . ".txt", "wb");
 fwrite($fHandle,
 "Current email offset: " . $_SESSION["mailer_offset"] . ".\n"
 . "Total emails to send: " . sizeof($_SESSION["mailer_emails"]) . ".\n"
 . "Last refresh: " . date("r") . ".\n"
 . "Time remaining: " . ((sizeof($_SESSION["mailer_emails"]) - $_SESSION["mailer_offset"]) * $ffForm->getValue("sleep") / 1000000) . " seconds.\n"
 . "About to send an email to the following recipient: " . htmlspecialchars($_SESSION["mailer_emails"][$_SESSION["mailer_offset"]]) . ".\n"
 . "Message Subject: " . $ffForm->getValue("subject") . "\n"
 . "Message Body:\n" . $ffForm->getValue("message")
 );
 fclose($fHandle);
 }

 usleep($_SESSION["mailer_microsToSleep"]);
 $_SESSION["mailer_offset"] = $_SESSION["mailer_offset"] + 1;
 $_SESSION["mailer_microsToSleep"] = $ffForm->getValue("sleep");
 }
 $finished = ($_SESSION["mailer_offset"] >= sizeof($_SESSION["mailer_emails"]));

 if ($finished &amp;&amp; FF_EMAIL_LOG_ON) {
 $fHandle = fopen(FF_EMAIL_LOG_DIR . "/email_" . $_REQUEST["PHPSESSID"] . ".txt", "wb");
 fwrite($fHandle,
 "Finished sending emails.\n"
 . "Sent a total of " . sizeof($_SESSION["mailer_emails"]) . " emails.\n"
 . "Message Subject: " . $ffForm->getValue("subject") . "\n"
 . "Message Body:\n" . $ffForm->getValue("message")
 );
 fclose($fHandle);
 }

 } else {
 $ffForm->setValue("offset", 0);
 $ffForm->setValue("sleep", 1000000);
 }

?>
<? /* END - SECTION 1 */ ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mailer 1</title>
<? /* BEGIN - SECTION 2 */ ?>
<? if ($_SESSION["mailer_ffForm"] &amp;&amp; !$finished) { ?>
 <meta http-equiv="Refresh" content="0; url=<?= $_SERVER["PHP_SELF"] ?>" />
<? } ?>
<? require($GLOBALS["SECURE_ROOT"] . "/section1.php"); ?>
<? /* END - SECTION 2 */ ?>
</head>

<body>
 <? require($GLOBALS["SECURE_ROOT"] . "/section2.php"); ?>
 <? printMenu("Emails", "Mailer 1"); ?>
 <div>
 <h1>
 Mailer 1
 </h1>
 <? /* BEGIN - SECTION 3 */ ?>
 <form action="" method="post" enctype="multipart/form-data">
 <?
 if ($_SESSION["mailer_ffForm"]) {
 if ($finished) {
 ?>
 <div style="font: normal normal bold 18px verdana;">
 Finished sending emails.
 </div>
 <div>
 Sent a total of <?= $_SESSION["mailer_offset"] - $ffForm->getValue("offset") ?> emails.
 </div>
 <div style="margin-top:20px;font: normal normal bold 12px verdana;">
 Click <a href="<?= $_SERVER["PHP_SELF"] ?>">here</a> to start over.
 </div>
 <?
 $_SESSION["mailer_ffForm"] = null;
 $_SESSION["mailer_emails"] = null;
 $_SESSION["mailer_offset"] = null;
 $_SESSION["mailer_microsToSleep"] = null;
 } else {
 ?>
 <div style="font: normal normal bold 18px verdana;">
 Current email offset: <?= $_SESSION["mailer_offset"] ?>.<br />
 Total emails to send: <?= sizeof($_SESSION["mailer_emails"]) ?>.<br />
 Last refresh: <?= date("r") ?>.<br />
 Time remaining: <?= (sizeof($_SESSION["mailer_emails"]) - $_SESSION["mailer_offset"]) * $ffForm->getValue("sleep") / 1000000 ?> seconds.<br />
 About to send an email to the following recipient: <?= htmlspecialchars($_SESSION["mailer_emails"][$_SESSION["mailer_offset"]]) ?>.<br />
 </div>
 <?
 }
 echo "<br />";
 } else {
 ?>
 <?= $ffForm->getTableTag() ?>
 <?
 }
 ?>
 </form>
 <? /* END - SECTION 3 */ ?>
 </div>
 <? require($GLOBALS["SECURE_ROOT"] . "/section3.php"); ?>
</body>


</html>

Auth Manager – User Management Script PHP

The most wonderful and the most unique open source user management script developed by ScriptsApart. It comes packed with amazing user authentication and management system to help webmasters protect their content from non-members. The powerful management panel makes it an easy task to manage users, update settings related to various parts of the website as well as view the traffic statistics. It is completely open source and you can grab it for free.

 

<?php

 /*
 +--------------------------------------------------------------------------
 |   Auth Manager - Content Protection &amp; User Management (Open Source)
 +--------------------------------------------------------------------------
 |   by ScriptsApart
 |   (c) 2011 ScriptsApart
 |   http://www.scriptsapart.com/
 +--------------------------------------------------------------------------
 |   Web: http://www.scriptsapart.com/
 |   Email: support@scriptsapart.com
 |    Facebook: http://www.facebook.com/pages/Scripts-Apart/149933518360387
 |    Twitter: http://www.twitter.com/scriptsapart
 |    Blackberry PIN: 20F03848
 |    Phone Support: +91 9871084893
 +--------------------------------------------------------------------------
 |   > Open Source(100%)
 |   > First Version: 13th September 2010
 |    > Version 2.0: 8th February 2011
 +--------------------------------------------------------------------------
 */


 error_reporting(0);
 ini_set('display_errors', '0');

?>

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 <html>
 <head>
 <title>Auth Manager / Installation</title>
 <META NAME="Description" CONTENT="Open source user authentication and management script developed by ScriptsApart.">
 <META NAME="Keywords" CONTENT="scriptsapart, akshit sethi, auth manager, user management, authentication script, free user management script">
 <META NAME="Author" CONTENT="Akshit Sethi">
 <link type="text/css" rel="stylesheet" href="css/default.css" />
 <link type="text/css" rel="stylesheet" href="css/dropdown.css" />
 <link type="text/css" rel="stylesheet" href="css/default.ultimate.css" />
 <style>
 body
 {
 background:#fcfcfc;
 margin:50px 0 0 0;
 }
 .container, .subcontainer
 {
 background:#fcfcfc;
 }
 p.infomsg
 {
 padding:5px 0 5px 10px;
 line-height:16px;
 }

 </style>
 <script type="text/javascript" src="js/jquery.js"></script>
 <!--[if lt IE 7]>
 <script type="text/javascript" src="js/jquery.dropdown.js"></script>
 <![endif]-->
 <!-- / END -->
 </head>
 <body><center>
 <div>
 <div>

<?php

 if(isset($_POST['install']))
 {
 $host = $_POST['host'];
 $dbuser = $_POST['dbuser'];
 $dbpass = $_POST['dbpass'];
 $dbname = $_POST['dbname'];
 $adminemail = $_POST['adminemail'];
 $adminpass = $_POST['adminpass'];
 $websitepath = $_POST['websitepath'];

 if(($host != "") &amp;&amp; ($dbuser != "") &amp;&amp; ($websitepath != "") &amp;&amp; ($dbname != "") &amp;&amp; ($adminemail != "") &amp;&amp; ($adminpass != ""))
 {
 if(substr($websitepath, strlen($websitepath) - 1) == "/")
 $websitepath = substr($websitepath,0, strlen($websitepath) - 1);

 /* Now verifying the admin email just to ensure that it is correct. */
 if(isValidEmail($adminemail))
 {

 $c = mysql_connect($host, $dbuser, $dbpass);
 if($c)
 {
 $s = mysql_select_db($dbname);
 if($s)
 {
 $FP = fopen('install/database.sql', 'r');
 $READ = fread($FP, filesize('install/database.sql'));
 $READ = explode(";", $READ);
 foreach($READ AS $RED)
 {
 mysql_query($RED);
 }

 /* Encrypting the password using the required format. */
 $adminpass = generate_encrypted_password($adminpass);
 $q_4 = mysql_query("INSERT INTO `settings` (`password`, `website`, `title`, `admin_email`, `login_attempt`, `is_superadmin`) VALUES('{$adminpass}', '{$websitepath}', 'Auth Manager', '{$adminemail}',  0, 1)") or die(mysql_error());

 echo "<center><div class=\"logindiv\" style=\"text-align:left;\">
 <div id=\"logindiv-header\"><p>Final Step</p></div>
 <div class=\"infobox\">Hey! Installation Completed</div>"
;
 echo "<br/><p class=\"infomsg\">Open file <b>'user/database.php'</b> and copy the text from below and replace it with the text already there:<br/>
 <br/>"
;

?>

 <p>define("DB_SERVER", "<?php echo $host; ?>");</p>
 <p>define("DB_USER", "<?php echo $dbuser; ?>");</p>
 <p>define("DB_PASSWORD", "<?php echo $dbpass; ?>");</p>
 <p>define("DB_NAME", "<?php echo $dbname; ?>");</p>
 <p>define("DB_TABLE", "visits");</p>
 <p>define("IP_TABLE", "ip2nation");</p>
 <p>define("IP_COUNTRY_TABLE", "ip2nationCountries");</p>

 <?php echo "<br/><p class=\"infomsg\">Also, delete the <b>'install.php'</b> file for security reasons. <b>That's it!</b> enjoy the product</p><br/></div><br/><br/></center>";
 }
 else
 {
 $err = "<div class=\"errorbox\">Database does not exist</div>";
 showform();
 }
 }
 else
 {
 $err = "<div class=\"errorbox\">Unable to connect to mySQL</div>";
 showform();
 }
 }
 else
 {
 $err = "<div class=\"errorbox\">Please enter a valid email address</div>";
 showform();
 }
 }
 else
 {
 $err = "<div class=\"errorbox\">Please fill in all fields to continue</div>";
 showform();
 }
 }
 else
 {
 showform();
 }

 function showform() {

 global $err; ?>

 <center>
 <img src="images/logo.png" /><br/><br/>
 <div>
 <div id="logindiv-header"><p>Install Wizard</p></div>
 <?php echo $err; ?>
 <form method="POST" action="install.php">
 <table>
 <tr><td>Server Host:</td>
 <td><input type="text" name="host" id="host" size="25" /><br/><small>(It is '<b>localhost</b>' for most web hosts)</small></td></tr>
 <tr><td>Database User:</td>
 <td><input type="text" name="dbuser" id="dbuser" size="25" /></td></tr>
 <tr><td>Database Password:</td>
 <td><input type="password" name="dbpass" id="dbpass" size="25" /></td></tr>
 <tr><td>Database Name:</td>
 <td><input type="text" name="dbname" id="dbname" size="25" /><br/><small>(Make sure that the database already exists)</small></td></tr>
 <tr><td>Website Path:</td>
 <td><input type="text" name="websitepath" id="websitepath" size="25" /><br/><small>(Exact path where your script will be installed. Must include <b>http://</b>)</small></td></tr>
 <tr><td>Admin Email:</td>
 <td><input type="text" name="adminemail" id="adminemail" size="25" /><br/><small>(Provide your working email address)</small></td></tr>
 <tr><td>Admin Password:</td>
 <td><input type="password" name="adminpass" id="adminpass" size="25" /><br/><small>(Password for accessing the admin panel)</small></td></tr>
 <tr><td></td>
 <td><input type="submit" name="install" id="install" value="Begin Installation" /></td></tr>
 </table></form>
 </div></center>

 <?php }

 function isValidEmail($email) {

 if(preg_match("/^(\w+((-\w+)|(\w.\w+))*)\@(\w+((\.|-)\w+)*\.\w+$)/",$email))
 {
 return true;
 }
 else
 {
 return false;
 }

 }

 function generate_encrypted_password($str) {

 define('SALT_ONE', 'some_random_123_collection_&amp;$^%_of_stuff');
 define('SALT_TWO', 'another_random_%*!_collection_ANbu_of_stuff');

 $new_pword = '';

 if(defined('SALT_ONE')):
 $new_pword .= md5(SALT_ONE);
 endif;

 $new_pword .= md5($str);

 if(defined('SALT_TWO')):
 $new_pword .= md5(SALT_TWO);
 endif;

 return substr($new_pword, strlen($str), 40);

 }

 ?>

</div>

 <div id="footer">
 <div><ul id="nav-footer">
 <li><a href="http://www.scriptsapart.com/"><b>Home</b></a></li>
 <li><a href="http://www.scriptsapart.com/freebies/"><b>Freebies</b></a></li>
 <li><a href="http://www.scriptsapart.com/contact-us/"><b>Contact Us</b></a></li>
 </ul></div>
 <p id="copyright">Copyright &amp;copy; 2011 ScriptsApart. All rights reserved. Use of this site is subject to express terms of use.</p>
 </div>

 <?php /* Footer ends over here */ ?>

</div>
</center>
</body>
</html>

&amp;nbsp;

Free PHP User Registration Login Management

So simple that anyone, even without PHP/HTML experience can use it.  Integrateable Login, Logoff, and registration pages.  Integrates into your already established database.  Easy to start up a new database. Sample table included.  Plug and Play files. Just place it where you want the form to appear. Ability to enable sessions and/or cookies usage.  Ability to keep user logged in for a certain period (1 hour/day/week/month/year,etc..) * Tiny file to download.

 

<?php
/*
This script was downloaded at:
LightPHPScripts.com
Please support us by visiting
out website and letting people
know of it.
Produced under: LGPL
*/


/* Start session */
if($startSession == TRUE){ session_start();}

/* Config file */
include('config.php');

/* Check for submition */
if($_POST['submitID'] == 2){

 /* Connect to database &amp; query */
 if($connectDatabase == TRUE){$action=TRUE;include('connect.php');}

 /* sanitize and check info */
 $userName = mysql_real_escape_string($_POST['userName'],$dbc);
 $password = mysql_real_escape_string($_POST['password'],$dbc);

 if($userName == NULL) { $message = 'Please enter username.';}
 if($message == NULL &amp;&amp; $password == NULL){ $message = 'Please enter password.';}
 if($message == NULL &amp;&amp; $password != $_POST['password2']){ $message = 'Passwords do not match.';}

 if($message == NULL)
 {
 $userQuery = mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM `$tableName`
 WHERE `$userNameField`='$userName'"
));
 if($userQuery[0] > 0){
 $message = 'This username already exists. Please select another.';
 } else {
 /* Add user */
 $addUser = mysql_query("INSERT INTO `$tableName` (`$userNameField`,`$userPasswordField`)
 VALUES ('$userName','$password')"
);
 if($addUser)
 {
 /* Disconnect from database */
 if($connectDatabase == TRUE){$action=FALSE;include('connect.php');}

 /* Log use in */
 $_SESSION['isLoged'] = 'yes';
 $_SESSION['userName'] = $userName;
 /* add cookies ?*/
 /* expire in 1 hour */
 if($useCookies == TRUE)
 {
 setcookie("isLoged", 'yes', time()+logedInFor, "/", ".$domainName", 1);
 setcookie("userName", $userName, time()+logedInFor, "/", ".$domainName", 1);
 }

 /* Redirect to login page */
 header("Location: $loginPage");
 exit();
 } else {
 $message = 'Internal error. Please contact administrator.';
 }
 }
 }
 /* Disconnect from database */
 if($connectDatabase == TRUE){$action=FALSE;include('connect.php');}
}
?>
<!--
/*
This script was downloaded at:
LightPHPScripts.com
Please support us by visiting
out website and letting people
know of it.
Produced under: LGPL
*/
-->
<?php

/* Display error messages */
if($message != NULL){?>
<table width="100%"  border="0" cellpadding="3" cellspacing="0" bgcolor="#FFCCCC">
 <tr>
 <td><div align="center"><strong><font color="#FF0000"><?=$message;?></font></strong></div></td>
 </tr>
</table>
<?php } ?>
<form action="<? echo $_SERVER['PHP_SELF'];?>" method="post" name="register" id="register" style="display:inline;">
 <table width="100%" border="1" align="center" cellpadding="5" cellspacing="0" bordercolor="#99CC33">
 <tr bgcolor="#99CC99">
 <td colspan="2"><div align="center"><strong>Please enter registration information: </strong></div></td>
 </tr>
 <tr>
 <td width="47%"><strong>Username:</strong></td>
 <td width="53%"><input name="userName" type="text" id="userName"></td>
 </tr>
 <tr>
 <td><strong>Password:</strong></td>
 <td><input name="password" type="password" id="password"></td>
 </tr>
 <tr>
 <td><strong>Re-enter password: </strong></td>
 <td><input name="password2" type="password" id="password2" /></td>
 </tr>
 <tr>
 <td colspan="2"><div align="center"><font face="Georgia, Times New Roman, Times, serif"><strong>
 <input name="Submit" type="submit" id="Submit" value="Register">
 <input name="submitID" type="hidden" id="submitID" value="2">
</strong></font> </div></td>
 </tr>
 <tr>
 <td colspan="2"><div align="right"><a href="http://lightphpscripts.com" target="_blank"><font size="1">Powered by LPS</font></a> </div></td>
 </tr>
 </table>
</form>

&amp;nbsp;

PHP Scripts for Membership User Management

Client side features- Registration page- Forgot password page- Login page. – Profile page.  Delete account page.  Mailing list.  Limited access to files/folders.  User Subscriptions.  Paypal and 2Checkout Payment Processing.  Easy implementation + documentation.  Remember me/public computer options. Administration side features:  Easy automatic installation.  Add/Edit/Remove users.  Add/Edit/Remove profile fields. Require/Optionate profile fields.  Enable/Disable account delete page.  Completely customizable image/text CAPTCHA verification. Require email verification.  User registration limit.  Add Membership groups and rates for each membership.  Enable payments, test payment (sandboxes) and automatic payment setup.  Limit access per PHP or htaccess.  Complete Mailing List.

 

<?php
/************* Membership V2.0 *******************/
/*
Released by AwesomePHP.com, under the GPL License, a
copy of it should be attached to the zip file, or
you can view it on http://AwesomePHP.com/gpl.txt
*/

/************* Membership V2.0 *******************/
if($is_admin == false){ die();}

if($_POST['user_id'] == NULL){    $_POST['user_id'] = $_GET['user_id'];}


if(!is_numeric($_POST['user_id']) AND $_GET['do'] != 'Add'){
 $get_list = "SELECT * FROM `memb_userlist`";
 $is_count = @mysql_query($get_list);
 $display_limit = '10';
 $items_count = @mysql_num_rows($is_count);
 if($items_count > $display) {
 $page_count = ceil ($items_count/$display_limit);
 } else {
 $page_count = 1;
 }
 if(is_numeric($_GET['start'])){
 $start = $_GET['start'];
 } else {
 $start = 0;
 }
 $get_users = @mysql_query($get_list . " ORDER BY `user_id` DESC LIMIT $start,$display_limit");
?>
 <table width="100%"  border="1" cellspacing="0" cellpadding="5">
 <tr bgcolor="#BEDEDE">
 <td colspan="4"><div align="center"><font color="#999999" size="4"><strong>User List [<a href="?page=users&amp;do=Add">Add</a>] </strong></font></div></td>
 </tr>
 <?php
 if($items_count > $display_limit){
 ?>
 <tr>
 <td colspan="4"><div align="center"><?php include('pagination.php');?></div></td>
 </tr>
 <?php } ?>
 <tr bgcolor="#CAFFCA">
 <td width="25%"><div align="center"><font size="2"><strong>User Name </strong></font></div></td>
 <td width="25%" bgcolor="#CAFFCA"><div align="center"><font size="2"><strong>User Email </strong></font></div></td>
 <td width="25%"><div align="center"><font size="2"><strong>User Status </strong></font></div></td>
 <td width="25%"><div align="center"><font size="2"><strong>Options</strong></font></div></td>
 </tr>
 <?php
 if($items_count <= 0){ echo '<tr><td colspan="4">No users found.</td><tr>';}
 while($each = mysql_fetch_assoc($get_users)){?>
 <tr>
 <td width="25%"><font color="#990000" size="2"><?php echo $each['user_name'];?></font></td>
 <td width="25%"><font color="#990000" size="2"><?php echo $each['user_email'];?></font></td>
 <td width="25%"><font color="#990000" size="2"><?php if($each['user_status'] == 1){ echo 'Active';}else{echo 'Disabled';}?></font></td>
 <td width="25%"><div align="center"><font size="2">[<a href="?page=users&amp;user_id=<?php echo $each['user_id'];?>">Edit/Remove</a>] [<a href="?page=payments&amp;user_id=<?php echo $each['user_id'];?>">Payments</a>]</font></div></td>
 </tr>
 <?php } ?>
</table>
<?php } else {
 if($_POST['user_id'] != NULL){
 $_POST = mysql_fetch_assoc(mysql_query("SELECT * FROM `memb_userlist` WHERE `user_id`='$_POST[user_id]'"));
 }
 ?>
 <form name="users" id="users" method="post" action="?page=users&amp;user_id<?php echo $_POST['user_id'];?>" style="display:inline;">
 <table width="100%"  border="1" cellspacing="0" cellpadding="5">
 <tr bgcolor="#BEDEDE">
 <td colspan="2"><div align="center"><font color="#999999" size="4"><strong>Add/Edit User: </strong></font></div></td>
 </tr>
 <tr>
 <td width="50%"><font size="2">User Name:</font></td>
 <td width="50%"><font size="2">
 <input name="user_name" type="text" id="user_name" value="<?php echo $_POST['user_name'];?>">
 <input name="old_name" type="hidden" id="old_name" value="<?php echo $_POST['user_name'];?>">
 </font></td>
 </tr>
 <tr>
 <td width="50%"><font size="2">User Email:</font></td>
 <td width="50%"><font size="2">
 <input name="user_email" type="text" id="user_email" value="<?php echo $_POST['user_email'];?>">
 <input name="old_email" type="hidden" id="old_email" value="<?php echo $_POST['user_email'];?>">
 </font></td>
 </tr>
 <tr>
 <td width="50%"><font size="2">User Password:</font></td>
 <td width="50%"><font size="2">
 <input name="user_password" type="text" id="user_password" value="<?php echo $_POST['user_password'];?>">
 </font></td>
 </tr>
 <tr>
 <td width="50%"><font size="2">Membership:</font></td>
 <td><font size="2">
 <select id="membership_id" name="membership_id">
 <?php
 $query = mysql_query("SELECT * FROM `memb_memberships`");

 while($em = mysql_fetch_assoc($query)){
 if($_POST['membership_id'] == $em['membership_id']){ $sel= ' selected';}else{$sel=NULL;}
 echo '<option value="'.$em['membership_id'].'"'.$sel.'>'.$em['membership_title'].'</option>';
 }
 ?>
 </select>
 </font></td>
 </tr>
 <tr>
 <td width="50%"><font size="2">User Status: </font></td>
 <td width="50%">
 <font size="2">
 <?php if($_POST['user_status'] == '1' || $_POST['user_status'] == NULL){$sel = ' checked';}else{$sel=NULL;}?>
 <input name="user_status" type="radio" value="1"<?php echo $sel;?>>
 On
 <?php if($_POST['user_status'] == '2'){$sel = ' checked';}else{$sel=NULL;}?>
 <input name="user_status" type="radio" value="2"<?php echo $sel;?>>
 Off
 <?php if(strlen($_POST['user_status']) > 2){$sel = ' checked';}else{$sel=NULL;}?>
 <input name="user_status" type="radio" value="2"<?php echo $sel;?> disabled>
 Un-Confirmed</font></td>
 </tr>
 <tr>
 <td><font size="2">Allow Account Deletion: </font></td>
 <td width="50%">
 <font size="2">
 <?php if($_POST['allow_delete'] == '1' || $_POST['allow_delete'] == NULL){$sel = ' checked';}else{$sel=NULL;}?>
 <input name="allow_delete" type="radio" value="1"<?php echo $sel;?>>
Yes
<?php if($_POST['allow_delete'] == '2'){$sel = ' checked';}else{$sel=NULL;}?>
 <input name="allow_delete" type="radio" value="2"<?php echo $sel;?>>
No</font></td>
 </tr>
 <tr>
 <td><font size="2">In Mailing List: </font></td>
 <td width="50%">
 <font size="2">
 <?php if($_POST['user_in_list'] == '1' || $_POST['user_in_list'] == NULL){$sel = ' checked';}else{$sel=NULL;}?>
 <input name="user_in_list" type="radio" value="1"<?php echo $sel;?>>
Yes
<?php if($_POST['user_in_list'] == '2'){$sel = ' checked';}else{$sel=NULL;}?>
 <input name="user_in_list" type="radio" value="2"<?php echo $sel;?>>
No</font></td>
 </tr>
 <tr bgcolor="#CAFFCA">
 <td colspan="2"><font color="#0000FF" size="2"><strong>Custom Fields: </strong></font></td>
 </tr>
 <?php
 $get_fields = mysql_query("SELECT * FROM `memb_customfds`");
 $recrod_nums = mysql_num_rows($get_fields);
 if($recrod_nums <= 0){
 echo '<tr><td colspan="2"><strong>No custom fields on system.</strong></td></tr>';
 } else {
 $array_list = explode("\n",$_POST['custom_fields']);
 foreach($array_list as $line){
 $line = trim($line);
 if($line){
 //Format
 list($id,$value) = explode('{+|%|+}',$line);
 $id = substr($id,1,-1);$value = substr($value,1,-1);
 $_POST["cusfield_$id"] = $value;
 }
 }
 while($each = mysql_fetch_assoc($get_fields)){?>
 <tr>
 <td><font size="2">
 <?php echo $each['field_name'];?>:</font></td>
 <td width="50%"><font size="2">
 <input name="cusfield_<?php echo $each['field_id'];?>" type="text" id="cusfield_<?php echo $each['field_id'];?>" value="<?php echo $_POST['cusfield_'.$each['field_id']];?>" >
 </font></td>
 </tr>
 <?php }
 }?>
 <tr bgcolor="#BEDEDE">
 <td colspan="2"><div align="center">
 <font size="2">
 <input type="submit" name="Submit" value="Submit">
 <input name="doid" type="hidden" id="doid" value="3">
 <input name="user_id" type="hidden" id="user_id" value="<?php echo $_POST['user_id'];?>">
 <input name="old_membership_id" type="hidden" id="old_membership_id" value="<?php echo $_POST['membership_id'];?>">
</font></div></td>
 </tr>
 <tr bgcolor="#CAFFCA">
 <td colspan="2"><div align="right">
 <font size="1">
 <input type="checkbox" id="do_delete" name="do_delete" value="yes">
Delete Users (will also delete payments by user) </font>      </div></td>
 </tr>
 </table>
</form>
<?php } ?>