News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

SSI.php Theme load

Started by undeR., April 30, 2013, 08:39:27 AM

Previous topic - Next topic

undeR.

Why SSI.php doesnt load theme?

http://rebirthofbalkan.com/Minecraft/test.php

<?php
require_once('SSI.php');


loadUserSettings();


template_body_above();

template_body_below();

?>
   

Arantor

Because you're not supposed to do it that way.

<?php
require_once('SSI.php');

template_header();
?>


page content goes here

<?php
template_footer
();
?>
Holder of controversial views, all of which my own.


undeR.

Warning: Cannot modify header information - headers already sent by (output started at /home/rebirtho/public_html/Minecraft/test.php:1) in /home/rebirtho/public_html/Minecraft/Sources/Subs.php on line 3402

Warning: Cannot modify header information - headers already sent by (output started at /home/rebirtho/public_html/Minecraft/test.php:1) in /home/rebirtho/public_html/Minecraft/Sources/Subs.php on line 3403

Warning: Cannot modify header information - headers already sent by (output started at /home/rebirtho/public_html/Minecraft/test.php:1) in /home/rebirtho/public_html/Minecraft/Sources/Subs.php on line 3409

Warning: Cannot modify header information - headers already sent by (output started at /home/rebirtho/public_html/Minecraft/test.php:1) in /home/rebirtho/public_html/Minecraft/Sources/Subs.php on line 3412


There are errors now.

Arantor

That would imply the <?php tag is not the *very start* of the file.
Holder of controversial views, all of which my own.


undeR.

<?php
require_once('SSI.php');

template_header();

error_reporting(0);
session_start();
// Config
// Amount of times a user can refresh within time limit (seconds)
$refreshlimit "10";
$refreshtimer "30";
// End config
// Check if banned for refreshing too fast.
// If session vars dont exist then create them, else add 1 to count.
if (!isset($_SESSION['first_hit'])) {
    
$_SESSION['first_hit'] = time();
    
$_SESSION['count']     = 1;
    
$_SESSION['banned']    = false;
} else {
    
$timer $_SESSION['first_hit'] + $refreshtimer;
    
// If timer has passed then reset all
    
if (time() > $timer) {
        
$_SESSION['count']     = 0;
        
$_SESSION['first_hit'] = time();
        
$_SESSION['banned']    = false;
    } else {
        
// If timer has not passed then add 1 to refresh count
        
$_SESSION['count']++;
    }
}

// Ban user if they refresh over x times within the x second time limit
if ($_SESSION['count'] > $refreshlimit) {
    
$_SESSION['banned'] = true;
}

// If person is banned, stop loading page
if ($_SESSION['banned'] == true) {
    echo 
"<div align='center'>";
    echo 
"<h2><strong>You reloaded the page too often. Come back in ";
    echo 
$refreshtimer;
    echo 
" seconds</strong></h2>";
    echo 
"</div>";
    die();
}

// change these things

   
$server "**";
   
$dbuser "**";
   
$dbpass "**";
   
$dbname "**";
   
mysql_connect($server$dbuser$dbpass);
mysql_select_db($dbname);

$result mysql_query("SELECT * FROM banlist ORDER BY id DESC");
//This will display the most recent by id edit this query how you see fit. Limit, Order, ect.
echo "<table width=100% border=1 cellpadding=3 cellspacing=0>";

echo 
"<tr style=\"font-weight:bold\">
<td>Type</td>
<td>Name</td>
<td>Reason</td>
<td>Admin/Mod</td>
<td>Time</td>
<td>TimeTempBan</td>
<td>id</td>

</tr>"
;

while(
$row mysql_fetch_assoc($result)){

if(
$col == "#eeeeee"){
$col "#ffffff";
}else{
$col "#eeeeee";
}
echo 
"<tr bgcolor=$col>";
if(
$row['type'] == "5"){
echo 
"<td>Unban</td>";
}else{
    if(
$row['type'] == "3"){
    echo 
"<td>Kick</td>";
    }else{
        if(
$row['type'] == "2"){
        echo 
"<td>Warn</td>";
        }else{
            if(
$row['type'] == "0"){
            echo 
"<td>Banned</td>";
            }else{
                if(
$row['type'] == "1"){
                echo 
"<td>IPBanned</td>";
                }else{
                    if(
$row['type'] == "4"){
                    echo 
"<td>Fine</td>";
                    }else{
                        if(
$row['type'] == "6"){
                        echo 
"<td>Jailed</td>";
                        }else{
                            if(
$row['type'] == "9"){
                            echo 
"<td>Perma</td>";
                            }else{
                            echo 
"<td>Unknown</td>";
//Holy Epic If Statement Batman!
                            
}
                        }
                    }
                }
            }
        }
    }
}
echo 
"<td>".$row['name']."</td>";
echo 
"<td>".$row['reason']."</td>";
echo 
"<td>".$row['admin']."</td>";
//Convert Epoch Time to Standard format
$datetime date("F j, Y, g:i a"$row['time']);
echo 
"<td>$datetime</td>";
$dateconvert date("F j, Y, g:i a"$row['temptime']);  
if(
$row['temptime'] == "0"){
echo 
"<td>None</td>";
}else{
echo 
"<td>$dateconvert</td>";
}
echo 
"<td>".$row['id']."</td>";

echo 
"</tr>";
}

echo
"</table>";

template_footer();
?>


Thats all.

Arantor

Firstly, you CANNOT run your own sessions alongside SMF's. Use SMF's. (Drop your session_start() call. SSI inherit's SMF's session handler to enable checking if the user is logged in or not. loadUserSettings() is already called for you.)

Secondly, the error you're getting disagrees with you. Please attach the actual file.
Holder of controversial views, all of which my own.


undeR.

3402: header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
3403: header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
3409: header('Content-Type: text/html; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set']));
3412: header('Content-Type: text/' . (isset($_REQUEST['xml']) ? 'xml' : 'html') . '; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set']));



I deleted the session.

Arantor

No, that wasn't what the error actually said. Those headers couldn't be issued because:
Quoteoutput started at /home/rebirtho/public_html/Minecraft/test.php:1

That's flat out stating that you have something before the <?php on the first line of the script.
Holder of controversial views, all of which my own.


undeR.

Quote from: Arantor on April 30, 2013, 10:31:10 AM
No, that wasn't what the error actually said. Those headers couldn't be issued because:
Quoteoutput started at /home/rebirtho/public_html/Minecraft/test.php:1

That's flat out stating that you have something before the <?php on the first line of the script.

I dont have anything, i pasted the code in the post before.

Kindred

Also, why are you using that db call like that when the dbinfo can already be acquired and validated from your SSI call and it can (and should) be parsed through the smf dbquery routines rather than a direct, unprotected dbquery like that?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

QuoteI dont have anything, i pasted the code in the post before.

Your PHP interpreter says otherwise. Please attach the actual file.
Holder of controversial views, all of which my own.


Advertisement: