Jump to content

Blank..?


Cless

Recommended Posts

Hello. I have this registration script... but for some odd reason, it doesn't submit. It just shows a blank submit when you click the submit button. Any ideas why?

 

<? include "top.php" ?>
<? 
include "connect.php";
$errors=-1;
if (isset($_POST['submit']))
{
$errors=0;
if ($_SESSION['formpage'] != $_SERVER["HTTP_REFERER"]){echo"You cannot submit the form via another server!"); $errors=1; exit;}
// check if the whole form is filled in
if (!$_POST['username'] || !$_POST['password'] || !$_POST['passwordrepeat'] || !$_POST['email'] || !$_POST['starter'])
{
echo "You did not fill up the entire Sign-Up form."; $errors=1; exit;
}
// name check
if (sqlrows(mysql_query("SELECT id FROM users WHERE username='$_POST[username]'")) != 0) {
echo "Sorry, the username $_POST[username] has already been taken. Please try another username.";$errors=1; exit;
}
// password repeat check
if ($_POST['password'] != $_POST['passwordrepeat']){echo "The 2nd password you provided does not match the first."; $errors=1; exit;}
}
if ($errors == 0)
{
$regdate = date('d/m/Y');
mysql_query("INSERT INTO users (username,password,email,regdate,gender,money) VALUES ('$username','$password','$email','$regdate','$gender','3000')","Cannot insert user data");
$getid = mysql_query("SELECT * FROM users WHERE username='$username'") or die("Could not get id because ".mysql_error());
$getid2=mysql_fetch_array($getid);
$newuserid=$getid2['id'];
$totalexp=getexp('5');
$totalexpneeded=$totalexp + 125;
$iv=rand(0,31);
$pokedata=mysql_fetch_array(mysql_query("SELECT * FROM pokedex WHERE pokemon='$starter'"));
$insertpokedata = "INSERT INTO pokemon (species,pokemon,trainer,level,exp,expneeded,slot,iv,happiness) VALUES ('$starter','$starter','$newuserid','5','$totalexp','$totalexpneeded','1','$iv','$pokedata[basehappiness]')";
mysql_query($insertpokedata) or die("Could not insert starter data because ".mysql_error());
// print a success message
echo "<b>Registration Complete</b><p>Please check your email for account validation.";
}
else
{
$_SESSION['formpage']=$_SERVER['PHP_SELF'];
?>
<b>Register</b><p>
<form action="register.php" method="POST">
<table>
<tr><td>Desired Username:</td><td><input type="text" name="username" maxlength="40"></td></tr>
<tr><td>Desired Password:</td><td><input type="password" name="password" maxlength="50"></td></tr>
<tr><td>Repeat Password:</td><td><input type="password" name="passwordrepeat" maxlength="50"></td></tr>
<tr><td>Email Address:</td><td><input type="text" name="email" maxlength="200"></td></tr>
<tr><td>Gender:</td><td><select name=gender><option value="Male">Male</option><option value="Female">Female</option></select></td></tr>
<tr><td>Desired Starter Pokemon:</td><td><select name=starter><option value="Bulbasaur">Bulbasaur</option><option value="Charmander">Charmander</option><option value="Squirtle">Squirtle</option><option value="Chikorita">Chikorita</option><option value="Cyndaquil">Cyndaquil</option><option value="Totodile">Totodile</option><option value="Treecko">Treecko</option><option value="Torchic">Torchic</option><option value="Mudkip">Mudkip</option></select></td></tr>
<tr><td colspan="2" align=middle><br><br><input type="submit" name="submit" value="Register"></td></tr>
</table>
</form>
<?
}
?> 
<? include "bottom.php" ?>

 

Thanks.

 

If you need more information, just ask.

Link to comment
Share on other sites

Try this:

 

<?php
include "top.php"
include "connect.php";

$errors=-1;
if (isset($_POST['submit'])) {
    $errors=0;
    if ($_SESSION['formpage'] != $_SERVER["HTTP_REFERER"]) {
        echo"You cannot submit the form via another server!");
        $errors=1;
        exit;
    }
    // check if the whole form is filled in
    if (!$_POST['username'] || !$_POST['password'] || !$_POST['passwordrepeat'] || !$_POST['email'] || !$_POST['starter']) {
        echo "You did not fill up the entire Sign-Up form.";
        $errors=1;
        exit;
    }
    // name check
    if (sqlrows(mysql_query("SELECT id FROM users WHERE username='$_POST[username]'")) != 0) {
        echo "Sorry, the username $_POST[username] has already been taken. Please try another username.";
        $errors=1;
        exit;
    }
    // password repeat check
    if ($_POST['password'] != $_POST['passwordrepeat']) {
        echo "The 2nd password you provided does not match the first.";
        $errors=1;
        exit;
    }
    
    
    
    if ($errors == 0) {
        $regdate = date('d/m/Y');
        mysql_query("INSERT INTO users (username,password,email,regdate,gender,money) VALUES ('$username','$password','$email','$regdate','$gender','3000')","Cannot insert user data");
        $getid = mysql_query("SELECT * FROM users WHERE username='$username'") or die("Could not get id because ".mysql_error());
        $getid2=mysql_fetch_array($getid);
        $newuserid=$getid2['id'];
        $totalexp=getexp('5');
        $totalexpneeded=$totalexp + 125;
        $iv=rand(0,31);
        $pokedata=mysql_fetch_array(mysql_query("SELECT * FROM pokedex WHERE pokemon='$starter'"));
        $insertpokedata = "INSERT INTO pokemon(species,pokemon,trainer,level,exp,expneeded,slot,iv,happiness) VALUES('$starter','$starter','$newuserid','5','$totalexp','$totalexpneeded','1','$iv','$pokedata[basehappiness]')";
        mysql_query($insertpokedata) or die("Could not insert starter data because ".mysql_error());
        // print a success message
        echo "<b>Registration Complete</b><p>Please check your email for account validation.";
    }
} else {
    $_SESSION['formpage']=$_SERVER['PHP_SELF'];
    ?>
    <b>Register</b><p>
    <form action="register.php" method="POST">
    <table>
    <tr><td>Desired Username:</td><td><input type="text" name="username" maxlength="40"></td></tr>
    <tr><td>Desired Password:</td><td><input type="password" name="password" maxlength="50"></td></tr>
    <tr><td>Repeat Password:</td><td><input type="password" name="passwordrepeat" maxlength="50"></td></tr>
    <tr><td>Email Address:</td><td><input type="text" name="email" maxlength="200"></td></tr>
    <tr><td>Gender:</td><td><select name=gender><option value="Male">Male</option><option value="Female">Female</option></select></td></tr>
    <tr><td>Desired Starter Pokemon:</td><td><select name=starter><option value="Bulbasaur">Bulbasaur</option><option value="Charmander">Charmander</option><option value="Squirtle">Squirtle</option><option value="Chikorita">Chikorita</option><option value="Cyndaquil">Cyndaquil</option><option value="Totodile">Totodile</option><option value="Treecko">Treecko</option><option value="Torchic">Torchic</option><option value="Mudkip">Mudkip</option></select></td></tr>
    <tr><td colspan="2" align=middle><br><br><input type="submit" name="submit" value="Register"></td></tr>
    </table>
    </form>
    
    <?php
}

include "bottom.php"
?>

Link to comment
Share on other sites

<?php
include "top.php"
include "connect.php";

$errors=-1;
if (isset($_POST['submit'])) {
    $errors=0;
    if ($_SESSION['formpage'] != $_SERVER["HTTP_REFERER"]) {
        echo"You cannot submit the form via another server!");
        $errors=1;
        exit;
    }
    // check if the whole form is filled in
    if (!$_POST['username'] || !$_POST['password'] || !$_POST['passwordrepeat'] || !$_POST['email'] || !$_POST['starter']) {
        echo "You did not fill up the entire Sign-Up form.";
        $errors=1;
        exit;
    }
    // name check
    if (sqlrows(mysql_query("SELECT id FROM users WHERE username='$_POST[username]'")) != 0) {
        echo "Sorry, the username $_POST[username] has already been taken. Please try another username.";
        $errors=1;
        exit;
    }
    // password repeat check
    if ($_POST['password'] != $_POST['passwordrepeat']) {
        echo "The 2nd password you provided does not match the first.";
        $errors=1;
        exit;
    }

    echo "Do you see this?";
    
    
    
    if ($errors == 0) {
        $regdate = date('d/m/Y');
        mysql_query("INSERT INTO users (username,password,email,regdate,gender,money) VALUES ('$username','$password','$email','$regdate','$gender','3000')","Cannot insert user data");
        $getid = mysql_query("SELECT * FROM users WHERE username='$username'") or die("Could not get id because ".mysql_error());
        $getid2=mysql_fetch_array($getid);
        $newuserid=$getid2['id'];
        $totalexp=getexp('5');
        $totalexpneeded=$totalexp + 125;
        $iv=rand(0,31);
        $pokedata=mysql_fetch_array(mysql_query("SELECT * FROM pokedex WHERE pokemon='$starter'"));
        $insertpokedata = "INSERT INTO pokemon(species,pokemon,trainer,level,exp,expneeded,slot,iv,happiness) VALUES('$starter','$starter','$newuserid','5','$totalexp','$totalexpneeded','1','$iv','$pokedata[basehappiness]')";
        mysql_query($insertpokedata) or die("Could not insert starter data because ".mysql_error());
        // print a success message
        echo "<b>Registration Complete</b><p>Please check your email for account validation.";
    }
} else {
    $_SESSION['formpage']=$_SERVER['PHP_SELF'];
    ?>
    <b>Register</b><p>
    <form action="register.php" method="POST">
    <table>
    <tr><td>Desired Username:</td><td><input type="text" name="username" maxlength="40"></td></tr>
    <tr><td>Desired Password:</td><td><input type="password" name="password" maxlength="50"></td></tr>
    <tr><td>Repeat Password:</td><td><input type="password" name="passwordrepeat" maxlength="50"></td></tr>
    <tr><td>Email Address:</td><td><input type="text" name="email" maxlength="200"></td></tr>
    <tr><td>Gender:</td><td><select name=gender><option value="Male">Male</option><option value="Female">Female</option></select></td></tr>
    <tr><td>Desired Starter Pokemon:</td><td><select name=starter><option value="Bulbasaur">Bulbasaur</option><option value="Charmander">Charmander</option><option value="Squirtle">Squirtle</option><option value="Chikorita">Chikorita</option><option value="Cyndaquil">Cyndaquil</option><option value="Totodile">Totodile</option><option value="Treecko">Treecko</option><option value="Torchic">Torchic</option><option value="Mudkip">Mudkip</option></select></td></tr>
    <tr><td colspan="2" align=middle><br><br><input type="submit" name="submit" value="Register"></td></tr>
    </table>
    </form>
    
    <?php
}

include "bottom.php"
?>

 

See if that shows anything.

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.