PHPkód

HackForum

PHPkód#
Zdravím, potřeboval bych poradit.. učím se v php a javascriptu..a nastal takovej problém. Potřebuji jeden kód vložit do indexu php. Když ho tam vložím tak se tam normálně objeví bohužel ale ten web ztratí funkčnost. Mohly by jste mi poradit jak tam ten kód mám vložit děkuji. Pokud možno tak do hlavičky stránky. Nešlo by tam přidat další výstup a dát tam složku s htlm s původním kódem? Za Vaši pomoc předem děkuji.

Tento kód potřebuji vložit:

<div id="hlasy" style="text-align: center" > <form action="[link]" method="get" target="_blank"> <br> <big><label><b><span style="color:#ff0000">Hlasuj a získej více denárů! </span><span style="color:#66cc00">Hlasování podpoříš server!</span></b></label>
;</big> <input type="hidden" name="id" value="9490"></p> <p><input name="user" type="text" placeholder="Jméno ze hry..." size="20"> <input value="Hlasuj!" type="submit"> </form></p>

do tohodle:

<?php
error_reporting(E_ALL | E_STRICT);
define('DEFINE_INDEX_FILE',TRUE);
define('CURRENT_VERSION', '1.2.6');
global $config;

// get,post,cookie (highest priority last)
function getVar($name,$type='',$order=array('get','p
ost')){$output='';
if(!is_array($order)) $order = @explode(',',(string)$order);
if(@count($order)==0 || $order=='')
if($order!='') $order = array($order);
else $order = array('get','post');
# get vars
foreach($order as $v){
if( $v=='get' && isset($_GET [$name])) $output=@$_GET [$name];
elseif($v=='post' && isset($_POST [$name])) $output=@$_POST [$name];
elseif($v=='cookie' && isset($_COOKIE[$name])) $output=@$_COOKIE[$name];
}
// convert type if set
if( $type=='str' || $type=='string' ) return( (string) $output );
elseif($type=='int' || $type=='integer') return( (integer) $output );
elseif($type=='float' || $type=='double' ) return( (float) $output );
elseif($type=='bool' || $type=='boolean') return( toBoolean($output) );
return($output);
}
function toBoolean($value){
if(gettype($value) == 'boolean') return($value);
$tempValue = strtolower((string)$value);
if($tempValue==='t' || $tempValue==='true' ) return(TRUE);
if($tempValue==='y' || $tempValue==='yes' ) return(TRUE);
if($tempValue==='f' || $tempValue==='false') return(FALSE);
if($tempValue==='n' || $tempValue==='no' ) return(FALSE);
return( (boolean)$value );
}

define('LOGIN_FORM_USERNAME', 'WA_Login_Username');
define('LOGIN_FORM_PASSWORD', 'WA_Login_Password');

// get page name
$page = getVar('page');
$action = getVar('action');
if(empty($page)) $page='home';

// render skin
if($page=='mcskin'){require('inc/mcskin.php
'); exit();}

// set defaults
$config=array(
'settings' => array(),
'languages' => array(),
'language' => '',
'html' => NULL,
'user' => NULL,
'page' => &$page,
'action' => &$action,
'paths' => array(
'local' => array(),
'http' => array()
),
'demo' => FALSE,
'title' => '',
'tags' => array(),
'theme' => '',
'table prefix' => 'WA_',
'iConomy' => array(
'use' => 'auto',
'table' => 'iConomy'
),
'session name' => 'WebAuctionPlus User'
);
$settings = &$config['settings'];
$languages= &$config['languages'];
$language = &$config['language'];
$html = &$config['html'];
$user = &$config['user'];
$tags = &$config['tags'];
// paths
$paths = &$config['paths'];
$lpaths = &$config['paths']['local'];
$wpaths = &$config['paths']['http'];
// local paths
$lpaths['config'] = 'config.php';
$lpaths['includes'] = 'inc/';
$lpaths['classes'] = 'inc/classes/';
$lpaths['pages'] = 'inc/pages/';
$lpaths['static'] = 'static/';
$lpaths['theme'] = 'html/{theme}/';
$lpaths['item packs'] = 'inc/ItemPacks/';
// http paths
$wpaths['static'] = 'static/';
$wpaths['images'] = 'html/{theme}/images/';
$wpaths['item packs'] = 'inc/ItemPacks/{pack}/icons/';
// load config
require($lpaths['config']);
// connect to database
//$dbi = FALSE;
ConnectDB();



// these lines are temp
$config['site title'] = 'WebAuctionPlus';
if(!isset($config['iConomy']['use'])) $config['iConomy']['use'] = 'auto';
if(!isset($config['iConomy']['table'])) $config['iConomy']['table'] = 'iConomy';
if(!@date_default_timezone_get())
@date_default_timezone_set('America/New_Yor
k');



// includes
require($lpaths['includes'].'inc.php');
$qtime = GetTimestamp();
$page=SanFilename($page);

// php session
$func = 'session_status';
if(function_exists($func))
if($func() == PHP_SESSION_DISABLED){
echo '<p>PHP Sessions are disabled. This is a requirement, please enable this.</p>';
exit();
}
session_init();

// load settings
require($lpaths['classes'].'settings.class.
php');
SettingsClass::LoadSettings();
// default settings
SettingsClass::setDefault('Version' , 'unknown!' , TRUE );
SettingsClass::setDefault('Language' , 'en' , TRUE );
SettingsClass::setDefault('Require Login' , FALSE , TRUE );
SettingsClass::setDefault('CSRF Protection' , TRUE , TRUE );
SettingsClass::setDefault('Currency Prefix' , '$ ' , FALSE);
SettingsClass::setDefault('Currency Postfix' , '' , FALSE);
SettingsClass::setDefault('Custom Description' , FALSE , TRUE );
SettingsClass::setDefault('Website Theme' , 'default' , TRUE );
SettingsClass::setDefault('jQuery UI Pack' , 'redmond' , TRUE );
SettingsClass::setDefault('Item Packs' , '' , FALSE);
SettingsClass::setDefault('Max Sell Price' , 10000.0 , TRUE );
//SettingsClass::setDefault('Max Selling Per Player', 20 , TRUE );
$config['language'] = SettingsClass::getString('Language');
$config['theme'] = SettingsClass::getString('Website Theme');

// check website version
if(SettingsClass::getString('Version') != CURRENT_VERSION){
echo '<center><h2>Please update the WebAuctionPlus website to match the plugin version you\'re running.</h2>'.
'<b>Plugin is running: '.SettingsClass::getString('Version').'<
/b><br />'.
'<b>Website is running: '.CURRENT_VERSION.'</b></center>
;';
exit();
}

// jquery ui path
$lpaths['static jquery'] = $lpaths['static'].'jquery/'.SanFilename(Set
tingsClass::getString('jQuery UI Pack')).'/';
$wpaths['static jquery'] = $wpaths['static'].'jquery/'.SanFilename(Set
tingsClass::getString('jQuery UI Pack')).'/';

// load item packs
require($lpaths['item packs'].'default/item.defines.php');
foreach(explode(',',SettingsClass::getStrin
g('Item Packs')) as $v){
$t = trim($v); if(empty($v)) continue;
require($lpaths['item packs'].SanFilename($v).'/item.defines.php'
);
}

// load template engine
require($lpaths['classes'].'html.class.php'
);
$page_outputs = array();
$config['html'] = new RenderHtml($page_outputs, $tags);

// load user manager
include($lpaths['classes'].'user.class.php'
);
$config['user'] = new UserClass();
if($config['user'] === NULL) {echo '<p>Failed to load user manager!</p>'; exit();}

// render page content
$page_outputs['body'] = include($lpaths['pages'].SanFilename($page)
.'.php');
if($page_outputs['body'] == TRUE){
$a = 'RenderPage_'.$page;
$page_outputs['body'] = $a();
}
if ($page_outputs['body'] === TRUE ) $page_outputs['body']='';
elseif($page_outputs['body'] === FALSE) $page_outputs['body']='Unable to load page, render returned FALSE';
$html->Display();
@session_write_close();


?>
(odpovědět)
Scipio | E-mail27.2.2015 11:05
re: PHPkód#
No, sem to prostě nevložíš, nebo můžeš za ?>. Jenže se ti to bude ukazovat všude. Musíš si najít šablonu, kterou ti index.php renderuje a tam to vložit. Není jasné jakej systém to je. Ale z toho kodu to vypada, že si musíš najít soubor home.php a tam to vložit...
(odpovědět)
rovi | 89.24.234.*27.2.2015 14:01
re: PHPkód#
Pokud ti jde skutečně o to, vložit ten výšeuvedený kód toho tebou uvedeného kódu php, můžeš to udělat takhle:

echo 'TVUJ KOD';

Bude to ale prasárna :)

----------
Teprve když vstáváte s hackingem a uléháte s myšlenkou na něj, máte šanci být hackerem.
(odpovědět)
.cCuMiNn. | E-mail | Website | PGP27.2.2015 15:16
re: PHPkód#
BTW: V tom tvém HTML kódu se ti nějak kříží tagy.

----------
Teprve když vstáváte s hackingem a uléháte s myšlenkou na něj, máte šanci být hackerem.
(odpovědět)
.cCuMiNn. | E-mail | Website | PGP27.2.2015 15:20
re: PHPkód#
jo díky.. no před tím sem to dával do souboru header.php , pak tam je ještě display a footer. home.php sem nenašel.No a v té header to neudělalo nic..ale určitěsem to dělal špatně :D.. Jinak je to systém na webové aukce pro jednu hru..
[link]
cCumiNn .. jak kříží ? :-) (ve wingetu ve wordpressu ten kód běží v pohodě..i funguje..ale pokud je tam něco špatně budu rád když mi to řekneš :-)

Tady dávám zdrojový kód header.php pokud by to tam šlo dát byl bych rád ... (myslím si že by to mohlo být ono protože ta hlavička se tam nějak nemění..

<?php if(!defined('DEFINE_INDEX_FILE')){if(header
s_sent()){echo '<header><meta http-equiv="refresh" content="0;url=../"></header>';}el
se{header('HTTP/1.0 301 Moved Permanently'); header('Location: ../');} die("<font size=+2>Access Denied!!</font>");}
global $config,$html,$user;
$output='';


// page header
$output.=
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[link]">
<html xmlns="[link]">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>{sitepage title}</title>
<link rel="icon" type="image/x-icon" href="{path=static}favicon.ico" />
';
// css
$output.='
<link rel="stylesheet" type="text/css" href="{path=theme}main.css" />
<link rel="stylesheet" type="text/css" href="{path=theme}table_jui.css" />
<link rel="stylesheet" type="text/css" href="{path=static jquery}jquery-ui-1.8.19.custom.css" />
<style type="text/css">
{css}
</style>
';
// finish header
$output.='
<script type="text/javascript" language="javascript" src="{path=static}js/jquery-1.7.2.min.js"&g
t;</script>
<script type="text/javascript" language="javascript" src="{path=static}js/jquery.dataTables-1.9.
0.min.js"></script>
<script type="text/javascript" language="javascript" src="{path=static}js/inputfunc.js"></
script>
{AddToHeader}
</head>
<body>
';

switch($html->getPageFrame()){
case 'default':
$output.='
<div id="holder">
<div id="profile-box">

{if logged in}

<table border="0" cellspacing="0" cellpadding="0" style="padding-bottom: 2px; text-align: left; font-size: 20px; font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;">
<tr>
<td rowspan="4"><img src="./?page=mcskin&user='.$user->ge
tName().'&view=body" alt="" width="60" height="120" id="mcface" /></td>
<td height="30">Name:</td><td>'.
$user->getName().
($user->hasPerms('isAdmin')?'&nbsp;&
lt;a style="font-size: small; font-weight: bold; color: #000000;">[ADMIN]</a>':'').'</t
d>
</tr>
<tr><td height="30">Money:&nbsp;&nbsp;&l
t;/td><td>'.str_replace(' ','&nbsp;',FormatPrice($user->getMon
ey())).'</td></tr>
<tr><td colspan="2" align="center" style="font-size: smaller;">'.@date('jS M Y H:i:s').'</td></tr>
</table>

{else}

<form action="./" name="loginform" method="post">
{token form}
<input type="hidden" name="page" value="login" />
<input type="hidden" name="lastpage" value="./" />
<table border="0" cellspacing="0" cellpadding="0" style="margin-top: -10px;width: 585px;">
<tr>
<td align="right"><label for="'.LOGIN_FORM_USERNAME.'">Herni Nick:&nbsp;</label></td>
<td width="290"><input type="text" name="'.LOGIN_FORM_USERNAME.'" value="" class="input" size="30" tabindex="1" id="'.LOGIN_FORM_USERNAME.'" /></td>
<td rowspan="3"><input type="submit" name="Submit" value="Submit" class="button" tabindex="3" style="margin-left: 10px;" /></td>
</tr>
<tr><td style="height: 5px;"></td></tr>
<tr>
<td align="right"><label for="'.LOGIN_FORM_PASSWORD.'">Heslo:&
;nbsp;</label></td>
<td><input type="password" name="'.LOGIN_FORM_PASSWORD.'" value="" class="input" size="30" tabindex="2" id="'.LOGIN_FORM_PASSWORD.'" /></td>
</tr>
<tr><td style="height: 5px;"></td></tr>
<tr><td colspan="3" align="center" style="font-size: small;">Toto jsou webove aukce pro server PVPraj. Vice na /warp aukce.Pro vytvoreni uctu zadejte ve hre tento prikaz:<br />/wa password [vase_heslo];</td></tr>
</table>
</form>
<script type="text/javascript">
function formfocus() {
document.getElementById(\''.LOGIN_FORM_USER
NAME.'\').focus();
}
window.onload = formfocus;
</script>

{endif}

</div>
<div id="menu-box">


<a href="./">Domu</a><br />
{if logged in}
<a href="./?page=myitems">Moje itemy</a><br />
<a href="./?page=myauctions">Moje aukce</a><br />
<!--
<a href="./?page=playerstats">Statistiky<
;/a><br />
<a href="./?page=info">Item Info</a><br />
<a href="./?page=transactionlog">Historie plateb</a><br />
-->
<a href="./?page=logout{token}">Odhlasit<
;/a><br />
{else}
<a href="./?page=login">Prihlasit</a>
<br />
{endif}


</div>
<div id="title-box">
<div id="title-box2">
<h1 style="margin-bottom: 10px; text-align: center; font-family: Arial;">Webove aukce<sup>PVPraj</sup></h1&g
t;
<h2>{page title}</h2>
</div>
</div>
';
break;
case 'basic':
$output.='
<table border="0" cellspacing="0" cellpadding="0" align="center" style="width: 100%; height: 100%;">
<tr><td style="height: 1px;"><h1 style="margin-bottom: 30px; text-align: center; font-family: Arial; font-size: 45px;">Webove aukce<sup>PVPraj</sup></h1&g
t;</td></tr>
<tr><td>
';
}


return($output."\n\n\n");
?>
(odpovědět)
Scipio | E-mail27.2.2015 16:30
re: PHPkód#
j a zkoušel sem to echo..opět se jen načte vzhled ale ztratí to funkčnost
(odpovědět)
Scipio | E-mail27.2.2015 16:55
re: PHPkód#
bavime sa o tomto predpokladam

[link]
(odpovědět)
otomzo | 77.173.197.*27.2.2015 18:34

Zpět
Svou ideální brigádu na léto najdete na webu Ideální brigáda
 
 
 

 
BBCode