Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyScoreDB{
- public function connectDB(){
- $host = 'localhost'; // Your MySQL Host
- $username = 'xxxx'; // Your MySQL Username
- $password = 'xxx'; // Your MySQL Pass
- $dbname = 'xxxx'; // Your MySQL DB
- mysql_connect($host, $username, $password) or die(mysql_error());
- mysql_select_db($dbname) or die(mysql_error());
- return 0;
- }
- public function insertScore($name,$score){
- $name = addslashes($name);
- mysql_query("INSERT INTO scores(name,score) VALUES ('".$name."','".$score."')") or die(mysql_error());
- return 0;
- }
- }
- $OS = new MyScoreDB();
- $OS->connectDB();
- if($_GET['sc'] == ""){
- $score = '0%';
- $name = 'Your';
- }else{
- $score = $_GET['sc'];
- $name = $UserName;
- $OS->insertScore($name,$score);
- };
Add Comment
Please, Sign In to add comment