473,320 Members | 1,916 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,320 software developers and data experts.

I am getting a Parse error: syntax error... need some help on login php please?

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2.  
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  4.   <head>
  5.     <title>Log</title>
  6.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7.     <meta name="title" content="Walker Energy Brokerage" />
  8.     <meta name="description" content="National Energy Brokering Firm" />
  9.     <meta name="keywords" content="electricity, texas, illionois, new york, pennsylvania, deregulation, energy brokering, walker energy brokerage, energy market" />
  10.     <meta name="language" content="en" />
  11.     <meta name="subject" content="Site subject here" />
  12.     <meta name="robots" content="All" />
  13.     <meta name="copyright" content="W.A.G., LLC" />
  14.     <meta name="abstract" content="National Energy Brokering Firm" />
  15.     <meta name="MSSmartTagsPreventParsing" content="true" />
  16.     <link id="theme" rel="stylesheet" type="text/css" href="style.css" title="theme" />
  17.   <style type="text/css">
  18. <!--
  19. body {
  20.     background-color: #E7F2D0;
  21.     background-image: url(images/css/Background.jpg);
  22. }
  23. .style1 {
  24.     font-size: 16px
  25. }
  26. .style3 {font-size: 12px}
  27. .style4 {color: #b97407}
  28. -->
  29.   </style></head>
  30.   <body> 
  31.     <div id="wrapper"> 
  32.       <div id="bg"> 
  33.         <div id="header"></div>  
  34.         <div id="page"> 
  35.           <div id="container"> 
  36.             <!-- banner -->  
  37.             <div id="banner"></div>  
  38.             <!-- end banner -->  
  39.             <!-- horizontal navigation -->  
  40.             <div id="nav1"> 
  41.               <ul>
  42.                 <li id="current" style="border:none"></li>
  43.                  <li>
  44.                   <a href="index.html" class="style3" shape="rect">HOME</a>                </li>
  45.                   <li>
  46.                   <a href="affiliates.html" class="style3" shape="rect">COMPANY</a>                </li>
  47.                 <li>
  48.                   <a href="Training.html" class="style3" shape="rect">TRAINING</a>                </li>
  49.                 <li>
  50.                   <a href="Opportunity.html" class="style3" shape="rect">OPPORTUNITY</a>                </li>
  51.                 <li>
  52.                   <a href="contact.html" class="style3" shape="rect">CONTACT </a>                </li>
  53.               </ul> 
  54.             </div></div></html>  
  55.             <!-- end horizontal navigation -->  
  56.             <!--  content -->  
  57.             <div id="content"> 
  58.               <div id="center"> 
  59.                 <div id="welcome"> 
  60.  
  61.                   <h2 class="style4">&nbsp;</h2><?
  62. session_name("MyLogin");
  63. session_start();
  64. if($_GET['action'] == "login") {
  65. //database connection.
  66. $conn = mysql_connect("cindywalker.db.6189501.hostedresource.com","cindywalker","Daddy1980");
  67. $db = mysql_select_db("cindywalker"); 
  68.  
  69. //assigns user provided information to variables.
  70. $name = $_POST['user'];
  71. $password = $POST['pass'];
  72.  
  73. //queries the database and fills variable with returned array
  74. $q_user = mysql_query("SELECT * FROM USERS WHERE login='$name'");
  75.  
  76. //if something is returned assigns array to variable then assigns the value of password to variable.
  77. if(mysql_num_rows($q_user) == 1) {
  78. $data = mysql_fetch_array($q_user);
  79. $user_pass = $data['password'];
  80.  
  81. //checks user provided password with one stored in db.
  82. if($password == $user_pass) {
  83. session_register("name");
  84. header("Location: energyresources.php"); // success page. 
  85. exit;
  86.  
  87. } elseif {
  88. header("Location: login.php?login=failed&cause=".urlencode('Wrong Password'));
  89. exit;
  90. }
  91. } else {
  92. header("Location: login.php?login=failed&cause=".urlencode('Invalid User'));
  93. exit;
  94. }
  95. }
  96.  
  97. // if the session is not registered
  98. if(session_is_registered("name") == false) {
  99. header("Location: login.php");
  100. }
  101. ?> 
  102.  
  103.  
  104.  
  105.                 <html>  <div>
  106.                     <div align="center"></div>
  107.                   </div>  
  108.                   <p>&nbsp;</p>  
  109.                   <p style="clear:both" /> 
  110.                 </div> 
  111.               </div>  
  112.               <div id="right"> 
  113.                 <div id="sidebar"> 
  114.                   <h3 class="style4">Categories</h3>  
  115.                   <ul class="vmenu">
  116.                     <li><a href="http://wagllc.emexpower.com/account/select_zip?dest=registration" target="_blank">Register 
  117.  
  118.                   Now                    </a></li><li>
  119.                       <div align="left"><a href="http://wagllc.emexpower.com/account/zipcode" target="_blank">Commercial Quotes </a></div>
  120.                     </li>
  121.                     <li>
  122.                       <div align="left"><a href="http://freelights.joinambit.com" target="_blank">Residential Quotes</a> </div>
  123.                     </li>
  124.                     <li>
  125.                       <div align="left"><a href="login.html">Affiliate Login</a></div>
  126.                     </li>
  127.                     <li><a href="energyresources.php">Energy Resources</a></li>
  128.                   </ul>  
  129.                   <h3 align="left" style="margin-top:40px">&nbsp;</h3>  
  130.                   <p align="left">&nbsp;</p>  
  131.                   <div style="font-weight:bold;margin-top:20px">
  132.                     <p>&nbsp;</p>
  133.                     <p>&nbsp;</p>
  134.                   </div>  
  135.                   <div style="text-align:center;margin:20px 0"></div> 
  136.                 </div> 
  137.               </div>  
  138.               <div class="clear" style="height:40px"></div> 
  139.             </div>  
  140.             <!-- end content --> 
  141.           </div>  
  142.           <!-- end container --> 
  143.         </div>  
  144.         <div id="footerWrapper"> 
  145.           <div id="footer"> 
  146.             <p class="style1" style="padding-top:10px"> 
  147.  
  148.               © 2010 W.A.G., LLC             </p> 
  149.           </div> 
  150.         </div> 
  151.       </div> 
  152.     </div> 
  153.   </body>
  154. </html>
  155.  
This code worked fine until 2 days ago. Now it returns the syntax error on line 87.
Parse error: syntax error, unexpected '{', expecting '(' in D:\Hosting\6189501\html\log.php on line 87.

Before this it was returning and unexpected else on line 85. I fixed that by changinging else to elseif...

Please help!
Sep 10 '10 #1
3 2592
code green
1,726 Expert 1GB
elseif and if should have a condition
Expand|Select|Wrap|Line Numbers
  1. if($password != $user_pass)
Sep 10 '10 #2
I am a self taught beginner, I am not sure where that would go.
Sep 10 '10 #3
code green
1,726 Expert 1GB
It doesn't go anywhere it is just an example.
You know the problem is because of an if or elseif condition, and the problem is on line 85/87.
Well, you will see on line 85/87, your elseif is missing a condition in brackets
Sep 10 '10 #4

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

Similar topics

1
mikeinspain
by: mikeinspain | last post by:
Hi Guys I am getting the following error: Parse error: syntax error, unexpected '}' in /home/9144/domains/cbweb.co.uk/html/propertyEnquiry.php on line 5 This is the referring PHP code... ...
3
by: basswhizz | last post by:
Hi everyone im a high school student and I'm having trouble with one of my projects could you please help!! I'm getting this error message. Parse error: syntax error, unexpected...
1
by: basswhizz | last post by:
Hi guys im having trouble with somethings else now can you help out thanks!! Im getting this error message Parse error: syntax error, unexpected $end Here's my code cheers!!] <?php //...
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...
4
by: needhelp08 | last post by:
I am getting the error Parse error: syntax error, unexpected T_VARIABLE on line 4 but I can't seem to find what is wrong. Could someone please help. <?php $conn = @mysql_connect("localhost",...
5
by: Joshr35 | last post by:
I keep getting this same error on my store front page login area. Parse error: syntax error, unexpected '{' Here's the actuall php script: <?php if ( (!strstr($_SERVER,'login.php')) and...
5
praclarush
by: praclarush | last post by:
I've just started php, and this is a class assignment, but my question is I’m getting this error PHP Parse error: syntax error, unexpected T_IF, expecting T_VARIABLE or '$' in...
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...
5
by: Mandyrjs | last post by:
hi im new to php and i want to code a admin login page where i want to match the values from the login form with the values of the database table.....when i run the login page after entering the user...
1
by: karine | last post by:
Hi, I keep getting this error message "Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ']' in /home/env49986/public_html/welcome.php on line 16" below is the code ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.