the's a mistake somewhere in my code, i'm sure of that, because it doesn't work like it should, but after spending a couple of weeks on it, i'm just too frustrated now
here's the code:
i think it's wither this part
or the function check_logina, coz the print_mb works perfectly alone...
i'm getting the $login and $pass from another php file's form.
please help.
here's the code:
PHP-Code:
<?php
$dbhost="***";
$dbuser="***";
$dbname="***";
$db = mysql_connect("$dbhost", "$dbuser");
mysql_select_db("$dbname");
$login=$_POST['login'];
$passwd=$_POST['passwd'];
if (!$login) {
echo "Neteisingai Ávestas Vartotojo Vardas";
} elseif (!$passwd) {
echo "Neteisingai Ávestas Slaptaþodis";
} else {
check_logina($login, $passwd)) {
print_mb();
) else {
echo "klaida";
}
mysql_close($db);
?>
<?php
function check_logina($login, $passwd) {
global $dbhost, $dbname, $dbuser, $login;
$failas = "/var/ipac/etc/passwd";
$duomenys = fopen ($failas, "r");
$index=0;
while (!feof($duomenys)) {
$eilute[$index] = fgetss($duomenys, 100);
list($useris, $slaptazodis, $workdyra, $kazkas) = explode("*", $eilute[$index]);
if ($login==$useris && $passwd==$slaptazodis) {
return 1;
} else {
return 0; }
}
fclose ($duomenys);
$index++;
}
?>
<?php
function print_mb() {
global $dbhost, $dbname, $dbuser, $login, $kazkas;
$rezult = mysql_query("SELECT round(sum(issiusta)/1024/1024) from statistika where vardas='".$login."' and HOUR(laikas) > 9 and HOUR(laikas) < 21");
while ($row = mysql_fetch_row($rezult))
echo $row[0].'<br />';
mysql_free_result($rezult);
}
?>
PHP-Code:
if (!$login) {
echo "Neteisingai Ávestas Vartotojo Vardas";
} elseif (!$passwd) {
echo "Neteisingai Ávestas Slaptaþodis";
} else {
check_logina($login, $passwd)) {
print_mb();
) else {
echo "klaida";
}
i'm getting the $login and $pass from another php file's form.
please help.
Kommentar