Nothing happens

brandon0layton89

New Member
Messages
5
Reaction score
0
Points
0
For some reason nothing happens when I click the button. Nothing echos, all that happens is the page refreshes...
This is my php code:
Code:
class functions {
    public static function chooseGiftee($SS){
        echo "chooseGiftee function started...";
        $gifteeResults;
        $sqllink= mysql_connect($host,$user,$pass);
           if(!$sqllink){
               echo "Could not connect! Please Try Again";
            return mysql_error();
           } else {
            echo "Connected!";
            echo "Selecting Table... ";
            if(mysql_select_db("bplayton_ss")){
                echo "Selected the Table!";
                echo "Fetching row...";
                   $selectGiftee = "SELECT * FROM ss WHERE Gifter = '' ORDER BY RAND() LIMIT 10";
                   if($results = mysql_query($selectGiftee)){
                    echo "Fetched " .$results. " as the row!";
                    $gifteeResults = $results['Name'];
                    $addSS = "UPDATE ss SET Gifter = '$SS' WHERE Name = '$gifteeResults'";
                    echo "Updating Gifter...";
                if(mysql_query($addSS)){
                          echo "Updated Gifter!";
                       return $gifteeResults;
                    } else {
                        echo "Couldn't update Gifter! please try again.";
                        return "ERROR! TRY AGAIN";
                    }
                } else {
                    echo "error:";
                    echo mysql_error();
                    return "ERROR! TRY AGAIN!";
                }
            } else {
                echo "ERROR: " .mysql_error();
                return "ERROR! TRY AGAIN!";
            }
            mysql_close($sqllink);
        }
    }
}
if($_SERVER['REQUEST_METHOD'] == "POST"){
    $echoName = functions::chooseGiftee($_POST['gifterName']);
    echo "Get a gift for: " .$echoName. " and don't tell them ;)";
}

Hopefully its a stupid mistake that I made and someone can explain what is wrong.
Thanks,
Brandon
 

Livewire

Abuse Compliance Officer
Staff member
Messages
18,169
Reaction score
216
Points
63
You're gunna laugh I swear it.

#1: Change your mysql username/password ASAP, it's exposed in the code because:
#2: HTML doesn't process through the php engine, and the page is a .html page. Change the extension to .php and update your mysql username/pass since they're currently exposed :) What's happening is it's viewing it just like a txt file. The PHP code isn't actually -being- processed as php - it's going straight through as text.


Edit 2: Forgot to mention, there's nothing I can see wrong with the code, but I checked your account to see if the file was on there and to see if that would explain why it wasn't working. It did. :)
 
Last edited:

brandon0layton89

New Member
Messages
5
Reaction score
0
Points
0
I dont see the exposure for my password... :p
Ok, so just change to .php? simple fix i guess. haha
Thanks :)
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
Your password is exposed because if you put PHP code in .html files, it just outputs the code.

Therefore, your password is exposed.
 
Top