mercredi 30 décembre 2015

My subdomain login service not working

Sorry if this has already been said before, but I didn't see it.
I am working on making a subdomain system, where each user gets a "url" and then hosts whatever their pretend side would host. I use this when doing a projects for friends, or kids learning about coding. I will list my code below, and then explain what error shows up.

<p> $> Connected to server... </p>
<?php
echo "$>  <br>";
echo "$> Term access started... <br>";
echo "$> Domain lookup started... <br>";
echo "$> Retrieving variable... <br>";
$domain = $_POST["dom"]; echo "$> Domain address received from login. <br>"; //log
$usern = $_POST["auth"]; echo "$> Login data revived from login. <br>"; //log
echo "$> Reading database... <br>";
$myfile = fopen("domlist.txt", "r") or die("$> #ERROR --> Unable to read database! Halting!"); echo "$> Database connected... <br>";
$d = fread($myfile,filesize("domlist.txt")); echo "$> Reading content from database... <br>";
$db = explode($d , ":");
//check clients address
$x = 0;
$c = count($db) - 1; echo "$> Database entity count: ". count($db) ."<br>";
$f = false;
 while ($x <= $c) {
    echo "Loop $x"; //loop read count
    if ($domain == $db[$x) {
        $f = $x;
    } 
    $x++;
}
 //check if the domain was found
if ($f != false) {
    echo "Domain found, named: " . $db[$f];
}
fclose($myfile);
?>

the messages where it echo:

$> blablah...

is a message to help the user know what is happening. When I load the webpage up, all it shows is white. Nothing pops up!

I run the server on a Ubuntu x86 (my stupid computer has trouble reading the x64 disk for some reason) with a full LAMP server installed, and running.




Aucun commentaire:

Enregistrer un commentaire