Jump to content

uhmm wtf? dono why the hell this isn't working xD


whiteboikyle

Recommended Posts

	$name = "<br>";
				//  /          ;         <         =         >         \
	if(preg_replace("/[&#47;] | [&#46;] | [&#39;] | [&#34;] | [&#59;] | [&#60;] | [&#61;] | [&#62;] | [&#92;]/","",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("/[&#47;] | [&#46;] | [&#39;] | [&#34;] | [&#59;] | [&#60;] | [&#61;] | [&#62;] | [&#92;]/","",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");
}

 

 

Link to comment
Share on other sites

WONT WORK

if(preg_replace("/[&#38;#47;] | [&#38;#46;] | [&#38;#39;] | [&#38;#34;] | [&#38;#59;] | [&#38;#60;] | [&#38;#61;] | [&#38;#62;] | [&#38;#92;]/","",trim($name))){
header("location:register2.php");
}

 

WORKS

if(preg_replace("/[&#38;#47;] | [&#38;#46;] | [&#38;#39;] | [&#38;#34;] | [&#38;#59;] | [&#38;#60;] | [&#38;#61;] | [&#38;#62;] | [&#38;#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

Link to comment
Share on other sites

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);

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.