Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- This Is To Call Username/Password -->
- <!--
- <form method="post" action="#" id="login">
- <input type="text" name="username" id="username" />
- <input type="password" name="password" id="password" />
- <input type="submit" value="Login" id="submit" />
- </form>
- -->
- <?php
- function main($formUse = true)
- {
- $link = mysql_connect('bondsolutionsnjcom.fatcowmysql.com', 'lightswitch', '*password*');
- if (!$link) {
- die('Could not connect: ' . mysql_error());
- }
- echo 'Connected successfully';
- mysql_select_db('red_light_life_accounts1');
- // This could be supplied by a user, for example
- $username = $_POST['username']; //Called By The Post, $_POST Is the Global variable to use
- $password = $_POST['password']; //Called By The Post, $_POST Is the Global variable to use
- $errors = array();
- if(isset($POST['submit'])){
- if(!$username){
- $errors[] = "Username Can Not Be Empty";
- }
- if(!$password){
- $errors[] = "Password Can Not Be Empty";
- }
- }
- $dothis = count($errors);
- if($dothis = 0){
- $SQL = "SELECT * FROM accounts WHERE username = '$username' & password = '$password'";
- $result_id = @mysql_query($SQL) or die("DATABASE ERROR!");
- $total = mysql_num_rows($result_id);
- if($total >= 1) {
- $datas = @mysql_fetch_array($result_id);
- $count = strlen($password);
- $count2 = strlen($datas['passwird']);
- if(!strcmp($count, $count2)) {
- echo "Success";
- } else {
- echo "Username or password is wrong.";
- }
- } else {
- echo "Data invalid - cant find username.";
- }
- }else{
- foreach($errors as $display){
- echo $display;
- }
- }
- }
- // Close mySQL Connection
- mysql_close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement