• 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!

Modern AAC Page - Lottery!

Kavvson

Gdy boli cie glowa wez
Joined
Jun 25, 2008
Messages
1,177
Reaction score
72
Location
Poland
This is a Lottry page for Modern Aac grounded on http://otland.net/f82/lottery-system-v2-45937/ .

How to include the page?

Go to this page http://127.0.0.1/index.php/admin/createPage

input there the code

Code:
<?PHP
require("config.php");
$ots = POT::getInstance();
$ots->connect(POT::DB_MYSQL, connection());
$SQL = $ots->getDBHandle();
$lottery = $SQL->query('SELECT id, name, item, world_id FROM lottery WHERE world_id = 0 ORDER BY id DESC LIMIT 1;');
foreach($lottery as $result) {
ECHO '
<table border="0px" cellspacing="1px" cellpadding="4px" width="100%">
            <tr bgcolor="#eeddb9" style="color: red;"><th width="100%"><center>Lottry</center></th></tr>
			<tr><td><center>Every X hours we will choose one player who will win random item!</tr></td>
			<tr><td><center>Last Winner on '.$config['server_name'].' is <b><a href="'.WEBSITE.'/index.php/character/view/'.urlencode($result['name']).'">'.$result['name'].'</a></b> won <i>'.$result['item'].'</i> Congratulations!</tr></td>
			</td></table>';
}
$lottery2 = $SQL->query('SELECT id, name, item, world_id FROM lottery WHERE world_id = 1 ORDER BY id DESC LIMIT 1;');
foreach($lottery2 as $result) {
ECHO '<table border="0px" cellspacing="1px" cellpadding="4px" width="100%">
<tr><td><center>Last Winner on World1: <a href="/index.php/character/view/'.urlencode($result['name']).'">'.$result['name'].'</a> won <i>'.$result['item'].'</i> Congratulations!</center></tr></td>';
ECHO '</table><br />';
}
?>

And then you can add it into the menu in index.tpl ;)

For the SQL Querys look at the original topic.

Regards
 
I recode it too :)
PHP:
<?PHP
require("config.php");
$ots = POT::getInstance();
$ots->connect(POT::DB_MYSQL, connection());
$SQL = $ots->getDBHandle();
$lottery = $SQL->query('SELECT id, name, item, world_id FROM lottery WHERE world_id = 0 ORDER BY id DESC;');
ECHO '
<table border="0px" cellspacing="0px" cellpadding="0px" width="100%">
   <tr style="color: red;"><th width="100%"><center>Loteria</center></th></tr>
    <tr><td><center>Every X hours we will choose one player who will win random item!</tr></td>
   <br>
   </table>
	<table border="0px" cellspacing="0px" cellpadding="0px" width="100%">
   <tr BGCOLOR="#505050">
	   <td CLASS=white>
	   <center>
			<b>Nombre</b>
	   </center>
	   </td>
		<td CLASS=white width=100>
		<center>
			<b>Item</b>
		</center>
		</td>
		<td width=100 CLASS=white>
		<center>
			<b>World</b>
		</center>
		</td>
	</tr>';
$players = 1;
foreach($lottery as $result) {
    $players++;
            if(is_int($players / 2))
                $bgcolor = "#D4C0A1";
            else
                $bgcolor = "#F1E0C6";
echo '
<TR BGCOLOR='.$bgcolor.'>
	<TD WIDTH=35%>
	   <center>
	   <b><a href="/index.php/character/view/'.urlencode($result['name']).'">'.$result['name'].'</a></b>
	   </center>
	</td>
	<TD WIDTH=30%>
	 <center>
	 <img src="'.WEBSITE.'/public/images/items/'.urlencode($result['item']).'.gif">
	 </center>
	</td>
	<TD WIDTH=30%>
	 <center>
	  <b>'.$config['server_name'].'</b>
	  </center>
	</td>
   </tr>
   ';
}
echo '</table>';
?>
 
Not Found

The requested URL /index.php/admin/createPage was not found on this server.

Why can't I access the create page for my website :huh:?
Help would be greatly appreciated!
 
I guess its something with the new rev. changed the page management
 
I go http://127.0.0.1//index.php/p/v/lottery and:

Code:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'world_id' in 'field list'' in D:\xampp\htdocs\system\pages\lottery.php:6 Stack trace: #0 D:\xampp\htdocs\system\pages\lottery.php(6): PDO->query('SELECT id, name...') #1 D:\xampp\htdocs\system\application\controllers\p.php(13): include('D:\xampp\htdocs...') #2 [internal function]: p->v('lottery') #3 D:\xampp\htdocs\system\codeigniter\CodeIgniter.php(236): call_user_func_array(Array, Array) #4 D:\xampp\htdocs\index.php(166): require_once('D:\xampp\htdocs...') #5 {main} thrown in D:\xampp\htdocs\system\pages\lottery.php on line 6
 
Unknown column 'world_id' ( u dont have it ) and all is clear
 
Back
Top