Jump to content

Help With Error


hasek522

Recommended Posts

When i attempt to go to my login.php i get this error:

Parse error: syntax error, unexpected $end in /home/brandoo8/public_html/jasonhedrick/mymoney/login.php on line 115

 

I just cant seem to figure out what is wrong.  What makes things weird to me is the error is in the HTML not the php.

 

 

Here is the code:

<?php require_once("config.php");

$db = mysql_connect($dbhost, $dbuser, $dbpassword);

mysql_select_db($dbdatabase, $db);

 

if($_POST['Submit'])

{

// Prtect Against SQL Injections and make password into correct fromat

$username = addslashes(htmlentities($_POST['username']));

$password = addslashes(htmlentities($_POST['password']));

//$password = md5("[HEPA7][".$password."][".$verstring."][PROTECTED]");

 

$sql = "SELECT * FROM users WHERE username = '" . $username . "' AND password = '" . $password . "';";

$result = mysql_query($sql);

$numrows = mysql_num_rows($result);

 

if($numrows == 1) {

$row = mysql_fetch_assoc($result);

session_register("USERNAME");

session_register("USERID");

 

$_SESSION['USERNAME'] = $row['username'];

$_SESSION['USERID'] = $row['id'];

echo('<p></p><p></p><p><center>' . $_SESSION['USERNAME'] . ', you have successfully been logged In!!!</center></p><br />');

}

else { //user not found in database

header("Location: " . $config_basedir . "login.php?error=invalid");

}

}

else { // submit button has not been clicked

 

// check if there's an error

switch($_GET['error']) {

case "invalid":

echo "<div id='error'>Invalid login information. Please try again.</div>";

break;

}

 

 

?>

<head>

<meta name="author" content="Wink Hosting (www.winkhosting.com)" />

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<link rel="stylesheet" href="images/style.css" type="text/css" />

<title>Login</title></head>

<body>

<div id="page" align="center">

<div id="toppage" align="center">

<div id="date">

<div class="smalltext" style="padding:13px;"></div>

  </div>

<div id="topbar">

<div align="right" style="padding:12px;" class="smallwhitetext">

                <a href="#">Home</a> |

               

                <?php

if(IsLoggedIn())

{

echo '<a href="#">Logout</a>';

}

{

                echo '<a href="#">Login</a>';

}

                ?>

               

                | <a href="#">Contact Us</a></div>

</div>

</div>

<div id="header" align="center">

<div class="titletext" id="logo">

<div class="logotext" style="margin:30px">My$</div>

</div>

<div id="pagetitle">

<div id="title" class="titletext" align="right">Welcome to MyMoney!</div>

</div>

</div>

<div id="content" align="center">

<div id="menu" align="right">

<div align="right" style="width:189px; height:8px;"><img src="images/mnu_topshadow.gif" width="189" height="8" alt="mnutopshadow" /></div>

<div id="linksmenu" align="center">

<a href="#" title="Home">Home</a>

<a href="#" title="About Us">About Us</a>

<a href="#" title="Products">Products</a>

<a href="#" title="Our Services">Our Services</a>

<a href="#" title="Contact Us">Contact Us</a>

</div>

<div align="right" style="width:189px; height:8px;"><img src="images/mnu_bottomshadow.gif" width="189" height="8" alt="mnubottomshadow" /></div>

</div>

<div id="contenttext">

<div style="padding:12px;" align="justify"><span class="orangetitle">Hello User Please Login<br />

</span>

  <form id="login" name="login" method="post" action="login.php">

    <label>Username:

    <input type="text" name="username" id="username" />

    </label>

    <label><br />

    Password:

        <input type="password" name="password" id="password" />

        </label>

    <label><br />

    <input type="submit" name="Login" id="Login" value="submit" />

    </label>

    <p> </p>

  </form>

  <span class="orangetitle"><br />

    </span>Some intro text.</div>

  </div>

</div>

<div id="footer" class="smallgraytext" align="center">

<a href="#">Home</a> | <a href="#">About Us</a> | <a href="#">Products</a> | <a href="#">Our Services</a> | <a href="#">Contact Us</a><br />

Your Company Name © 2007<br />

<a href="http://www.winkhosting.com" title="Hosting Colombia">Hosting Colombia</a><br />

</div>

</div>

</body>

 

Link to comment
Share on other sites

this is all down to matching up your { and }

 

also

 

if(IsLoggedIn())

            {

              echo '<a href="#">Logout[/url]';

            }

            {

                    echo '<a href="#">Login[/url]';

            }

 

is missing an else...

Link to comment
Share on other sites

ok cool thanks i made those changes, however now im getting this error:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/brandoo8/public_html/jasonhedrick/mymoney/login.php on line 14

 

does that mean that possibly the select statement isnt working?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.