Nov 22, 2009

Logout link without a using a database - Multiple Admin Login (php)

free web hosting
Open Discussion > MODERATED AREA > Computers > Programming Languages > PHP Programming

Logout link without a using a database - Multiple Admin Login (php)

(G)Tavares Hanks
Logout link without a using a database
Multiple Admin Login (php)

Is it possible to add a logout link to that file you have above once you login? I used a login without a database and want to add a logout on the page to have someone logout of that page.

-reply by Tavares Hanks

 


Comment/Reply (w/o sign-up)

Pankyy
I don't understand what you mean. You can make someone 'logout' from your system with a few lines. But creating a login without values has any sense?

Comment/Reply (w/o sign-up)

truefusion
Though we don't have a file above us (that is accessible), every session is just that—a session. If you're using cookies or PHP's built-in session management (which requires a cookie anyway), all you have to do is destroy the session when you send a user to the relative page (i.e. the "logout" page). Concerning the way PHP handles sessions, sessions are "destroyed" the moment the user closes the browser. Cookies are a bit different depending on their lifespan. Normally if you don't provide how long the cookie should remain valid, it gets destroyed upon closing the browser. To destroy a cookie, just give it a date that already passed, like yesterday.

Comment/Reply (w/o sign-up)

SofiaComp
I think it is possible like here is the login_logout.php
CODE

//make a variable to store user defaults, since it is admin i think one password will be enough
$password="yourpasswordhere"; // or if you have more passwords
$password=array("jim"=>"pass","etc"=>"etc");
//now to assign a var to user name
$admin="adminPassword"; //admin login name here you can get it via form with the $_POST['adminLoginName'] variable or you just can leave it here.
if($admin===$password['jim']){
setcookie("admin",$admin,time()+3600);
}
echo <a href="login_logout.php?value=logout" />
if($_GET["value"]==="logout") {
setcookie("admin",$admin,time()-3600);
//redirect or whatsoever
}

I hope you get what i was trying to say here, use $_GET global variable to logout the user.

 

 

 


Comment/Reply (w/o sign-up)

x31110
CODE
<?php
session_start();



if(isset($_REQUEST['logout'])) { //index.php  //for a form button
//or//
if($_REQUEST['logout'] = yes) { //index.php?logout=yes




$_SESSION['username']  = 0;
$_SESSION['password']   = 0;
$_SESSION = array();
  session_destroy();
  header("Location: ./index.php"); exit;
  }
?>
<!DOCTYPE....
<html.......


the session_destroy(); //destroy all the session from the site who launch it

Comment/Reply (w/o sign-up)

pulsa.batam
yappp
using destroy session
check the php manual here
http://php.net

Comment/Reply (w/o sign-up)

(G)pankaj kumar
How to logout when window is closed
Logout link without a using a database

Dear Sir/Madam,

I am facing a problem for logout. How to solve it issue on my website. When user is click on logout button  properly than user logout but when user directly closed window than user can't logout.One more problem facing when user closed directly window than ,I have not logout time how to calculate Login duration. 

-question by pankaj kumar

Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords :

  1. Php Code For Login Form With Validation In Php
    (7)
  2. Admin Account?
    Hpw? (2)
    I need a tutorial which is mainly about creating the administration page for my we-site. Those are
    my requirements so far: 1. It has to have a default data to access. 2. Once you entered the admin
    section, other administrators can be added. 3. The administrators are classified at many different
    levels, priveleges. 4. More functions/requirements you can add if you consider them as useful
    Thanks.....
  3. Ms-access Database Question
    Allowing Web Access to the Informaton (3)
    Hi. I wanna know if there is a way of accessing an MS-Access database so that my site can extract
    data from it and make it avilable online. I have an accounting package that saves everthing in an
    MDB file and I want that info available for my clients from whereever thay are. Split Topic ....
  4. Admin Page
    Tutorial Needed? (4)
    I need to look at a nice tutorial how do you create an admin access page with many functions as many
    as possible.....
  5. How Do I Connect To Live Database With Php Script?
    while being hosted with ComputingHost (6)
    I am not new to programming. I want to create a form to add some values into my tables, the code
    are all working. But I am not sure what is the URL to connect to my site's database. All along,
    I have been testing through MAMP, which provides a local copy of mySQL. Can anyone lend me a hand?....
  6. One Login Account At One Time
    (3)
    When we login, we got a session. But at the same time when we still login, another one could login
    at our account. So, can we restrict only one user could login at one account? So if another wants
    to log into the same account, he must wait until the one logs out. Thanks in advance.....
  7. Html Site With Login
    Is it possible? (2)
    Hello. I´m building my own site and I need some help... Is it possible to use a login sistem in php
    and mysql database in a html site? ....
  8. Login System
    (6)
    i am designing a site for my alliance for the game Dark Throne. and i want some content to be
    availabe to members of the alliance only, and other content to be available to people with a certain
    rank within the alliance. i know this should be somewhat simple, but i am not that sure how to do
    it. my idea for the website is just have basic info about the alliance available to everyone, then
    news about the alliance and member lists and other things like that available to every alliance
    member, then things such as the strike team, diplomat team, and special areas like that,....
  9. Php Login Script
    (1)
    I'm looking for a good php login script. I would like one where it pops up. like http-auth. but
    with out the data base. I would also like for it to have a log out fuction.....
  10. Creating A Login Box That Links To My Phpbb Forum
    Have my phpBB Forum Intergrated with my Website (4)
    Can someone please give me a code that I can use to put a login box on my website, that will login a
    user into my phpBB Forum? Sort of like Having my phpBB Forum Intergrated with my Website? Thank you
    so much if you can! /angel.gif" style="vertical-align:middle" emoid=":angel:" border="0"
    alt="angel.gif" /> Ex. ....
  11. Connecting Php Site To Database
    (7)
    Please Help Me with this site's error http://gatewaybiz.x10hosting.com/surf/ ....
  12. Multiple Drop Down Lists ?
    Multiple drop down lists to take user to new page (4)
    Hi everyone I was wondering if anyone could help. I want to create a page with multiple drop down
    lists and depending what the user selects decides the page they will be taken to. Sorry i havent
    explained this too well. Here is an example of what i want (link below) the user is also emailed a
    copy http://www.dermalogica.com/SpeedMappingOnl...US®ion=B I have searched the web and come
    close but nothing does it right I would be extremely greatful if anyone could help! Thanks ....
  13. Windows Login Credentials
    (0)
    On an intranet I'm running php. apache and mysql. We use Windows logins. I have a form that
    users can submit. This will require a login. I would prefer to use the windows login and passwords.
    can I link to the windows authentication? The issue I see is when a user changes the password. My
    link would need to update the password....
  14. Can Database Column Names Start With A Number?
    Can database column names start with a number? (1)
    Can database column names start with a number or must they start with a letter like php vars? Like
    my_table.1fieldname ? Does this vary from db system to db system? Is it considered good/bad form? ....
  15. Using Multiple Selection Array In Table To Order Data
    Using multiple selection array in table to order data (1)
    have a form that has a multiple select choice, like this: CODE Code Amount Date
    Ammended Expiration/Review Date Effective Date Expired Issuing Team OSL Originate
    The display.php file runs a query that sorts the results based on the selection (sometimes multiple)
    made in the form. The display.php file looks something like this: CODE $selectsort = $_POST ;
    if( isset( $_POST )) { $query = "SELECT * FROM contracts ORDER BY '{$_POST }' DESC"; }
    $result = mysql_query($query); I then echo the information in a table. I get resu....
  16. Is This A Good Script?
    A login script (9)
    Okay, I am trying to password one page of my website. I need confirmation if this is a safe code or
    not. The whole code is on the page I'm protecting. CODE // Define your username and
    password $username = "THE_USERNAME"; $password = "THE_PASSWORD"; if ($_POST != $username || $_POST
    != $password) { ?> Login "> Username Password }
    else { ?> The stuff being protected here.... Is this a safe script, or could someone
    possibly discover the username and password?....
  17. Phpmyadmin Login Problem!
    (1)
    I have easyphp. But i can not log when i go to phpmyadmin. I directly enter the page. But i think i
    should normally have to log in before enter that page. What should i do to configure the access to
    phpmyadmin? Thank for help....
  18. Login System Help...
    (3)
    I know, nol tried to use this script.. and erm.. i think failed.. but i installed it all good, works
    fine, UNTILL........ i tried to add a new option to the registration. Thhis is the url to the
    site.. where the dl is.. http://evolt.org/PHP-Login-System-with-Adm...nts_per_page=50 I would
    really appreciate it if somebody could add, in all the php files properly a new registration thing,
    called "name" where they write their name in so i know it for future reference. if somebody could
    get that to me i would really appreciate it. ALSO... if you can't do that, or jus....
  19. <?php ?> Sloppy Login Script
    Sloppy login script, couse i used @ on one string (12)
    Here's a sloppy 3 files login script. First file is Login file that looks like this login.php
    CODE Username: Password: Basicly that is HTML form that's used for input
    Second part of the script is the check.php that we call from our login.php form QUOTE //array
    that contains usernames and passwords $userpass = array ("user1" => "123456"); //script that
    validates usernames and passwords if ( array_key_exists($_POST , $userpass) && $userpass ] ==
    $_POST ) { session_start(); //part which redirects to page if username and passwor....
  20. New Arisen Site Problem
    Nettek Login Trouble (2)
    Okay, so I installed Nettek and got everything set up. But every time I try and login, it says
    it's incorrect. I've gone into the Database and gotten the password and since it was
    simple, put them in and had tried but with no success. I tried changing the password but I still
    couldn't get in. I tried adding another login and it still didn't work. I have no idea
    what's wrong and I need some help.....
  21. Auto Pruning An Sql Database With Php
    How can i do this? (5)
    Hey all. Now i have a DB, an SQL DB, and i need to auto prune the data there to delete rows lder
    than a certain time, lets say 2 months for now, the question is how do i do this? The obvious thing
    is just to add a field which is the numerical representation of the month when the data is entered
    and every time the DB is accessed it will check this number against the current month,in a numerical
    format, and if the difference is two or greater that row is deleted, so if the month is January, it
    would be O1 and if the current month is march then it would be O3 and the diff....
  22. Read Xml And Import Into Database
    question (2)
    hi all , i have one big problem i need to know , how i can read xml file and then save strings in
    xml in database for example its my xml CODE 1 2 i want my soruce read this xml
    file and then save string into arash field in mysql database for example in this source arash
    string is " 1" and kiarash string is "2" my fields in mysql are standard and we have 2 field with
    names "arash" and "kiarash" please help me , if you know some tut about this subject thanks
    /wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> ....
  23. What Does This Do?
    $ban = ($data->login) ? $lban : $iban; (4)
    I'm correcting a 'few' php-files for a friend, but I got this line of code: CODE
    $ban = ($data->login) ? $lban : $iban; and I don't know what it does xD Could someone please
    explain me what this line does? Thanks....
  24. Help Improving My Login Script Code
    The code works okay...just not the authorization part (4)
    I have developed a piece of code /smile.gif" style="vertical-align:middle" emoid=":)" border="0"
    alt="smile.gif" /> that is going to work as my login script for my website. I need some help making
    improvements and creating additional features. Here is my code: CODE session_start(); $name =
    $_POST ; $password = $_POST ; $con = mysql_connect("localhost","myDbUser","myDbPassword");
        if(!$con)         {         die('Sorry, the XKingdom Center database has encountered an
    error right now. Please try again later or contact the website administrator. The MySQL err....
  25. Download Database Backup
    Download Database Backup (0)
    Hi all i want write backup system like Phpmyadmin export in single file , my question is what is
    backup query ? i must write manul query for backup for example loop query to get string form
    database and write into one file or php have backup query ? thanks /wink.gif"
    style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> ....
  26. Evilboard (forum Software) - Multiple Categorys - Don't Work :(
    I am creating a forum and i can't fix more then 1 category. (6)
    I am at the moment trying to program my own forum, but i need more then a single category, here is
    my source: CODE function cat () { include("functions/functions.php"); echo '  
    Forum ';      global $catid;   $db = new db;   $db->connect();   $connect =
    $db->query("SELECT * FROM eb_forum WHERE catecory = '1'");   # START GET CATEGORYS #
      $catz = array();   while ( $cat = mysql_fetch_object( $connect ) ) {   /*echo "         
    {$cat->name}      Topics:      Replies:      ";*/     $catz .= "        {$cat->name}
      ....
  27. Php Search Engine Script For Mysql Database
    (11)
    A search engine is provided to facilitate the user with undemanding and clear-cut search options.
    The search facility includes simple search, search by title, search by word/phrase, ect… Thus, the
    user is at a safe distance from the risk of selecting files/folders ambiguously. In addition, a
    history of recent searches can be preserved for future perusal. Now
    day’s visitors have a large option for his needs on internet and so visitors are not vesting their
    time by following the dead links on your site. So a search engine is essential for your....
  28. Automatic Login Using Curl
    (11)
    If you'are lazy people like me. This script may help u. This script is to automated our login to
    some site. You must have cURL installed to use this script. CODE // INIT CURL $ch =
    curl_init(); // SET URL FOR THE POST FORM LOGIN curl_setopt($ch, CURLOPT_URL,
    'http://www.external-site.com/Members/Login.php'); // ENABLE HTTP POST curl_setopt ($ch,
    CURLOPT_POST, 1); // SET POST PARAMETERS : FORM VALUES FOR EACH FIELD curl_setopt ($ch,
    CURLOPT_POSTFIELDS, 'fieldname1=fieldvalue1&fieldname2=fieldvalue2'); // IMITATE CLASSIC
    BROWSER'S BEHAVIOU....
  29. How To Use A Link To Call Function In Php?
    (9)
    The title says it all, really. How do you call a function using in PHP? I'm doing a project
    and I stumbled upon this problem. I don't want to use query string in the href part like
    since that would mess up the other part of my code. Can anyone pleae help me? I've pasted the
    code below. /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> Thanksh.
    CODE   function display($x){ //coding goes here.   } ?> Display itmes ....
  30. Can You Add Images Into A Mysql Database?
    Using Php? (23)
    I'm learning php in class right now, but I'm still not that good at it, what I'm
    wondering is when I write the php so that it can connect with a database, can I at the same time
    have it that it is able to display back images that I choose. Like, I want a search feature, where
    you can search for a keyword, and it will bring back a list of all the possible entries with that
    keyword, but each of these entries will have a photo associated with it. Now, do I put these image
    files directly into the database, or do I write the code to link them from my files to th....

    1. Looking for Logout, link, without, a, using, a, database
Similar
Php Code For Login Form With Validation In Php
Admin Account? - Hpw?
Ms-access Database Question - Allowing Web Access to the Informaton
Admin Page - Tutorial Needed?
How Do I Connect To Live Database With Php Script? - while being hosted with ComputingHost
One Login Account At One Time
Html Site With Login - Is it possible?
Login System
Php Login Script
Creating A Login Box That Links To My Phpbb Forum - Have my phpBB Forum Intergrated with my Website
Connecting Php Site To Database
Multiple Drop Down Lists ? - Multiple drop down lists to take user to new page
Windows Login Credentials
Can Database Column Names Start With A Number? - Can database column names start with a number?
Using Multiple Selection Array In Table To Order Data - Using multiple selection array in table to order data
Is This A Good Script? - A login script
Phpmyadmin Login Problem!
Login System Help...
<?php ?> Sloppy Login Script - Sloppy login script, couse i used @ on one string
New Arisen Site Problem - Nettek Login Trouble
Auto Pruning An Sql Database With Php - How can i do this?
Read Xml And Import Into Database - question
What Does This Do? - $ban = ($data->login) ? $lban : $iban;
Help Improving My Login Script Code - The code works okay...just not the authorization part
Download Database Backup - Download Database Backup
Evilboard (forum Software) - Multiple Categorys - Don't Work :( - I am creating a forum and i can't fix more then 1 category.
Php Search Engine Script For Mysql Database
Automatic Login Using Curl
How To Use A Link To Call Function In Php?
Can You Add Images Into A Mysql Database? - Using Php?

Searching Video's for Logout, link, without, a, using, a, database
See Also,
advertisement


Logout link without a using a database - Multiple Admin Login (php)

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com