EvilZone

Programming and Scripting => Web Oriented Coding => : bubzuru October 06, 2013, 08:31:21 PM

: [Request] Basic Login Page
: bubzuru 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
: Re: [Request] Basic Login Page
: Fur October 06, 2013, 11:58:53 PM
: (php)
<?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.');
}
}
?>


: (php)
<?php
// main.php

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

echo 
's00per secret text.';
?>

Written in the browser.
: Re: [Request] Basic Login Page
: bubzuru October 07, 2013, 08:08:00 PM
this is causing the  same error i was getting

:
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
: Re: [Request] Basic Login Page
: gh0st October 31, 2013, 04:51:23 AM
im new to this stuff are u working with mysql?
: Re: [Request] Basic Login Page
: Traitor4000 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.
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.
: Re: [Request] Basic Login Page
: Stackprotector November 13, 2013, 10:17:45 AM
</thread>