Jump to content

[Request](PHP Support)Web Castle Control Lineage2


Recommended Posts

Posted

Here is what i'v gote but!

 

<?php



$db_serv = '';			//the address of the database goes here

$db_user = '';				//your sql username goes here
$db_pass = '';					//your sql password goes here

$db_name = '';				//your database name goes here

$filename = './helios.js';		//generated javascript file you need to put attribute 777 in your folder

//-----------------------------------------------------------------------------------------------

@mysql_connect ( $db_serv, $db_user, $db_pass ) or die ('Coudn\'t connect to host');
@mysql_select_db( $db_name ) or die ('Couldn\'t select database');

$sql = @mysql_query('SELECT id,name,tax_percent,siege_date FROM `castle`') or die('Query failed!');

$gen = "\n";

while ($castle = @mysql_fetch_array($sql))
{
$gen .= "\n".strtolower($castle['name']) . 'info = \'<div class="castleWrapper">';
$gen .= '<div class="castlePic" id="' . ucfirst(strtolower($castle['name'])) . 'Pic"></div>';
$gen .= '<div class="castleInfo">';
$gen .= '<div class="castleName"><strong>' . ucfirst(strtolower($castle['name'])) . ' Castle</strong></div>';

$clan = @mysql_fetch_array(mysql_query('SELECT clan_name,hasCastle FROM `clan_data` WHERE hasCastle = ' . $castle['id']));
$clan_name = (isset($clan['clan_name'])) ? htmlspecialchars($clan['clan_name'], ENT_QUOTES) : 'UNCLAIMED';

$gen .= '<div><strong>Controlled by:</strong> ' . $clan_name . '</div>';

if (isset($clan['clan_name'])) $gen .= '<div><strong>Tax Rate:</strong> ' . $castle['tax_percent'] . '%</div>';

$gen .= '<div><strong>Next Siege:</strong> ' . date('M d Y ',$castle['siege_date']/1000) . '</div>';
$gen .= '</div></div>\';'."\n\n";
}

$handle = @fopen($filename, 'w+');
@fwrite($handle, $gen);
@fclose($handle);

?>

 

my tables are not like l2jserver tables ...

clan_data only have clan_id

and clan_name is in table clan_subpledges

 

how can i config the php to show clan name ?

 

tnx in advance!

Posted

<?php require 'castle/generator.php'; ?>
<style type="text/css">

.castleWrapper{width:405px; margin:20px; padding:10px; border:1px solid #000000; color: #FFFFFF; overflow: auto; text-align: left;}
.castlePic{width:149px; height:99px; border:1px solid #FFFFFF; float:left; margin-right:10px;}
.castleInfo div{width:400px;}
.castleName{width:450px; background: #000000; color: #FFFFFF; margin-bottom:5px; padding:2px;}
#AdenPic{background:url(castle/castle_control_image/aden.jpg) no-repeat;}
#DionPic{background:url(castle/castle_control_image/dion.jpg) no-repeat;}
#GiranPic{background:url(castle/castle_control_image/giran.jpg) no-repeat;}
#GludioPic{background:url(castle/castle_control_image/gludio.jpg) no-repeat;}
#GoddardPic{background:url(castle/castle_control_image/goddard.jpg) no-repeat;}
#InnadrilPic{background:url(castle/castle_control_image/innadril.jpg) no-repeat;}
#OrenPic{background:url(castle/castle_control_image/oren.jpg) no-repeat;}
#RunePic{background:url(castle/castle_control_image/rune.jpg) no-repeat;}
#SchuttgartPic{background:url(castle/castle_control_image/schuttgart.jpg) no-repeat;}
</style>
<script language="javascript" type="text/javascript" src="./helios.js"></script>
</head>
<body> 
  <script language="javascript">
document.write(gludioinfo);
document.write(dioninfo);
document.write(giraninfo);
document.write(oreninfo);
document.write(adeninfo);
document.write(innadrilinfo);
document.write(goddardinfo);
document.write(runeinfo);
document.write(schuttgartinfo);

 

<?php



$db_serv = '***';			//the address of the database goes here

$db_user = 'root';				//your sql username goes here
$db_pass = '***';					//your sql password goes here

$db_name = '***';				//your database name goes here

$filename = './helios.js';		//generated javascript file you need to put attribute 777 in your folder

//-----------------------------------------------------------------------------------------------

@mysql_connect ( $db_serv, $db_user, $db_pass ) or die ('Coudn\'t connect to host');
@mysql_select_db( $db_name ) or die ('Couldn\'t select database');

$sql = @mysql_query('SELECT id,name,tax_percent,siege_date FROM `castle`') or die('Query failed!');

$gen = "\n";

while ($castle = @mysql_fetch_array($sql))
{
$gen .= "\n".strtolower($castle['name']) . 'info = \'<div class="castleWrapper">';
$gen .= '<div class="castlePic" id="' . ucfirst(strtolower($castle['name'])) . 'Pic"></div>';
$gen .= '<div class="castleInfo">';
$gen .= '<div class="castleName"><strong>' . ucfirst(strtolower($castle['name'])) . ' Castle</strong></div>';

$clan = @mysql_fetch_array(mysql_query('SELECT clan_id,hasCastle FROM `clan_data` WHERE hasCastle = ' . $castle['id']));
$clan2 = @mysql_fetch_array(mysql_query('SELECT name FROM `clan_subpledges` WHERE name = ' . $clan['clan_id']));

$clan_name = (isset($clan['name'])) ? htmlspecialchars($clan['name'], ENT_QUOTES) : 'UNCLAIMED';

$gen .= '<div><strong>Controlled by:</strong> ' . $clan_name . '</div>';

if (isset($clan2['name'])) $gen .= '<div><strong>Tax Rate:</strong> ' . $castle['tax_percent'] . '%</div>';

$gen .= '<div><strong>Next Siege:</strong> ' . date('M d Y ',$castle['siege_date']/1000) . '</div>';
$gen .= '</div></div>\';'."\n\n";
}

$handle = @fopen($filename, 'w ');
@fwrite($handle, $gen);
@fclose($handle);

?>

 

SQL TABLES HERE -> DOWNLOAD

 

if you need more info about anything else tell tnx for help :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...