Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // setlocale ( LC_ALL, 'sv_SE.ISO8859-1');
- // if ( is_array ( $options['javascripts'] ) )
- // echo $css . '?' . filemtime ( $css );
- // first at the page
- // require ('includes/data.php');
- // $data['title'] = $profil_id . ' - SnackZon';
- // define ('ROOT', '/home/snackzon/public_html/');
- // define ('IMAGE', '/css/gfx/');
- // $_SESSION['sess_login'] = time ();
- function redirect ( $page )
- {
- if ( headers_sent () )
- {
- echo '<script type="text/javascript">window.location.href = "' . $page . '";</script>';
- exit '<meta http-equiv="refresh" content="0;url=' . $page . '" />';
- }
- else
- {
- header ('Location: ' . $page);
- exit;
- }
- }
- function online_time ()
- {
- $output = '';
- $online_secs = time () - $_SESSION['sess_login'];
- $online_days = floor ( $online_secs / 86400 );
- $online_hrs = floor (( $online_secs - $online_days * 86400 ) / 3600 );
- $online_mins = floor (( $online_secs % 3600 ) / 60 );
- if ( $online_days == 1 )
- {
- $output .= 'en dag, ';
- }
- elseif ( $online_days > 1 )
- {
- $output .= $online_days . ' dagar ';
- }
- if ( $online_hrs > 0 )
- {
- $output .= $online_hrs . ' tim, ';
- }
- if ( $online_mins > 0 )
- {
- $output .= $online_mins . ' min';
- }
- elseif ( $online_hrs == 0 && $online_days == 0 && $online_mins == 0 )
- {
- $output .= '0 min';
- }
- return '<span class="online">' . $output . '</span>';
- }
- function report_error ( $text, $type = null, $file = null, $line = null )
- {
- // $type == "sql"
- // mysql_query ( $query ) or report_error ( $query, 'sql', __FILE__, __LINE__ );
- echo '<h2>Ett fel har inträffat</h2>' . "\n";
- echo '<p>' . "\n";
- echo ( $type == 'sql') ? mysql_error () . "<br /><br />\n" : '';
- echo htmlentities ( $text ) . '<br /><br />' . "\n";
- echo $file . ' #' . $line . '</p>' . "\n";
- echo '<h2>print_r ()</h2>' . "\n";
- echo '<pre>' . "\n";
- print_r ( $text );
- echo '</pre>' . "\n";
- // logga felet
- $handle = fopen (ROOT . 'includes/error.txt', 'a+');
- $handle = fwrite ( $handle, $text . " - " . $file . " #" . $line . "\n\n");
- $handle = fclose ( $handle );
- }
- function download ( $page )
- {
- $name = ROOT . $page;
- if ( strpos ( file_get_contents ( $name ), '// download') !== false)
- {
- header ('Content-Type: application/octet-stream');
- header ('Content-Type: application/force-download');
- header ('Content-Disposition: attachment; filename="' . basename ( $name ) . '";');
- readfile ( $_GET['download'] );
- exit;
- }
- return 'You can\'t download this file';
- }
- function ie_message ()
- {
- if ( strpos ( $_SERVER['HTTP_USER_AGENT'], 'MSIE') && !strpos ( $_SERVER['HTTP_USER_AGENT'], 'MSIE 7.0'))
- {
- echo 'You use IE :(';
- }
- }
- function last_action ()
- {
- if ( check_login () )
- {
- $actions = array ('index.php' => 'Kikar in startsidan',
- 'gb.php' => 'Kollar in XXX\'s gästbok',
- 'profile.php' => 'Rotar runt på XXX\'s profil',
- 'cookies.php' => 'Läser om cookies',
- 'news.php' => 'Läser nyheter',
- 'blog.php' => 'Läser i XXX\'s underbara blogg');
- if ( in_array ( $_SERVER['PHP_SELF'], $actions ) )
- {
- $sql = "UPDATE `members` SET `action` = '" . $_SERVER['PHP_SELF'] . "' ";
- $sql .= "WHERE `id` = $_SESSION['sess_id'] LIMIT 1";
- }
- else
- {
- $sql = "UPDATE `members` SET `action` = 'Ehm?' ";
- $sql .= "WHERE `id` = $_SESSION['sess_id'] LIMIT 1";
- }
- $query = mysql_query ($sql) or
- report_error ( $sql, 'sql', __FILE__, __LINE__ );
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement