php require_once -
i have in first page "login.php"
<?php session_start(); $msg=''; if ((isset($_post))&& (!empty($_post))) { require_once('log.php') or die(mysql_error()); $p=md5($pass); if (login($login,$p)) { header('location:index.php');; } else { $msg="login ou mot de passe incorrect"; } } ?>
log.php:
$req="select * admin login='$e' , password='$p'"; $res=mysql_query($req) or die(mysql_error()."\n".$req); if(mysql_num_rows($res)!=0) { $data=mysql_fetch_assoc($res); $_session['adm']=array('code'=>$data['code'], 'login'=>$data['login']); return true; mysql_close(); } else return false; }?>
and if test first page "login.php" got this:
warning: require_once(1): failed open stream: no such file or directory in c:\xampp\htdocs\admin\login.php on line 6
fatal error: require_once(): failed opening required '1' (include_path='.;c:\xampp\php\pear') in c:\xampp\htdocs\admin\login.php on line 6
to sure have right location, can use dirname
dirname(__file__) . '/log.php'
Comments
Post a Comment