Jump to content

funderboltz

New Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by funderboltz

  1. I don't know how to solve this error; Parse error: syntax error, unexpected '$db' (T_VARIABLE) code: <?php $connection = mysql_connect("localhost", "root", "") $db = mysql_select_db("company", $connection); session_start(); $user_check = $SESSION['login_user']; $ses_sql = mysql_query("select username from login where username ='$user_check", $connection); $row = mysql_fect_assoc($ses_sql); $login_session =$row[username]; if(!isset($login_session)){ mysql_close($connection); header(('Location: Index.html')); } ?>
  2. Thanks for all of your help. I solved the problem by saving the index.html as index.php.
  3. And I changed the include part of the code @gingerjm, still nothing
  4. @ginerjm, you want me to name the html code above with a .php extension? And @hansford thanks for the code; but still nothing happens, not even the error message, I'm starting to think there's an error in my html code.
  5. The name of the file is login.html. I didn't copy and paste the top part so that's probably why, but at the top there's code that is as follows <?php $include(process.php) ?> The name of the file of php code is process.php. And thanks @ginerjm for telling me this, I'll keep it in mind next time I post.
  6. I have edited the html, as before the form action was linked to my php file! But after setting up the mysql database with login table not much seems to work. The only difference now is that when I submit the form, nothing happens. I'm not sure if it's my html login form, that's not working or if it's my php, I've set up the database and have created a record, so that I could try out my form, but it does nothing. Here's my html; <!DOCTYPE html> <html> <head> <title>Student Room Login</title> </head> <link rel="stylesheet" type="text/css" href="loginstyle.css"> <body> <div id ="container"> <div id ="header"> <h1>Student Room</h1> </div> </div> <div id ="content"> <div id = "nav"> <h3><h3 style = "font-size: 20px">Navigation</h3> <img src="nav-image.png"> <ul> <li><a href="Index.html">Home</a></li> <li><a href="Login.html">Log in<a/></li> </ul> </div> <div id ="jumbotron"> <h2>Login</h2> <form action ="" method="post"> <label>Username :</label> <input id = "name" name ="username" placeholder = "username" type = "text"> <label>Password :</label> <input id = "password" name = "password" placeholder ="************" type ="password"> <input name ="submit" type = "submit" value = " Login "> <span><?php echo $error; ?></span> </form> </div> </div> <div id ="footer"> Copyright © 2014 Reuben </div> </body> </html> I literally don't know what to do...
  7. Every time I click login on my html document the php is displayed any help, would be great. <?php session_start(); $error=''; if(isset($_POST['submit'])){ if(empty($_POST['username']) || empty($_POST['password'])){ $error = "Username or Password are invalid"; } else { $username = $_POST['username']; $password = $_POST['password']; $connection = mysql_connect("localhost", "reboot", ""); $username = stripslashes($username); $password = stripslashes($password); $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($username); $db = mysql_select_db("company", $connection); $query = mysql_query("select * from login where password = 'password' AND username = '$username'", $connection); $rows = mysql_num_rows($query); if($rows > 0) { $_SESSION['login_user'] =$username; header("location : profile.php"); }else{ $error = "Username or Password are invalid"; } mysql_close($connection); } } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.