Jump to content

debugging new user script


PC Nerd

Recommended Posts

this is a script that validates a users input, from a previous page.  2 problems,

1.    the information is being sent as get ($_GET)  but the form says <form action = 'validation_form.php' action = 'post'>
2.    the form is continually displayed, even when the information is correct


the form is continually displayed through an include file.  if the previous data is wrong, then redisplay the form, which send to the same page checks then loops.

i cant seem to get the validation to work

[code]<html>

<head>
<link rel="stylesheet" type="text/css" href="B_A-CSS.css">
<title>New</title>
</head>

<body>

<?php


$Wrong = "NO";
$Form = "NO";

if($_POST['Email'] != $_POST['Re_Email']){$Wrong = "YES";}

foreach($_POST as $field){
    if(empty($field)){
        $Wrong = "YES";
    }
}

if($Empty = "YES"){
    $Form = "YES";
}
else{

    $Individual = "NO";

    while($Individual == "NO"){
        $Security_Number = rand(0, 9).rand(0, 9).rand(0, 9).rand(0, 9)." - ".rand(0, 9).rand(0, 9).rand(0, 9)." - ".rand(0, 9).rand(0, 9).rand(0, 9);

        $S_N_SQL = "SELECT Security_Number FROM Table_1 WHERE Security_Number = '".$Security_Number."'";

        include('inc files/Database link.inc');

        $Query = @mysql_query($S_N_Query, $DB_Server);
        if(!$Query){
            $Individual = "YES";
        }
    }

    setcookie("User_Name", "'".$_POST['User_Name']."'", strtotime(' + 1 day'));
    setcookie("Password", "'".$_POST['Password']."'", strtotime(' + 1 day'));
    setcookie("Email", "'".$_POST['Email']."'", strtotime(' + 1 day'));
    setcookie("Security_Code", "'".$Security_Number."'", strtotime(' + 1 day'));


    $mailaddress = "'".$_POST['Email']."'";
    $subject = "Confirmation Email";
    $message = "This email is to confirm your request to join.  This email is in html format.  If you would like a text version, please email us, EMAIL.  The following email, contains all of the information you entered when you signed up. <br>User Name: "."'".$_POST['User_Name']."'"."<br>Password: "."'".$_POST['Password']."'"."<br>You have 24 hours to activate your acount by logging in.  To activate your account, go to <a href = SITE NAME>this page</a>.  If you do not activate within 24 hours, you will need to re-enter your details and sign up again.  Goodluck with your playing.<br><br><br>Battle-Ages Staff";

    $header = "Signup Confirmation";
    $header . "From: EMAIL";

    mail($mailaddress,$subject,$message,$header);

}




echo "<table>";

echo "<thead>\n";
echo "<td class = \"left\">\n";
echo "<img src=\"Graphics\\Draft Logo.jpg\" alt=\"Logo\" width = \"50%\" hight = \"50%\">\n";
echo "</td>";

echo "<td class = \"centre\">\n";
echo "</td>";

echo "<td class = \"right\">\n";
echo "<img src=\"Graphics\\Draft Logo.jpg\" alt=\"Logo\" width = \"50%\" hight = \"50%\">\n";
echo " </td>";

echo "</thead>";

echo "<tbody>";

echo "<tr>";

echo "<td class = \"left\">\n";
echo "</td>";

echo "<td class = \"centre\">\n";
echo "<center><h1>New Player</h1></center>";

if($Form == "YES"){
echo "<p>You left one of the fields blank, or your emails did not match.  Please fill in the form again.</p>";
include("inc_files/B_A-New_Player.inc");
}
else{


    echo "<p>Every time you login, you will be required to use your User Name and your password.  In addition to this you need to fill in a sequrity section, just like the ine at the end of the previous page.  This helps to stop automated scripts playing th game for you.</p>";

echo "<p>To activate your account you must use the security number that is displayed below.  The security Number will be emailed to the address which you enter before, along wil your details (Username, Password etc.)</p>";


echo "<p>Your Security Number is: $Security_Number</p>";


echo "<br>";



echo "<p>Click Finish to submit the full form to us.  Your email will be sent within 24 hours.  After you recieve the email, login at the First Time Login page which has a link from the email.  To view that page, <a href=\"B_A-First Login.html\" alt=\"First time Login\">Click here</a>.</p>";

echo "<p>Click the Re-Start link to restart the New Player Form.  This will reset all information you have entered.</p>";


echo "<form action=\"B_A-New_Create.php\" action=\"POST\">";

    echo "<p><a href=\"B_A-New Player.html\" alt=\"Re-Start\">Start again</a></p>\n";
    echo "<p><input type=\"submit\" value=\"Finish\"></p>";

                echo "</form>";
}


echo "</td>";

echo "<td right = \"right\">\n";
echo "</td>";

echo "</tr>";
echo "</tbody>";
echo "</table>";


echo "</body>";

echo "</html>";[/code]


THIS IS THE INC FILE WHICH IS THE FORM

[code]<?php

echo "<form action='B_A-New_Player_Valid.php' action='post'>";

echo " <p>User Name: <input type='text' name='User Name'></p>";
echo " <p>Password: <input type='password' name='Password'></p>";
echo " <p>Re-Enter Password: <input type='password' name='Re_Password'></p>";

echo " <hr>";

echo " <p>Email: <input type='text' name='Email'></p>";
echo " <p>Re-Enter Email: <input type='text' name='Re_Email'></p>";

echo " <hr>";

echo " <P>Terms And Conditions: <input type='checkbox' name='terms and conditions'></p>";
echo " <P>Privacy Policy: <input type='checkbox' name='Privacy Policy'></p>";

echo " <p><input type = 'submit' value = 'submit'></p>";
echo " <p><input type = 'reset' value = 'reset'></p>";

echo "</form>";

?>[/code]


i dont need to include the other inc files, because i can tell that the error is in the loop.

all help is appreciated

P.S

please dont comment about any bad formating.  I am coppying from a page which reformats to a word wrap style look, but infact creates tabs and all sorts.  im trying to change it.  especially the loops may be a little messy. 
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.