Search
 
SCRIPT & CODE EXAMPLE
 

PHP

single sign on php script

<a href='http://login.example.com/login.php?source=my.other.site.com/foo/bar'>log in!!</a>
Comment

single sign on php script

<?php
$MySecretKey = 'Nobody Will Ever Guess This!!';

// Generate signature from authentication info + secret key
$sig = hash(
    'sha256',
     $user->id . $user->email,
     $MySecretKey
);

// Make sure we're redirecting somewhere safe
$source = parse_url($_GET['source']);
if(in_array($source->host, $list_of_safe_hosts))
  $target = 'http://'.$source->host.$source->path;

// Send the authenticated user back to the originating site
header('Location: '.$target.'?'.
    'user_id='.$user->id.
    '&user_email='.urlencode($user->email).
    '&sig='.$sig);
?>
Comment

PREVIOUS NEXT
Code Example
Php :: phpspreadsheet select sheet 
Php :: exit and echo php 
Php :: Edit PHP INI 
Php :: substr last 3 characters 
Php :: log php 
Php :: warning: parameter 2 to search_by_title() expected to be a reference, value given inwp-includesclass-wp-hook.php on line 287 
Php :: laravel allow all fillable 
Php :: php array_diff 
Php :: PHP sprintf — Return a formatted string 
Php :: phpmailer doesnt work on infinityfree 
Php :: Error : Call to undefined method IlluminateNotificationsChannelsMailChannel::assertSentTo() 
Php :: how to check page loading time in php 
Php :: php use curl 
Php :: woocommerce_recently_viewed 
Php :: login with email or username codeigniter 4 
Php :: Call Python From PHP And Get Return Code 
Php :: How to get a list of registered route paths in Laravel? 
Php :: phpmyadmin mysql execution time 
Php :: laravel 8 search with pagination 
Php :: php strftime year 2 digits 
Php :: laravel create method 
Php :: php 8 null safe operator 
Php :: unset method 
Php :: laravel automatically encrypt model atribute 
Php :: pass data to blade laravel 
Php :: PHP XML Expat Parser 
Php :: php loop in js 
Php :: laravel repository design pattern 
Php :: PHP script to download all images from URL 
Php :: scss laravel 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =