Author Topic: [Request] Basic Login Page  (Read 1648 times)

0 Members and 1 Guest are viewing this topic.

Offline bubzuru

  • Knight
  • **
  • Posts: 395
  • Cookies: 21
  • everything is contained in the data
    • View Profile
    • New School Tools
[Request] Basic Login Page
« on: October 06, 2013, 08:31:21 pm »
this keeps fucking up for me, can someone give me a basic login page using
sessions , no databases im just getting user pass from a variable

page1.php << create sesion if user pass is correct
page2.php << redirect to page1.php if session is not set >> data
Damm it feels good to be gangsta
http://bubzuru.comule.com

Offline Fur

  • Knight
  • **
  • Posts: 216
  • Cookies: 34
    • View Profile
Re: [Request] Basic Login Page
« Reply #1 on: October 06, 2013, 11:58:53 pm »
Code: (php) [Select]
<?php
// login.php
@session_start();
define('USERNAME''root');
define('PASSWORD''toor');

if (@
$_SESSION['IS_LOGGED_IN']) {
    
header("Location: main.php");
}

if (isset(
$_GET['username'], $_GET['password'])) {
if (USERNAME == $_GET['username'] && PASSWORD == $_GET['password']) {
$_SESSION['IS_LOGGED_IN'] = true;

header("Location: main.php");
} else {
die('Incorrect login.');
}
}
?>


Code: (php) [Select]
<?php
// main.php

if (!@$_SESSION['IS_LOGGED_IN']) {
header("Location: login.php");
exit;
}

echo 
's00per secret text.';
?>

Written in the browser.
« Last Edit: October 07, 2013, 07:07:05 pm by Fur »

Offline bubzuru

  • Knight
  • **
  • Posts: 395
  • Cookies: 21
  • everything is contained in the data
    • View Profile
    • New School Tools
Re: [Request] Basic Login Page
« Reply #2 on: October 07, 2013, 08:08:00 pm »
this is causing the  same error i was getting

Code: [Select]
The page isn't redirecting properly
         
 Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
       

  This problem can sometimes be caused by disabling or refusing to accept
    cookies.

nm fixed it now, you just forgot to add session_start() to main.php

thanx +1
« Last Edit: October 07, 2013, 08:22:56 pm by bubzuru »
Damm it feels good to be gangsta
http://bubzuru.comule.com

Offline gh0st

  • Sir
  • ***
  • Posts: 575
  • Cookies: 8
  • #DEDSec
    • View Profile
Re: [Request] Basic Login Page
« Reply #3 on: October 31, 2013, 04:51:23 am »
im new to this stuff are u working with mysql?

Offline Traitor4000

  • Knight
  • **
  • Posts: 191
  • Cookies: 8
    • View Profile
Re: [Request] Basic Login Page
« Reply #4 on: November 12, 2013, 03:58:44 am »

im new to this stuff are u working with mysql?
Nope just php if it were MySQL you would see things like SELECT, WHERE, and FROM.


See Here: that is just defining php variables if it were MySQL these would be in a database
Also right here to retrieve the username and password from the database would be a very different process.
  • if (isset($_GET['username'], $_GET['password'])) {
  •         if (USERNAME == $_GET['username'] && PASSWORD == $_GET['password']) {
ps. I don't want to go too off topic so I won't explain it more besides I don't know php I'm just using what I know from C and MySQL.
« Last Edit: November 12, 2013, 04:08:11 am by Traitor4000 »
The most vulnerable part of an impenetrable system is those who believe it to be so.

Offline Stackprotector

  • Administrator
  • Titan
  • *
  • Posts: 2515
  • Cookies: 205
    • View Profile
Re: [Request] Basic Login Page
« Reply #5 on: November 13, 2013, 10:17:45 am »
</thread>
~Factionwars