PHP Classes

File: connexion.php

Recommend this page to a friend!
  Classes of zinsou A.A.E.Moïse   tinyUGatMs   connexion.php   Download  
File: connexion.php
Role: Auxiliary script
Content type: text/plain
Description: script for members connexion
Class: tinyUGatMs
Manage users and groups of events in a database
Author: By
Last change:
Date: 6 years ago
Size: 2,883 bytes
 

Contents

Class file image Download
<?php
    session_start
();
    require_once(
'usefullfunctions.php');
   
$url='testaccess.php';
    if(isset(
$_SESSION ['groupstatut'])&&isset($_SESSION["startaccesstime"])&&isset($_SESSION["endaccesstime"])&&$_SESSION ['groupstatut']==true&&inrangetime(explode(':',date('H:I:s')),explode(':',$_SESSION["startaccesstime"]),explode(':',$_SESSION["endaccesstime"]))){
    echo
'<script type="text/javascript">window.location="'.$url.'";</script>';
    exit;
    }
   
?>
<!DOCTYPE>
        <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title>Connexion</title>

        <style type="text/css">
           
             #other {
                font-family: verdana;
                font-weight: bold;
                font-size: 14px;
                font-style:italic;
                color: #FFFFFF;
                background-color: grey;
                width: auto;
                margin-left: 15%;
                margin-right: 15%;
                padding:2%;
            }
           
            label
            {
                display: block ;
                width: 150px;
                float : left ;
            }
            </style>
       
        </head>
    <body>
    <div id="other">
    <div id="message" ></div>
    <form method="POST" id="connexion">
    <fieldset>
    <legend>Connexion</legend>
    <p>
    <label for="pseudo">Pseudo :</label><input name="pseudo" type="text"
    id="pseudo" /><br>
    <label for="password">Password:</label><input type="password"
    name="password" id="password" />
    </p>
    </fieldset>
    <p><input type="submit" value="Connexion" /></p></form>
    <p><a href="./registration.php">not registred ?</a></p> <p><a href="./forgetpassword.php?action=reset">forget password ?</a></p>
    </div>
    <script language="JavaScript">
        var message=document.getElementById("message");
        var connexion=document.getElementById("connexion");
        var pseudo=document.getElementById("pseudo");;
        var password=document.getElementById("password");;
        function addEvent (element,event,func) {
            if (element.attachEvent){
                element.attachEvent ("on"+event,func) ;
            }else{
                element.addEventListener(event,func,true) ;
            }
        }
       
       
        function connectify(url){
            message.innerHTML='<span style="color:blue;">Trying to connect.Please wait...</span>';
            var xhr=new XMLHttpRequest;
            xhr.open("POST","./ajax-connexion.php");
            xhr .setRequestHeader ( "Content-Type" ,"application/x-www-form-urlencoded" );
            xhr.onreadystatechange=function(){
                if(xhr.readyState==4&&xhr.status==200){
                    var resp=xhr.responseText;
                    if(resp=='ok'){
                        window.location=url;
                    }else{
                        message.innerHTML=resp;
                    }
                }
            }
            xhr.send('pseudo='+pseudo.value+'&password='+password.value);
        }
       
        addEvent(connexion,"submit",function(e){
                                        e = e || window.event ;
                                        connectify('./testaccess.php');
                                        e.returnValue= false;
                                        if (e.preventDefault) {
                                            e.preventDefault();
                                        }
                                    }
        );
    </script>
    </body>
    </html>