File: registration.php

Recommend this page to a friend!
  Classes of zinsou A.A.E.Mo´se  >  tinyUGatMs  >  registration.php  >  Download  
File: registration.php
Role: Auxiliary script
Content type: text/plain
Description: script for members registration
Class: tinyUGatMs
Manage users and groups of events in a database
Author: By
Last change:
Date: 2 years ago
Size: 4,240 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>REGISTRATION</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>
<form id="users" method="POST">
<fieldset><legend>Registration</legend>
<p><label for="name">username</label><input name="username" type="text" id="username" /><br>
<label for="password">password:</label><input type="password" name="password" id="password" /><br>
<label for="firstname">firstname</label><input name="firstname" type="text" id="firstname" /><br>
<label for="lastname">lastname</label><input name="lastname" type="text" id="lastname" /><br>
<label for="email">email</label><input name="email" type="text" id="email" /><br>
</p>
</fieldset>
<p><input type="submit" value="Submit" /></p>
<div id="manage"></div></form></div>
<script language="JavaScript">
    var manage=document.getElementById("manage");
    var users=document.getElementById("users");
    var username=document.getElementById("username");
    var mail=document.getElementById("email");
    var password=document.getElementById("password");
    var lastname=document.getElementById("lastname");
    var firstname=document.getElementById("firstname");
   

   
   
    function addEvent (element,event,func) {
        if (element.attachEvent){
            element.attachEvent ("on"+event,func) ;
        }else{
            element.addEventListener(event,func,true) ;
        }
    }
   
    function Sendmail(musername,mmail,mlastname,mfirstname){
        var xhr=new XMLHttpRequest;
        xhr.open("POST","./send_registrationmail.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=="mail successfully sent"){
                        return true;
                    }
               
            }
        }
        xhr.send('user='+musername+'&mail='+mmail+'&lastname='+mlastname+'&firstname='+mfirstname);
    }
   
   
    function user_create(){
        manage.innerHTML='<span style="color:blue;">submitting...Please wait...</span>';
        var xhr=new XMLHttpRequest;
        xhr.open("POST","./user_properties.php");
        xhr .setRequestHeader ( "Content-Type" ,"application/x-www-form-urlencoded" );
        xhr.onreadystatechange=function(){
            if(xhr.readyState==4&&xhr.status==200){
                var resp=xhr.responseText;
                        // manage.innerHTML=resp;
                    if(resp=="User successfully added"){
                       
                        manage.innerHTML="Your registration is now completed.";
                        if(Sendmail(username.value,mail.value,lastname.value,firstname.value)){
                            manage.innerHTML+="An email confirmation has been sent to your email";
                        }else{
                            manage.innerHTML+="<br>But unfortunaly An email confirmation has failed to be sent to your email...We will try again later...";
                        }
                        // manage.innerHTML+="<br> You will be redirected in 30 seconds";
                        // setInterval(window.location="./manageusers.php?action=add",30000);
                    }
               
            }
        }
        xhr.send('add=true&user='+username.value+'&mail='+mail.value+'&password='+password.value+'&groupid=1&lastname='+lastname.value+'&firstname='+firstname.value);
    }
   
    addEvent(users,"submit",function(e){
                                    e = e || window.event ;
                                    user_create();
                                    e.returnValue= false;
                                    if (e.preventDefault) {
                                        e.preventDefault();
                                    }
                                }
    );
   
</script>
</div>
</body>
</html>


For more information send a message to info at phpclasses dot org.