The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 16, 2019, 09:50:06 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: GhettoLogin  (Read 2580 times)
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« on: February 14, 2008, 06:37:06 PM »

You gotta love when you can use Ghetto in a function name and actually be a legitimate use.
This function does no enforcement, but it sets a session var "usertype".
do your own enforcement from there. Just meant to be a quick and easy password login for a site that does not warrant a database.

usage
Code:
ghettologin('nutballs','ghettopass',$_POST['user'],$_POST['pass'],'admin','/home.php');
ghettologin('perk','biglongultraparanoidpass',$_POST['user'],$_POST['pass'],'phpnerd','/home.php');

function
Code:
    function ghettologin($validuser,$validpass,$user,$pass,$successusertype,$successtowhere='/')
    {
    //string as many of these 1 right after the other on a login page, as needed.
    if ($user != '' and $pass != '')
    {
if ($validuser == $user and $validpass == $pass)
{
$_SESSION['usertype'] = $successusertype;
header('Location:'.$successtowhere);
}
}
}
« Last Edit: March 17, 2008, 10:57:58 AM by nutballs » Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: February 14, 2008, 06:56:15 PM »

oh I can see a whole new batch of interestingly named functions on the horizon... go NBs!
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #2 on: February 14, 2008, 06:59:35 PM »

yep, it makes perfect sense to me. this is the most ghetto of login functions I have ever made. lol
but hell, it works.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #3 on: February 20, 2008, 09:13:42 AM »

uber.
Logged

hai
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!