Hallo,

Ik heb een register page waarbij hij alleen het 'account' opslaat.

Ik wil echter het paswoord en phrase ergens anders opslaan.
Dit is de register.php: http://pastebin.com/f27853bda

Ik heb al geprobeerd bij het einde deze regel toe te voegen:

$register = mysql_query("INSERT INTO usercp (account, password, phrase) VALUES ('$username', '$password', '$phrase')");


Dus dan krijg je:

$register = mysql_query("INSERT INTO accounts (AccountID, LogonType) VALUES ('$username', '2')");

$register = mysql_query("INSERT INTO usercp (account, password, phrase) VALUES ('$username', '$password', '$phrase')");
	
if($register) { echo 'Registration Complete.'; } else { 'Registration failed.';


Maar dit werkte niet.


Iemand andere ideeën?

Greetz,
Mitch Mertz




Zet dit bovenin je script.
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);

// rest
?>
Als ik op register klik dan maakt hij een account aan, zonder iets in te voeren in 'usercp'.

Dus dit werkt niet:

$register = mysql_query("INSERT INTO usercp (account, password, phrase) VALUES ('$username', '$password', '$phrase')");


<?php 
error_reporting(E_ALL); 
ini_set("display_errors", 1); 

// rest
?> 


Hij laat de echo van Registration Complete ook niet meer zien of failed.
Waarschijnlijk gaat je query fout, maar dat zal je nooit te weten komen omdat je die fouten niet afvangt.

Je zal daar iets mee moeten, meest simpele:

<?php
    $result = mysql_query("...") or die(mysql_error());
?>
Werkt nu.
Bedankt voor het helpen iedereen.



<?php 
error_reporting(E_ALL); 
ini_set("display_errors", 1); 
?>
<div align="center">Welcome to our server! Please register below.<br />
  <br />
</div><form action="?op=register" method="post">
<table width="308" border="0" align="center">
  <tr>
    <td width="102">&nbsp;</td>
    <td width="190">&nbsp;</td>
  </tr>
  <tr>
    <td>Username:</td>
    <td><label>
      <input type="text" name="user" id="user">
    </label></td>
  </tr>
  <tr>
    <td>Password:</td>
    <td><label>
    <input type="password" name="pass" id="pass">
    </label></td>
  </tr>
  <tr>
    <td>Secret Phrase:</td>
    <td><label>
    <input type="password" name="phrase" id="phrase">
    </label></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="submit" name="register" id="register" value="Submit" /></td>
  </tr>
</table>
</form>
<p>&nbsp;</p>
<?php if(isset($_POST['register'])) {

$username = $_POST['user'];
$password = $_POST['pass'];
$prhase = $_POST['phrase'];
	 
	 # Check the username
	 
	 $check = mysql_query("SELECT * FROM accounts WHERE AccountID = '$username'");
     $check2 = mysql_num_rows($check);
     if($check2 != '0') {
     die("Account name is already in use.");
     }
	 
	 # If username is not in use, then insert the data.
	 
	 $register = mysql_query("INSERT INTO accounts (AccountID, LogonType) VALUES ('$username', '2')");
	 $register1 = mysql_query("INSERT INTO usercp (account, password, phrase) VALUES ('$username', '$password', '$phrase')");
	 if($register) { echo 'Registration Complete.'; } else { 'Registration failed.';	 
	 if($register1) { echo 'Registration Complete.'; } else { 'Registration failed.';	 

}
}
}
	 
?>

Reageren