Jump to content


  • Posts

  • Joined

  • Last visited

RobberBaron's Achievements


Newbie (1/7)



  1. Found the problem. The forms are submitting to "index.php?do=etc" rather than login.php, so therefore index.php realizes they're not logged in and just sends them back to the login page. Thanks anyway.
  2. Thanks, however after posting this I updated all the form inputs so that the name property is equal to the ID property, so that made no difference, it still just refreshes the page :/ The whole website depends on this page: http://robberbaron.comeze.com
  3. Update: I commented out the register form, and yet submitting the Login form still just refreshed the page. What's going wrong :/
  4. I'm writing a website wherein if the user is not logged in, they will be redirected to "login.php", which gives the option of logging in or registering; the issue is, when I submit the Login or Register form, all that happens is the page refreshes - I've checked the database, nothing is inserted. When the login is submitted, if there are no errors then it should redirect to "index.php"When the registration form is submitted, it should redirect to "login.php?r=1" - this is the login/register page only with a notification saying the registration worked.Any help? :/ Here's the code for "login.php": <?phpIf (isset($_POST['do_rblogin'])){Include('db.php');// Makes sure they filled it inIf (!$_POST['user_text']){Die('You need to enter a username to login.');}Elseif(!$_POST['user_pass']){Die('Please enter a password.');};//Checks it against the database, gives error if user doesn't exist$check=mysql_query('SELECT * FROM users WHERE username = "'.$_POST['user_text'].'"') or die(mysql_error());If (mysql_num_rows($check)==0){Die('That user does not exist, maybe try registering silly.');};While($info=mysql_fetch_array($check)){$_POST['pass']=stripslashes($_POST['pass']);$info['password'] = stripslashes($info['password']);$_POST['pass'] = md5($_POST['pass']);//Gives error if the password is wrongIf ($_POST['pass']!=$info['password']){Die('Incorrect password, please try again.');}Else{ //if login is ok then we add a cookie setcookie('rb_userid', $info['ID'], time()*10);Header("Location: index.php"); }}}Elseif (isset($_POST['do_rbreg'])){Include('db.php');//Register code// $_POST['user_text']// $_POST['user_pass']// $_POST['user_cr_pass']// $_POST['user_email'] //This makes sure they did not leave any fields blank If (!$_POST['user_text']){Die('Please enter a username.');}Elseif (!$_POST['user_pass']){Die('Please enter a password.');}Elseif (!$_POST['user_cr_pass']||$_POST['user_pass']!=$_POST['user_cr_pass']){Die('Please check your secondary password - this ensures you know the password that you\'ll be using to login.');}; //Check if username is in use$usercheck=$_POST['user_text'];$check=mysql_query('SELECT username FROM users WHERE username = "'.$usercheck.'"') or die(mysql_error());//If the name exists it gives an errorIf (mysql_num_rows($check)!= 0) {die('Sorry, the username '.$usercheck.' is already in use, please select another.');};//Encrypt the password and add slashes if needed$_POST['user_pass']=md5($_POST['user_pass']);If (!get_magic_quotes_gpc()){$_POST['user_text']=addslashes($_POST['user_text']);$_POST['user_pass']=addslashes($_POST['user_pass']);$_POST['user_email']=addslashes($_POST['user_email']);}; //Now we insert it into the databasemysql_query('INSERT INTO users (username, password, email) VALUES ("'.$_POST['user_text'].'", "'.$_POST['user_pass'].'", "'.$_POST['user_email'].'")') or die(mysql_error());Header('Location: login.php?r=1');}Else{?><html><head><title>RobberBaron</title></head><body><h1>RobberBaron Accounts</h1><hr /><h1><?php If (isset($_GET['r'])) { Echo('Registration complete Now '); }; ?>Login</h1><form name="login" action="index.php?do=login" method="post"><input type="hidden" id="do_rblogin" value="1" /><table border="0"><tr><td>Username:</td><td><input type="text" id="user_text" /></td></tr><tr><td>Password:</td><td><input type="password" id="user_pass" /></td></tr></table><input type="submit" value="Submit" /><input type="reset" value="Clear" /></form><hr /><h1>...or register</h1><form name="register" action="index.php?do=register" method="post"><input type="hidden" id="do_rbreg" value="1" /><table border="0"><tr><td>Username:</td><td><input type="text" id="user_text" /></td></tr><tr><td>Password:</td><td><input type="password" id="user_pass" /></td></tr><tr><tr><td>Confirm Password:</td><td><input type="password" id="user_cr_pass" /></td></tr><tr><td>Email:</td><td><input type="text" id="user_email" /></td></tr></table><input type="submit" value="Submit" /><input type="reset" value="Clear" /></form><?php};?> Thanks for any help
  5. Chronology:-window.onload()-Loop executes that draws many divs with incremential ids-Code tries to call getElementById on divs, but it for some reason returns null
  6. The GetObject() function is used to set events and values in the DOM on the div, so if it just returns the innerHTML it won't help much. Also, instead of addblock = new Block()block_join="";for(i=1; i<5;i++){addblock.Name='Block'+i;block_join += addblock.Draw();} it would be more for(i=1; i<5;i++){addblock = new Block()block_join="";addblock.Name='Block'+i;block_join += addblock.Draw();} Because it's making lots of blocks which will then be used later.I've put the test file on the internet, but I'm not sure it will help all that much: http://www.robberbaron.evinext.com/pixelgr...nt-example.html
  7. I inserted a bunch of alerts on page load. If I alert someblock.GetObject(), that alert and any following alerts won't show, however no errors show in the console.
  8. The code is called as a handler to window.onload. After commenting out the section using GetObject, I've added a boolean to check if the Block has been drawn, so if it hasn't been drawn it will loop until the object can be found. Yet $.GetObject still returns null. I can easily get the Block object itself, and even the Block's name, but even after the Block has definitely been drawn and the class instance definitely exists, using document.getElementById still fails.
  9. I use a loop to draw a bunch of blocks with different colors, which all show. The block's Name is decided from a counter that increases every time a block is created. The blocks definitely exist, and $.Name works. The reason I didn't use "this" was because I was unsure whether using "this" inside a sub function would reference the main function or the child, since you are assigning values to a this in one function I presumed the context wouldn't matter. If I comment out the area where GetObject() is used, and use the console, I can easily use document.getElementById('Block1') to find an element. So it only breaks in the sub function....how odd...
  10. I have a script with a function in that I'm going to use as a class. It has some code like this: function Block(){ var $=this; $.Name='Block1'; $.Draw=function(){ window.document.write('<div id="'+$.Name+'"> </div>'); }; $.GetObject=function(){ return window.document.getElementById($.Name); };}; Obviously it's more complicated than that. So, I plan to use it as a class, like var a=new Block();But my problem is, even after I'm sure the element exists on the page from $.Draw, $.GetObject() still returns null. This makes many other functions fail also. The exact error is "Uncaught TypeError: Cannot set property 'onmousedown' of null", because later I use a loop to Draw a bunch of blocks and set an onmousedown property.Any help would be gladly appreciated, and I can offer virtual cookies.
  11. Hiya,My first problem is one with System.Text.RegularExpressions. I'm using them to highlight script expressions in a RichTextBox, but I want to be able to highlight certain symbols that define Regex markers. For example, I want to highlight any "[" characters, but I get an error of an unterminated [] set. There's a few others as well.Another question, how would I represent a range as a Regular Expression? For example, currently I am only highlighting single double-quote characters (") on their own, but I want to be able to highlight strings of a range from the first " to the next closing ", something like Regex("[a-z+A-Z]")?Final question, I've seen several applications using a CodeBox sort of thing that highlights code without selecting it, and it also automatically shows line numbers. Another feature is it has + and - controls to maximise and minimise snippets of code such as if statements. It is also generally used with a special file type tab system where tabs can be dragged and dropped and rearranged. I've seen this in Microsoft Visual Studio, Roblox Studio, SciTe, CodeLobster and some others, so I was assuming it was a .NET thing. Is there some way I can use this, and if not is there some way to change word color without selecting code?Thanks
  12. Thanks, it almost works, but for some reason it won't register the newline. Wasn't there someway to get the newline character from Environment?EDIT: Oh yeah, Environment.NewLine. Thanks, work perfectly (although it is a bit slow at updating)
  13. I don't want to add the numbers onto the end of the first TextBox, I want to update so that for every line in TextBox2, the corresponding line in TextBox1 will hold the line number.
  14. It changes all the links so they will load the page in Google.
  • Create New...