Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- index.php -
- <html>
- <form action="add.php">
- </table><input type="submit"/>
- </form>
- <table border="1">
- <tr>
- <th>Website</th>
- <th>PayPal Email</th>
- <th>Username</th>
- <th>Paid Amount</th>
- </tr>
- <tr>
- <td></td>
- <td></td>
- <td></td>
- <td></td>
- </tr>
- </html>
- --------------------------------------------------------------
- add.php -
- <html>
- <body>
- <form name="add" method="post" action="confirm.php">
- Username:<input type="text" name="username"/><br/>
- Password:<input type="password" name="password"/><br/>
- Email:<input type="text" name="email"/><br/>
- Website:<input type="text" name="website"/><br/>
- Paid Amount:<input type="text" name="paid"/><br/>
- <input type="submit" name="submit"/>
- </form>
- </body>
- </html>
- --------------------------------------------------------------
- config.php -
- <?php
- //Variables
- $host = "localhost";
- $username = "root";
- $password = "";
- $db_name = "list";
- //connection
- mysql_connect("$host", "$username", "$password")or die("<b>CONNECTION ERROR: </b>".mysql_error());
- mysql_select_db("$db_name")or die("Cannot select DB!");
- ?>
- --------------------------------------------------------------
- Confirm.php
- <?php
- include('config.php');
- $testname = $_POST['username'];
- //Test
- if(explode("([^A-Za-z0-9])", $testname)){
- //test for duplicate names
- $query = "SELECT * FROM info WHERE username = ".$_POST['username'];
- $result = mysql_query($query);
- $num = mysql_num_rows($result);
- if($num == 0) {
- $query = "SE
- } else {
- echo "Name in use!";
- } else {
- echo "Invalid name!";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement