Script abi
Lehekülg 1, lehekülgi kokku 1 • Share
- DateNJuunior
- Liitus : 14/01/2013
Postitusi : 44
Tere. Ehk siis oleks vaja Counter-Strike SuperHero XP scripti nimelt Mängja XP laekub MySQL-i ja mul oleks vaja nii et kui keegi saadab sms-i enda nimega siis tuleb mängjal XP juurde. Tabelid mis MySQL sisaldab:
- Kood:
# Start: Create the databaseCREATE DATABASE IF NOT EXISTS SHeroDB;
USE SHeroDB;
GRANT SELECT ON `SHeroDB`.* TO SuperHeroModUser@localhost;
#----------------------------------------------------
# Start: Create the tables
#----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sh_savexp` (
`SH_KEY` varchar(32) binary NOT NULL default '',
`PLAYER_NAME` varchar(32) binary NOT NULL default '',
`LAST_PLAY_DATE` timestamp(14) NOT NULL,
`XP` int(10) NOT NULL default '0',
`HUDHELP` tinyint(3) unsigned NOT NULL default '1',
`SKILL_COUNT` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`SH_KEY`)
) TYPE=MyISAM COMMENT='SUPERHERO XP Saving Table';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER ON `sh_savexp` TO SuperHeroModUser@localhost;
CREATE TABLE IF NOT EXISTS `sh_saveskills` (
`SH_KEY` varchar(32) binary NOT NULL default '',
`SKILL_NUMBER` tinyint(3) unsigned NOT NULL default '0',
`HERO_NAME` varchar(25) NOT NULL default '',
PRIMARY KEY (`SH_KEY`,`SKILL_NUMBER`)
) TYPE=MyISAM COMMENT='SUPERHERO Skill Saving Table';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER ON `sh_saveskills` TO SuperHeroModUser@localhost;
FLUSH PRIVILEGES;
#----------------------------------------------------
# Stop
#----------------------------------------------------
- DateNJuunior
- Liitus : 14/01/2013
Postitusi : 44
Vajadulse saab ka phpmyadmin accessi
- Tonight
- Liitus : 19/02/2012
Postitusi : 18000
Sry, ei oska PHPga aidata
- Pilvik
- Liitus : 11/11/2012
Postitusi : 4409
Ei viitsi hetkel väga süveneda kuna 100 muud asja ootab tegemist, kuid see kästi ära teha.
Script peaks olema midagi sellist:
Script peaks olema midagi sellist:
- Kood:
<?php
mysql_connect('localhost', 'kasutajanimi', 'parool') or die('Ei saanud ühendust: ' . mysql_error());
mysql_select_db('andmebaas') or die('Ei saanud valida andmebaasi.');
//set true if you want to use script for billing reports
//first you need to enable them in your account
$billing_reports_enabled = false;
// check that the request comes from Fortumo server
if(!in_array($_SERVER['REMOTE_ADDR'],
array('81.20.151.38', '81.20.148.122', '79.125.125.1', '209.20.83.207' ))) {
die("Error: Unknown IP");
}
// check the signature
$secret = ''; // insert your secret between ''
if(!empty($secret) && !check_signature($_GET, $secret)) {
die("Error: Invalid signature");
}
$sender = $_GET['sender'];
$message = $_GET['message'];
// do something with $sender and $message
$reply = "Kasutajale $message on lisatud xp arv!";
// print out the reply
echo($reply);
//customize this according to your needs
if($billing_reports_enabled
&& preg_match("/Failed/i", $_GET['status'])
&& preg_match("/MT/i", $_GET['billing_type'])) {
// find message by $_GET['message_id'] and suspend it
}
mysql_query("UPDATE tabel SET xp=xp+summa WHERE mangija=\"$message\"");
function check_signature($params_array, $secret) {
ksort($params_array);
$str = '';
foreach ($params_array as $k=>$v) {
if($k != 'sig') {
$str .= "$k=$v";
}
}
$str .= $secret;
$signature = md5($str);
return ($params_array['sig'] == $signature);
}
?>
Soovid vestluses osaleda?
Selleks logi sisse või tee endale kasutaja.
Lehekülg 1, lehekülgi kokku 1
Permissions in this forum:
Sa ei saa vastata siinsetele teemadele