whiteboikyle Posted June 24, 2008 Share Posted June 24, 2008 $name = "<br>"; // / ; < = > \ if(preg_replace("/[/] | [.] | ['] | ["] | [;] | [<] | [=] | [>] | [\]/","",trim($name))){ header("location:register2.php"); } okay i put that in a test.php and it works.. kk well when i put that in my process.php and click submit so it goes to process.php it wont work... it wont go to another page but if i put die("test") where the header is.. it will work.. hmm dono why the hell this aint working and its really making me mad.. been working on it for 3 hours.. I am going to blow up lol here is my full function //Register_Submit function register(){ global $config; //Defines All The Users Inputs $myusername=$_POST['myusername']; $myusername2=$_POST['myusername']; $mypassword=$_POST['mypassword']; $mypassword2=$_POST['mypassword2']; $email=$_POST['email']; $passwordcount=$_POST['mypassword']; # Allows letters, numbers $name = "<br>"; // / ; < = > \ if(preg_replace("/[/] | [.] | ['] | ["] | [;] | [<] | [=] | [>] | [\]/","",trim($name))){ header("location:register2.php"); } if(!preg_match('/^[a-zA-Z0-9]+$/i', $myusername2)) { session_register(bad_char); $_SESSION['bad_char'] = "<center><font color='red' size='1'>Invalid Charcter; Only Letters Or Numbers Can Be Used!</font></center>"; header("location:register.php"); } //Stop SQL Injection $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $mypassword2 = stripslashes($mypassword2); $email = stripslashes($email); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $mypassword2 = mysql_real_escape_string($mypassword2); $email = mysql_real_escape_string($email); //encrypt password variable $encrypt_password = md5($mypassword); $query = $config->query("SELECT * FROM members WHERE username='".$myusername."'"); // Mysql_num_row is counting table row $count=mysql_num_rows($query); // If result matches $myusername then username is taken if($count===1){ // Send error back to the register page if count = 1 session_register(username_taken); $_SESSION['username_taken'] = "<center><font color='red' size='1'>The Username You Chose Is Already In Use</font></center>"; header("location:register.php"); } elseif($mypassword != $mypassword2) { session_register(password_same); $_SESSION['password_same'] = "<center><font color='red' size='1'>Passwords Dont Match</font></center>"; header("location:register.php"); } elseif(strlen($mypassword) < "5") { session_register(password_less_then_5); $_SESSION['password_less_then_5'] = "<center><font color='red' size='1'>Password Must be Greater then 4 Charcters</font></center>"; header("location:register.php"); } else { $query = $config->query("INSERT INTO members (id, username, password, email) VALUES (NULL, '$myusername', '$encrypt_password', '$email')"); session_register(welcome_screen); $_SESSION['welcome'] = "Welcome, You are now a member of _____.<br> Reccommend us to your friends.<br> We are a free gamming community!<br> <a href='login.php'>Continue</a>"; header("location: register.php"); } } function userlevel(){ global $config; $username = $_POST['username']; $userID = $_POST['userID']; $config->query("UPDATE members SET userlevel = '$userID' WHERE username = '$username'"); session_register(userlevel_edit); $_SESSION['complete'] = $username."'s userlevel has now been changed to $userID<br /> <a href='main.php'>Go Back</a>"; header("location: view.php?function=userlevel"); } Quote Link to comment Share on other sites More sharing options...
whizard Posted June 24, 2008 Share Posted June 24, 2008 define "doesn't work" Do you get an error message? What specifically happens? Quote Link to comment Share on other sites More sharing options...
LinuxForce Posted June 24, 2008 Share Posted June 24, 2008 For some add reason i don't see <?php ?> Quote Link to comment Share on other sites More sharing options...
whiteboikyle Posted June 24, 2008 Author Share Posted June 24, 2008 WONT WORK if(preg_replace("/[&#47;] | [&#46;] | [&#39;] | [&#34;] | [&#59;] | [&#60;] | [&#61;] | [&#62;] | [&#92;]/","",trim($name))){ header("location:register2.php"); } WORKS if(preg_replace("/[&#47;] | [&#46;] | [&#39;] | [&#34;] | [&#59;] | [&#60;] | [&#61;] | [&#62;] | [&#92;]/","",trim($name))){ die("test"); } @LinuxForce lol its a snipplet its not all the code.. this is the only part you need to see.. i dont understand why Quote Link to comment Share on other sites More sharing options...
LinuxForce Posted June 24, 2008 Share Posted June 24, 2008 Oh i was just skimming through the thread and i don't really see why it shouldn't either then again im still learning myself. Quote Link to comment Share on other sites More sharing options...
peranha Posted June 24, 2008 Share Posted June 24, 2008 Do you have error reporting on, are you outputing data before the header is called? if you are outputing anything, they it will not redirect. Put this at the top of the page and see if anything is erroring out error_reporting(E_ALL); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.