xxreenaxx1 Posted March 13, 2010 Share Posted March 13, 2010 I was working on these three codes below, I have came across some problem, not sure what they are. Can some one help me!! <?php error_reporting(E_ALL | E_STRICT); int_Set('display_error', false); session_start(); if (isset($_SESSION['username'])){ header('Location: ./') ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Login</title> </head> <body> <div></div> You are now logged in <a href="logout.php", Logout</a> <?php } else { ?> <form action="login.php" method="post"> username:<input name="username" type="text" /> password:<input name="password" type="password" /> <input type="submit" /> </form> <?php } ?> <?php echo $_SESSION['error']; unset($_SESSION['error']); ?> } </body> </html> <?php session_start();// session starts $db_host ='localhost'; $db_user = 'root'; $db_pass = ''; $db_db = login; if (isset($_POST['username'])) { //MySql connection $db_link = mysql_connect($db_host, $db_user, $db_pass) or die('MySql connection error:'. mysql_error()); mysql_select_db($db_db) or die('MySql error: connot select table'); $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['pasword']); //MySql Query $result = mysql_query("SELECT * FROM users WHERE username = '$username' and password = '$password'"); if (!result){ $_SESSION['error'] = '<span style="color: red" >Login Falied</span>'; } else{ $row = mysql_fetch_assoc($result); $_SESSION['userid'] = $row['id']; $_SESSION['username'] = $username; $_SESSION['error'] = 'Login successful<br> Welcome,' .$username; } mysql_close($db_link); } ?> <?php session_start(); if(isset($_GET['logout'])) { $_SESSION = array(); if($_COOKIE[sesiion_name()]) { setcookies(session_name(),'',time()-4200); } session_destroy(); header('Location: ./'); } ?> Link to comment https://forums.phpfreaks.com/topic/195109-error-for-mysql-n-php/ Share on other sites More sharing options...
jskywalker Posted March 13, 2010 Share Posted March 13, 2010 *jskywalker also not sure what problem is, maybe you can tell use what error you have? of what is not working correctly (besides the code) What should it do? Link to comment https://forums.phpfreaks.com/topic/195109-error-for-mysql-n-php/#findComment-1025600 Share on other sites More sharing options...
xxreenaxx1 Posted March 13, 2010 Author Share Posted March 13, 2010 The error that I am getting is Fatal error: Call to undefined function int_Set() in C:\xampp\htdocs\12march10\index.php on line 3 Its just a login normal page. one is index, login and logout. Link to comment https://forums.phpfreaks.com/topic/195109-error-for-mysql-n-php/#findComment-1025603 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.