
Originally Posted by
John
Finished the mod uploading now :) but it maybe kind of hard for noobs to install maybe renlok will add it to the next version after boxlot tests it out :)
eh eh :) i reviewed your source and i have some quastion to u:
1, why just ONLY ONE adsense source will be saving into database (its possible to displaying max 3 adwertise / site)
2,in adsense.php u wrote:
$adsense = $_POST['adsense']; // WHY it is??? u wana seeing nothing in the edited textarea?
and
'ADSENSE1' => $adsense,
well-well
i remaked your source and implemented that into my webidversion085
v085 adsense.php:
<?php
define('InAdmin', 1);
include '../includes/common.inc.php';
include $include_path . 'functions_admin.php';
include 'loggedin.inc.php';
unset($ERR);
// Get adsense code
$adsenseconfirm = 'Insert google adsense codes in textareas';
$queryads = "SELECT adsense1,adsense2,adsense3 FROM " . $DBPrefix . "settings";
$resads = mysql_query($queryads);
$adsensei1 = mysql_result($resads, 0, 'adsense1');
$adsensei2 = mysql_result($resads, 0, 'adsense2');
$adsensei3 = mysql_result($resads, 0, 'adsense3');
if (isset($_POST['submit']) && $_POST['action'] == 'update') {
$adsense1 = $_POST['adsense1'];
$adsense2 = $_POST['adsense2'];
$adsense3 = $_POST['adsense3'];
if (empty($adsense1) AND empty($adsense2) AND empty($adsense3)) {
$adsenseconfirm = 'Insert google adsense code in textarea';
} elseif (!empty($adsense1) OR !empty($adsense2) OR !empty($adsense3)) {
$adsenseconfirm = 'Code submitted';
}
// Update database
$query = "UPDATE " . $DBPrefix . "settings SET
adsense1 = '" . $_POST['adsense1'] . "'"
.", adsense2 = '" . $_POST['adsense2'] . "'"
.", adsense3 = '" . $_POST['adsense3'] . "'";
$system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);
$system->SETTINGS['adsense1'] = $_POST['adsense1'];
$system->SETTINGS['adsense2'] = $_POST['adsense2'];
$system->SETTINGS['adsense3'] = $_POST['adsense3'];
$ERR = "Adsense settings updated";
}
$template->assign_vars(array(
'ERROR' => (isset($ERR)) ? $ERR : '',
'ADSENSE1' => $adsensei1,
'ADSENSE2' => $adsensei2,
'ADSENSE3' => $adsensei3,
'ADSENSECONFIRM' => $adsenseconfirm
));
$template->set_filenames(array(
'body' => 'adsense.tpl'
));
$template->display('body');
?>
v085 adsense.tpl:
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="{SITEURL}style.css" />
</head>
<body style="margin:0;">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td background="{SITEURL}images/bac_barint.gif">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td width="30"><img src="{SITEURL}images/i_ban.gif" ></td>
<td class="white">{L_25_0011} >> {L__0013}</td>
</tr>
</table>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="center" valign="middle">
<table width="95%" border="0" cellpadding="1" bgcolor="#0083D7">
<tr>
<td align="center" class="title">{L__0013}</td>
</tr>
<tr>
<td bgcolor="#FFFFFF">
<div style="width:75%; float:right;">
<div class="main-box">
<h4 class="rounded-top rounded-bottom">{L_25_0011} >> Google Adsense</h4>
<form method="post" action="" enctype="multipart/form-data">
<!-- IF ERROR ne '' -->
<div class="error-box"><b>{ERROR}</b></div>
<!-- ENDIF -->
<table width="98%" border="0" cellpadding="0" cellspacing="0">
<tr>
<th><label for="adsense">Google Adsense</label></th>
</tr>
<tr>
<td>
{ADSENSECONFIRM}
</td>
</tr>
<tr>
<td>
<textarea id="adsense1" name="adsense1" cols="60" rows="10">{ADSENSE1}</textarea>
</td>
</tr>
<tr>
<td>
<textarea id="adsense2" name="adsense2" cols="60" rows="10">{ADSENSE2}</textarea>
</td>
</tr>
<tr>
<td>
<textarea id="adsense3" name="adsense3" cols="60" rows="10">{ADSENSE3}</textarea>
</td>
</tr>
</table>
<input type="hidden" name="action" value="update">
<input type="submit" value="Add Google Codes" name="submit">
</form>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- INCLUDE footer.tpl -->
welll u can check out
here, how its works