How to create LOGIN AREA (register,log in)

Hello

I am making my web sites with a Xara web designer 6. using 000webhost.com server to upload the files to the internet.

Now i want to add LOGIN area to my site, where people can “register”, “login”, and “forget passport”. (so there would be restricted area (a page or two) (for example: index5, where you would have to register, - to see it) … and it would be ok that i create user names and passports manually for people (it doesnt have to be automacilly)

Can any body please help me (i am making my sites in Xara web…)
I am beginer, just a design platform website maker.

THANK YOU VERY MUCH :slight_smile: … have a nice day…

If you are using a wysiwyg program for creating your site then you will most likely be restricted to whatever functions they have for such a feature. Do they offer anything like that with the script you are using? If they don’t then you may want to look into a CMS or something that has a functionality close to what you are looking for. What do you want the users to be able to do once they have logged in?

You may consider to move to the next step by using mySQL integration with your website…
You may refer to php and mySQL tutorials. :slight_smile:
And I guess you can still make the website using Xara but you have to work around with the SOURCE page in the editor…

Please check this tutorial
http://www.phpeasystep.com/phptu/6.html <-- Making a login page
and this one
http://www.phpeasystep.com/mysqlview.php?id=2 <-- Making a database using phpMyAdmin…
If you got trouble, please ask us again…
Hope helps :slight_smile:

hi willypt

i would like to create a login page and a registration page for my users,
do you know anything about creating scripts for phpmyadmin,
i have created a table in mysql with 7 rows,
including:
ID, INT 4
Firstname, VARCHAR 65
Lastname, VARCHAR 65
E-mail, VARCHAR 65
Username, VARCHAR 65
Password, VARCHAR 65
Verify password, VARCHAR 65

i have looked at serveral tutorials and still don’t get them a 100%
could you help oknow anybody else who could please.

i found this script to be very useful -> http://www.free-installations.info/forum/scripts-code-snippets/108-simple-login-script-protect-your-pages.html

It´s easy to set up and integrate in your site

Hi Bad Karma

really appreciate the help, i downloaded the script and inserted the table into my mysql named users i had to modify the scripts abit ie,dbhost , dbuser, dbpassword, dbdatabase every seems to be fine appart from when i insert my dbhost it comes up with a error could you by any chance please thanks in advance.

There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

ERROR: Unknown Punctuation String @ 1
STR: <?
SQL: <?php

define (“DB_HOST”, “mysql12.000webhost.com”);<?php

define (“DB_HOST”, “mysql12.000webhost.com”);<?php

define (“DB_HOST”, “mysql12.000webhost.com”);<?php

define (“DB_HOST”, “mysql12.000webhost.com”);<?php

define (“DB_HOST”, “mysql12.000webhost.com”);<?php

define (“DB_HOST”, “mysql12.000webhost.com”);<?php

SQL query:

<?php define (“DB_HOST”, “mysql12.000webhost.com”);

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<?php

define (“DB_HOST”, “mysql12.000webhost.com”)’ at line 1

where did you get all the

<?php

from? i am sure they aren´t there in the original config file.

i donwloaded the script from this website and it was in the dbc file http://php-login-script.com/

I know it´s in the dbc.php file, but look at the original code for the database configuration

define ("DB_HOST", "xxxxxx"); // set database host
define ("DB_USER", "xxxxxx"); // set database user
define ("DB_PASS","xxxxxxx"); // set database password
define ("DB_NAME","xxxxxx"); // set database name

and then look at the output of your error message

define ("DB_HOST", "mysql12.000webhost.com");<?php

define ("DB_HOST", "mysql12.000webhost.com");<?php

define ("DB_HOST", "mysql12.000webhost.com");<?php

define ("DB_HOST", "mysql12.000webhost.com");<?php

define ("DB_HOST", "mysql12.000webhost.com");<?php

define ("DB_HOST", "mysql12.000webhost.com");<?php

I wonder where that <?php at the end of each line comes from?
Can you post the first 30 lines of your dbc.php file please? Prior to posting please remove your details or replace them with some fictional details

<?php

define (“DB_HOST”, “"); // set database host
define (“DB_USER”, "
"); // set database user
define (“DB_PASS”,"
"); // set database password
define (“DB_NAME”,"
*****”); // set database name

$link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(“Couldn’t make connection.”);
$db = mysql_select_db(DB_NAME, $link) or die(“Couldn’t select database”);

/* Registration Type (Automatic or Manual)
1 -> Automatic Registration (Users will receive activation code and they will be automatically approved after clicking activation link)
0 -> Manual Approval (Users will not receive activation code and you will need to approve every user manually)
*/
$user_registration = 1; // set 0 or 1

define(“COOKIE_TIME_OUT”, 10); //specify cookie timeout in days (default is 10 days)
define(‘SALT_LENGTH’, 9); // salt for password

//define (“ADMIN_NAME”, “admin”); // sp

/* Specify user levels */
define (“ADMIN_LEVEL”, 5);
define (“USER_LEVEL”, 1);
define (“GUEST_LEVEL”, 0);

/*************** reCAPTCHA KEYS****************/
$publickey = “***********************”;
$privatekey = “**********************”;

/**** PAGE PROTECT CODE ********************************/

function page_protect() {
session_start();

global $db;

/* Secure against Session Hijacking by checking user agent */
if (isset($_SESSION[‘HTTP_USER_AGENT’]))
{
if ($_SESSION[‘HTTP_USER_AGENT’] != md5($_SERVER[‘HTTP_USER_AGENT’]))
{
logout();
exit;
}
}

// before we allow sessions, we need to check authentication key - ckey and ctime stored in database

/* If session not set, check for cookies set by Remember me /
if (!isset($_SESSION[‘user_id’]) && !isset($_SESSION[‘user_name’]) )
{
if(isset($_COOKIE[‘user_id’]) && isset($_COOKIE[‘user_key’])){
/
we double check cookie expiry time against stored in database */

$cookie_user_id  = filter($_COOKIE['user_id']);
$rs_ctime = mysql_query("select `ckey`,`ctime` from `users` where `id` ='$cookie_user_id'") or die(mysql_error());
list($ckey,$ctime) = mysql_fetch_row($rs_ctime);
// coookie expiry
if( (time() - $ctime) &gt; 60*60*24*COOKIE_TIME_OUT) {

	logout();
	}

/* Security check with untrusted cookies - dont trust value stored in cookie.
/* We also do authentication check of the ckey stored in cookie matches that stored in database during login*/

 if( !empty($ckey) && is_numeric($_COOKIE['user_id']) && isUserID($_COOKIE['user_name']) && $_COOKIE['user_key'] == sha1($ckey)  ) {
 	  session_regenerate_id(); //against session fixation attacks.

	  $_SESSION['user_id'] = $_COOKIE['user_id'];
	  $_SESSION['user_name'] = $_COOKIE['user_name'];
	/* query user level from database instead of storing in cookies */	
	  list($user_level) = mysql_fetch_row(mysql_query("select user_level from users where id='$_SESSION[user_id]'"));

	  $_SESSION['user_level'] = $user_level;
	  $_SESSION['HTTP_USER_AGENT'] = md5($_SERVER['HTTP_USER_AGENT']);
	  
   } else {
   logout();
   }

} else {
header(“Location: login.php”);
exit();

Weird, looks alright. Let me do a quick test on my 000webhost test account

Script works fine -> http://just2test.freeiz.com/login
Just did a quick setup without any Captcha to see if the script works. So can you doublecheck your database details you put in the configuration file?

it show the error in image verification on line no. 465 and 466…
plzzz help me…
this script is the same

you put the wrong server, instead of putting the host name of the web server use the name of the mysql server (typically mysql**.000webhost.com, ** being a number)

MY SCRIPT SHOWS THIS ERROR

[COLOR=“Red”]Image Verification [/COLOR]
[COLOR=“Blue”]PHP Error Message [/COLOR]

Warning: require_once(recaptchalib.php) [function.require-once]: failed to open stream: No such file or directory in /home/a4435963/public_html/register.php on line 465

[COLOR=“seagreen”]Free Web Hosting [/COLOR]

[COLOR=“blue”]PHP Error Message [/COLOR]

Fatal error: require_once() [function.require]: Failed opening required ‘recaptchalib.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/a4435963/public_html/register.php on line 465

[COLOR=“SeaGreen”]Free Web Hosting [/COLOR]

PLZZZ HELP ME

Please consult the FAQ for the script. This error is caused by you not having uploaded the recaptchalib.php file to the directory you installed the login script in. also you need to get the private/public keys to make the recaptcha verficiation work

can u fix this problem then plzz tell me…
i really need this script 4 my website…

Please download this zip file
http://code.google.com/p/recaptcha/downloads/detail?name=recaptcha-php-1.11.zip&can=2&q=label%3Aphplib-Latest
Then extract it and put recaptchalib.php in the directory you install login script
and here is a page you have to consult further with.
http://code.google.com/apis/recaptcha/docs/php.html

Hope helps,
WillyPT

It´s all in the FAQ, especially the part about recaptcha. And you need to sign up with Recaptcha to get the keys for the image verification to work :slight_smile:

I have done all things but it is not registering …
it shows * ERROR - Invalid email address.