Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

makethetick

Members
  • Joined

  • Last visited

Reputation Activity

  1. Like
    makethetick got a reaction from Renaissance-Design in Simple Twitter OAuth login system in PHP   
    Hi all,
     
    I've created a quick and simple Twitter OAuth login system which will allow users to sign in to your site via Twitter.
    The project is available on github.
     
    To restrict access to a page, ensure you enter your consumer key and secret at the top of twitter.php, then add the following to the top of the page.
     

    require_once 'twitter.php';
     
    Users will then need to login with Twitter in order to view the page.
     
    twitter.php (you will need the rest of the files on github)

    <?php /* How to use: * Add the following line to the top * of any page you wish to protect: * * require_once 'twitter.php'; */ session_start(); require_once 'twitter-async/EpiCurl.php'; require_once 'twitter-async/EpiOAuth.php'; require_once 'twitter-async/EpiTwitter.php'; /* Enter your consumer key and secret here */ $consumer_key = ""; $consumer_secret = ""; /* By default, all pages which include twitter.php are protected */ twitterLogin(); /* Call this function on every page you want protected. * If the user is not logged in, the logon link is displayed. */ function twitterLogin(){ global $consumer_key, $consumer_secret; if (!$consumer_key || !$consumer_secret) die ('Please enter your consumer key/secret!'); if (isset($_GET['oauth_token'])) twitterCallback(); if ($_SESSION['logged_in']) return true; $twitterObj = new EpiTwitter($consumer_key, $consumer_secret); $url = $twitterObj->getAuthorizationUrl(); // Customise your login page/link here echo "<a href='$url'><img src=\"https://si0.twimg.com/images/dev/buttons/sign-in-with-twitter-l.png\" /></a>"; exit(); } /* Process login callback, this can be called from any page proteced by * twitterLogin(), the index.php page is recommended though. * Once logged in, you are forwarded to the homepage. */ function twitterCallback(){ if ($_SESSION['logged_in']){ header ('Location: /'); exit(); } global $consumer_key, $consumer_secret; $twitterObj = new EpiTwitter($consumer_key, $consumer_secret); $twitterObj->setToken($_GET['oauth_token']); $token = $twitterObj->getAccessToken(); $twitterObj->setToken($token->oauth_token, $token->oauth_token_secret); $_SESSION['ot'] = $token->oauth_token; $_SESSION['ots'] = $token->oauth_token_secret; $twitterInfo= $twitterObj->get_accountVerify_credentials(); $twitterInfo->response; $username = $twitterInfo->screen_name; $_SESSION['logged_in'] = $username; // Here you can integrate a database backed login system with stored users and sessions header ('Location: /Twitter-PHP-Login'); exit(); } /* Function to log the user out and destroy the session */ function twitterLogout(){ unset($_SESSION['logged_in']); session_destroy(); // You can either leave the following here or put it on your logout page echo "You have logged out, <a href=\"/\">click here</a> to return to the home page."; exit(); } ?>
  2. Like
    No, search engines will not crawl iframes.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.