PHP Classes

File: langs/en-us/scripts/adminquerys/createinvite.php

Recommend this page to a friend!
  Classes of VITOR GABRIEL M. DANTAS   Pleiades   langs/en-us/scripts/adminquerys/createinvite.php   Download  
File: langs/en-us/scripts/adminquerys/createinvite.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Pleiades
Application to implement an issue-tracking system
Author: By
Last change:
Date: 4 months ago
Size: 1,894 bytes
 

Contents

Class file image Download
<?php
session_start
();
require
__DIR__.'/../../config.php';
include
__DIR__.'/../../scripts/status.php';
include
__DIR__.'/../../scripts/verifyauth.php';
include
__DIR__.'/../../scripts/verifypermission.php';

$GetKey = filter_var($_POST['keygenerator'], FILTER_SANITIZE_STRING);
$GetInvitedEmail = filter_var($_POST['emailinvite'], FILTER_SANITIZE_STRING);
$GetTagInvited = filter_var($_POST['taginvite'], FILTER_SANITIZE_STRING);

$EmailExistsQuery = "SELECT email FROM users WHERE email='".$GetInvitedEmail."'";
$EmailExistsExec = mysqli_query($CONNECTION_DB, $EmailExistsQuery);

if(
mysqli_num_rows($EmailExistsExec)==0){

    if(
strlen($GetKey)>=3 and strlen($GetKey)<100 and strlen($GetInvitedEmail)>=4 and strlen($GetInvitedEmail)<100 and strlen($GetTagInvited)>=3 and strlen($GetTagInvited)<100){
       
$InsertInvite = "INSERT INTO invites(id,key_invite,class_account,tag_account,email_account,is_expired) VALUES ('','".$GetKey."','1','".$GetTagInvited."','".$GetInvitedEmail."','0')";
       
mysqli_query($CONNECTION_DB, $InsertInvite);

       
$_SESSION['Msg'] = '<div class="alert alert-success" role="alert"><i class="fa-solid fa-circle-check fa-beat"></i> Invitation generated!</div>';
       
header("Location: ../../pages/system/ManageSystem.php");
        exit();
    }else{
       
$_SESSION['Msg'] = '<div class="alert alert-danger" role="alert"><i class="fa-solid fa-triangle-exclamation fa-beat"></i> Account creation conditions are not met!</div>';
       
header("Location: ../../pages/system/ManageSystem.php");
        exit();
    }
}else{
   
$_SESSION['Msg'] = '<div class="alert alert-warning" role="alert"><i class="fa-solid fa-triangle-exclamation fa-beat"></i> The email already has an invitation or is already being used by a user in the system!</div>';
   
header("Location: ../../pages/system/ManageSystem.php");
    exit();
}

mysqli_close($CONNECTION_DB);