chanfuterboy Posted November 6, 2009 Share Posted November 6, 2009 im busy with register page, everythink is working fine. The html code is on the same page thus after submit it come back in same page to post things in db. What i want is a script that after that it will not show again the register fields instead of that a other page.php help plz <?php include("dbconfig.php"); // item register ta kuminsa aki // prome kos bo tei wak si e port bou nomber di submit mane ta skibi komo nomber dje botton if(isset($_POST['submit'])) { // nos tabuta par di variabel ku ta nomber ku ba dune fields nan $articlename= $_POST['username']; $articlecolor= $_POST['password']; { // den database // na Value ta depende den kuantu table bo ta hinka kos, bo mester buta ('',) den nos kaso tin 8 table den kual e table ku nos ta usa ta 6 7 i 8 // Sobra tab // Sobra table ku no ta wordu usa na value ta keda bashi dor di un parentensis riba nan mysql_query("INSERT into users VALUES('','$_POST[username]','$_POST[password]','$pic')"); echo"$pic"; }else { echo "Can't upload. check folder permission"; } } ?> Quote Link to comment Share on other sites More sharing options...
Goldeneye Posted November 6, 2009 Share Posted November 6, 2009 If you're looking to perform a page redirect, you can use the following code: <?php if(...) //check if user is logged in header('Location: the_page_you_want_to_redirect_to.php') and exit; ?> That code will redirect to the page you specify. You must place this in your script before anything is outputted with echo or print. Quote Link to comment Share on other sites More sharing options...
JAY6390 Posted November 6, 2009 Share Posted November 6, 2009 Also, you say that everything is fine in your code, however it's totally open to SQL injection attacks Quote Link to comment Share on other sites More sharing options...
chanfuterboy Posted November 6, 2009 Author Share Posted November 6, 2009 but, in my case when it is not online will redirect help on this, the script has some kind of error if(isset($_SESSION["username"])) { }else { header('Location: collection.php'); exit; } Quote Link to comment Share on other sites More sharing options...
huszi001 Posted November 6, 2009 Share Posted November 6, 2009 Try this if(!isset($_SESSION["username"])) { echo '<meta http-equiv="refresh" content="0;url=collection.php">'; exit; } and use mysql_escape_string or mysql_real_escape_string mysql_query("INSERT into users VALUES('','".mysql_real_escape_string($_POST[username])."','".mysql_real_escape_string($_POST[password])."','$pic')"); 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.