• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

xCMS

Status
Not open for further replies.
Try this one..
PHP:
<?
/*
     Author: Oceanic
    Product Name: xCMS
    Purpose: To easy manage Opentibia servers, and to be a good CMS

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

session_start();
include "config.php";
error_reporting($error_reporting);
mysql_connect($connection[1], $connection[2], $connection[3]) or die("Could not connect, please check your settings");
mysql_select_db($connection[4]) or die("Database dont exist");

////////////////////////////////////
//    Search player
////////////////////////////////////

if(!empty($_POST["search_name"])){
    
    $name = mysql_escape_string($_POST["search_name"]);
    $player_check = mysql_query("SELECT * FROM players WHERE name='$name'") or die(mysql_error());
        if (mysql_num_rows($player_check) == 0){
        $player_dont_exist = "<p>Player dont exist</p>\n";
        }else{
        header("Location: ?page=Search&name=".preg_replace("/".chr(32)."/", "_", $_POST["search_name"]));
        }
}

////////////////////////////////////
//    Login
////////////////////////////////////

if(!empty($_POST["login_number"]) && !empty($_POST["login_password"])){
    
    $account_number = mysql_escape_string($_POST["login_number"]);
        if($use_md5 == true){
        $account_passoword = mysql_escape_string($_POST["login_password"]);
        $account_passoword = md5($account_passoword);
        }else{
        $account_passoword = mysql_escape_string($_POST["login_password"]);
        }
    

    
    if(!empty($_COOKIE["name"]) && !empty($_COOKIE["password"]) && $_POST["remember"] != true){
    setcookie("name","");
    setcookie("password","");
    }
    

    $get_account_data = mysql_query("SELECT * FROM accounts WHERE id='$account_number'") or die(mysql_error());
    
    if (mysql_num_rows($get_account_data) != 0){
        $data = mysql_fetch_array( $get_account_data );

        if($account_number == $data['id'] && $account_passoword == $data['password']){
            if($data['group_id'] > 1){
            $_SESSION["logged_in"] = 1;
            $_SESSION["admin"] = 1;
            $_SESSION["account_number"] = $account_number;
            
            }else{
            $_SESSION["logged_in"] = 1;
            $_SESSION["account_number"] = $account_number;
            }
            if($_POST["remember"] == true){
            setcookie("name",md5($account_number));
            setcookie("password",md5($account_passoword));
            }
            header("Location: ?page=Account");
        }else{
            $wrong_password = "<p>Wrong password</p>\n";
        }
    }else{
    $account_dont_exist = "<p>Account dont exist</p>\n";
    }
}



echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
//Head
echo "<head>\n";
echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\"/>\n";
echo "<meta name=\"description\" content=\"\"/>\n";
echo "<meta name=\"keywords\" content=\"\"/> \n";
echo "<meta name=\"author\" content=\"Oceanic\"/> \n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"skinsstyle.css\" media=\"screen\"/>\n";
echo "<title>".$title."</title>\n";
echo "</head>\n";

echo "<body>\n";
echo "<div id=\"wrapper\">\n";
echo "<div id=\"container\">\n";

echo "<div class=\"title\">\n";
    
echo "    <h1><a href=\"index.php\">".$title."</a></h1>\n";

echo "</div>\n";

echo "<div class=\"header\"></div>\n";

//Menu
echo "<div class=\"navigation\">\n";
echo "<a href=\"?page=Home\">Home</a>\n";
    if($_SESSION["logged_in"] == 1){
    echo "<a href=\"?page=Account\">Account</a>\n";
        if($_SESSION["admin"] == 1){
        echo "<a href=\"?page=Admin\">Admin</a>\n";
        }
    }else{
    echo "<a href=\"?page=Login\">Login</a>\n";
    }
    
echo "<a href=\"?page=Search\">Search</a>\n";
echo "<a href=\"?page=Highscore\">Highscore</a>\n";
echo "    <div class=\"clearer\"></div>\n";
echo "</div>\n";

//Main
echo "<div class=\"main\">\n";

echo "    <div class=\"content\">\n";
switch($_GET["page"]){

default:
    include "bin/news.php";
break;

case "Home":
    include "bin/news.php";    
break;

case "Comments":
    include "bin/comments.php";
break;


case "Admin":
    include "bin/admin.php";
break;

case "Login":
    include "bin/login.php";
break;

case "Register":
    include "bin/register.php";
break;

case "Search":
    include "bin/search.php";
break;

case "Highscore":
    include "bin/highscore.php";    
break;

case "Account":
    include "bin/account.php";
break;

case "Logout":
    session_destroy();
    echo "<h3>Logout</h3>\n";
    echo "<h3>You was logged out, <a href=\"?page=Home\">Click here to go back</a></h3>\n";
break;

case "Recover":
    include "bin/recover.php";
break;

}
echo "    </div>\n";


echo "    <div class=\"bottom\">\n";
echo "    <div class=\"clearer\"></div>\n";
echo "</div>\n";

//Footer
echo "    <div class=\"footer\">\n";
echo "    <div class=\"left\">\n";
echo "    Copyright &copy; 2008 <a href=\"http://kammarfelt.eu\">Oceanic</a>\n";
echo "    </div>\n";
echo "        <div class=\"right\">\n";
echo "            Website template based on by <a href=\"http://arcsin.se\">Arcsin</a>\n";
echo "        </div>\n";
echo "        <div class=\"clearer\"></div>\n";
echo "    </div>\n";
echo "</div>\n";

echo "</div>\n";
echo "</div>\n";

echo "</body>\n";
echo "</html>\n";
?>
 
owkay :S now i get this:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Users\gebruiker\Desktop\forgottenserver\Xammp\xampp\htdocs\index.php:1) in C:\Users\gebruiker\Desktop\forgottenserver\Xammp\xampp\htdocs\index.php on line 21
Oceanic CMS
Home Login Search Highscore
Table 'forgottenserver.xcms_news' doesn't exist
 
You need to install the SQL tables, also try this:

PHP:
<?
session_start();
/*
     Author: Oceanic
    Product Name: xCMS
    Purpose: To easy manage Opentibia servers, and to be a good CMS

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

include "config.php";
error_reporting($error_reporting);
mysql_connect($connection[1], $connection[2], $connection[3]) or die("Could not connect, please check your settings");
mysql_select_db($connection[4]) or die("Database dont exist");

////////////////////////////////////
//    Search player
////////////////////////////////////

if(!empty($_POST["search_name"])){
    
    $name = mysql_escape_string($_POST["search_name"]);
    $player_check = mysql_query("SELECT * FROM players WHERE name='$name'") or die(mysql_error());
        if (mysql_num_rows($player_check) == 0){
        $player_dont_exist = "<p>Player dont exist</p>\n";
        }else{
        header("Location: ?page=Search&name=".preg_replace("/".chr(32)."/", "_", $_POST["search_name"]));
        }
}

////////////////////////////////////
//    Login
////////////////////////////////////

if(!empty($_POST["login_number"]) && !empty($_POST["login_password"])){
    
    $account_number = mysql_escape_string($_POST["login_number"]);
        if($use_md5 == true){
        $account_passoword = mysql_escape_string($_POST["login_password"]);
        $account_passoword = md5($account_passoword);
        }else{
        $account_passoword = mysql_escape_string($_POST["login_password"]);
        }
    

    
    if(!empty($_COOKIE["name"]) && !empty($_COOKIE["password"]) && $_POST["remember"] != true){
    setcookie("name","");
    setcookie("password","");
    }
    

    $get_account_data = mysql_query("SELECT * FROM accounts WHERE id='$account_number'") or die(mysql_error());
    
    if (mysql_num_rows($get_account_data) != 0){
        $data = mysql_fetch_array( $get_account_data );

        if($account_number == $data['id'] && $account_passoword == $data['password']){
            if($data['group_id'] > 1){
            $_SESSION["logged_in"] = 1;
            $_SESSION["admin"] = 1;
            $_SESSION["account_number"] = $account_number;
            
            }else{
            $_SESSION["logged_in"] = 1;
            $_SESSION["account_number"] = $account_number;
            }
            if($_POST["remember"] == true){
            setcookie("name",md5($account_number));
            setcookie("password",md5($account_passoword));
            }
            header("Location: ?page=Account");
        }else{
            $wrong_password = "<p>Wrong password</p>\n";
        }
    }else{
    $account_dont_exist = "<p>Account dont exist</p>\n";
    }
}



echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
//Head
echo "<head>\n";
echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\"/>\n";
echo "<meta name=\"description\" content=\"\"/>\n";
echo "<meta name=\"keywords\" content=\"\"/> \n";
echo "<meta name=\"author\" content=\"Oceanic\"/> \n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"skinsstyle.css\" media=\"screen\"/>\n";
echo "<title>".$title."</title>\n";
echo "</head>\n";

echo "<body>\n";
echo "<div id=\"wrapper\">\n";
echo "<div id=\"container\">\n";

echo "<div class=\"title\">\n";
    
echo "    <h1><a href=\"index.php\">".$title."</a></h1>\n";

echo "</div>\n";

echo "<div class=\"header\"></div>\n";

//Menu
echo "<div class=\"navigation\">\n";
echo "<a href=\"?page=Home\">Home</a>\n";
    if($_SESSION["logged_in"] == 1){
    echo "<a href=\"?page=Account\">Account</a>\n";
        if($_SESSION["admin"] == 1){
        echo "<a href=\"?page=Admin\">Admin</a>\n";
        }
    }else{
    echo "<a href=\"?page=Login\">Login</a>\n";
    }
    
echo "<a href=\"?page=Search\">Search</a>\n";
echo "<a href=\"?page=Highscore\">Highscore</a>\n";
echo "    <div class=\"clearer\"></div>\n";
echo "</div>\n";

//Main
echo "<div class=\"main\">\n";

echo "    <div class=\"content\">\n";
switch($_GET["page"]){

default:
    include "bin/news.php";
break;

case "Home":
    include "bin/news.php";    
break;

case "Comments":
    include "bin/comments.php";
break;


case "Admin":
    include "bin/admin.php";
break;

case "Login":
    include "bin/login.php";
break;

case "Register":
    include "bin/register.php";
break;

case "Search":
    include "bin/search.php";
break;

case "Highscore":
    include "bin/highscore.php";    
break;

case "Account":
    include "bin/account.php";
break;

case "Logout":
    session_destroy();
    echo "<h3>Logout</h3>\n";
    echo "<h3>You was logged out, <a href=\"?page=Home\">Click here to go back</a></h3>\n";
break;

case "Recover":
    include "bin/recover.php";
break;

}
echo "    </div>\n";


echo "    <div class=\"bottom\">\n";
echo "    <div class=\"clearer\"></div>\n";
echo "</div>\n";

//Footer
echo "    <div class=\"footer\">\n";
echo "    <div class=\"left\">\n";
echo "    Copyright &copy; 2008 <a href=\"http://kammarfelt.eu\">Oceanic</a>\n";
echo "    </div>\n";
echo "        <div class=\"right\">\n";
echo "            Website template based on by <a href=\"http://arcsin.se\">Arcsin</a>\n";
echo "        </div>\n";
echo "        <div class=\"clearer\"></div>\n";
echo "    </div>\n";
echo "</div>\n";

echo "</div>\n";
echo "</div>\n";

echo "</body>\n";
echo "</html>\n";
?>
 
now i get this message:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Users\gebruiker\Desktop\forgottenserver\Xammp\xampp\htdocs\index.php:1) in C:\Users\gebruiker\Desktop\forgottenserver\Xammp\xampp\htdocs\index.php on line 21
Oceanic CMS
Home Login Search Highscore
Table 'forgottenserver.xcms_news' doesn't exist

and how do i update sql tables?
 
k now i get only this:


Oceanic CMS
Home Login Search Highscore
Table 'forgottenserver.xcms_news' doesn't exist
 
You need to add the mysql tables into your database.
 
Script is very easy to install and use. You're great Oceanic!
 
It's a bit simple for my taste (so far), but atleast you're doing an AAC which is highly appreciated on behalf of the entire opentibia communities. Keep it up mate!
 
It's a bit simple for my taste (so far), but atleast you're doing an AAC which is highly appreciated on behalf of the entire opentibia communities. Keep it up mate!

Ty, working on my sms AAC at the momoent
 
Yeah, saw that other post of yours. If you want, I can give you my donation script using DaoPay as a text message/calling service.
 
This is not the full version of it, but it does all the hard stuff. What you need to add is the actuall reward script. Have fun with it!

PHP:
<?PHP

    // CONFIG: Database settings.
    mysql_connect ( 'localhost' , 'user' , 'pass' );
    mysql_select_db ( 'database' );
    
    // CONFIG: Webshop (DaoPay).
    $cfg['webshop_application']  = 12345; 
    $cfg['webshop_product']      = 'Boots of Haste';
    
?>


<!-- POST Form -->
<form method="post" action="#">
    <strong>Character:</strong> <input type="text" name="character" /><br />
    <strong>PIN Code:</strong> <input type="text" name="pin" /><br />
    <input type="submit" name="purchase" value="Complete the transaction" />
</form>
    
    
<?PHP
                        
    // Transform any blankspace into plus character.
    $cfg['webshop_product'] = str_replace ( ' ' , '+' , $cfg['webshop_product'] );
    
    // Check if user has posted his PIN code.
    if ( isset ( $_POST['purchase'] ) )
    {
        
        // Define regular variables.
        $product       = $cfg['webshop_product'];
        
        // Define post variables.
        $pincode       = mysql_real_escape_string ( $_POST["pin"] );
        $character      = mysql_real_escape_string ( $_POST["character"] );
        
        // Define queries.
        $queryChar   = mysql_query ( "SELECT `id` , `account_id` , `name` FROM `players` WHERE `name` = '$character'" );
            
            // Define queries (num_rows).
            $countExist  = mysql_num_rows ( $queryChar );
            $countStatus = mysql_num_rows ( mysql_query ( "SELECT `account_id` , `name` FROM `players` WHERE `name` = '$character' AND `online` = '0'" ) );
            $countPin    = mysql_num_rows ( mysql_query ( "SELECT `pin` FROM `daopay` WHERE `pin` = '$pincode'" ) );
            $countChar   = mysql_num_rows ( $queryChar );
        
            // Define queries (fetch_array).
            $checkChar   = mysql_fetch_array ( $queryChar );
            $countArrow  = mysql_num_rows ( mysql_query ( "SELECT `pid` FROM `player_items` WHERE `pid` = '10' AND `player_id` = '".$checkChar["id"]."'" ) );
        
        
        
        // Check if character exists.
        if ( $countExist > 0 )
        {
        
            // Check if character is offline.
            if ( $countStatus > 0 )
            {
                
                // Check if product code or PIN code is empty.
                if ( $product && $product != "" && $pincode && $pincode != "" )
                {
                
                    // Validating the PIN code.
                    $handle = fopen ( "http://daopay.com/svc/pincheck?appcode=" . $cfg['webshop_application'] . "&subkey=" . $product . "&pin=" . $pincode , "r" );
                    // Open the handle.
                    if ( $handle )
                    {
                    
                        // Get the reply from the handle.
                        $reply = fgets ( $handle );
                        // Check if the reply is 'ok'.
                        if ( substr ( $reply , 0 , 2 ) == "ok" )
                        {
                            
                            // Check if the PIN has been used before.
                            if ( $countPin > 0 )
                            {
                            
                                // Print an error.
                                echo "<br /><b>An error occurred!</b><br />This PIN has already been used.";
                            
                            }
                            else
                            {
                                
                                //
                                //
                                // DO WHATEVER!
                                //
                                //
                                
                                mysql_close();
                                
                            }
                            
                        }
                        else
                        {
                        
                            // Print an error.
                            echo "<br /><b>An error occurred!</b><br />The PIN code you entered is not valid.";
                            
                        }
                        
                    }
                    else
                    {
                        
                        // Print an error.
                        echo "<br /><b>An error occurred!</b><br />Could not validate the PIN code.";
                        
                    }
                    
                }
                else
                {
                
                    // Print an error.
                    echo "<br /><b>An error occurred!</b><br />Could not validate the PIN code.";
                    
                }
                
            }
            else
            {
            
                // Print an error.
                echo "<br /><b>An error occurred!</b><br />To proceed with the transaction, please logout from your character.";
            
            }
        
        }
        else
        {
        
            // Print an error.
            echo "<br /><b>An error occurred!</b><br />Could not find the mentioned character.";
        
        }
        
    }

?>
Database:
Code:
 CREATE TABLE `daopay` (
`id` INT NOT NULL AUTO_INCREMENT ,
`account_id` INT NOT NULL ,
`pin` VARCHAR( 255 ) NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM
 
Look nice, shall see what i can do about it.
Just like the easy way that you get my using sms
 
Hehe sure, if you ever need any assistance in developing your AAC, feel free to contact me. :- )
 
Status
Not open for further replies.
Back
Top