By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,018 Members | 1,204 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,018 IT Pros & Developers. It's quick & easy.

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

P: 2
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
Share this Question
Share on Google+
3 Replies


code green
Expert 100+
P: 1,726
elseif and if should have a condition
Expand|Select|Wrap|Line Numbers
  1. if($password != $user_pass)
Sep 10 '10 #2

P: 2
I am a self taught beginner, I am not sure where that would go.
Sep 10 '10 #3

code green
Expert 100+
P: 1,726
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

Post your reply

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