This is an example of a session helper "LOGIN" button for client using php instead of a "LOGIN" url combination with the helper.

   1 <?php
   2 # license note
   3 # Copyright (c) 2014, Eliezer Croitoru
   4 # All rights reserved.
   5 #
   6 # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
   7 #
   8 # 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
   9 #
  10 # 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  11 #
  12 # 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
  13 #
  14 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
  15 
  16 /* connect to memcached server */
  17 $memcache = new Memcache();
  18 $memcache->connect("localhost", 11211);
  19 $memcache_obj = memcache_connect('localhost', 11211);
  20 $memcache->set($_SERVER['REMOTE_ADDR'], time() );
  21 echo "The Client: (";
  22 echo $_SERVER['REMOTE_ADDR'] . ")<br/>";
  23 echo "Logged in at: (";
  24 echo $memcache->get( $_SERVER['REMOTE_ADDR']) . ") ";
  25 echo "Epoch time";
  26 ?>

EliezerCroitoru/SessionHelper/PhpLoginExample (last edited 2014-09-03 20:46:47 by Eliezer Croitoru)