Created
June 24, 2020 07:21
-
-
Save tayyebi/fe6a96b28c61a74d648473fff1e01228 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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