152 lines
4.5 KiB
PHP
152 lines
4.5 KiB
PHP
<?php
|
|
ini_set('display_errors', 0);
|
|
ini_set('display_startup_errors', 0);
|
|
ini_set('buffer_output', 1);
|
|
//error_reporting(E_ALL | E_STRICT);
|
|
// This should be equal to: PATH_TO_VANGUARD_FOLDER/extra/auth.php
|
|
include('../extra/auth.php');
|
|
//require_once __DIR__ . '/extra/auth.php';
|
|
// Here we just check if user is not
|
|
// logged in, and in that case we redirect
|
|
// the user to vanguard login page.
|
|
if (! Auth::check()) {
|
|
|
|
redirectTo('login');
|
|
|
|
}
|
|
$user = Auth::user();
|
|
$iduserlogin=$user->present()->id;
|
|
$nameuser=$user->present()->name;
|
|
$emailuser=$user->present()->email;
|
|
$idcompany=$user->present()->idcompany;
|
|
$langid=$user->present()->langid;
|
|
$privacyacc=$user->present()->privacyaccepted;
|
|
$loginusername=$user->present()->username;
|
|
$roleuser=$user->present()->role_id;
|
|
//$user = "1";
|
|
//$iduserlogin="1";
|
|
//$idcompany="1";
|
|
//$companyname="Company Name";
|
|
//$nameuser="Claudio";
|
|
//$emailuser="info@acscreativesolutions.com";
|
|
?>
|
|
<?php require_once('../Connections/cmctrfdb.php'); ?>
|
|
<?php require_once('../webassist/mysqli/rsobj.php'); ?>
|
|
<?php // require_once('@@RSObjectPath@@'); ?>
|
|
<?php require_once('../webassist/mysqli/queryobj.php'); ?>
|
|
<?php // require_once("../webassist/form_validations/wavt_scripts_php.php"); ?>
|
|
<?php include('generalsettings.php'); ?>
|
|
<?php
|
|
if (session_status() == PHP_SESSION_NONE) {
|
|
session_start();
|
|
}
|
|
if (!isset($_SESSION["idowneruser"])) {
|
|
$_SESSION["iduserlogin"]=$iduserlogin;
|
|
}
|
|
$iduserlog=$_SESSION["iduserlogin"];
|
|
$_SESSION["nameuser"]=$nameuser;
|
|
$_SESSION["emailuser"]=$emailuser;
|
|
if (!isset($_SESSION["tempcode"])) {
|
|
$timestampnow=time();
|
|
$temporarycode=$iduserlog."-".$timestampnow;
|
|
$_SESSION["tempcode"]=$temporarycode;
|
|
$tempcode=$_SESSION["tempcode"];
|
|
} else { $tempcode=$_SESSION["tempcode"]; }
|
|
?>
|
|
<?php
|
|
|
|
// if undermanteinance
|
|
if ($undermanteinance == "yes" && $roleuser != 1 && $roleuser != 4 && $roleuser != 5) {
|
|
header("Location: undermanteinance.php");
|
|
exit();
|
|
}
|
|
?>
|
|
<?php
|
|
//check privacy policy accepted
|
|
if (empty($privacyacc)) {
|
|
header("location: privacyaccept.php");
|
|
die();
|
|
}
|
|
?>
|
|
<?php
|
|
if (isset($_GET['info'])) {
|
|
$infobox=$_GET['info'];
|
|
$_SESSION["infobox"]=$infobox;
|
|
}
|
|
if (isset($_SESSION["infobox"])) {
|
|
$infobox=$_SESSION["infobox"];
|
|
}
|
|
?>
|
|
|
|
<?php include('languages/it/general.php');
|
|
include('languages/it/questionaire.php');
|
|
?>
|
|
<!-- query languages -->
|
|
<?php
|
|
$langselect = new WA_MySQLi_RS("langselect",$cmctrfdb,1);
|
|
$langselect->setQuery("SELECT * FROM languages WHERE languages.idlanguages='$langid'");
|
|
$langselect->execute();
|
|
$lang=$langselect->getColumnVal("acronym_languages");
|
|
?>
|
|
<?php
|
|
$languageselection = new WA_MySQLi_RS("languageselection",$cmctrfdb,0);
|
|
$languageselection->setQuery("SELECT * FROM languages WHERE languages.active_languages='Y' ORDER BY languages.name_languages");
|
|
$languageselection->execute();
|
|
?>
|
|
<?php
|
|
$avat = new WA_MySQLi_RS("avat",$cmctrfdb,0);
|
|
$avat->setQuery("SELECT avatar,id FROM auth_users WHERE auth_users.id='$iduserlogin'");
|
|
$avat->execute();
|
|
$avatarname=$avat->getColumnVal("avatar");
|
|
?>
|
|
<?php
|
|
//$companydetails = new WA_MySQLi_RS("companydetails",$cmctrfdb,1);
|
|
//$companydetails->setQuery("SELECT * FROM company WHERE company.idcompany='1'");
|
|
//$companydetails->execute();
|
|
if (!isset($idcompany)) {
|
|
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);
|
|
$InsertQuery->Action = "insert";
|
|
$InsertQuery->Table = "company";
|
|
$InsertQuery->bindColumn("companyname_company", "s", "-", "WA_DEFAULT");
|
|
$InsertQuery->saveInSession("");
|
|
$InsertQuery->execute();
|
|
$InsertGoTo = "";
|
|
$InsertQuery->redirect($InsertGoTo);
|
|
|
|
$lastcompany = new WA_MySQLi_RS("lastcompany",$cmctrfdb,1);
|
|
$lastcompany->setQuery("SELECT * FROM company ORDER BY company.idcompany DESC");
|
|
$lastcompany->execute();
|
|
|
|
$lastcompanyid=$lastcompany->getColumnVal("idcompany");
|
|
|
|
$UpdateQuery = new WA_MySQLi_Query($cmctrfdb);
|
|
$UpdateQuery->Action = "update";
|
|
$UpdateQuery->Table = "auth_users";
|
|
$UpdateQuery->bindColumn("idcompany", "i", "$lastcompanyid", "WA_DEFAULT");
|
|
$UpdateQuery->addFilter("id", "=", "i", "".($iduserlogin) ."");
|
|
$UpdateQuery->execute();
|
|
$UpdateGoTo = "";
|
|
$companyData["edited"]='N';
|
|
}
|
|
if (isset($idcompany)) {
|
|
$companydetails = mysqli_query($cmctrfdb, "SELECT * FROM company LEFT JOIN countries ON company.country_company=countries.idcountries WHERE company.idcompany='$idcompany'");
|
|
$companyData = mysqli_fetch_assoc($companydetails);
|
|
$companyname=$companyData["companyname_company"];
|
|
//echo $companyData["companyname_company"];
|
|
}
|
|
//include('securitycheck.php');
|
|
?>
|
|
<?php
|
|
//check company profile filled
|
|
if ($companyData["edited"]!="Y") {
|
|
|
|
header("location: companyprofile.php");
|
|
die();
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
|