I have the php below that works vary vary fine on localhost apache server (WAMP server) but when i put it online withowt any reason or error it doesnt do its job ! please need an answer although i will change my hosting server i dont like their services because there are many functions disabled. (update : i have a "html code" that is the profile that this code should logon-to . the profile html is after the php . this php has the problem that shows the die message even when the user and password is correct. this problem only on online server)
<?php
function password($username='noneuser') {
$tegjitha=file_get_contents("pasetkkadmin.txt");
$infot=preg_split('/'.PHP_EOL.'/',$tegjitha,-1,PREG_SPLIT_NO_EMPTY);
$final=null;
foreach ($infot as $info) {
$pos=preg_split('/:/',$info,-1,PREG_SPLIT_NO_EMPTY);
if ($pos[0]==$username){
$final=$pos[1];
}
}
return $final;
}
function isuser($input) {
$tegjitha=file_get_contents("pasetkkadmin.txt");
$infot=preg_split('/'.PHP_EOL.'/',$tegjitha,-1,PREG_SPLIT_NO_EMPTY);
$rezultati=false;
foreach ($infot as $info) {
$pos=preg_split('/:/',$info,-1,PREG_SPLIT_NO_EMPTY);
if ($input==md5('albipatozi'.$pos[0])) { $rezultati=true;}
}
return $rezultati;
}
if ( isset($_GET['dil']) ) {
setcookie('mbajmend','',time()-3600*24*365);
die('<meta http-equiv="REFRESH" content="0;url=index.php" />');
}
if ( isset($_POST['username']) && !empty($_POST['username']) ) {
$username=$_POST['username'];
} else {$username=null;}
if ( isset($_POST['pass']) && !empty($_POST['pass']) ) {
$passwd=sha1('justastring£"'.$_POST['pass']);
} else {$passwd='none';}
if ( isset($_POST['mbajmend']) && !empty($_POST['mbajmend']) ) {
$koha=time()+3600*24*60;
} else {$koha=null;}
$duhet=password($username);
if ($passwd==$duhet) {
setcookie('mbajmend',md5('sdaggs'.$username),$koha);
} elseif (!( isset($_COOKIE['mbajmend']) && isuser($_COOKIE['mbajmend']) )) {
setcookie('mbajmend','',time()-3600*24*360);
if (isset($_SERVER['HTTP_REFERER']) && (preg_match('/[index.php]$/',$_SERVER['HTTP_REFERER']) || preg_match('/[admin\/]$/',$_SERVER['HTTP_REFERER'])) ) { $textshtes='Perdoruesi ose Fjalkalimi jane Gabim ! '; }
else { $textshtes='Ju Lutem Vendosni Te Dhenat Thuaja'; }
die('<body style="background:lightgrey;">
<div id="trupi" style="position:relative; background:#999999; margin:auto; width:360px; margin-top:160px; height:260px;">
<form id="form1" name="form1" method="post" action="" style="position:absolute; margin:56px; text-shadow:black; font-style:oblique; color:darkred">
<label><strong>Perdoruesi: </strong>
<input type="text" name="username" />
</label>
<p>
<label><strong>Fjalekalimi:</strong>
<input type="password" name="pass" />
</label>
</p>
<p>
<label>
<input type="checkbox" name="checkbox" value="checkbox" />
Me Mbaj Mend te Ky Kompjuter</label>
</p>
<p>
<label style="float:right;">
<input type="submit" value="Identifikohu" />
</label>
</p>
</form><p style="text-align:center; color:darkred; background:grey"> <b>'.$textshtes.'</b></p>
</div>
</body>
');
}
?>
<html>
this should be shown when user and passord is correct :)
</html>
i tried to echo every single variable one by one step by step and everything is OK exept the fact it doesnt work
the passdords txt file is pasetkkadmin.txt- its model is
superadmin:a3b22231bbe113a948a349af09cea4e4129584de
the first line is : superadmin and its password is : albi whith that data it should work but it doesnt