cottton wie meinst du das, so wird mir keiner helfen können ?
Weil der Code nicht im Codeblock gesetzt war ?.
cottton wie meinst du das, so wird mir keiner helfen können ?
Weil der Code nicht im Codeblock gesetzt war ?.
hier der Code:
<?php
function spss_replace_url (&$text)
{
global $aCfg;
global $sClickCode;
global $aCampaign;
global $aSite;
$text = str_replace ('<%url%>', $aCfg['url'] . '/click.php?s=' . $aSite['id'] . '&c=' . $aCampaign['id'] . '&h=' . $sClickCode, $text);
$text = str_replace ('<%_url%>', rawurlencode ($aCfg['url'] . '/click.php?s=' . $aSite['id'] . '&c=' . $aCampaign['id'] . '&h=' . $sClickCode), $text);
$text = str_replace ('<%layerclick%>', $aCfg['url'] . '/click.php?t=countClick&layer=1&s=' . $aSite['id'] . '&c=' . $aCampaign['id'] . '&h=' . $sClickCode, $text);
}
function spss_get_object ($id)
{
global $aCfg;
global $sClickCode;
global $aCampaign;
global $aSite;
return $aCfg['url'] . '/object.php?id=' . $id . '&s=' . $aSite['id'] . '&c=' . $aCampaign['id'] . '&h=' . $sClickCode;
}
function spss_get_campaign ($priority = NULL)
{
global $oDB;
global $aSite;
global $iCurrentTime;
if (isset ($priority))
{
$sWhereClause = ' AND priority=\'' . $priority . '\' ';
}
return $oDB->FetchFirst ('SELECT campaigns.* FROM spss_campaigns AS campaigns LEFT JOIN spss_campcat AS campcat on campcat.campaign_id=campaigns.id WHERE campaigns.mid=' . $aSite['mid'] . ' AND campcat.category_id=' . $aSite['cid'] . ' AND campaigns.status=1 ' . $sWhereClause . ' AND ((campaigns.views OR campaigns.clicks) OR campaigns.admin=1) AND default_traffic=0 AND begin <= ' . $iCurrentTime . ' AND end >= ' . $iCurrentTime . ' ORDER BY campaigns.last ASC LIMIT 0,1');
}
header ('Content-Type: text/plain');
require_once './_config.inc.php';
require_once './_settings.inc.php';
/*if ($_GET['ck'] != '1')*/
if ( !isset($_GET['ck'])
or !isset($_GET['ck'])
or $_GET['ck'] == ""
)
{
echo 'var preferrer=\'\';';
echo 'try {';
echo ' preferrer = top.document.referrer;';
echo '} catch (e) {';
echo ' preferrer = \'\';';
echo '} finally {';
echo ' document.write(\'<scr\' + \'ipt type="text\\/javascript" src="' . $aCfg['url'] . '/script.php?s=' . $_GET['s'] . '&pref=\' + escape(preferrer) + \'&ref=\' + escape(document.referrer) + \'&ck=1"><\\/scr\' + \'ipt>\');';
echo '}';
exit ();
}
require_once './lib/database.class.php';
require_once './lib/count.func.php';
$oDB = new Database ($aDB['host'], $aDB['name'], $aDB['user'], $aDB['pass']);
$aSite = $oDB->FetchFirst ('SELECT * FROM spss_sites WHERE id=\'' . $_GET['s'] . '\' AND status=1');
$aMedium = $oDB->FetchFirst ('SELECT * FROM spss_media WHERE id=\'' . $aSite['mid'] . '\'');
if ((empty ($aSite['id']) OR $aMedium['status'] != '1'))
{
exit ();
}
mt_srand ((double)microtime () * 1000000);
$iCurrentTime = time ();
$bCountHit = TRUE;
if (!empty ($_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
$sLanguage = substr ($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
$aLanguage = $oDB->FetchFirst ('SELECT id FROM spss_languages WHERE short=\'' . $sLanguage . '\' AND default_traffic=1');
if (!empty ($aLanguage['id']))
{
$aCampaign = $oDB->FetchFirst ('SELECT campaigns.* FROM spss_campaigns AS campaigns, spss_campcat AS campcat WHERE campaigns.id=campcat.campaign_id AND campaigns.mid=' . $aSite['mid'] . ' AND campcat.category_id=' . $aSite['cid'] . ' AND campaigns.status=1 AND (((campaigns.views > 0) OR (campaigns.clicks > 0)) OR (campaigns.admin=1)) AND default_traffic=1 AND begin <= ' . $iCurrentTime . ' AND end >= ' . $iCurrentTime . ' ORDER BY campaigns.last ASC LIMIT 0,1');
}
}
if (empty ($aCampaign['id']))
{
$relation = mt_rand (1, 12);
if (in_array ($relation, array ('7', '8', '9', '10', '11', '12')))
{
$aCampaign = spss_get_campaign (3);
}
else
{
if (in_array ($relation, array ('4', '5', '6')))
{
$aCampaign = spss_get_campaign (2);
}
else
{
if (in_array ($relation, array ('2', '3')))
{
$aCampaign = spss_get_campaign (1);
}
else
{
if ($relation == '1')
{
$aCampaign = spss_get_campaign (0);
}
}
}
}
}
if (empty ($aCampaign['id']))
{
$aCampaign = spss_get_campaign ();
}
$oDB->Query ('UPDATE spss_campaigns SET last=' . $iCurrentTime . ' WHERE id=\'' . $aCampaign['id'] . '\'');
spss_count_hit (0, 1);
if ((($aMedium['block_reload'] == '1' AND $bCountHit == FALSE) AND $bBlockReload == TRUE))
{
exit ();
}
$sReturnCode = $aMedium['template'];
$sClickCode = md5 (uniqid (mt_rand ()));
$iResult = $oDB->Query ('SELECT campaigns.*, placeholders.type, placeholders.placeholder, placeholders.required, placeholders.url FROM spss_campaigns_placeholders AS campaigns LEFT JOIN spss_media_placeholders AS placeholders ON campaigns.pid=placeholders.id WHERE placeholders.mid=\'' . $aMedium['id'] . '\' AND campaigns.cid=\'' . $aCampaign['id'] . '\'');
while ($oDB->FetchAll ($aPlaceholder, $iResult))
{
if ($aPlaceholder['type'] == 'STRING')
{
$sReturnCode = str_replace ('<%' . $aPlaceholder['placeholder'] . '%>', htmlentities ($aPlaceholder['data2']), $sReturnCode);
continue;
}
else
{
if ($aPlaceholder['type'] == 'OBJECT')
{
$sReturnCode = str_replace ('<%' . $aPlaceholder['placeholder'] . '%>', spss_get_object ($aPlaceholder['id']), $sReturnCode);
continue;
}
else
{
if ($aPlaceholder['type'] == 'HTML')
{
$sReturnCode = str_replace ('<%' . $aPlaceholder['placeholder'] . '%>', $aPlaceholder['data4'], $sReturnCode);
continue;
}
else
{
if ($aPlaceholder['type'] == 'JS')
{
$sReturnCode = str_replace ('<%' . $aPlaceholder['placeholder'] . '%>', '<script type="text/javascript">' . $aPlaceholder['data4'] . '</script>', $sReturnCode);
continue;
}
continue;
}
continue;
}
continue;
}
}
if ((($bInvalidRef == FALSE AND $bProxyCall == FALSE) AND $bInvalidCall == FALSE))
{
$oDB->Query ('INSERT INTO spss_log_clicks SET sid=\'' . $aSite['id'] . '\',
cid=\'' . $aCampaign['id'] . '\',
date=\'' . time () . '\',
type=\'preclick\',
code=\'' . $sClickCode . '\'');
}
spss_replace_url ($sReturnCode);
$dynamic_id = 'dyn' . md5 (uniqid (mt_rand ()));
$sReturnCode = str_replace ('<%id%>', $dynamic_id, $sReturnCode);
$sReturnCode = str_replace ('<%root%>', $aCfg['url'], $sReturnCode);
$sReturnCode = preg_replace ('@<%([0-9a-z_-])*%>@sim', '', $sReturnCode);
$sJSLines = preg_split ('@(
|
)@sim', $sReturnCode);
echo '<!--
';
foreach ($sJSLines as $key => $line)
{
if (!empty ($line))
{
echo 'document.writeln("' . addslashes ($line) . '");
';
continue;
}
}
echo '// -->';
?>
Alles anzeigen
ich habe ein Problem mit PHP , hier der Code:
$aSite = $oDB->FetchFirst ('SELECT * FROM spss_sites WHERE id=\'' . $_GET['s'] . '\' AND status=1');
hier ist die Fehlermeldung :
Call to undefined method database::FetchFirst() in
ich hoffe ihr könnt mir helfen
so dein Code funktioniert zwar doch da stimmt was nicht :
ich werde jetzt mal die Dateien Posten die zusammengehören und auch mit require_once eingebunden sind.
database.class.php
<?php
class database
{
var $connection = '';
var $db = array ();
var $result = '';
var $show_errors = null;
function database ($host, $name, $user, $pass)
{
$this->db['host'] = $host;
$this->db['name'] = $name;
$this->db['user'] = $user;
$this->db['pass'] = $pass;
$this->show_errors = $show_errors; /*diese Zeile macht die Probleme*/
}
function connect ()
{
$this->connection = mysql_connect ($this->db['host'], $this->db['user'], $this->db['pass']);
if (empty ($this->connection))
{
echo mysql_error ();
}
mysql_select_db ($this->db['name'], $this->connection);
}
function query ($Query)
{
if (empty ($this->connection))
{
$this->connect ();
}
$this->result = mysql_query ($Query, $this->connection);
$err_str = mysql_error ();
if (!empty ($err_string))
{
echo $err_str . '<br>';
echo '<b>' . $Query . '</b>';
}
return $this->result;
}
function getinsertid ()
{
return mysql_insert_id ();
}
function fetchfirst ($Query, $assoc = TRUE)
{
if ($assoc == TRUE)
{
return mysql_fetch_assoc ($this->Query ($Query));
}
return mysql_fetch_array ($this->Query ($Query));
}
function fetchvalue ($field, $Query, $assoc = TRUE)
{
if ($assoc == TRUE)
{
$result = mysql_fetch_assoc ($this->Query ($Query));
}
else
{
$result = mysql_fetch_array ($this->Query ($Query));
}
return $result[$field];
}
function countrows ($Query)
{
return mysql_num_rows ($this->Query ($Query));
}
function fetchall (&$saveto, $result = 0, $assoc = TRUE)
{
if (!$result)
{
$result = $this->result;
}
if ($assoc == TRUE)
{
return $saveto = mysql_fetch_assoc ($result);
}
return $saveto = mysql_fetch_array ($result);
}
}
?>
Alles anzeigen
script.php
<?php
function spss_replace_url (&$text)
{
global $aCfg;
global $sClickCode;
global $aCampaign;
global $aSite;
$text = str_replace ('<%url%>', $aCfg['url'] . '/click.php?s=' . $aSite['id'] . '&c=' . $aCampaign['id'] . '&h=' . $sClickCode, $text);
$text = str_replace ('<%_url%>', rawurlencode ($aCfg['url'] . '/click.php?s=' . $aSite['id'] . '&c=' . $aCampaign['id'] . '&h=' . $sClickCode), $text);
$text = str_replace ('<%layerclick%>', $aCfg['url'] . '/click.php?t=countClick&layer=1&s=' . $aSite['id'] . '&c=' . $aCampaign['id'] . '&h=' . $sClickCode, $text);
}
function spss_get_object ($id)
{
global $aCfg;
global $sClickCode;
global $aCampaign;
global $aSite;
return $aCfg['url'] . '/object.php?id=' . $id . '&s=' . $aSite['id'] . '&c=' . $aCampaign['id'] . '&h=' . $sClickCode;
}
function spss_get_campaign ($priority = NULL)
{
global $oDB;
global $aSite;
global $iCurrentTime;
if (isset ($priority))
{
$sWhereClause = ' AND priority=\'' . $priority . '\' ';
}
return $oDB->FetchFirst ('SELECT campaigns.* FROM spss_campaigns AS campaigns LEFT JOIN spss_campcat AS campcat on campcat.campaign_id=campaigns.id WHERE campaigns.mid=' . $aSite['mid'] . ' AND campcat.category_id=' . $aSite['cid'] . ' AND campaigns.status=1 ' . $sWhereClause . ' AND ((campaigns.views OR campaigns.clicks) OR campaigns.admin=1) AND default_traffic=0 AND begin <= ' . $iCurrentTime . ' AND end >= ' . $iCurrentTime . ' ORDER BY campaigns.last ASC LIMIT 0,1');
}
header ('Content-Type: text/plain');
require_once './_config.inc.php';
require_once './_settings.inc.php';
/*if ($_GET['ck'] != '1')*/
if ( !isset($_GET['ck'])
or !isset($_GET['ck'])
or $_GET['ck'] == ""
)
{
echo 'var preferrer=\'\';';
echo 'try {';
echo ' preferrer = top.document.referrer;';
echo '} catch (e) {';
echo ' preferrer = \'\';';
echo '} finally {';
echo ' document.write(\'<scr\' + \'ipt type="text\\/javascript" src="' . $aCfg['url'] . '/script.php?s=' . $_GET['s'] . '&pref=\' + escape(preferrer) + \'&ref=\' + escape(document.referrer) + \'&ck=1"><\\/scr\' + \'ipt>\');';
echo '}';
exit ();
}
require_once './lib/database.class.php';
require_once './lib/count.func.php';
$oDB = new Database ($aDB['host'], $aDB['name'], $aDB['user'], $aDB['pass']);
$aSite = $oDB->FetchFirst ('SELECT * FROM spss_sites WHERE id=\'' . $_GET['s'] . '\' AND status=1');
$aMedium = $oDB->FetchFirst ('SELECT * FROM spss_media WHERE id=\'' . $aSite['mid'] . '\'');
if ((empty ($aSite['id']) OR $aMedium['status'] != '1'))
{
exit ();
}
mt_srand ((double)microtime () * 1000000);
$iCurrentTime = time ();
$bCountHit = TRUE;
if (!empty ($_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
$sLanguage = substr ($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
$aLanguage = $oDB->FetchFirst ('SELECT id FROM spss_languages WHERE short=\'' . $sLanguage . '\' AND default_traffic=1');
if (!empty ($aLanguage['id']))
{
$aCampaign = $oDB->FetchFirst ('SELECT campaigns.* FROM spss_campaigns AS campaigns, spss_campcat AS campcat WHERE campaigns.id=campcat.campaign_id AND campaigns.mid=' . $aSite['mid'] . ' AND campcat.category_id=' . $aSite['cid'] . ' AND campaigns.status=1 AND (((campaigns.views > 0) OR (campaigns.clicks > 0)) OR (campaigns.admin=1)) AND default_traffic=1 AND begin <= ' . $iCurrentTime . ' AND end >= ' . $iCurrentTime . ' ORDER BY campaigns.last ASC LIMIT 0,1');
}
}
if (empty ($aCampaign['id']))
{
$relation = mt_rand (1, 12);
if (in_array ($relation, array ('7', '8', '9', '10', '11', '12')))
{
$aCampaign = spss_get_campaign (3);
}
else
{
if (in_array ($relation, array ('4', '5', '6')))
{
$aCampaign = spss_get_campaign (2);
}
else
{
if (in_array ($relation, array ('2', '3')))
{
$aCampaign = spss_get_campaign (1);
}
else
{
if ($relation == '1')
{
$aCampaign = spss_get_campaign (0);
}
}
}
}
}
if (empty ($aCampaign['id']))
{
$aCampaign = spss_get_campaign ();
}
$oDB->Query ('UPDATE spss_campaigns SET last=' . $iCurrentTime . ' WHERE id=\'' . $aCampaign['id'] . '\'');
spss_count_hit (0, 1);
if ((($aMedium['block_reload'] == '1' AND $bCountHit == FALSE) AND $bBlockReload == TRUE))
{
exit ();
}
$sReturnCode = $aMedium['template'];
$sClickCode = md5 (uniqid (mt_rand ()));
$iResult = $oDB->Query ('SELECT campaigns.*, placeholders.type, placeholders.placeholder, placeholders.required, placeholders.url FROM spss_campaigns_placeholders AS campaigns LEFT JOIN spss_media_placeholders AS placeholders ON campaigns.pid=placeholders.id WHERE placeholders.mid=\'' . $aMedium['id'] . '\' AND campaigns.cid=\'' . $aCampaign['id'] . '\'');
while ($oDB->FetchAll ($aPlaceholder, $iResult))
{
if ($aPlaceholder['type'] == 'STRING')
{
$sReturnCode = str_replace ('<%' . $aPlaceholder['placeholder'] . '%>', htmlentities ($aPlaceholder['data2']), $sReturnCode);
continue;
}
else
{
if ($aPlaceholder['type'] == 'OBJECT')
{
$sReturnCode = str_replace ('<%' . $aPlaceholder['placeholder'] . '%>', spss_get_object ($aPlaceholder['id']), $sReturnCode);
continue;
}
else
{
if ($aPlaceholder['type'] == 'HTML')
{
$sReturnCode = str_replace ('<%' . $aPlaceholder['placeholder'] . '%>', $aPlaceholder['data4'], $sReturnCode);
continue;
}
else
{
if ($aPlaceholder['type'] == 'JS')
{
$sReturnCode = str_replace ('<%' . $aPlaceholder['placeholder'] . '%>', '<script type="text/javascript">' . $aPlaceholder['data4'] . '</script>', $sReturnCode);
continue;
}
continue;
}
continue;
}
continue;
}
}
if ((($bInvalidRef == FALSE AND $bProxyCall == FALSE) AND $bInvalidCall == FALSE))
{
$oDB->Query ('INSERT INTO spss_log_clicks SET sid=\'' . $aSite['id'] . '\',
cid=\'' . $aCampaign['id'] . '\',
date=\'' . time () . '\',
type=\'preclick\',
code=\'' . $sClickCode . '\'');
}
spss_replace_url ($sReturnCode);
$dynamic_id = 'dyn' . md5 (uniqid (mt_rand ()));
$sReturnCode = str_replace ('<%id%>', $dynamic_id, $sReturnCode);
$sReturnCode = str_replace ('<%root%>', $aCfg['url'], $sReturnCode);
$sReturnCode = preg_replace ('@<%([0-9a-z_-])*%>@sim', '', $sReturnCode);
$sJSLines = preg_split ('@(
|
)@sim', $sReturnCode);
echo '<!--
';
foreach ($sJSLines as $key => $line)
{
if (!empty ($line))
{
echo 'document.writeln("' . addslashes ($line) . '");
';
continue;
}
}
echo '// -->';
?>
Alles anzeigen
ich habe den 2 Code von dir übernommen und eingefügt doch leider ist es die selbe Fehlermeldung :
Undefined variable: show_errors in <b>G:\xampp\htdocs\surfzentrale\lib\database.class.php
Danke für die schnelle Rückantwort doch leider funktioniert es nicht.
Hallo Liebe Community ,
ich habe ein Problem mit PHP hier der Code:
class database
{
var $connection = '';
var $db = array ();
var $result = '';
var $show_errors = null;
function database ($host, $name, $user, $pass)
{
$this->db['host'] = $host;
$this->db['name'] = $name;
$this->db['user'] = $user;
$this->db['pass'] = $pass;
$this->show_errors = $show_errors; /* diese Zeile macht die Probleme */
}
hier ist die Fehlermeldung :
Undefined variable: show_errors in
ich hoffe ihr könnt mir helfen
HTML-Seminar.de - mit Videos zum schnellen Lernen, wie man eine Website selbst erstellt.