+ Reply to Thread
Results 1 to 5 of 5

Thread: Nothing happens

  1. #1
    brandon0layton89 is offline x10Hosting Member brandon0layton89 is an unknown quantity at this point
    Join Date
    Dec 2010
    Posts
    5

    Nothing happens

    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

  2. #2
    Livewire's Avatar
    Livewire is offline Abuse Compliance Officer Livewire is a glorious beacon of lightLivewire is a glorious beacon of light
    Join Date
    Jun 2005
    Location
    Behind a keyboard.
    Posts
    8,998

    Re: Nothing happens

    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 by Livewire; 12-17-2010 at 07:55 PM.


    TOS breakers will be suspended regardless of race, creed, national origin, hair color, or favorite food. Thanks for your understanding!

  3. #3
    brandon0layton89 is offline x10Hosting Member brandon0layton89 is an unknown quantity at this point
    Join Date
    Dec 2010
    Posts
    5

    Re: Nothing happens

    I dont see the exposure for my password... :P
    Ok, so just change to .php? simple fix i guess. haha
    Thanks

  4. #4
    leafypiggy's Avatar
    leafypiggy is offline Community Advocate leafypiggy is on a distinguished road
    Join Date
    Aug 2007
    Location
    Massachusetts
    Posts
    2,228

    Re: Nothing happens

    Your password is exposed because if you put PHP code in .html files, it just outputs the code.

    Therefore, your password is exposed.
    Neil Hanlon | x10Hosting Support Representative
    Neil[at]x10hosting.com
    █ I'm always happy to help. Just ask a question in Free Hosting
    Terms of Service IRC

  5. #5
    brandon0layton89 is offline x10Hosting Member brandon0layton89 is an unknown quantity at this point
    Join Date
    Dec 2010
    Posts
    5

    Re: Nothing happens

    Oh, ok that makes sense.
    Thanks for all of your help guys

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers