473,473 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\nothing\index.php o

1 New Member
how can i resolve this

Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\Elomity\index.php on line 88



Expand|Select|Wrap|Line Numbers
  1. <? include ("inc/incfiles/header.inc.php"); ?>
  2. <?
  3. $reg = @$_POST['reg'];
  4. //declaring variables to prevent errors
  5. $fn = ""; //First Name
  6. $ln = ""; //Last Name
  7. $un = ""; //Username
  8. $em = ""; //Email
  9. $em2 = ""; //Email 2
  10. $pswd = ""; //Password
  11. $pswd2 = ""; //Password2
  12. $d = ""; //Sign up Date
  13. $u_check = ""; //Check if username is exists
  14. //registration form
  15. $fn = strip_tags(@$_POST['fname']);
  16. $ln = strip_tags(@$_POST['lname']);
  17. $un = strip_tags(@$_POST['username']);
  18. $em = strip_tags(@$_POST['email']);
  19. $em2 = strip_tags(@$_POST['email2']);
  20. $pswd = strip_tags(@$_POST['password']);
  21. $pswd2 = strip_tags(@$_POST['password2']);
  22. $d = date("Y-m-d"); // Year - Month - Day
  23.  
  24. if ($reg) {
  25. if ($em==$em2) {
  26. // Check if user already exists
  27. $u_check = mysql_query("SELECT username FROM users WHERE username='$un'");
  28. // Count the amount of rows where username = $un
  29. $check = mysql_num_rows($u_check);
  30. if ($check == 0) {
  31. //check all of the fields have been filed in
  32. if ($fn&&$ln&&$un&&$em&&$em2&&$pswd&&$pswd2) {
  33. // check that passwords match
  34. if ($pswd==$pswd2) {
  35. // check the maximum length of username/first name/last name does not exceed 25 characters
  36. if (strlen($un)>25||strlen($fn)>25||strlen($ln)>25) {
  37. echo "The maximum limit for username/first name/last name is 25 characters!";
  38. }
  39. else
  40. {
  41. // check the maximum length of password name does not exceed 25 characters and is not less than 5
  42. if (strlen($pswd)>30||strlen($pswd)<5) {
  43. echo "Your password must be between 5 and 30 characters long";
  44. }
  45. else
  46. {
  47. //encrypt password and password 2 using md5 before sending to database
  48. $pswd = md5($pswd);
  49. $pswd2 = md5($pswd2);
  50. $query = mysql_query("INSERT INTO users VALUES ('','$un','$fn','$ln','$em','$pswd','$d','0')");
  51. die("<h2>Welcome to Elomity</h2>Login to your account to get started...");
  52. }
  53. }
  54. }
  55. else {
  56. echo "Your passwords don't match";
  57. }
  58. }
  59. else
  60. {
  61. echo "Please fill in all of the fields";
  62. }
  63. }
  64. else
  65. {
  66. echo "Username already taken";
  67. }
  68. }
  69. else {
  70. echo "Your E-mails don't match";
  71. }
  72. }
  73. ?>
  74. <?
  75. //Login Script
  76. if (isset($_POST["user_login"]) && isset($_POST["password_login"])) {
  77.     $user_login = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["user_login"]); // filter everything but letters and numbers
  78.     $password_login = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["password_login"]); // filter everything but letters and numbers
  79.     $md5password_login = md5($password_login);
  80.     $sql = mysql_query("SELECT id FROM users WHERE username='$user_login' AND password='$password_login' LIMIT 1"); // query the person
  81.     //Check for their existance
  82.     $userCount = mysql_num_rows($sql); //Count the number of rows returned
  83.     if ($userCount == 1) {
  84.         while($row = mysql_fetch_array($sql)) {
  85.              $id = $row["id"];
  86.     }
  87.         $_SESSION ["id"] = $id;
  88.         $_SESSION ["user_login"] = $user_login;
  89.         $_SESSION ["password_login"] = $password_login;    
  90.         header ("location: index.php");    
  91. //checks to see if user is logged in
  92.         $user = $_SESSION ["user_login"];
  93. //If the user is not logged in
  94. if (!isset ($_SESSION["user_login"])){    header ("location: index.php");    exit();
  95. }
  96. if (isset ($_SESSION["user_login"])){    header ("location: home.php");    exit();
  97. }    
  98. }
  99. ?>
Apr 2 '13 #1
2 5400
Luuk
1,047 Recognized Expert Top Contributor
There is a 'strange' character in your source.
I copied above code, and when editting, line 88 looks like:
Expand|Select|Wrap|Line Numbers
  1.   $_SESSION ["user_login"]<feff> = $user_login;
  2.  
Apr 5 '13 #2
Dormilich
8,658 Recognized Expert Moderator Expert
that is the BOM (Byte Order Mark) U+FEFF. it’s used to indicate UTF encoded files.
Apr 9 '13 #3

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

Similar topics

8
by: Wescotte | last post by:
The error message Parse error: syntax error, unexpected $end in FILE on line X is one I run into frequently and I know the cause is I missed an ending quote. Is there an easy way to determine...
36
by: rhys | last post by:
My Gurus and Angels -- Please pardon this old-school programmer, only recently enlightened to open-source, having been trapped in the convenience of proprietary lingos for way too long. My...
3
by: SilvaZodiac | last post by:
Hi everyone, I'm still rather new to PHP code, and I have a syntax error. I've tried several different solutions, but it won't fix. It seems to suggest that I need a new bracket somewhere in the...
2
by: fburn | last post by:
I need some help with an error I'm getting using php 5.2.5 running on linux. I receive an error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or...
9
akohistani
by: akohistani | last post by:
I am having Parse error problem with my newly purchased Php upload script I have uploaded the script and I get the error below Parse error: syntax error, unexpected $end in URL/functions.php on...
3
paulrajj
by: paulrajj | last post by:
hi to all, i am getting syntax error on my code.. Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in D:\xampp\htdocs\Dummy\paulraj\matrim\exam.php on line 62 ...
10
by: benicio | last post by:
Parse error: syntax error, unexpected T_STRING, expecting '(' in C:\wamp\www\study_group\includes\functions.php on line 19 I got this error and this syntax is from 8 to 19th line. <?php ...
3
by: brkseven | last post by:
Looking for help with this Contact Form. The error is on line 1, but that' doesn't mean a lot, I think. In fact, a php syntax check passed it, but I was hoping for an easy syntax error, it looks...
3
by: CYNTHIA CUTRER | last post by:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> ...
2
by: Vicki Hendra | last post by:
Hi I am new to php fullstop I and colleagues have setup wordpress blogs for our local towns, giving the local businesses free advertisment. Part of the problem started when using wordpress...
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
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.