Ok, im quite new to php. I have a tutorial booklet that helped me code this, however it wont work, its supposed to redirect me to admincp.php when i successfully login, and redirect back to index when login fails. However it only ever redirects to index.
here:
index:
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>mysite</title> <script language="javascript"> function Validate(){ var username = document.frmLogin.txtUsername.value; var lenusername = username.length; var password = document.frmLogin.txtPassword.value; var lenpassword = password.length; if(username <1) { alert("Please enter your username."); document.frmLogin.txtUsername.value = ""); return false; } else if(lenpassword <1) { alert("Please enter your passowrd."); document.frmLogin.txtPassword.value = ""); return false; } else { frmLogin.Submit.disabled = true; return true; } } </script> // ----------------------------------------------------------------------\ // Tom's Website | // Copyright 2009 GFX-Core | // | // Redistribution prohibited without written permission | // ______________________________________________________________________/ </head>
Learn to follow the tutorial better. I doubt it told you to put all of those in quotes. Also there is a of other stuff wrong. The main thing I see is you aren't protecting yourself from mysql_injection and sooner or later you site will likely get hacked.
It seems that it wont connect to the mysql. It says;
Code:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'nobody'@'10.50.0.58' (using password: NO) in /home/a9541859/public_html/mysite/login.php
yet the password is being used, it just doesnt seem to recognise it....
Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'MYWEBHOSTMYSQL, MYSQLUSERNAME, PASSWORD' (3) in /home/a9541859/public_html/mysite/login.php