<?php
function userbymail($email)
{
+ $email = strtolower($email);
foreach (glob("profile/*") as $useropt) {
if ($mailopt = @file_get_contents("$useropt/email.txt")
- and rtrim($mailopt) == $email) {
+ and strtolower(rtrim($mailopt)) == $email) {
return substr($useropt, strlen('profile/'));
}
}
if (!file_put_contents("profile/$found/.token", $token))
throw new Exception("could not store token for $found");
- $sitename = $_SERVER['HTTP_HOST'];
+ $sitename = preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']);
$sitelink = 'https://'.$sitename;
$rep = [
'[[user]]' => $user->name ?: $found,