473,394 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

login authendication

*************error********************************


( ! ) Parse error: syntax error, unexpected T_STRING in C:\wamp\www\login.php on line 19

**********************end of error*****************

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. <?php
  4.  
  5. //Database Information
  6.  
  7. $dbhost = "localhost";
  8. $dbname = "test";
  9. $dbuser = "username";
  10. $dbpass = "";
  11.  
  12. //Connect to database
  13.  
  14. mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
  15. mysql_select_db($dbname) or die(mysql_error());
  16.  
  17. session_start();
  18. $username = $_POST[‘username’];
  19. $password = md5($_POST[‘password’]);
  20.  
  21. $query = “select * from users1 where username='mysql_real_escape_string($POST['username']).' and password='mysql_real_escape_string($POST['password']).' ”;
  22.  
  23. $result = mysql_query($query);
  24.  
  25. if (mysql_num_rows($result) != 1) {
  26. $error = “Bad Login”;
  27.     include “login.html”;
  28.  
  29. } else {
  30.     $_SESSION[‘username’] = “$username”;
  31.     include “memberspage.php”;
  32. }
  33.  
  34. ?>
  35.  
  36.  
  37.  
Mar 8 '12 #1
1 1185
Luuk
1,047 Expert 1GB
The error is obviously on line 19 of your PHP-script.
Because you posted two empty lines extra,
It is on line 21 of the code you posted.

I think you are messing up too much with single- and double-quote when trying to use the function 'mysl_real_escape_string()' in our code.

Expand|Select|Wrap|Line Numbers
  1. $username = mysql_real_escape_string($_POST[‘username’]);
  2.  19. $password = mysql_real_escape_string(md5($_POST[‘password’]));
  3.  20. 
  4.  21. $query = “select * from users1 where username=$username and password=$password ”;
  5.  
Mar 24 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: koolyio | last post by:
Hey, could you please tell me what is wrong with my login script. I just started learning php. CODE: login.php <? session_start(); header("Cache-Control: private"); ?>
5
by: Simon | last post by:
Hi, I have a Login.php page that logs the user in and out. I has two forms within the page, (depending on what we are trying to do), either one to log in or out. The form calls itself using a...
1
by: John Davis | last post by:
I put a little login (username and password textfields) in a web page, and once the user able to login, I want the username and password textfields will disappear, and replace with text " has...
1
by: Tom Jones | last post by:
Hi, I am using the HttpWebRequest and HttpWebResponse classes to pull information from a web server on the internet. I have an account on one of the webservers that I need to log into...
2
by: Beginner | last post by:
I know this is an old question, but searching all over the internet plus several MS security conferences, still haven't got a straight anwser. Basically, the login.aspx is on one dedicated server...
2
by: IdleBrain | last post by:
Hello All: I used a Login control to authenticate a user to login. The problem is that when I login with good username & password, the login view would say that the login was successful. But...
6
by: AppleBag | last post by:
I'm having the worst time trying to login to myspace through code. Can someone tell me how to do this? Please try it yourself before replying, only because I have asked this a couple of times in...
4
by: Freedolen | last post by:
Hi All, I had a perl script which is used to login in a web page, but it gives the error as "301 Moved Permanently". What does this means and how can it be rectified? Can anyone help on this? ...
3
by: satishknight | last post by:
Hi, Can some one tell me how to change the validation sequence for the code pasted below, actually what I want it when any one enters the wrong login information (already registered users) then it...
13
by: Apostle | last post by:
Hi all, after thinking for sometimes, I thought it will be great opportunity to learn if I will start from scratch and build my own register/login system. Here is the thread that I will be posting...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.