Jump to content

[SOLVED] Help me please


FXC

Recommended Posts

 

Hi guys, sup?

I have this code:

 

<?php

require ("config.php");
$i=$_POST[submit];

if(isset($i))
{
$ruser=$_POST[rusername];
$rpass=$_POST[rpassword];
$regcode2=$_POST[regcode];

if($regcode==$regcode2)
{
require("connect.php");
$ruser = mysql_real_escape_string($ruser);
$rpass = mysql_real_escape_string($rpass);

mysql_query("INSERT INTO users (user,pass,uploads,downloads,rep) VALUES ('$ruser','$rpass',0,0,0)") or die(mysql_error());
echo ("Succes!");
}else{
sleep(2);
echo "Wrong register code! Try again or leave.";
}

}




?>
<style type="text/css">
<!--
.style2 {color: #990033}
-->
</style>


<form action="<?php echo htmlentities(strip_tags($_SERVER['SCRIPT_URL']));?>" method="post" name="form1" class="style2" id="form1">
  <pre><label>    Username:   <input name="username" type="text" id="rusername" maxlength="12" /> Max. 12 characters
    </label>Password:<label>   <input name="password" type="password" id="rpassword" maxlength="12" /> Max. 12 characters<br /></label>Registercode:   <label><input type="text" name="regcode" id="regcode" /> Contact the admin for the code
    </label>

             <label><input type="submit"  name="submit" id="submit" value="Register" />
    </label>
  </pre>
</form>



 

 

What I want it to do is:

 

Let the user choose a user name and password and then fill in a the regcode (just a pass so not everybody can register)

 

Then I want to check if the form is send and so yes check the register code, connect to mysql and anti sql the input then put the input in the database.

The problem is that the $ruser and $password are just empty in mysql and I can't seem to echo them. They just stay empty :| Where is it going wrong?

 

Please help me guys,

 

 

Thanks alot  ;D

 

 

 

Don't know of it mathers but this page is included by my index page like: index.php?p=register

Link to comment
Share on other sites

$i=$_POST[submit];

 

if(isset($i))

{

$ruser=$_POST[rusername];

$rpass=$_POST[rpassword];

$regcode2=$_POST[regcode];

 

Should be

 

$i=$_POST['submit'];

 

if(isset($i))

{

$ruser=$_POST['username'];

$rpass=$_POST['password'];

$regcode2=$_POST['regcode'];

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.