My PRIVATE PLACE

Discussion about the creation of websites in general, HTML, PHP, Java.

My PRIVATE PLACE

Postby Knoxnyt on Mon Feb 20, 2006 9:56 pm

Hello, i wanna know if anyone here can tell me an MODULE or script or anything like this to make an login, without register, ( I Want to put an private part in my site, thats only me and friends can enter)
Knoxnyt
Newbie
Newbie
 
Posts: 15
Joined: Mon Feb 20, 2006 9:33 pm

Postby Tim on Tue Feb 21, 2006 6:31 am

somepage.html
Code: Select all
<form action=login.php method=post>
Username: <input type=text name=username><br>
Password: <input type=text name=password><br>
<input type=submit value=Login></form>


login.php
Code: Select all
<?php

// BASIC LOGIN SCRIPT USING HARDCODED CREDENTIALS
// BY TIM [ [email protected] ]

( !isset( $_POST['username'] ) || !isset( $_POST['password'] ) ) ? die('Insufficient login elements completed') : '';

$auth = array();

// Insert your usernames and passwords like so.....
// $auth['username'] = 'password';
// ie. should your user be tim and your pass be test
// you would do:
// $auth['tim'] = 'test';

$auth['tim'] = 'test';
$auth['idiot'] = 'password';
$auth['example'] = 'example';

// NOTE: ONLY UNCOMMENT ONE OF THE BELOW LINES
// Uncommment the line below if you want to use plaintext passwords
// if ( $auth[$_POST['username']] == $_POST['password'] ) {
// Uncomment the line below if you want to use encrypted passwords
// if ( $auth[$_POST['username']] == sha1($_POST['password']) ) {

header('Redirect: http://my.website.com/secure_page');

} else {

die('Incorrect login details provided');

}

?>

Ok, the above probably doesn't work but its a pretty decent description of how it would work assuming you didn't want database access and stuff, nor actual secure pages using sessions and cookies and the like....
User avatar
Tim
root
root
 
Posts: 736
Joined: Thu Mar 10, 2005 6:31 am
Location: Australia

Postby Xer on Wed Feb 22, 2006 3:10 pm

why dont u get any script and disble registring , its easy and simple solution Smile
Xer
Contributer
Contributer
 
Posts: 36
Joined: Fri Feb 17, 2006 8:01 am

Postby zogo on Wed Feb 22, 2006 4:52 pm

why don't you just protect with .htaccess? Easiest and fastest solution.
irc.anoxs.net
#phoenix
zogo
Phoenix Veteran
Phoenix Veteran
 
Posts: 667
Joined: Thu Mar 10, 2005 5:23 pm
Location: Northern California

Postby Samppa on Wed Feb 22, 2006 7:53 pm

But looks like doodoo Wink
(\__/)
(='.'=) This is RomMaster's Bunny. Copy and paste bunny into your
(" )_(" ) signature to help him gain world domination.
Samppa
Phoenix Veteran
Phoenix Veteran
 
Posts: 744
Joined: Thu Feb 02, 2006 10:00 am
Location: Finland

Postby Tim on Thu Feb 23, 2006 8:59 pm

zogo wrote:why don't you just protect with .htaccess? Easiest and fastest solution.


But php and cookies/session's makes you seem cool Razz
User avatar
Tim
root
root
 
Posts: 736
Joined: Thu Mar 10, 2005 6:31 am
Location: Australia

Postby Knoxnyt on Sun Feb 26, 2006 4:14 pm

er.. where do i find the .htaccess to edit it ? i'm trying to see in the FTP and i didn't found ;(
Knoxnyt
Newbie
Newbie
 
Posts: 15
Joined: Mon Feb 20, 2006 9:33 pm

Postby PP06 on Sun Feb 26, 2006 4:26 pm

Knoxnyt wrote:er.. where do i find the .htaccess to edit it ? i'm trying to see in the FTP and i didn't found ;(


Which FTP client do you use? Have you turned on "show hidden files"? Because .xxxx files are meaned as hidden
PP06
Newbie
Newbie
 
Posts: 6
Joined: Sun Feb 26, 2006 1:46 pm

Postby Hamish on Sun Feb 26, 2006 4:31 pm

It should be right there, in your home directory? Or CHMOD .htaccess to 777.
Thanks, Hamish.
Hamish
Contributer
Contributer
 
Posts: 36
Joined: Sun Feb 19, 2006 4:18 pm
Location: Scotland


Return to General Webmastering

Who is online

Users browsing this forum: No registered users and 1 guest

cron