Skip to content

Instantly share code, notes, and snippets.

@tayyebi
Created June 24, 2020 07:21
Show Gist options
  • Save tayyebi/fe6a96b28c61a74d648473fff1e01228 to your computer and use it in GitHub Desktop.
Save tayyebi/fe6a96b28c61a74d648473fff1e01228 to your computer and use it in GitHub Desktop.
<?php
// Find the domain name
$domain = $_SERVER['HTTP_HOST'];
$domain_alias = 'www.' . $_SERVER['HTTP_HOST'];
// Find root URL
$directory = rtrim ( ltrim ( __DIR__ , $_SERVER["DOCUMENT_ROOT"] ) , "core" );
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]";
$root = $actual_link . '/' . $directory;
// Find team ID
$sql = "select
*
from teams
where teams.Domain = '$domain' or teams.Domain = '$domain_alias'";
$result = $conn->query($sql);
if ($result->num_rows > 0)
{
if ($row = $result->fetch_assoc())
{
$title = $row['Title'];
$teamid = $row['Id'];
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment