This script is very easy to integrate into your existing website. It uses “PHP Include” statements to insert the script output into your web pages. You can use a website template and simply use the “include” statement wherever you want the scripts output to appear.
In addition, you could use "Theme" files to change the look of your site.
The sample site included here uses "themes" that incorporate “header” and “footer” files. Header and Footer files splits a website template into 2 parts – the part before the script output is saved as the header, while the html used after the script output is saved as a footer file. The same header and footer file are used on each page of the website - making global changes to the website a snap. If you change some of the html in the header file, the change would be global on every page of the site. Without using this technique, you would have to edit every page on the site to make one small change to your site.
A Theme Tutorial is in the works and will be posted soon. This tutorial will show you how to make your own themes. For now, the script comes prepackaged with several themes. The theme can be changed from the admin section in the "Main Configuration" section. To change themes, log into the admin back end, select the "Main Configuration" link and scroll down to the "Theme Section". Find the dropdown box and select the theme you want to use. Be sure to click the "Save" button to save the change. The new theme will instantly be displayed globally on your site.
How to use this “include” function:
This script was designed from the outset as an "include" script. Simply "include" the functions you need into your html template and omit the features that you don't need. To include a script, you need to follow these rules.
Here is an example of how to include the "Contact Us" form inside your html page:
<?php
# These lines must appear at the top of the page before any html.
# Start the session so php can track users.
session_start();
# include the config.php file so the script will know where
# the support files are located.
include ($path_adjuster."config.php");
?>
(Your html goes here – or html header.)
<?php
# This command will print the "Contact Us" form
include($path_adjuster."$support_files_directory /EZUser_Contact_Form.php");
?>
(The remainder of your html (or footer file) goes here)
This technique will be used for all scripts described here.
List of scripts included and a short description of each one:
Here is a list of each script that can be included and a short description of what they do. You can choose to either use or omit these scripts as your need requires.
EZUser_Registration.php: (This is the only required include script - the rest are optional)
EZUser_Contact_Form.php:
(This script is optional. Only
needed if you want to provide a "Contact Us" email page.)
EZUser_Forgot_Password.php: (Only
required if you require passwords. YES! - Passwords are optional! – you
wouldn’t want to hassle a user for a password in a simple “opt-in” newsletter
would you?)
EZUser_Account_Info.php:
(Again, only needed if passwords are
required.)
EZUser_Change_Password.php: (Yep,
only required if passwords are required.)
EZUser_Failed_Login.php: (Again,
only needed if passwords are required.)
EZUser_Unsubscribe.php: (Although not required for
functionality, you should include this feature if your want to provide a way for
users to “opt-out” of your newsletter.)
EZUser_Validate.php
(Only required if validation is toggled on.)
EZUser_Resend_Validation.php: (Again, only required if validation is toggled
on.)
Setting Up The Simplest Scenario - A Simple Newsletter Subscription Script.
In it's simplest form, this script will allow your users to subscribe to your newsletter. You don't want to hassle your users to input a lot of personal data about themselves like name, address, phone number, etc.. You don't even want them to enter a password! You just want to present them with a small form that allows them to enter their email address - so that they can receive your emailed newsletter. I like to require them to enter just their first name though. That way I have something to call them when I email them later.
For this simple "opt-in"
scenario, the only required files are the "EZUser_Support_Files" directory and
the "config.php" script. All other files are optional. You can
remove them if you wish..
*IMPORTANT POINT*
Remember, as long a PHP is
installed on your server, you can change any .htm or .html page to .php and it
won’t hurt a thing. All html will work just as it did before. The only
difference is that we can insert php code into the document and have it
recognized and executed!
For this example let’s create a new page called "registration.php". Copy and paste your website template or add your website's html look into this new file. Where ever you want the registration form to appear in the new page, just copy and paste this code:
<?php
# This command will print the "Contact Us" form
include($path_adjuster."$support_files_directory /EZUser_Registration.php");
?>
And magically, the registration form will appear wherever this code is entered.
Also, at the very top of the web page - even before the first <html> tag, the following code must appear as the very first thing at the top of the page:
<?php
# These lines must appear at the top of the page before any html.
# Start the session so php can track users.
session_start();
# include the config.php file so the script will know where
# the support files are located.
include ($path_adjuster."config.php");
?>
If this code doesn't appear at the very top of your page, you’ll get a nasty "Headers Already Sent" or other errors like “can’t find file”.
Now just save the page and then access it with a web browser. If all is well, you will be presented with a registration form on a web page that has the look and feel of your website. Fill out the form and see what happens.
If you need to add or remove fields from the registration form, simply go to the admin editor (you may be asked to log in) and click the “registration Form Editor” link, and then edit the registration form by checking or un-checking the appropriate boxes to either display or not display any given field on the registration form. You can also check or uncheck whether or not the field is required or not. Required fields will be marked in bold on the form and will force the user to enter the required info before they can register successfully. In our case, we just want the email to be required (Email is ALWAYS required and can not be changed). We may also want to display the first name and last name fields - but not make them required. That way, the user can enter their name if they want to, but it is strictly voluntary. I actually like to require the first name only so I can use it in the email template to personalize my message to them in mass mailings.
Sending your first Newsletter.
Now that you have the registration form working and you have acquired a few members, it is time to send out a newsletter. Follow the 3 steps previously mentioned above (and reprinted here) to actually send out your newsletter.
Step 1 - Compose your Newsletter
From the admin section main menu, click “Email Template”. Use the WYSIWYG editor to compose your newsletter. Be sure to enter a subject. The subject becomes the file name that you will choose in the next step.
You can use variables inside the subject or the body of the e-mail. For example, typing !first_name! in the body of the email will cause the script to replace that variable with the user’s actual first name. A complete list of usable variables are listed at the bottom of the “Email Template” page for your convenience.
Be sure to save the completed newsletter before continuing to the next step.
Step 2 – Choosing the Recipients
Now that your newsletter is composed, we have to choose who to send it to. From the admin main menu, select “Email Preparation”. Once there, select the newsletter that you just composed in the first dropdown box. Next, select “All Users” from the second dropdown box and click the “Save Emails to Outbox” button. If all went well, the script generated the emails, replaced the variables (like !first_name!) with real data, and saved them to the outbox. Click the link that says “Continue to Outbox”.
Step 3 – Sending the Newsletter
Go to the “Email Outbox” either by clicking the “Continue to Outbox” link as described above or clicking the “Email Outbox” link from the admin Main Menu. You can view any email by clicking on it in the right panel. You can even edit individual letters and re-save them before they are sent. Look over the letters and make sure they meet your approval and then send them out.
You have now just sent out your first newsletter to your distribution list!
If You Require Passwords ...
If you need to require passwords, a few more scripts need to be available to your users. To enable passwords, use the form editor in the admin section and check the box that makes passwords required.
Once passwords are required, your users will need to have a way to recover lost passwords as well as the ability to change their password. This script provides a solution for this. You'll need to make the following pages and use the following "include" statements:
Change Password Form:
To make a "Change Password" page, follow these steps:
Step 1: Build a page called "change_password.php" (you can name it anything you wish - as long as it has the .php extension) and copy your html template to this new file. Be sure to follow this format when you build the change password page:
<?php
# These lines must appear at the top of the page before any html.
# Start the session so php can track users.
session_start();
# include the config.php file so the script will know where
# the support files are located.
include ($path_adjuster."config.php");
?>
And include this code exactly where you want the Change Password form to appear on your page.
<?php
# This command will print the "Change Password" form
include($path_adjuster."$support_files_directory /EZUser_Change_Password.php");
?>
Step2: Go to the “Main Configuration” in the admin section and enter the name of your “Change Password Page” (near the bottom). The script needs to know what you named this page because it generates links to this page on other pages.
Step 3: Test the new page by accessing it with a web browser and log in if needed - then try to change your password.
Recover Lost Password Form:
To make a "Recover Password" page, follow these steps:
Step 1: Build a page called "recover_password.php" (again, you can name it anything you wish - as long as it has the .php extension) and copy your html template to this new file. Be sure to follow this format when you build the recover password page:
<?php
# These lines must appear at the top of the page before any html.
# Start the session so php can track users.
session_start();
# include the config.php file so the script will know where
# the support files are located.
include ($path_adjuster."config.php");
?>
And include this code exactly where you want the Change Password form to appear
<?php
# This command will print the "Change Password" form
include($path_adjuster."$support_files_directory /EZUser_Forgot_Password.php");
?>
Step2: Go to the “Main Configuration” in the admin section and tell the script the name of your “Forgot password page” (near the bottom). The script needs to know what you named this page because it generates links to this page on another pages.
Step 3: Test the new page by accessing the page with a web browser and fill out the form to have your password sent to you.
=============================================================================
Do you see a pattern here? Yep, all of the separate scripts described here are all installed or "included" the exact same way as the examples above. You just have to determine which scripts you need for your particular application and the script will take care of all the work for you. Just remember to include the "session" and “config.php” statement at the top of each page and the include statement in the exact place you want the script's output to show up on your page. That's It!
Here is a quick Guide to which scripts you'll need for various applications.
Script "includes" required for a simple opt-in newsletter or email list. - A simple opt-in list should not require the user to enter a password. You normally want to make this as easy as possible on your prospective list subscriber to fill out the registration form. Require them to enter just their e-mail address only. Since no password is required, you don't need to make a page to change the password, or to recover the password, etc.
For this simple use, you only need to include the registration form.
include ($path_adjuster."$support_files_directory /EZUser_Registration.php"); (This prints out the registration or "opt-in" form.)
If you want to allow your users to unsubscribe from the list, you'll need to include:
include ($path_adjuster."$support_files_directory /EZUser_Unsubscribe.php"); (This script allows your users to unsubscribe from any opt in newsletter or email list.)
Script includes needed for a true membership script. - If you need to password protect files, or simply require your users to log in to view some special content, then you will need to require them to enter a password when they register for an account. To do this, you will want to "include" these pages on your website.
include
($path_adjuster."$support_files_directory /EZUser_Registration.php");
(This prints out the
registration form.)
include
($path_adjuster."$support_files_directory
/EZUser_Change_Password.php"); (This script allows your users to
change their password)
include
($path_adjuster."$support_files_directory
/EZUser_Forgot_Password.php");
(This script allows your users to recover their lost password via email.)
If you want to allow your users to update their account info like address or phone number, etc - then you need to include this script:
include ($path_adjuster."$support_files_directory /EZUser_Account_Info.php"); (This prints out a form that allows your users to change their personal info.)
If you want to take advantage of using the options like "suspend user", or "Ban an account" or "Expire account", or "account validation", you'll need to include the EZUser_Failed_Login.php script: These options are all available in the admin section's User Editor. You can ban a user until a certain date or make the user's account expire on some future date, or simply suspend the user until further notice. Just check the appropriate checkbox in the user editor.
include ($path_adjuster."$support_files_directory /EZUser_Failed_Login.php"); (This script informs your user why they were denied access.)