Jump to content

hi guys, when i press the login button on my login.html form its sends me to my login.php with a blank screen when its supposed to send me to my php123.html file after i press my login button, heres my login.php code;

 

<?php@$member = sessions_start(); // Start PHP session@$conn = mysql_connect('localhost','ash','password') or die("Fatal error, no DB accs!"); // Use host,username,password to connect do DB@mysql_select_db('mywebsite', $conn) or die("Fatal error, no DB!"); // Select DB name.    // All of those are for UTF-8.    mysql_query('SET NAMES utf8');    mysql_query("SET character_set_client = 'utf8'");    mysql_query("SET character_set_connection = 'utf8'");    mysql_query("SET character_set_results = 'utf8'");    mysql_query("SET character_set_server = 'utf8'"); if(isset($_POST['username']) && isset($_POST['password'])) { // Isset bypass error of making two files for login.// Sme query that we used before$login_query = mysql_query("SELECT * FROM `user` WHERE `username` = '".$_POST['username']."' AND `password` = '".$_POST['password']."'");    // If number of rows is == to 0 (zero) then return error.    if(mysql_num_rows($admin) == 0) {        // Pick error, as this.        die("Wrong username or password.");        // If there is user:    } else {        // Use same query to fetch in array all abou that user, so you can put his ID in session.        $user = mysql_fetch_array($login_query, MYSQL_ASSOC);            $_SESSION['user_id'] = $user['id'];    }} header ('Location: login_form.html'); ?>

 

and here is my login_form.html code

 

<html><body><body bgcolor="#069099"><center><p>Input Details to Login Bruva:</p></center><form name="login" action="login.php" method="post">    Username: <input type="text" name="username" />    Password: <input type="password" name="password" />    <input type="submit" value="Login" /></form></body></body></html> 

 

 

Link to comment
https://linustechtips.com/topic/333728-login-button-posts-a-blank-screen/
Share on other sites

Link to post
Share on other sites

Sorry bud, I'm not sure anyone on here can help you out. Most people here only know hardware.

CM Storm Switch Tester MOD (In-Progress) - http://linustechtips.com/main/topic/409147-cm-storm-switch-tester-macro-mod/


       Ammo Can Speaker 02 (Completed) - http://linustechtips.com/main/topic/283826-ammo-can-speakers-02/       A/B Switch V 0.5 (Completed) - http://linustechtips.com/main/topic/362417-ab-switch-v0


     Build 01 - The Life of a Prodigy -  http://linustechtips.com/main/topic/13103-build-01-the-life-of-a-prodigy/             Build 02 - Silent Server 3000 - http://linustechtips.com/main/topic/116670-build-02-silent-server-3000/

Link to post
Share on other sites

Sorry bud, I'm not sure anyone on here can help you out. Most people here only know hardware.

I don't even know why you would post that.... Like... There's a subforum for it... I can think of at least 8 practiced PHP developers on here that can help.. Most of us are active 

 

 

 

 

hi guys, when i press the login button on my login.html form its sends me to my login.php with a blank screen when its supposed to send me to my php123.html file after i press my login button, heres my login.php code;

<?php@$member = sessions_start(); // Start PHP session@$conn = mysql_connect('localhost','ash','password') or die("Fatal error, no DB accs!"); // Use host,username,password to connect do DB@mysql_select_db('mywebsite', $conn) or die("Fatal error, no DB!"); // Select DB name.    // All of those are for UTF-8.    mysql_query('SET NAMES utf8');    mysql_query("SET character_set_client = 'utf8'");    mysql_query("SET character_set_connection = 'utf8'");    mysql_query("SET character_set_results = 'utf8'");    mysql_query("SET character_set_server = 'utf8'"); if(isset($_POST['username']) && isset($_POST['password'])) { // Isset bypass error of making two files for login.// Sme query that we used before$login_query = mysql_query("SELECT * FROM `user` WHERE `username` = '".$_POST['username']."' AND `password` = '".$_POST['password']."'");    // If number of rows is == to 0 (zero) then return error.    if(mysql_num_rows($admin) == 0) {        // Pick error, as this.        die("Wrong username or password.");        // If there is user:    } else {        // Use same query to fetch in array all abou that user, so you can put his ID in session.        $user = mysql_fetch_array($login_query, MYSQL_ASSOC);            $_SESSION['user_id'] = $user['id'];    }} header ('Location: login_form.html'); ?>

and here is my login_form.html code

<html><body><body bgcolor="#069099"><center><p>Input Details to Login Bruva:</p></center><form name="login" action="login.php" method="post">    Username: <input type="text" name="username" />    Password: <input type="password" name="password" />    <input type="submit" value="Login" /></form></body></body></html> 

 

Your error is actually in your second line.

session_start();

 

rather than 

sessions_start();

I am good at computer

Spoiler

Motherboard: Gigabyte G1 sniper 3 | CPU: Intel 3770k @5.1Ghz | RAM: 32Gb G.Skill Ripjaws X @1600Mhz | Graphics card: EVGA 980 Ti SC | HDD: Seagate barracuda 3298534883327.74B + Samsung OEM 5400rpm drive + Seatgate barracude 2TB | PSU: Cougar CMX 1200w | CPU cooler: Custom loop

Link to post
Share on other sites

header ('Location: login_form.html');

Is the line that says where you'll end up, if you want the page to redirect to php123.html then you need to tell it go there instead of back to login_form.html.

 

Edit: and when something doesn't work you should remove all the @s to stop suppressing the errors.

1474412270.2748842

Link to post
Share on other sites

I don't even know why you would post that.... Like... There's a subforum for it... I can think of at least 8 practiced PHP developers on here that can help.. Most of us are active 

 

 

 

 

Your error is actually in your second line.

session_start();

 

rather than 

sessions_start();

Thanks that helped :)

Link to post
Share on other sites

header ('Location: login_form.html');

Is the line that says where you'll end up, if you want the page to redirect to php123.html then you need to tell it go there instead of back to login_form.html.

 

Edit: and when something doesn't work you should remove all the @s to stop suppressing the errors.

 

oh haha yes very true, didn't notice :/ but now my parameters don't work, so if i enter something wrong in the text boxes it still continues to go on to the next page, it should not let me continue and should say enter name and password and if the details are incorrect to say Username and password is incorrect.

Link to post
Share on other sites

oh haha yes very true, didn't notice :/ but now my parameters don't work, so if i enter something wrong in the text boxes it still continues to go on to the next page, it should not let me continue and should say enter name and password and if the details are incorrect to say Username and password is incorrect.

On your form tag attach an onSubmit and return a function. Code will be below. The function should have a prevent default. However, to check if the username and password is correct, serverside code is needed, thus requiring AJAX requests to properly work. Client side you can do things like check if the input fields are empty and that sort of thing without intervention, but you can't do things that are too extensive

<!-- The onSubmit attribute you need to add to your form element --><form onSubmit="return checkLogin()">//The script you need to have at the bottom of the page<script>		function checkLogin(){			user = document.getElementByID('username')			pass = document.getElementByID('password')			if(user == null || user == ''){				alert('You have not entered a username');				return false();			}			if(pass == null || pass == ''){				alert('You have not entered a password');				return false();			}		}	</script>

Notes on the script, for that to work I have given <input type="text" name="username" /> an ID of username and the same for the password box. This only checks to see if the inputs have nothing in them, and thus appropriate errors are alerted. Note, that if they are not empty, then the form will continue to submit as per normal. If you wanted to check if the username and password is valid without refreshing the page, let me know... But I wouldn't really recommend it

I am good at computer

Spoiler

Motherboard: Gigabyte G1 sniper 3 | CPU: Intel 3770k @5.1Ghz | RAM: 32Gb G.Skill Ripjaws X @1600Mhz | Graphics card: EVGA 980 Ti SC | HDD: Seagate barracuda 3298534883327.74B + Samsung OEM 5400rpm drive + Seatgate barracude 2TB | PSU: Cougar CMX 1200w | CPU cooler: Custom loop

Link to post
Share on other sites

On your form tag attach an onSubmit and return a function. Code will be below. The function should have a prevent default. However, to check if the username and password is correct, serverside code is needed, thus requiring AJAX requests to properly work. Client side you can do things like check if the input fields are empty and that sort of thing without intervention, but you can't do things that are too extensive

<!-- The onSubmit attribute you need to add to your form element --><form onSubmit="return checkLogin()">//The script you need to have at the bottom of the page<script>		function checkLogin(){			user = document.getElementByID('username')			pass = document.getElementByID('password')			if(user == null || user == ''){				alert('You have not entered a username');				return false();			}			if(pass == null || pass == ''){				alert('You have not entered a password');				return false();			}		}	</script>

Notes on the script, for that to work I have given <input type="text" name="username" /> an ID of username and the same for the password box. This only checks to see if the inputs have nothing in them, and thus appropriate errors are alerted. Note, that if they are not empty, then the form will continue to submit as per normal. If you wanted to check if the username and password is valid without refreshing the page, let me know... But I wouldn't really recommend it

so what would you recommend me do to know if the username and password is valid?

Link to post
Share on other sites

so what would you recommend me do to know if the username and password is valid?

I would recommend letting it do what it's doing now and running through the current PHP script as per normal

I am good at computer

Spoiler

Motherboard: Gigabyte G1 sniper 3 | CPU: Intel 3770k @5.1Ghz | RAM: 32Gb G.Skill Ripjaws X @1600Mhz | Graphics card: EVGA 980 Ti SC | HDD: Seagate barracuda 3298534883327.74B + Samsung OEM 5400rpm drive + Seatgate barracude 2TB | PSU: Cougar CMX 1200w | CPU cooler: Custom loop

Link to post
Share on other sites

On your form tag attach an onSubmit and return a function. Code will be below. The function should have a prevent default. However, to check if the username and password is correct, serverside code is needed, thus requiring AJAX requests to properly work. Client side you can do things like check if the input fields are empty and that sort of thing without intervention, but you can't do things that are too extensive

<!-- The onSubmit attribute you need to add to your form element --><form onSubmit="return checkLogin()">//The script you need to have at the bottom of the page<script>		function checkLogin(){			user = document.getElementByID('username')			pass = document.getElementByID('password')			if(user == null || user == ''){				alert('You have not entered a username');				return false();			}			if(pass == null || pass == ''){				alert('You have not entered a password');				return false();			}		}	</script>

Notes on the script, for that to work I have given <input type="text" name="username" /> an ID of username and the same for the password box. This only checks to see if the inputs have nothing in them, and thus appropriate errors are alerted. Note, that if they are not empty, then the form will continue to submit as per normal. If you wanted to check if the username and password is valid without refreshing the page, let me know... But I wouldn't really recommend it

haha I'm sorry but I'm lost is this how you wanted me to do it

 

this is my form and i added that line you told me to add

 

<?phpif (isset($_POST['Login'])) {header('Location: php123.html');?><form onSubmit="return checkLogin()"><html><body><body bgcolor="#069099"><center><p>Input Details to Login Bruva:</p></center><form name="login" action="login.php" method="post">     Username: <input type="text" name="username" />    Password: <input type="password" name="password" />    <input type="submit" value="Login" /></form></body></body></html></form>

 

 

I'm confused with where i was supposed to put that other script, do i put it in the php script? this is how I've done it

 

<?php@$member = session_start(); // Start PHP session@$conn = mysql_connect('localhost','ash','password') or die("Fatal error, no DB accs!"); // Use host,username,password to connect do DB@mysql_select_db('Users', $conn) or die("Fatal error, no DB!"); // Select DB name.    // All of those are for UTF-8.    mysql_query('SET NAMES utf8');    mysql_query("SET character_set_client = 'utf8'");    mysql_query("SET character_set_connection = 'utf8'");    mysql_query("SET character_set_results = 'utf8'");    mysql_query("SET character_set_server = 'utf8'"); if(isset($_POST['username']) && isset($_POST['password'])) { // Isset bypass error of making two files for login.// Sme query that we used before$login_query = mysql_query("SELECT * FROM `user` WHERE `username` = '".$_POST['username']."' AND `password` = '".$_POST['password']."'");}    // If number of rows is == to 0 (zero) then return error.    if(mysql_num_rows($admin) == 1)    {        // Pick error, as this.        die("Wrong username or password.");        // If there is user:    }     else {        // Use same query to fetch in array all abou that user, so you can put his ID in session.        $user = mysql_fetch_array($login_query, MYSQL_ASSOC);            $_SESSION['user_id'] = $user['id'];    }  header ('Location: php123.html'); ?><script>        function checkLogin(){            user = document.getElementByID('username')            pass = document.getElementByID('password')            if(user == null || user == 'ash'){                alert('You have not entered a username');                return false();            }            if(pass == null || pass == 'password'){                alert('You have not entered a password');                return false();            }        }    </script> 
Link to post
Share on other sites

 

haha I'm sorry but I'm lost is this how you wanted me to do it

 

this is my form and i added that line you told me to add

 

 

I'm confused with where i was supposed to put that other script, do i put it in the php script? this is how I've done it

<?php@$member = session_start(); // Start PHP session@$conn = mysql_connect('localhost','ash','password') or die("Fatal error, no DB accs!"); // Use host,username,password to connect do DB@mysql_select_db('Users', $conn) or die("Fatal error, no DB!"); // Select DB name.    // All of those are for UTF-8.    mysql_query('SET NAMES utf8');    mysql_query("SET character_set_client = 'utf8'");    mysql_query("SET character_set_connection = 'utf8'");    mysql_query("SET character_set_results = 'utf8'");    mysql_query("SET character_set_server = 'utf8'"); if(isset($_POST['username']) && isset($_POST['password'])) { // Isset bypass error of making two files for login.// Sme query that we used before$login_query = mysql_query("SELECT * FROM `user` WHERE `username` = '".$_POST['username']."' AND `password` = '".$_POST['password']."'");}    // If number of rows is == to 0 (zero) then return error.    if(mysql_num_rows($admin) == 1)    {        // Pick error, as this.        die("Wrong username or password.");        // If there is user:    }     else {        // Use same query to fetch in array all abou that user, so you can put his ID in session.        $user = mysql_fetch_array($login_query, MYSQL_ASSOC);            $_SESSION['user_id'] = $user['id'];    }  header ('Location: php123.html'); ?><script>        function checkLogin(){            user = document.getElementByID('username')            pass = document.getElementByID('password')            if(user == null || user == 'ash'){                alert('You have not entered a username');                return false();            }            if(pass == null || pass == 'password'){                alert('You have not entered a password');                return false();            }        }    </script> 

 

Hmm, it's my fault sorry, should have been clearer. You wanted to add the onSubmit to your existing HTML tag

So change it to

<html><body><body bgcolor="#069099"><center><p>Input Details to Login Bruva:</p></center><form name="login" action="login.php" method="post" onSubmit="return checkLogin()">     Username: <input type="text" name="username" />    Password: <input type="password" name="password" />    <input type="submit" value="Login" /></form>
<script>
        function checkLogin(){
            user = document.getElementByID('username')
            pass = document.getElementByID('password')
            if(user == null || user == 'ash'){
                alert('You have not entered a username');
                return false();
            }
            if(pass == null || pass == 'password'){
                alert('You have not entered a password');
                return false();
            }
        }
    </script>

</body> </body> </html>

The script should go on the login_form page. Probably just above the body tag, but anywhere should work fine. The above code has this already added.

 

Now, how this all works currently should be something like this. When the user enters a username and password, you will be sent to login.php which will go and do all the database stuff and checking and what not. If everything is fine, the user will be logged in and redirected to the page php123.html. If everything isn't fine, an error will be displayed on the page. Unfortunately, this will currently only be a plain text error on a white page. You can fix this by adding a full HTML page unerneath all that PHP code and sending the errors there.

 

Alternatively, on the login_form page under the form you can have and error box with some php code that will display an an appropriate error and instead of using using die() to output a string, you can just send the user back to the login_form page using header ('Location: login_form.html?error=incorrect');

 

Or, if you really want I can still show you how to do all this without having to refresh or send to various pages 

I am good at computer

Spoiler

Motherboard: Gigabyte G1 sniper 3 | CPU: Intel 3770k @5.1Ghz | RAM: 32Gb G.Skill Ripjaws X @1600Mhz | Graphics card: EVGA 980 Ti SC | HDD: Seagate barracuda 3298534883327.74B + Samsung OEM 5400rpm drive + Seatgate barracude 2TB | PSU: Cougar CMX 1200w | CPU cooler: Custom loop

Link to post
Share on other sites

I would recommend letting it do what it's doing now and running through the current PHP script as per normal

i done everything 

 

Hmm, it's my fault sorry, should have been clearer. You wanted to add the onSubmit to your existing HTML tag

So change it to

<html><body><body bgcolor="#069099"><center><p>Input Details to Login Bruva:</p></center><form name="login" action="login.php" method="post" onSubmit="return checkLogin()">     Username: <input type="text" name="username" />    Password: <input type="password" name="password" />    <input type="submit" value="Login" /></form>
<script>
        function checkLogin(){
            user = document.getElementByID('username')
            pass = document.getElementByID('password')
            if(user == null || user == 'ash'){
                alert('You have not entered a username');
                return false();
            }
            if(pass == null || pass == 'password'){
                alert('You have not entered a password');
                return false();
            }
        }
    </script>

</body> </body> </html>

The script should go on the login_form page. Probably just above the body tag, but anywhere should work fine. The above code has this already added.

 

Now, how this all works currently should be something like this. When the user enters a username and password, you will be sent to login.php which will go and do all the database stuff and checking and what not. If everything is fine, the user will be logged in and redirected to the page php123.html. If everything isn't fine, an error will be displayed on the page. Unfortunately, this will currently only be a plain text error on a white page. You can fix this by adding a full HTML page unerneath all that PHP code and sending the errors there.

 

Alternatively, on the login_form page under the form you can have and error box with some php code that will display an an appropriate error and instead of using using die() to output a string, you can just send the user back to the login_form page using header ('Location: login_form.html?error=incorrect');

 

Or, if you really want I can still show you how to do all this without having to refresh or send to various pages 

so is this how you wanted my form page to look like?

 

<?phpif (isset($_POST['Login'])) {header('Location: php123.html');?><html><body><body bgcolor="#069099"><center><p>Input Details to Login Bruva:</p></center><form name="login" action="login.php" method="post" onSubmit="return checkLogin()">     Username: <input type="text" name="username" />    Password: <input type="password" name="password" />    <input type="submit" value="Login" /></form><script>        function checkLogin(){            user = document.getElementByID('username')            pass = document.getElementByID('password')            if(user == null || user == 'ash'){                alert('You have not entered a username');                return false();            }            if(pass == null || pass == 'password'){                alert('You have not entered a password');                return false();            }        }</script></body></body></html></form> 
Link to post
Share on other sites

 

i done everything 

 

so is this how you wanted my form page to look like?

<?phpif (isset($_POST['Login'])) {header('Location: php123.html');?><html><body><body bgcolor="#069099"><center><p>Input Details to Login Bruva:</p></center><form name="login" action="login.php" method="post" onSubmit="return checkLogin()">     Username: <input type="text" name="username" />    Password: <input type="password" name="password" />    <input type="submit" value="Login" /></form><script>        function checkLogin(){            user = document.getElementByID('username')            pass = document.getElementByID('password')            if(user == null || user == 'ash'){                alert('You have not entered a username');                return false();            }            if(pass == null || pass == 'password'){                alert('You have not entered a password');                return false();            }        }</script></body></body></html></form> 

 

You left a closing form tag at the very bottom, also, the php code at the top is irrelevant since the PHP script automatically goes straight through to php123.html

I am good at computer

Spoiler

Motherboard: Gigabyte G1 sniper 3 | CPU: Intel 3770k @5.1Ghz | RAM: 32Gb G.Skill Ripjaws X @1600Mhz | Graphics card: EVGA 980 Ti SC | HDD: Seagate barracuda 3298534883327.74B + Samsung OEM 5400rpm drive + Seatgate barracude 2TB | PSU: Cougar CMX 1200w | CPU cooler: Custom loop

Link to post
Share on other sites

You left a closing form tag at the very bottom, also, the php code at the top is irrelevant since the PHP script automatically goes straight through to php123.html

ohkie so is this it?

 

<html><body><body bgcolor="#069099"><center><p>Input Details to Login Bruva:</p></center><form name="login" action="login.php" method="post" onSubmit="return checkLogin()">     Username: <input type="text" name="username" />    Password: <input type="password" name="password" />    <input type="submit" value="Login" /><script>        function checkLogin(){            user = document.getElementByID('username')            pass = document.getElementByID('password')            if(user == null || user == 'ash'){                alert('You have not entered a username');                return false();            }            if(pass == null || pass == 'password'){                alert('You have not entered a password');                return false();            }        }</script></body></body></html></form>
Link to post
Share on other sites

 

ohkie so is this it?

<html><body><body bgcolor="#069099"><center><p>Input Details to Login Bruva:</p></center><form name="login" action="login.php" method="post" onSubmit="return checkLogin()">     Username: <input type="text" name="username" />    Password: <input type="password" name="password" />    <input type="submit" value="Login" /><script>        function checkLogin(){            user = document.getElementByID('username')            pass = document.getElementByID('password')            if(user == null || user == 'ash'){                alert('You have not entered a username');                return false();            }            if(pass == null || pass == 'password'){                alert('You have not entered a password');                return false();            }        }</script></body></body></html></form>

You removed the wrong closing from tag, there's a closing tag right at the very bottom that shouldn't be there. The one you removed was fine

I am good at computer

Spoiler

Motherboard: Gigabyte G1 sniper 3 | CPU: Intel 3770k @5.1Ghz | RAM: 32Gb G.Skill Ripjaws X @1600Mhz | Graphics card: EVGA 980 Ti SC | HDD: Seagate barracuda 3298534883327.74B + Samsung OEM 5400rpm drive + Seatgate barracude 2TB | PSU: Cougar CMX 1200w | CPU cooler: Custom loop

Link to post
Share on other sites

You removed the wrong closing from tag, there's a closing tag right at the very bottom that shouldn't be there. The one you removed was fine

oh sorry my bad is this correct now?

 

<html><body><body bgcolor="#069099"><center><p>Input Details to Login Bruva:</p></center><form name="login" action="login.php" method="post" onSubmit="return checkLogin()">     Username: <input type="text" name="username" />    Password: <input type="password" name="password" />    <input type="submit" value="Login" />    </form><script>        function checkLogin(){            user = document.getElementByID('username')            pass = document.getElementByID('password')            if(user == null || user == 'ash'){                alert('You have not entered a username');                return false();            }            if(pass == null || pass == 'password'){                alert('You have not entered a password');                return false();            }        }</script></body></body></html> 
Link to post
Share on other sites

 

oh sorry my bad is this correct now?

<html><body><body bgcolor="#069099"><center><p>Input Details to Login Bruva:</p></center><form name="login" action="login.php" method="post" onSubmit="return checkLogin()">     Username: <input type="text" name="username" />    Password: <input type="password" name="password" />    <input type="submit" value="Login" />    </form><script>        function checkLogin(){            user = document.getElementByID('username')            pass = document.getElementByID('password')            if(user == null || user == 'ash'){                alert('You have not entered a username');                return false();            }            if(pass == null || pass == 'password'){                alert('You have not entered a password');                return false();            }        }</script></body></body></html> 

Yep, golden. Everything should work more or less as intended 

I am good at computer

Spoiler

Motherboard: Gigabyte G1 sniper 3 | CPU: Intel 3770k @5.1Ghz | RAM: 32Gb G.Skill Ripjaws X @1600Mhz | Graphics card: EVGA 980 Ti SC | HDD: Seagate barracuda 3298534883327.74B + Samsung OEM 5400rpm drive + Seatgate barracude 2TB | PSU: Cougar CMX 1200w | CPU cooler: Custom loop

Link to post
Share on other sites

haha dude I'm about to shoot myself it did not really make a difference, i can still enter nothing and just continue on to my php123 page..... bruhhhh

 

I apologise, my fault again. I didn't pay much attention to the javascript as I thought you used it exactly as I gave it to you, and the exact version I gave to you had errors as well. So, sorry. To clarify one thing, which took me ages to see. user == null || user == ''. It's meant to be blank quotations. Anyway, I actually went and tested my code rather then just typing it to you, and this works perfectly

<script>        function checkLogin(){            var user = document.getElementById('username').value            var pass = document.getElementById('password').value            if(user == null || user == ''){                alert('You have not entered a username');                return false;            }            if(pass == null || pass == ''){                alert('You have not entered a password');                return false;            }        }</script>

Also, one last thing, when I first provided the code, I mentioned that I decided to add the id to the inputs as well for ease, so the full HTML page should look like this

<html><body><body bgcolor="#069099"><center><p>Input Details to Login Bruva:</p></center><form name="login" action="login.php" method="post" onSubmit="return checkLogin()">     Username: <input type="text" name="username" id="username" />    Password: <input type="password" name="password" id="password"/>    <input type="submit" value="Login" />    </form><script>        function checkLogin(){            var user = document.getElementById('username').value            var pass = document.getElementById('password').value            if(user == null || user == ''){                alert('You have not entered a username');                return false;            }            if(pass == null || pass == ''){                alert('You have not entered a password');                return false;            }        }</script></body></body></html>

Again, sorry for not seeing things.. My mind is a bit wandery today. Birthday was yesterday and I had a bit too much to drink, also I'm developing a browser extension, so I haven't been giving this thread the proper attention it deserved 

I am good at computer

Spoiler

Motherboard: Gigabyte G1 sniper 3 | CPU: Intel 3770k @5.1Ghz | RAM: 32Gb G.Skill Ripjaws X @1600Mhz | Graphics card: EVGA 980 Ti SC | HDD: Seagate barracuda 3298534883327.74B + Samsung OEM 5400rpm drive + Seatgate barracude 2TB | PSU: Cougar CMX 1200w | CPU cooler: Custom loop

Link to post
Share on other sites

I apologise, my fault again. I didn't pay much attention to the javascript as I thought you used it exactly as I gave it to you, and the exact version I gave to you had errors as well. So, sorry. To clarify one thing, which took me ages to see. user == null || user == ''. It's meant to be blank quotations. Anyway, I actually went and tested my code rather then just typing it to you, and this works perfectly

<script>        function checkLogin(){            var user = document.getElementById('username').value            var pass = document.getElementById('password').value            if(user == null || user == ''){                alert('You have not entered a username');                return false;            }            if(pass == null || pass == ''){                alert('You have not entered a password');                return false;            }        }</script>

Also, one last thing, when I first provided the code, I mentioned that I decided to add the id to the inputs as well for ease, so the full HTML page should look like this

<html><body><body bgcolor="#069099"><center><p>Input Details to Login Bruva:</p></center><form name="login" action="login.php" method="post" onSubmit="return checkLogin()">     Username: <input type="text" name="username" id="username" />    Password: <input type="password" name="password" id="password"/>    <input type="submit" value="Login" />    </form><script>        function checkLogin(){            var user = document.getElementById('username').value            var pass = document.getElementById('password').value            if(user == null || user == ''){                alert('You have not entered a username');                return false;            }            if(pass == null || pass == ''){                alert('You have not entered a password');                return false;            }        }</script></body></body></html>

Again, sorry for not seeing things.. My mind is a bit wandery today. Birthday was yesterday and I had a bit too much to drink, also I'm developing a browser extension, so I haven't been giving this thread the proper attention it deserved 

ahhahaha omg finally some progress, thanks soon much bro i love you <3 one thing but when you enter a random username and password it will go on the next page but the other parameters work? any idea?

Link to post
Share on other sites

ahhahaha omg finally some progress, thanks soon much bro i love you <3 one thing but when you enter a random username and password it will go on the next page but the other parameters work? any idea?

That's.... Hard for me to test on my end, I don't have your database and what not. What do you mean by parameters?

I am good at computer

Spoiler

Motherboard: Gigabyte G1 sniper 3 | CPU: Intel 3770k @5.1Ghz | RAM: 32Gb G.Skill Ripjaws X @1600Mhz | Graphics card: EVGA 980 Ti SC | HDD: Seagate barracuda 3298534883327.74B + Samsung OEM 5400rpm drive + Seatgate barracude 2TB | PSU: Cougar CMX 1200w | CPU cooler: Custom loop

Link to post
Share on other sites

That's.... Hard for me to test on my end, I don't have your database and what not. What do you mean by parameters?

so when i don't enter a username its says you must enter a username and then when i do it says you must enter a password, that type of stuff?

Link to post
Share on other sites

so when i don't enter a username its says you must enter a username and then when i do it says you must enter a password, that type of stuff?

I'm not quite sure I follow still? Yes, if you enter only a username, it still doesn't let you go to the next page and vice versa... Did you want it so that the user doesn't have to enter in both to move to the next page..?

I am good at computer

Spoiler

Motherboard: Gigabyte G1 sniper 3 | CPU: Intel 3770k @5.1Ghz | RAM: 32Gb G.Skill Ripjaws X @1600Mhz | Graphics card: EVGA 980 Ti SC | HDD: Seagate barracuda 3298534883327.74B + Samsung OEM 5400rpm drive + Seatgate barracude 2TB | PSU: Cougar CMX 1200w | CPU cooler: Custom loop

Link to post
Share on other sites

I'm not quite sure I follow still? Yes, if you enter only a username, it still doesn't let you go to the next page and vice versa... Did you want it so that the user doesn't have to enter in both to move to the next page..?

no no i was saying that for instance if the user entered a wrong username and password it would not let them proceed but to come up with another message saying your username and password was incorrect, do you understand what I'm trying to say?

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×