f14000 Posted June 25, 2011 Share Posted June 25, 2011 <form method="post" action="login.php" name="register"> <input type="submit" value="peGistrirai cE"/> </form> Quote Link to comment https://forums.phpfreaks.com/topic/240371-this-is-supposed-to-redirect-me-to-loginphp-right/ Share on other sites More sharing options...
ZulfadlyAshBurn Posted June 25, 2011 Share Posted June 25, 2011 Yes it should. are you trying to send data over unless you can use a simple hyperlink method. Quote Link to comment https://forums.phpfreaks.com/topic/240371-this-is-supposed-to-redirect-me-to-loginphp-right/#findComment-1234676 Share on other sites More sharing options...
f14000 Posted June 25, 2011 Author Share Posted June 25, 2011 Yes I am trying to send data (this is not the whole code), but when I click it , it just changes the link to : "register.php?(somestuffhere)" and does not redirect me, why is that? I need to be redirected upon clicking ! Quote Link to comment https://forums.phpfreaks.com/topic/240371-this-is-supposed-to-redirect-me-to-loginphp-right/#findComment-1234677 Share on other sites More sharing options...
ZulfadlyAshBurn Posted June 25, 2011 Share Posted June 25, 2011 can you post more code so that we are able to see more into the problem. please insert login.php so that if we can detect any prob there. Quote Link to comment https://forums.phpfreaks.com/topic/240371-this-is-supposed-to-redirect-me-to-loginphp-right/#findComment-1234678 Share on other sites More sharing options...
f14000 Posted June 25, 2011 Author Share Posted June 25, 2011 Register.php : <div align="center"></br></br></br></br></br></br></br></br> <form method="post" action="sendaccinfo.php" name="register"> <table> <tr> <td><strong><font color="#8A2BE2">noTrebitel:</font></strong></td><td><input type="text" name="username" maxlength="12"/></br></td> </tr> <tr> <td><strong><font color="#8A2BE2">naroLa:</font></strong></td><td> <input type="password" name="pass"/></br></font></td> </tr> <input name="userip" value="<? echo $_SERVER['REMOTE_ADDR']; ?>" type="hidden"/> <tr><td></td><td><div align="right"><input type="submit" value="peGistrirai cE"/></div></td></tr> </table> </form> </div> And here is the login.php which I renamed to sendaccinfo.php : <? $ip = $_POST['userip']; $username = $_POST['username']; $pass = $_POST['pass']; include 'condb.php'; $query = "SELECT ip FROM users WHERE ip='$ip'"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)){$match=true;} if (isset($match)){$msg="weche si se registriral!"; }else{$query = "INSERT INTO users (ip, username, password) VALUES('$ip', '$username', '$pass')"; mysql_query($query) or die(mysql_error()); $msg="Registrira se uspeshno!"; } echo "<div align='center'><font color='#8A2BE2'>$msg</font></div>"; mysql_close(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/240371-this-is-supposed-to-redirect-me-to-loginphp-right/#findComment-1234679 Share on other sites More sharing options...
ZulfadlyAshBurn Posted June 25, 2011 Share Posted June 25, 2011 are you hosting it locally or you are hosting is on a shared web server? Quote Link to comment https://forums.phpfreaks.com/topic/240371-this-is-supposed-to-redirect-me-to-loginphp-right/#findComment-1234683 Share on other sites More sharing options...
f14000 Posted June 25, 2011 Author Share Posted June 25, 2011 I am hosting it Locally Quote Link to comment https://forums.phpfreaks.com/topic/240371-this-is-supposed-to-redirect-me-to-loginphp-right/#findComment-1234685 Share on other sites More sharing options...
ZulfadlyAshBurn Posted June 25, 2011 Share Posted June 25, 2011 does it redirect you to sendaccinfo.php? i run the code on my local server and it seems to work. is your condb.php configured properly? Quote Link to comment https://forums.phpfreaks.com/topic/240371-this-is-supposed-to-redirect-me-to-loginphp-right/#findComment-1234686 Share on other sites More sharing options...
f14000 Posted June 25, 2011 Author Share Posted June 25, 2011 No it doesn't , but that's what I want , I want to redirect me to sendaccinfo.php and about the condb it's configured perfectly ! Quote Link to comment https://forums.phpfreaks.com/topic/240371-this-is-supposed-to-redirect-me-to-loginphp-right/#findComment-1234687 Share on other sites More sharing options...
ZulfadlyAshBurn Posted June 25, 2011 Share Posted June 25, 2011 your php script is not coded in correct terms. Â <? $ip = $_POST['userip']; $username = $_POST['username']; $pass = $_POST['pass']; include 'condb.php'; $query = "SELECT ip FROM users WHERE ip='$ip'"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)){$match=true;} if (isset($match)){$msg="weche si se registriral!"; }else{$query = "INSERT INTO users (ip, username, password) VALUES('$ip', '$username', '$pass')"; mysql_query($query) or die(mysql_error()); $msg="Registrira se uspeshno!"; } echo "<div align='center'><font color='#8A2BE2'>$msg</font></div>"; mysql_close(); ?> Â at the starting of the code change <? to <?php Quote Link to comment https://forums.phpfreaks.com/topic/240371-this-is-supposed-to-redirect-me-to-loginphp-right/#findComment-1234688 Share on other sites More sharing options...
ZulfadlyAshBurn Posted June 25, 2011 Share Posted June 25, 2011 try to use this script for your sendaccinfo.php  <?php // get all data from forms $ip = $_POST['userip']; $username = $_POST['username']; $pass = $_POST['pass']; // connect to db include 'condb.php'; // ask mysql $query = "SELECT ip FROM users WHERE ip='$ip'"; // get result from mysql $result = mysql_query($query); while($row = mysql_fetch_assoc($result)){ $match=true; } if (isset($match)){ $msg = "weche si se registriral!"; echo "<div align='center'><font color='#8A2BE2'>$msg</font></div>"; }else{$query = "INSERT INTO users (ip, username, password) VALUES('$ip', '$username', '$pass')"; mysql_query($query) or die(mysql_error()); $msg = "Registrira se uspeshno!"; echo "<div align='center'><font color='#8A2BE2'>$msg</font></div>"; } mysql_close(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/240371-this-is-supposed-to-redirect-me-to-loginphp-right/#findComment-1234690 Share on other sites More sharing options...
f14000 Posted June 25, 2011 Author Share Posted June 25, 2011 I did that but it's still not redirecting me from register.php to sendaccinfo.php ... Quote Link to comment https://forums.phpfreaks.com/topic/240371-this-is-supposed-to-redirect-me-to-loginphp-right/#findComment-1234691 Share on other sites More sharing options...
ZulfadlyAshBurn Posted June 25, 2011 Share Posted June 25, 2011 my local server is able to redirect the script. is the something wrong with your local server or full page script? Quote Link to comment https://forums.phpfreaks.com/topic/240371-this-is-supposed-to-redirect-me-to-loginphp-right/#findComment-1234692 Share on other sites More sharing options...
ZulfadlyAshBurn Posted June 25, 2011 Share Posted June 25, 2011 try creating a new page with only this codes  test.html <div align="center"></br></br></br></br></br></br></br></br> <form method="post" action="check.php" name="register"> <table> <tr> <td><strong><font color="#8A2BE2">noTrebitel:</font></strong></td><td><input type="text" name="username" maxlength="12"/></br></td> </tr> <tr> <td><strong><font color="#8A2BE2">naroLa:</font></strong></td><td> <input type="password" name="pass"/></br></font></td> </tr> <input name="userip" value="<? echo $_SERVER['REMOTE_ADDR']; ?>" type="hidden"/> <tr><td></td><td><div align="right"><input type="submit" value="peGistrirai cE"/></div></td></tr> </table> </form> </div>  check.php <?php $ip = $_POST['userip']; $username = $_POST['username']; $pass = $_POST['pass']; include 'condb.php'; $query = "SELECT ip FROM users WHERE ip='$ip'"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)){$match=true;} if (isset($match)){ $msg = "weche si se registriral!"; echo "<div align='center'><font color='#8A2BE2'>$msg</font></div>"; }else{$query = "INSERT INTO users (ip, username, password) VALUES('$ip', '$username', '$pass')"; mysql_query($query) or die(mysql_error()); $msg = "Registrira se uspeshno!"; echo "<div align='center'><font color='#8A2BE2'>$msg</font></div>"; } mysql_close(); ?>  if it works means there is something wrong with your server or your full page script. Quote Link to comment https://forums.phpfreaks.com/topic/240371-this-is-supposed-to-redirect-me-to-loginphp-right/#findComment-1234693 Share on other sites More sharing options...
f14000 Posted June 25, 2011 Author Share Posted June 25, 2011 OMG i tried to recreate the 2 files as you recommended and it worked, so, as you already said, I figured there's something wrong with the whole page script and I saw I had a non-closed form above >.< THANKS MAN! 8) Quote Link to comment https://forums.phpfreaks.com/topic/240371-this-is-supposed-to-redirect-me-to-loginphp-right/#findComment-1234695 Share on other sites More sharing options...
ZulfadlyAshBurn Posted June 25, 2011 Share Posted June 25, 2011 HAHA. no prob. Solving people's script is something i love to do I learn my mistakes from there too Quote Link to comment https://forums.phpfreaks.com/topic/240371-this-is-supposed-to-redirect-me-to-loginphp-right/#findComment-1234696 Share on other sites More sharing options...
ZulfadlyAshBurn Posted June 25, 2011 Share Posted June 25, 2011 please mark this topic as solved. it can be found at the bottom of the page . thanks Quote Link to comment https://forums.phpfreaks.com/topic/240371-this-is-supposed-to-redirect-me-to-loginphp-right/#findComment-1234700 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.