Jump to content

[SOLVED] Form isn't submitting correct.


BillyBoB

Recommended Posts

My form is showing up right and supposedly it is getting inputs because when you press refresh it says resend. But it isn't checking form or letting login.

 

<div id="login">
<form method="post">
<img src="../images/UserLogin.jpg" alt="User Login" /><br/>
<div class="Login_Input"><img src="../images/Username.jpg" alt="Username" /><img src="../images/spacer.gif" alt=" " style="width: 10px; height: 1px;" /><input type="text" name="username" size="15" class="LOGINInput" /></div>
<div class="Login_Input"><img src="../images/Password.jpg" alt="Password" /><img src="../images/spacer.gif" alt=" " style="width: 10px; height: 1px;" /><input type="password" name="password" size="15" class="LOGINInput" /></div>
<div id="Login_ALeft"><input type="submit" name="submit" value="" id="LoginBtn" /> <a href="#">Forgot Password?</a></div>
</form>
<div id="Login_Register">
<?php
if($_POST['submit']) {
	echo("I am the master");
	if(!$_POST['username']||!$_POST['password']) {
		$error .= "One or more of the fields were left blank. ";
	}else{
		$sql = mysql_query("SELECT `id` FROM `user_profiles` WHERE `username`='$_POST[username]'");
		$info = mysql_fetch_array($sql);
		$loginuser = new User($info['id']);
		$loginuser->retrieveFiles();
		if($loginuser->calculatePassword($_POST['username'], $_POST['password'])==1) {
			$_SESSION['id'] = $info['id'];
			$_SESSION['password'] = $loginuser->dbpassword;
			$error .= "You were logged in successfully. This page will redirect you in 3 seconds, if it doesn't click <a href=\"http://syckgamingleague.com/Home/\">here</a>.<meta http-equiv=\"Refresh\" content=\"3; url=http://syckgamingleague.com/Home/\" />";
		}else{
			$error .= "The username or password you entered was incorrect. ";
		}
	}
} 
?>
<?php if($error) { echo $error; }else{?><a href="../Register/"><img src="../images/RegisterUp_btn.jpg" alt="Register an Account" id="RegisteranAccountImg" onmouseover="imgHover('RegisteranAccountImg','RegisterDown_btn.jpg');" onmouseout="imgHover('RegisteranAccountImg','RegisterUp_btn.jpg');" /></a><? } ?>
</div>
</div>

sorry if it is a noob error haven't slept in over 24 hours.

 

While you are in this article could anyone suggest why my webpage is coming up in Firefox but is trying to download in IE. I am using SEF URL's I think it has something to do with the hosting.

 

.htaccess

RewriteEngine on
RewriteRule Validation/(.*)/(.*)/ Validation?username=$1&valkey=$2
DirectoryIndex Home

<FilesMatch "^(Home|Register|Validation)$"> 
ForceType application/x-httpd-php  
</FilesMatch>

 

The URL is: http://syckgamingleague.com/Home/

Link to comment
Share on other sites

try:

 

if(isset($_POST['submit']))

 

instead of:

 

if($_POST['submit'])

 

and

 

if ( !isset($_POST['username']) || !isset($_POST['password']) )

 

or

 

if ( $_POST['username'] == '' || $_POST['password'] == '' )

 

instead of the method you have no to check if the fields are blank.

Link to comment
Share on other sites

I just figured this out too. Lol. But the fields don't need to be if isset. Just the submit because the value = null.

 

Sorry for wasting your time.

 

Also figured out why IE was trying to download my script instead of read them. Its because the header.

If you would like to read up on this because you too have the same error or ever do the link is:

http://keystonewebsites.com/articles/mime_type.php

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.