Sponsor-Board.de
PHP Problem

+- Sponsor-Board.de (https://www.sponsor-board.de)
+-- Forum: Community (/forumdisplay.php?fid=56)
+--- Forum: Hilfe (/forumdisplay.php?fid=102)
+---- Forum: Scripting (/forumdisplay.php?fid=108)
+---- Thema: PHP Problem (/showthread.php?tid=16263)


PHP Problem - Damian - 07.09.2011 13:29

Hallo SB,
Ich habe ein Problem mit einer PHP Datei.

Der Code:

PHP-Code:
<?php

/**
 @ Author: Clear
 @ Created: 15/11/2010
 @ Version: 1.0
 @ Contact: [email protected]
 @ License: Is not allowed the copy, redistribution and sale of this plugin. For all problem, contact me.

*/

if(!defined("IN_MYBB"))
    die(
"This file cannot be accessed directly.");
    
$plugins->add_hook('global_start''avvisospiti'); 

function 
avvisospiti_info() {
    return array(
      
'name'         => 'Guest warn',
      
'description'  => 'Show an elegant warn for all guest of your forum.',
      
'website'      => 'http://www.mybb.com/',
      
'author'       => 'Clear',
      
'authorsite'   => 'http://www.downloadsafe.altervista.org',
      
'version'      => '1',
  );
}

function 
avvisospiti()
{
    global 
$mybb;
    
        
            global 
$theme,$avvisospiti;
            
            if (
$mybb->user['usergroup'] == 1)
        {
            
$avvisospiti='<style>#avviso { background: #000; margin-right: 7px; color: #fff; font-size: 10px; border: 0px solid #94c2e8; padding: 8px; -moz-border-radius: 8px; -webkit-border-radius: 8px;  filter:alpha(opacity=88); -moz-opacity:.88; opacity:.88; -moz-box-shadow:5px 5px 5px #191919; -webkit-box-shadow:5px 5px 5px #191919; box-shadow:5px 5px 5px #191919; } #avviso a:link { color: #fff; text-decoration: none; } #avviso a:visited { color: #fff; text-decoration: none; } #avviso a:hover, #avviiso a:active { color: #fff; text-decoration: underline; } .avviso_fixed { height: auto;  position: fixed;  top:'  $mybb->settings['avvisospiti_2'] . ';  right: '  $mybb->settings['avvisospiti_3'] . '; width: 280px; }</style><div class="avviso_fixed"><div id="avviso">' $mybb->settings['avvisospiti_1'] . '</div></div>';

        }
}

function 
avvisospiti_activate()
{
    global 
$db$mybb;
    
// Settings
    
$avvisospiti_group = array(
        
"gid" => "NULL",
        
"name" => "avvisospiti",
        
"title" => "Guest warn Settings",
        
"description" => "These settings allow an elegant warn for all guest of your forum.",
        
"disporder" => "1",
        
"isdefault" => "no",
    );
    
$db->insert_query("settinggroups"$avvisospiti_group);
    
    
$gid $db->insert_id();
    
$avvisospiti_setting_1 = array(
        
"sid"            => "NULL",
        
"name"            => "avvisospiti_1",
        
"title"            => "Enter your guest warn message here",
        
"description"    => "This text will are show in the warn for the guests off your forum",
        
"optionscode"    => "textarea",
        
"value"            => 'Hello Guest, if you read this, it means you are not registered. <a href="member.php?action=register">Click here</a> to register a few simple steps, you will enjoy all the features of our Forum. Please note that nicknames are prohibited lewd or meaningless (no numbers or letters at random) and presented in the section for you to meet our community.',
        
"disporder"        => '3',
        
"gid"            => intval($gid),
    );
    
$avvisospiti_setting_2 = array(
        
"sid"            => "NULL",
        
"name"            => "avvisospiti_2",
        
"title"            => "Set the height for the position of the warn in forum",
        
"description"    => "Recomended is 50%",
        
"optionscode"    => "text",
        
"value"            => '50%',
        
"disporder"        => '2',
        
"gid"            => intval($gid),
    );
    
$avvisospiti_setting_3 = array(
        
"sid"            => "NULL",
        
"name"            => "avvisospiti_3",
        
"title"            => "Set the width for the position of the warn in forum",
        
"description"    => "Recomended is 2%",
        
"optionscode"    => "text",
        
"value"            => '2%',
        
"disporder"        => '1',
        
"gid"            => intval($gid),
    );
    
$db->insert_query("settings"$avvisospiti_setting_1);
    
$db->insert_query("settings"$avvisospiti_setting_2);
    
$db->insert_query("settings"$avvisospiti_setting_3);
    require 
MYBB_ROOT."/inc/adminfunctions_templates.php";
    
find_replace_templatesets("headerinclude""#".preg_quote('{$stylesheets}')."#i",'{$stylesheets}{$avvisospiti}');
    
// Rebuilding settings
    
rebuild_settings();
}

function 
avvisospiti_deactivate()
{
    global 
$db$mybb;
    
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='avvisospiti'");
    
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='avvisospiti_1'");
    
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='avvisospiti_2'");
    
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='avvisospiti_3'");
    require 
MYBB_ROOT."/inc/adminfunctions_templates.php";
    
find_replace_templatesets("headerinclude""#".preg_quote('{$avvisospiti}')."#i"''0);
    
// Rebuilding settings
    
rebuild_settings();



?>


Es geht mir um folgende Stelle:

PHP-Code:
global $theme,$avvisospiti;
            
            if (
$mybb->user['usergroup'] == 1)
        {
            
$avvisospiti='<style>#avviso { background: #000; margin-right: 7px; color: #fff; font-size: 10px; border: 0px solid #94c2e8; padding: 8px; -moz-border-radius: 8px; -webkit-border-radius: 8px;  filter:alpha(opacity=88); -moz-opacity:.88; opacity:.88; -moz-box-shadow:5px 5px 5px #191919; -webkit-box-shadow:5px 5px 5px #191919; box-shadow:5px 5px 5px #191919; } #avviso a:link { color: #fff; text-decoration: none; } #avviso a:visited { color: #fff; text-decoration: none; } #avviso a:hover, #avviiso a:active { color: #fff; text-decoration: underline; } .avviso_fixed { height: auto;  position: fixed;  top:'  $mybb->settings['avvisospiti_2'] . ';  right: '  $mybb->settings['avvisospiti_3'] . '; width: 280px; }</style><div class="avviso_fixed"><div id="avviso">' $mybb->settings['avvisospiti_1'] . '</div></div>';

        }
}

function 
avvisospiti_activate()
{
    global 
$db$mybb


Vor dem <style>#avviso möchte ich einen LayerCode einfügen

Der LayerCode:

Code:
<script Language="JavaScript">
document.write ('<scr' + 'ipt Language="JavaScript" src="http://www.euros4click.de/showme.php?id=xxxx&rnd=' + Math.random() + '&popup=false&layer=true"></scr' + 'ipt>');
</script>


Wie füge ich den davor ein?
Ich habe es schon versucht aber bekomme dann immer eine Fehlermeldung :/


RE: PHP Problem - 27United SP - 07.09.2011 13:37

z.b.:

<?php

<PHP-Quellcode>

echo '<HTML-Quellcode>';

<PHP-Quellcode>

?>


RE: PHP Problem - Thomas - 07.09.2011 13:40

Du solltest einen Layer Code besser in den Footer einbauen und zwar vor den tag </body>.


RE: PHP Problem - Damian - 07.09.2011 13:43

Thomas schrieb:
Du solltest einen Layer Code besser in den Footer einbauen und zwar vor den tag </body>.


Ja das ist klar

nur möchte ich das das Layer nur für Gäste sichtbar ist

Dieses Plugin ist schon so gecodet das es nur Gäste sehen

Wenn der Code also davor steht sehen das Layer nur die Gäste Wink


RE: PHP Problem - 27United SP - 07.09.2011 13:57

könntest die Gäste eine Id 0 geben z.b.: und den Usern ID 1.

Einfache IF abfrage fertig Wink

Hatte ich auch schon mal dran gebastelt Smile


RE: PHP Problem - Damian - 07.09.2011 16:19

So Maurice hat mit ein extra Addon geschrieben

Danke dafür Smile

Closed