$dbhost = '122.102.52.12';
$dbuser = 'megaxus2';
$dbpass = '@p@4j4l4h';
$dbname = "facebookdb";
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db($dbname);
$id = $_GET[id];
$pilih = $_GET[pilih];
$tgl = $_GET['date'];
$token = $_GET['token'];
$cek = mysql_query("select count(IDFB) from jawabans where IDFB='$id' and tanggal='$tgl'",$conn);
$row = mysql_fetch_row($cek);
if($row[0] < 1)
{
mysql_query("insert into jawabans values('',$id,'$pilih','$tgl')",$conn);
$mes = urlencode("Baru saja mendapatkan CBT KEY SD Gundam Capsule Fighter Online, setiap orang yang mengaktivasi CBT KEY berkesempatan mendapatkan MI-Cash http://bit.ly/If8SMQ");
$ch = curl_init();
$url = "https://graph.facebook.com/me/feed?access_token=$token";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, 1); // set POST method
curl_setopt($ch, CURLOPT_POSTFIELDS, "message=$mes");
$data = curl_exec($ch);
curl_close($ch);
$dbhost1 = '122.102.52.14';
$dbuser1 = 'iseng';
$dbpass1 = 'm4uk3m@nAs1h';
$dbname1 = "megaxus_member";
$conn1 = mysql_connect($dbhost1, $dbuser1, $dbpass1) or die ('Error connecting to mysqsl');
mysql_select_db($dbname1);
function cbtKey()
{
$prefix = 'FB79';
$characters = array(
"A","B","C","D","E","F","G","H","J","K","M",
"N","P","R","S","T","X","Y","Z",
"1","2","3","4","5","6","7","8","9");
//make an "empty container" or array for our keys
$keys = array();
//first count of $keys is empty so "1", remaining count is 1-6 = total 7 times
while(count($keys) < 8) {
//"0" because we use this to FIND ARRAY KEYS which has a 0 value
//"-1" because were only concerned of number of keys which is 32 not 33
//count($characters) = 33
$x = mt_rand(0, count($characters)-1);
if(!in_array($x, $keys)) {
$keys[] = $x;
}
}
foreach($keys as $key){
$random_chars .= $characters[$key];
}
return $prefix.$random_chars;
}
$key = cbtKey();
mysql_query("insert into sdgo_cbt values('','2012-03-30 10:03:11','FBQuestion','$key',1,'','cbtquestion@megaxus.com','')",$conn1);
$key = str_split($key, 4);
echo "$key[0]" . " - " . $key[1] ." - " . "$key[2]
";
}
?>