2 Replies - 3820 Views - Last Post: 29 July 2010 - 07:18 PM Rate Topic: -----

#1 Longblob   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 12-December 09

How To Create Database Table For This Source Code

Posted 28 July 2010 - 08:39 PM

Hi all,

I was download Dragon Knight text based game source code here it is the link:http://dragon.Se7enet.Com/dev.php

first problem i don't know how to make a database table for this game because there is no SQL extension file available in source code.i just see many php function but none of them are html form.

this is index.php script :

<?php // index.php :: Primary program script, evil alien overlord, you decide.

if (file_exists('install.php')) { die("Please delete <b>install.php</b> from your Dragon Knight directory before continuing."); }
include('lib.php');
include('cookies.php');
$link = opendb();
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");//->>THIS I DONT KNOW TO,I DONT FAMILIAR WITH doquery function
$controlrow = mysql_fetch_array($controlquery);

// Login (or verify) if not logged in.
$userrow = checkcookies();
if ($userrow == false) { 
    if (isset($_GET["do"])) {
        if ($_GET["do"] == "verify") { header("Location: users.php?do=verify"); die(); }
    }
    header("Location: login.php?do=login"); die(); 
}
// Close game.
if ($controlrow["gameopen"] == 0) { display("The game is currently closed for maintanence. Please check back later.","Game Closed"); die(); }
// Force verify if the user isn't verified yet.
if ($controlrow["verifyemail"] == 1 && $userrow["verify"] != 1) { header("Location: users.php?do=verify"); die(); }
// Block user if he/she has been banned.
if ($userrow["authlevel"] == 2) { die("Your account has been blocked. Please try back later."); }

if (isset($_GET["do"])) {
    $do = explode(":",$_GET["do"]);
    
    // Town functions.
    if ($do[0] == "inn") { include('towns.php'); inn(); }
    elseif ($do[0] == "buy") { include('towns.php'); buy(); }
    elseif ($do[0] == "buy2") { include('towns.php'); buy2($do[1]); }
    elseif ($do[0] == "buy3") { include('towns.php'); buy3($do[1]); }
    elseif ($do[0] == "sell") { include('towns.php'); sell(); }
    elseif ($do[0] == "maps") { include('towns.php'); maps(); }
    elseif ($do[0] == "maps2") { include('towns.php'); maps2($do[1]); }
    elseif ($do[0] == "maps3") { include('towns.php'); maps3($do[1]); }
    elseif ($do[0] == "gotown") { include('towns.php'); travelto($do[1]); }
    
    // Exploring functions.
    elseif ($do[0] == "move") { include('explore.php'); move(); }
    
    // Fighting functions.
    elseif ($do[0] == "fight") { include('fight.php'); fight(); }
    elseif ($do[0] == "victory") { include('fight.php'); victory(); }
    elseif ($do[0] == "drop") { include('fight.php'); drop(); }
    elseif ($do[0] == "dead") { include('fight.php'); dead(); }
    
    // Misc functions.
    elseif ($do[0] == "verify") { header("Location: users.php?do=verify"); die(); }
    elseif ($do[0] == "spell") { include('heal.php'); healspells($do[1]); }
    elseif ($do[0] == "showchar") { showchar(); }
    elseif ($do[0] == "onlinechar") { onlinechar($do[1]); }
    elseif ($do[0] == "showmap") { showmap(); }
    elseif ($do[0] == "babblebox") { babblebox(); }
    elseif ($do[0] == "ninja") { ninja(); }
    
} else { donothing(); }

function donothing() {
    
    global $userrow;

    if ($userrow["currentaction"] == "In Town") {
        $page = dotown();
        $title = "In Town";
    } elseif ($userrow["currentaction"] == "Exploring") {
        $page = doexplore();
        $title = "Exploring";
    } elseif ($userrow["currentaction"] == "Fighting")  {
        $page = dofight();
        $title = "Fighting";
    }
    
    display($page, $title);
    
}


Honestly i am newbie for source code things.i know some little php programming but this is my first experience to modify a raw source code.please master i need your guide to fix the database for this source code :helpsmilie:

Thank You

Is This A Good Question/Topic? 0
  • +

Replies To: How To Create Database Table For This Source Code

#2 Atli   User is offline

  • Enhance Your Calm
  • member icon

Reputation: 4241
  • View blog
  • Posts: 7,216
  • Joined: 08-June 10

Re: How To Create Database Table For This Source Code

Posted 29 July 2010 - 03:05 AM

The install.php file included in that package includes all the table definitions for that game. You should run that file in your browser to set it up.
Was This Post Helpful? 0
  • +
  • -

#3 Longblob   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 12-December 09

Re: How To Create Database Table For This Source Code

Posted 29 July 2010 - 07:18 PM

this is the install instructions :
1. Create a new database for Dragon Knight to use, if you don't already have one set up.
2. Edit 'config.php' to include the correct values for your database setup.
3. Upload the contents of the Dragon Knight folder to your site.
4. In your browser, run 'install.php' and follow the instructions.
5. After completing installation, delete 'install.php' from your Dragon Knight directory for security.
6. Enjoy the game.

In number 2 i have edit config.php like this :

<?php // config.php :: Low-level app/database variables.

$dbsettings = Array(
        "server"        => "localhost",     //MySQL server name. (Default: localhost)
        "user"          => "root",              // MySQL username.
        "pass"          => "",              // MySQL password.
        "name"          => "dragonknight",              // MySQL database name.
        "prefix"        => "dk",            // Prefix for table names. (Default: dk)
        "secretword"    => "");             // Secret word used when hashing information for cookies.

?>


i have test it in my wampserver and failed to include correct value for prefix for table names,the output is error :

"Table dk_doesn't exist"

i don't know to include the prefix value in config.php,please help me
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1