Giter Club home page Giter Club logo

steam-login-crud-app-php's Introduction

Steam login CRUD app example

A PHP OOP psr-4 auto-loading CRUD app example which uses Steam login authentication from OpenId with xPaw OpenId Steam auth. Includes auto-loading classes for DB actions and for pages.

Generic badge Generic badge Generic badge

Features:

Pages:

  • Home page (Different message depending on login status).
  • Login page (Redirects if already logged in).
  • Logout page.
  • Account page (Redirects if NOT logged in).
  • Account edit page (Redirects if NOT logged in).
  • Delete account page (Redirects if NOT logged in).

Actions:

  • Simple check for pages if user is logged in.
  • Login (Stores: username, Steam id and first login date in DB).
  • Creates a unique 6 character id string for account which is separate to the Steam id.
  • Creates a unique 32 character string as an account key.
  • Update account (Username, last login and times logged in) on login.
  • Edit/Update account email address.
  • Delete account (Redirects if not logged in).
  • Bootstrap 5.1 included on all frontend pages.

Usage (setup):

  • Run database.sql into your MySQL server.
  • Add your MySQL details lines 10-13 src/Config.php.
  • Change your URL line 5 src/Config.php.
  • Change your assets URL line 6 src/Config.php.
  • Add your Steam API key at line 7 src/Config.php.
To check logged in:
        if ($this->isLoggedIn()) {
            //Is logged in
        } else {
            //Not logged in
        }

Creating page only logged in users can view:

secret/index.php:

<?php
require_once '../vendor/autoload.php';

use frontend\Pages;

$h = new Pages();
$h->secretPage();

src/frontend/Pages.php:

    public function secretPage(): void
    {
        if (!$this->isLoggedIn()) {//Not logged in
            $this->doHeader(self::URL);
        }
        echo "You can see this because you are logged in";
    }

steam-login-crud-app-php's People

Contributors

cp6 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.