Api System Problem

Bazinga

Posting Freak
Aug 3, 2010
819
54
Hello, well I'm having a problem with rewarding the users with credits, I've added the right codes and the variables work so I don't know why the codes won't work
PHP:
<?php
//////////////////////////////////////////////////////////////
// # TheHabbos Topsites API Script - Release 1.0.0 (BETA 1) //
// # (C) Copyright TheHabbos 2010. All rights reserved.     //
//////////////////////////////////////////////////////////////

/* SCRIPT CONFIG */

@include('./_inc/core.php');
if($userCredentials['name']=='')
    {
        @header('location: '.$My_Path);
        exit;
    }
$TheHabbos_User = 'cloudhabbo';
$Credits_Reward = '50';
$USERNAME = $userCredentials['name'];
?>
<head>
<?php @include('./_inc/information.php'); ?>

    <title>CloudHabbo: Thank you for voting!</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <link rel="shortcut icon" href="<?php echo $My_Path; ?>images/favicon.ico" type="image/vnd.microsoft.icon" />
    <style>
        @import "<?php echo $My_Path; ?>_inc/style.css";
    </style>
</head>
<table id="overview_overlay" align="center">
            <tr id="overview_verticaltop">
                <td>
                    <div id="overview_overlay_1">
<?php
/* VALIDATION SCRIPT */

ob_start();
$handle = fopen('http://api.thehabbos.org/validate.php?user='.$TheHabbos_User.'&ip='.$_SERVER['REMOTE_ADDR'], 'r');
if(!$handle) {
  echo 'TheHabbos seems to be having connection issues. :(';
}else{
  $validateCode = stream_get_contents($handle);
  fclose($handle);
  
  if($validateCode == 1) {
    //what happens if someone does successfully vote
    mysql_query("
    UPDATE 'users'
    SET 'credits' = 'credits' + '".$Credits_Reward."'
    WHERE 'name' = '".$USERNAME."'");
    ?>
    <h1 style="color: green;">Success!</h1><br />
    You have successfully voted and recieved 50 credits!<br />
    <br />
    <a href="/">Return to cloud</a>
    <?php
  }else{
    //what happens if someone doesn't successfully vote
    ?>
    <h1 style="color: red;">Oh no, something went wrong!</h1><br />
    It appears that you have already voted today so you will recieve no credits.<br />
    <br />
    <a href="/">Return to cloud</a>
    <?php
  }
}
?>
                </td>
            </tr>
        </table>

All looks fine to me but upon voting successfully no credits are given, any suggestions?
Edit:
Core is included
Variables; all echoed out so they work..

Still doesn't work :S
 

Jonty

Active Member
Aug 7, 2010
194
65
Link them to vote_button.php, get them to click the button and then they can vote and it will redirect them to the hotel client.
 

Bazinga

Posting Freak
Aug 3, 2010
819
54
Lol, I'm not talking about that, TheHabbos new api system is what I'm on about, anyone else care to offer a suggestion..?
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,194
3,901
Yeah, they has to click the vote_button.php to validate it, I just added the vote_button.php too my generic column.
 

Bazinga

Posting Freak
Aug 3, 2010
819
54
Look, the voting works everything works, it goes back to api.php and says success etc the only thing that doesn't work is the MySQL Query..

I'm using this;
Code:
<form action="http://thehabbos.org/topsites/vote/cloudhabbo" method="post">
<input type="hidden" name="api_url" value="http://cloudhabbo.net/api" /><input style="width: 120px; height: 40px; 

background-image: url('http://thehabbos.org/topsites/button.php'); border: 0px; cursor: pointer;" type="submit" 

name="votingAPI" value="" />
</form>
 
Nov 23, 2010
307
2
There is no mysql connect or db select ?

PHP:
$USERNAME = $userCredentials['name']; // that won't specific username that has logged in!
/* Fix: (phpretro) */
$USERNAME = $user->name;
/* Fix: (uber) */
$USERNAME = %name%; // on some edits username is %username% , so change if that dont work!

If you get mysql connect and fix username that shud work.
 

Kryptos

prjRev.com
Jul 21, 2010
2,205
1,252
Actually userCredentials['name'] is okay, he's using a different CMS that is not phpretro or uberCMS.



You didn't include the core.
That should fix it.
 

Users who are viewing this thread

Top