query( "SELECT `value` FROM `configuration` WHERE `setting` = '". $setting ."'" ); $fetch = $db->fetch( $query ); $value = $fetch[ 'value' ]; $value = explode( ';', $value ); switch( $setting ) { case 'scripts': foreach( $value as $val ) { if( !empty( $val ) ) { $return .= ''; } } break; case 'css': foreach( $value as $val ) { if( !empty( $val ) ) { $return .= ''; } } break; } return $return; } function output( $setting ) { global $global_vars; if( !isset( $global_vars ) && !empty( $global_vars ) ) { include( "includes/globals.php" ); } return $global_vars[ $setting ]; } function cronJob() { global $db; $query = @$db->query( "UPDATE `accounts` SET `points` = '0', `referalls` = '0'" ); $query2 = @$db->query( "TRUNCATE TABLE `addings`" ); $query = @$db->query( "UPDATE `featured` SET `days` = `days` - 1" ); return "Cronjob complete"; } function produceNavLinks() { $links = array( "Home" => "home", "News" => "news", "Top today" => "toptoday", "Members" => "members", "Help" => "help", ); foreach( $links as $link => $page ) { $return .= "". $link .""; } if( isset( $_SESSION[ 'url' ] ) ) { $return .= "Logout"; } return $return; } function produceAdminNavLinks() { if( isset( $_SESSION[ 'username' ] ) ) { $links = array( "Home" => "home", "News" => "news", "Settings" => "settings", "Logout" => "logout" ); foreach( $links as $link => $page ) { $return .= "". $link .""; } return $return; } else { return 'Please login...'; } } function produceHeader( $tpl ) { $template = file_get_contents( 'tpl/' . $tpl . '/header.tpl' ); $args = array( "{nav-links}" ); $vals = array( $this->produceNavLinks() ); $template = str_replace( $args, $vals, $template ); return $template; } function produceAdminHeader( $tpl ) { $template = file_get_contents( 'tpl/' . $tpl . '/header.tpl' ); $args = array( "{nav-links}" ); $vals = array( $this->produceAdminNavLinks() ); $template = str_replace( $args, $vals, $template ); return $template; } function addUser() { global $db; $id = $_GET[ 'id' ]; $id = $this->clean( $id ); $bulletin = $_GET['bulletin']; $bulletin = $this->clean( $bulletin); $id_b = ( isset( $_SESSION[ 'url' ] ) ) ? $_SESSION[ 'url' ] : $bulletin; $query = $db->query( "SELECT * FROM `addings` WHERE `url` = '". $id_b ."' AND `acc` = '". $id ."'" ); $num = $db->num( $query ); if( $id == $_SESSION[ 'url' ] ) { return 'Oops! You can\'t add yourself!'; } if( $num <= 0 ) { if( isset( $_SESSION[ 'url' ] ) ) { $query = $db->query( "UPDATE `accounts` SET `adds` = `adds` + 1, `points` = `points` + 1 WHERE `url` = '". $_SESSION[ 'url' ] ."'" ); $query = $db->query( "UPDATE `points_log` SET `adds` = `adds` + 1, `points` = `points` + 1 WHERE `url` = '". $_SESSION[ 'url' ] ."'" ); } elseif( isset( $bulletin ) ) { $q = $db->query( "SELECT * FROM `accounts` WHERE `url` = '". $bulletin ."'" ); $num = @$db->num( $q ); if( $num > 0 ) { $query = $db->query( "UPDATE `accounts` SET `adds` = `adds` + 1, `points` = `points` + 1 WHERE `url` = '". $bulletin ."'" ); $query = $db->query( "UPDATE `points_log` SET `adds` = `adds` + 1, `points` = `points` + 1 WHERE `url` = '". $bulletin ."'" ); } } if( !empty( $_SESSION[ 'ref' ] ) ) { $query = $db->query( "UPDATE `accounts` SET `adds` = `adds` + 1, `points` = `points` + 5 WHERE `url` = '". $_SESSION[ 'ref' ] ."'" ); $query = $db->query( "UPDATE `points_log` SET `adds` = `adds` + 1, `points` = `points` + 5 WHERE `url` = '". $_SESSION[ 'ref' ] ."'" ); } $q = $db->query( "SELECT * FROM `accounts` WHERE `url` = '". $id ."'" ); $num = @$db->num( $q ); if( $num > 0 ) { $query = $db->query( "UPDATE `accounts` SET `requests` = `requests` + 1 WHERE `url` = '". $id ."'" ); $query = $db->query( "UPDATE `points_log` SET `requests` = `requests` + 1 WHERE `url` = '". $id ."'" ); $query = $db->query( "INSERT INTO `addings` ( `url`, `acc` ) VALUES ( '" . $id_b . "', '" . $id . "' )" ); header( 'Location: http://friends.myspace.com/index.cfm?fuseaction=invite.addfriend_verify&friendID=' . $id ); } else { header( 'Location: index.php' ); } } else { $return = 'Oops! You\'ve already added this account today or you\'re trying to add yourself!'; } return $return; } function featuredMyspaces() { global $db; $date = date( "Ymd" ); $query = $db->query( "SELECT * FROM `featured` WHERE `featured_till` > '". $date ."' ORDER BY `featured_till` DESC" ); $num = @$db->num( $query ); if( $num > "0" ) { $return .= '
'; while( $f2 = $db->fetch( $query ) ) { $q2 = $db->query( "SELECT * FROM `accounts` WHERE `id` = '" . $f2[ 'url' ] . "'" ); $f = $db->fetch( $q2 ); $return .= '

'. $f2[ 'days' ] .' days left
[Add | View ]
'; } $return .= '
'; } else { $return = 'There are currently no featured Myspaces!'; } return $return; } function getUsers( $setting, $id ) { global $db; $query = $db->query( "SELECT `". $this->clean( $setting ) ."` FROM `accounts` WHERE `url` = '". $this->clean( $id ) ."'" ); $fetch = $db->fetch( $query ); return $fetch[ $setting ]; } function pointsToday( $type ) { global $db; $date = date( 'dmY' ); $query = $db->query( "SELECT * FROM `points_log` WHERE `type` = '" . $this->clean( $type ) . "' AND `date` = '" . $date . "' AND `username` = '". $_SESSION[ 'url' ] ."'" ); $num = 0; while( @$f = $db->fetch( $query ) ) { $num .= ( $num + $f[ 'amount' ] ); } return $num; } function pointsOverall( $type ) { global $db; $query = $db->query( "SELECT `". $this->clean( $type ) ."` FROM `accounts` WHERE `url` = '". $_SESSION[ 'url' ] ."'" ); $f = $db->fetch( $query ); return $f[ $type ]; } function genHome() { $page = "

" . $this->output( "site_name" ) . "

"; if( isset( $_SESSION[ 'url' ] ) ) { $page = '
'; $page .= '

[Update picture/name]
'; $page .= '
'; $page .= 'Hi '. $this->getUsers( 'name', $_SESSION[ 'url' ] ) .'
Welcome to '. $this->output( 'site_name' ) .'

Start getting points

'; $page .= '

Stats

'; $page .= '
Total
Points '. $this->pointsOverall( 'points' ) .'
Referrals '. $this->pointsOverall( 'referalls' ) .'
Requests '. $this->pointsOverall( 'requests' ) .'
Adds '. $this->pointsOverall( 'adds' ) .'
'; $page .= '
'; $page .= '

Points reset at midnight GMT.

'; $page .= '
'; $page .= '
'; } else { $page .= '
Join ' . $this->output( 'site_name' ) . ' to get thousands of friends fast! It\'s easy and free. So join ' . $this->output( 'site_name' ) . ' right now to get started! :)
Friend ID:
'; if( $_GET[ 'r' ] != '' ) { $_SESSION[ 'ref' ] = $this->clean( $_GET[ 'r' ] ); } } $page .= "

Where's my friend id?

"; $page .= '

Go to your myspace page, and in the address bar it will look like the picture above except it will be your friend id instead.

'; $page .= "

Featured (10 points)

"; $page .= $this->featuredMyspaces(); $page .= "

Members (1 point)

"; $page .= $this->randomMyspaces(); return $page; } function randomMyspaces() { global $db; $query = $db->query( "SELECT * FROM `accounts` ORDER BY `points` DESC LIMIT ". $this->output( 'random_limit' ) ); $return = '
'; while( $f = $db->fetch( $query ) ) { $return .= '

[Add | View ]
'; } $return .= '
'; return $return; } function gen404() { header( 'Location: index.php' ); } function leftNav() { $return = '
'; $member_links = array( "Get Points" => "getpoints", "Add friends" => "add", "Bulletins" => "bulletins", "Codes" => "codes" ); if( isset( $_SESSION[ 'url' ] ) ) { $return .= '

Member Links

'; foreach( $member_links as $link => $page ) { $return .= "" . $link . ""; } $return .= '
'; } $partner_links = array( "Google" => "http://www.google.com" ); $return .= '

Partners

'; foreach( $partner_links as $link => $page ) { $return .= "" . $link . ""; } $return .= '
'; return $return; } function leftAdminNav() { $return = '
'; $partner_links = array( "Google" => "http://www.google.com" ); $return .= '

Partners

'; foreach( $partner_links as $link => $page ) { $return .= "" . $link . ""; } $return .= '
'; return $return; } function login() { global $db; $id = $this->clean( $_POST[ 'friendid' ] ); if( !is_numeric( $id ) ) { $return .= '
Oops! The MySpace ID you entered is invalid
'; } else { $query = @$db->query( "SELECT * FROM `accounts` WHERE `url` = '" . $id . "'" ); $num = @$db->num( $query ); if( $num > 0 ) { $_SESSION[ 'url' ] = $id; $query = $db->query( "SELECT * FROM `accounts` WHERE `url` = '" . $id . "'" ); $fetch = $db->fetch( $query ); if( !empty( $fetch[ 'ref' ] ) ) { $_SESSION[ 'ref' ] = $fetch[ 'ref' ]; } $return .= '


Logging in...

'; $return .= ''; } else { $profile_url = "http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendID=". $id; $handle = fopen( $profile_url, "r" ); if( !$handle ) { $return = "Oh noes! Myspace is being slow, please go back and try again"; } else { $timeout = 300; ini_set( 'max_execution_time', '120' ); set_time_limit( 120 ); ini_set( 'default_socket_timeout','120' ); while( $contents = fread( $handle, '1024' ) ) { $hold .= $contents; } $pic_url = explode( '', $hold ); $pic_url = explode( '', $pic_url[1] ); $pic_url = $pic_url[0]; $pic_url = explode( 'src="', $pic_url ); $pic_url = explode( '"', $pic_url[1] ); $pic_url = $pic_url[0]; $name = explode( "", $hold ); $name = explode( "", $name[1] ); $name = trim( $name[0] ); $name = str_replace( '
', '', $name ); $name = str_replace( '
', '', $name ); $name = str_replace( '
', '', $name ); if( empty( $pic_url ) ) { preg_match( "/.*?<\s*img [^\>]*src=\"([^\">]+)/is", $hold, $match ); $pic_url = explode( "", $hold ); $pic_url = explode( '', $pic_url[1] ); $pic_url = $pic_url[0]; $pic_url = explode( 'query( "SELECT * FROM `accounts` WHERE `url` = '". $_SESSION[ 'ref' ] ."'" ); $num = @$db->num( $query ); if( $num > 0 ) { if( $query = $db->query( "INSERT INTO `accounts` ( `url`, `name`, `pic`, `ref` ) VALUES ( '". $id ."', '". $this->clean( $name ) ."', '". $this->clean( $pic_url ) ."', '". $_SESSION[ 'ref' ] ."' )" ) ) { $query = $db->query( "UPDATE `accounts` SET `referalls` = `referalls` + 1, `points` = `points` + 50 WHERE `url` = '". $_SESSION[ 'ref' ] ."'" ); $query = $db->query( "UPDATE `points_log` SET `referalls` = `referalls` + 1, `points` = `points` + 50 WHERE `url` = '". $_SESSION[ 'ref' ] ."'" ); $q = $db->query( "INSERT INTO `points_log` ( `url`, `points`, `referalls`, `adds`, `requests` ) VALUES ( '". $id ."', '0', '0', '0', '0' )" ); $_SESSION[ 'url' ] = $id; $return .= ''; } else { $return .= 'Oops! An error occured, please try again'; } } else { if( $query = $db->query( "INSERT INTO `accounts` ( `url`, `name`, `pic` ) VALUES ( '". $id ."', '". $this->clean( $name ) ."', '". $this->clean( $pic_url ) ."' )" ) ) { $q = $db->query( "INSERT INTO `points_log` ( `url`, `points`, `referalls`, `adds`, `requests` ) VALUES ( '". $id ."', '0', '0', '0', '0' )" ); $_SESSION[ 'url' ] = $id; $return .= ''; } else { $return .= 'Oops! An error occured, please try again'; } } } else { if( $query = $db->query( "INSERT INTO `accounts` ( `url`, `name`, `pic` ) VALUES ( '". $id ."', '". $this->clean( $name ) ."', '". $this->clean( $pic_url ) ."' )" ) ) { if( $db->query( "INSERT INTO `points_log` ( `url`, `points`, `referalls`, `adds`, `requests` ) VALUES ( '". $id ."', '0', '0', '0', '0' )" ) ) { $_SESSION[ 'url' ] = $id; $return .= ''; } else { $return .= 'Oops! An error occured, please try again'; } } else { $return .= 'Oops! An error occured, please try again'; } } } else { $return .= '
Oops! The MySpace ID you entered is invalid
'; } } } } return $return; } function update() { global $db; if( isset( $_SESSION[ 'url' ] ) ) { $profile_url = "http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendID=". $_SESSION[ 'url' ]; $handle = fopen( $profile_url, "r" ); $id = $_SESSION[ 'url' ]; if( !$handle ) { $return = "Oh noes! Myspace is being slow, please go back and try again"; } else { $timeout = 300; ini_set( 'max_execution_time', '120' ); set_time_limit( 120 ); ini_set( 'default_socket_timeout','120' ); while( $contents = fread( $handle, '1024' ) ) { $hold .= $contents; } $pic_url = explode( '', $hold ); $pic_url = explode( '', $pic_url[1] ); $pic_url = $pic_url[0]; $pic_url = explode( 'src="', $pic_url ); $pic_url = explode( '"', $pic_url[1] ); $pic_url = $pic_url[0]; $name = explode( "", $hold ); $name = explode( "", $name[1] ); $name = trim( $name[0] ); $name = str_replace( '
', '', $name ); $name = str_replace( '
', '', $name ); $name = str_replace( '
', '', $name ); if( empty( $pic_url ) ) { preg_match( "/.*?<\s*img [^\>]*src=\"([^\">]+)/is", $hold, $match ); $pic_url = explode( "", $hold ); $pic_url = explode( '', $pic_url[1] ); $pic_url = $pic_url[0]; $pic_url = explode( 'query( "UPDATE `accounts` SET `name` = '". $this->clean( $name ) ."', `pic` = '". $this->clean( $pic_url ) ."' WHERE `url` = '". $_SESSION[ 'url' ] ."'" ) ) { $return .= ''; } else { $return .= 'Oops! An error occured, please try again'; } } else { $return .= 'Oops! The MySpace ID you entered is invalid'; } } } else { header( 'Location: index.php' ); } return $return; } function produceContent( $tpl, $action ) { $template = file_get_contents( 'tpl/' . $tpl . '/content.tpl' ); $args = array( "{content}" ); $val = $this->leftNav(); $val .= ''; $template = str_replace( $args, $val, $template ); return $template; } function news() { global $db; $page = '

News

'; $query = $db->query( "SELECT * FROM `news`" ); $num = $db->fetch( $query ); if( $num > 0 ) { $query = $db->query( "SELECT * FROM `news`" ); while( $f = $db->fetch( $query ) ) { $page .= '

' . $f[ 'title' ] . '

'; $page .= '

' . nl2br( $f[ 'msg' ] ) . '

'; $page .= '

Posted on ' . $f[ 'date' ] . ' by ' . $f[ 'username' ] . '


'; } } else { $page .= 'There are currently no news posts!'; } return $page; } function loginForm() { global $db; if( !$_POST[ 'login' ] ) { $var = '

Login

'; $var .= '
Username:


'; $var .= 'Password:


'; $var .= '
'; $var .= '
'; return $var; } else { $username = $this->clean( $_POST[ 'user' ] ); $password = $this->encrypt( $_POST[ 'pass' ] ); $query = $db->query( "SELECT * FROM `admins` WHERE `username` = '". $username ."'" ); $num = @$db->num( $query ); if( $num > 0 ) { $fetch = $db->fetch( $query ); if( $fetch[ 'password' ] == $password ) { $_SESSION[ 'username' ] = $fetch[ 'username' ]; header( 'Location: admin.php' ); } else { $var = 'Oops! The password you entered is incorrect, please go back and try again.'; } } else { $var = 'Oops! The username you entered doesn\'t exist, please go back and try again.'; } return $var; } } function help() { global $db; $id = $_GET[ 'id' ]; $id = $this->clean( $id ); $searchterm = $_POST[ 'search' ]; $searchterm = $this->clean( $searchterm); $return .= '

Help

'; $return .= '

'; if( !isset( $id ) || empty( $id ) ) { if( $_GET[ 'ext' ] == "search" ) { if( isset( $searchterm ) && $searchterm != '' && strlen( $searchterm) > 3 ) { $query = $db->query( "SELECT * FROM `help` WHERE `msg` LIKE '%". $searchterm ."%'" ); $num = @$db->num( $query ); if( $num > 0 ) { $query = $db->query( "SELECT * FROM `help` WHERE `msg` LIKE '%". $searchterm ."%'" ); while( $f = $db->fetch( $query ) ) { $f[ 'name' ] = str_replace( "{site-name}", $this->output( 'site_name' ), $f[ 'name' ] ); $f[ 'msg' ] = str_replace( "{site-name}", $this->output( 'site_name' ), $f[ 'msg' ] ); $return .= '

' . $f[ 'name' ] . '
' . $f[ 'msg' ] . '

'; } } else { $return .= 'No topics were found that matched your search..'; } } else { $return .= 'Please enter a valid search term! (Search terms must be more than 3 characters!)'; } } else { $return .= '

' . $this->output( 'site_name' ) .'
'; $query = $db->query( "SELECT * FROM `help` WHERE `topic` = '1'" ); while( $f = $db->fetch( $query ) ) { $f[ 'name' ] = str_replace( "{site-name}", $this->output( 'site_name' ), $f[ 'name' ] ); $return .= '' . $f[ 'name' ] . '
'; } $return .= '

'; $return .= '

Statistics
'; $query = $db->query( "SELECT * FROM `help` WHERE `topic` = '2'" ); while( $f = $db->fetch( $query ) ) { $f[ 'name' ] = str_replace( "{site-name}", $this->output( 'site_name' ), $f[ 'name' ] ); $return .= '' . $f[ 'name' ] . '
'; } $return .= '

'; $return .= '

Problems
'; $query = $db->query( "SELECT * FROM `help` WHERE `topic` = '3'" ); while( $f = $db->fetch( $query ) ) { $f[ 'name' ] = str_replace( "{site-name}", $this->output( 'site_name' ), $f[ 'name' ] ); $return .= '' . $f[ 'name' ] . '
'; } $return .= '

'; } } else { $query = $db->query( "SELECT * FROM `help` WHERE `id` = '". $id ."'" ); $num = $db->num( $query ); if( $num > 0 ) { $f = $db->fetch( $query ); $f[ 'name' ] = str_replace( "{site-name}", $this->output( 'site_name' ), $f[ 'name' ] ); $f[ 'msg' ] = str_replace( "{site-name}", $this->output( 'site_name' ), $f[ 'msg' ] ); $return .= '

' . $f[ 'name' ] . '
' . $f[ 'msg' ] . '

'; } else { $return .= 'Please go back and choose a valid help topic'; } } $return .= '

'; return $return; } function adminContent() { global $db; $action = $_GET[ 'action' ]; if( isset( $_SESSION[ 'username' ] ) ) { if( empty( $action ) || $action == "home" ) { $page = '

Welcome to the administrator panel

Hello '. $_SESSION[ 'username' ] .', welcome to the administrator panel. From this panel you are able to add news and update the users that appear on the homepage.'; } switch( $action ) { case 'news': if( !$_GET[ 'ext' ] || $_GET[ 'ext' ] != "add" && $_GET[ 'ext' ] != "edit" && $_GET[ 'ext' ] != "rem" ) { $page = '

News management

- Add news
- Edit news
- Remove news
'; } else { switch( $_GET[ 'ext' ] ) { case 'add': if( !$_POST[ 'submit' ] ) { $page = '

Add news

'; $page .= '
'; $page .= 'Title:
'; $page .= '

Message:
'; $page .= '

'; $page .= '
'; } else { $title = $this->clean( $_POST[ 'title' ] ); $msg = $this->clean( $_POST[ 'msg' ] ); $date = date( "F d, Y" ); if( $query = $db->query( "INSERT INTO `news` ( `title`, `msg`, `date`, `username` ) VALUES ( '". $title ."', '". $msg . "', '". $date ."', '". $_SESSION[ 'username' ] ."' )" ) ) { $page = '

Add news

Thanks! Your post has been...well...posted.

'; } else { $page = 'Oops An error occured, please try again!'; } } break; case 'edit': if( !$_POST[ 'submit' ] ) { $page = '

Edit news

'; if( !$_GET[ 'id' ] ) { $query = $db->query( "SELECT * FROM `news`" ); $num = @$db->num( $query ); if( $num > 0 ) { while( $f = $db->fetch( $query ) ) { $page .= '- ' . $f[ 'title' ] . '
'; } } else { $page .= 'There are currently no news posts!'; } } else { $id = $_GET[ 'id' ]; $id = $this->clean( $id ); $query = $db->query( "SELECT * FROM `news` WHERE `id` = '". $id ."'" ); $f = $db->fetch( $query ); $page .= '
'; $page .= 'Title:
'; $page .= '

Message:
'; $page .= '

'; $page .= '
'; } } else { $title = $this->clean( $_POST[ 'title' ] ); $msg = $this->clean( $_POST[ 'msg' ] ); $id = $this->clean( $_POST[ 'id' ] ); $date = date( "F d, Y" ); if( $query = $db->query( "UPDATE `news` SET `title` = '" . $title . "', `msg` = '" . $msg . "' WHERE `id` = '" . $id . "'" ) ) { $page = '

Edit news

Thanks! The post has been updated.

'; } else { $page = 'Oops An error occured, please try again!'; } } break; case 'rem': if( !$_GET[ 'id' ] ) { $page = '

Remove news

'; $query = $db->query( "SELECT * FROM `news`" ); $num = @$db->num( $query ); if( $num > 0 ) { while( $f = $db->fetch( $query ) ) { $page .= '- ' . $f[ 'title' ] . '
'; } } else { $page .= 'There are currently no news posts!'; } } else { $id = $this->clean( $_GET[ 'id' ] ); if( $query = $db->query( "DELETE FROM `news` WHERE `id` = '" . $id . "'" ) ) { $page = '

Remove news

Thanks! The post has been removed.

'; } else { $page = 'Oops An error occured, please try again!'; } } break; } } break; case 'settings'; if( !$_GET[ 'ext' ] || $_GET[ 'ext' ] != 'add' && $_GET[ 'ext' ] != "rem" ) { $page .= '

Settings

- Add featured myspace
- Remove featured myspace

'; } else { switch( $_GET[ 'ext' ] ) { case 'add': if( !$_POST[ 'submit' ] ) { $page .= '

Settings

'; $page .= 'Account:
'; $query = $db->query( "SELECT * FROM `accounts`" ); $page .= ' or

Amount of days to feature for:


'; } else { $id = $_POST[ 'user' ]; $id = $this->clean( $id ); $id2 = $_POST[ 'user2' ]; $id2 = $this->clean( $id2 ); if( $id == '' ) { $id = $id2; } elseif( $id2 == '' ) { $id = $id; } $date = $_POST[ 'date' ]; $date = $this->clean( $date ); $date2 = $date; $new_date = mktime(0, 0, 0, date("m"), date("d") + $date, date("y")); $date = date("Ymd", $new_date); if( $query = $db->query( "INSERT INTO `featured` ( `url`, `featured_till`, `days` ) VALUES ( '". $id ."', '". $date ."', '". $date2 ."' )") ) { $page .= '

Settings

Thanks! The account has been featured'; } } break; case 'rem': if( !$_GET[ 'id' ] ) { $page .= '

Settings

'; $query = $db->query( "SELECT * FROM `featured`" ); $num = @$db->num( $query ); if( $num > 0 ) { while( $f = $db->fetch( $query ) ) { $q = $db->query( "SELECT `url` FROM `accounts` WHERE `id` = '". $f[ 'url' ] ."'" ); $f2 = $db->fetch( $q ); $page .= '- ' . $f2[ 'url' ] . '
'; } } else { $page .= 'There are currently no featured accounts'; } $page .= '
'; } else { $id = $_GET[ 'id' ]; $id = $this->clean( $id ); if( $query = $db->query( "DELETE FROM `featured` WHERE `id` = '" . $id . "'" ) ) { $page .= '

Settings

Thanks! The featured account has been removed!

'; } else { $page .= '

Settings

Oops! An error occured, please go back and try again.

'; } } break; } } break; case 'logout': session_destroy(); header( 'Location: admin.php' ); } return $page; } else { header( 'Location: admin.php' ); } } function produceAdminContent( $tpl, $action ) { $template = file_get_contents( 'tpl/' . $tpl . '/content.tpl' ); $args = array( "{content}" ); $val = $this->leftAdminNav(); $val .= ''; $template = str_replace( $args, $val, $template ); return $template; } function membersList() { global $db; $num = $db->num( $db->query( "SELECT * FROM `accounts`" ) ); $page .= '

Members

Total members: ' . $num . '

'; $pagenum = $this->clean( $_GET[ 'pagenum' ] ); if( !isset( $pagenum ) || $pagenum == '' ) { $pagenum = 1; } $page_rows = 25; $last = ceil( ( $num / $page_rows ) ); if( $pagenum < 1 ) { $pagenum = 1; } elseif( $pagenum > $last ) { $pagenum = $last; } $max = 'LIMIT ' . ( ( $pagenum - 1 ) * $page_rows ) . ',' . $page_rows; $query = $db->query( "SELECT * FROM `accounts` ". $max); $page .= '
'; while( $f = $db->fetch( $query ) ) { $page .= '

[view profile ]
'; } $page .= '

'; $page .= '

'; if( $pagenum != 1) { $page .= " « First | "; $page .= " "; $previous = ( $pagenum - 1 ); $page .= " « Previous "; $page .= " | "; } $page .= 'Page '. $pagenum .' of '. $last; if( $pagenum != $last ) { $next = ( $pagenum + 1 ); $page .= " | Next » "; $page .= " "; $page .= " | Last » "; } $page .= '

'; return $page; } function topToday() { global $db; $arg = $_GET[ 'arg' ]; if( $arg != "points" && $arg != "referalls" && $arg != "t_points" && $arg != "t_referalls" ) { $arg = "points"; } $page .= '

Top today

'; $page .= '

View top: '; if( $arg == "points" ) { $page .= 'points |'; } else { $page .= 'points | '; } if( $arg == "referalls" ) { $page .= 'referrals | '; } else { $page .= 'referalls | '; } if( $arg == "t_points" ) { $page .= 'total points |'; } else { $page .= 'total points | '; } if( $arg == "t_referalls" ) { $page .= 'total referrals | '; } else { $page .= 'total referrals | '; } $page .= '

'; if( $arg != "t_referalls" && $arg != "t_points" ) { $query = $db->query( "SELECT * FROM `accounts` ORDER BY `". $arg ."` DESC LIMIT 25" ); } else { if( $arg == "t_points" ) { $query = $db->query( "SELECT * FROM `points_log` ORDER BY `points` DESC LIMIT 25" ); } if( $arg == "t_referalls" ) { $query = $db->query( "SELECT * FROM `points_log` ORDER BY `referalls` DESC LIMIT 25" ); } } $page .= '
'; $there_is = "none"; while( $f = $db->fetch( $query ) ) { if( $arg == "t_referalls" || $arg == "t_points" ) { $q2 = $db->query( "SELECT * FROM `accounts` WHERE `url` = '". $f[ 'url' ] ."'" ); $f2 = $db->fetch( $q2 ); $q3 = $db->query( "SELECT * FROM `addings` WHERE `url` = '". $_SESSION[ 'url' ] ."' AND `acc` = '". $f[ 'url' ] ."'"); $num = $db->num( $q3 ); if( $num <= 0 && $_SESSION[ 'url' ] != '' ) { $there_is = "atleast one"; $page .= '

'; if( $arg == "t_referalls" ) { $page .= 'Referred: ' . $f[ 'referalls' ] . '
'; } elseif( $arg == "t_points" ) { $page .= 'Points: ' . $f[ 'points' ] . '
'; } $page .= '[view profile ]
'; } } else { $q3 = $db->query( "SELECT * FROM `addings` WHERE `url` = '". $_SESSION[ 'url' ] ."' AND `acc` = '". $f[ 'url' ] ."'"); $num = $db->num( $q3 ); if( $num <= 0 && $_SESSION[ 'url' ] != '' ) { $there_is = "atleast one"; $page .= '

'; if( $arg == "referalls" ) { $page .= 'Referred: ' . $f[ 'referalls' ] . '
'; } elseif( $arg == "points" ) { $page .= 'Points: ' . $f[ 'points' ] . '
'; } $page .= '[view profile ]
'; } } } if( $there_is != "atleast one" ) { $page .= '
There are no more people that you can add!
'; } $page .= '
'; return $page; } function getPoints() { if( isset( $_SESSION[ 'url' ] ) ) { $return .= '

How to get points

'; $return .= '
Skip this? Start adding people »
'; $return .= '

The fastest way to get points is by adding people.
You\'ll get 1 point for each member you add!
And you\'ll get 10 points per featured member you add!

'; $return .= '

The fastest way to get a lot of points is by posting bulletins! You can post bulletins with either the bulletin code or the regular code.
When someone signs up from the bulletin you post you\'ll get 50 points. Whenever someone adds a member through your bulletins you\'ll get 5 points.

'; return $return; } else { header( 'Location: index.php' ); } } function produceFooter( $tpl ) { $template = file_get_contents( "tpl/" . $tpl . "/footer.tpl" ); $args = array( '{site-name}' ); $vals = array( $this->output( 'site_name' ) ); $template = str_replace( $args, $vals, $template); return $template; } function addFriends() { global $db; if( isset( $_SESSION[ 'url' ] ) ) { $limit = $_GET[ 'limit' ]; if( $limit == "10" || $limit == "15" || $limit == "20" || $limit == "words" ) { // NULL } else { $limit = "15"; } $page = '

Add friends

'; $page .= '

View: '; if( $limit == "10" ) { $page .= '10 |'; } else { $page .= '10 | '; } if( $limit == "15" ) { $page .= '15 | '; } else { $page .= '15 | '; } if( $limit == "20" ) { $page .= '20 | '; } else { $page .= '20 | '; } if( $limit == "words" ) { $page .= 'show all'; } else { $page .= 'show all'; } $page .= '



'; if( $limit == "words" ) { $query = $db->query( "SELECT * FROM `accounts` ORDER BY `points`" ); $page .= '
'; while( $f = $db->fetch( $query ) ) { $page .= '

[Add | View ]
'; } $page .= '
'; } else { $query = $db->query( "SELECT * FROM `accounts` ORDER BY `points` LIMIT ". $this->clean( $limit ) ); $page .= '
'; while( $f = $db->fetch( $query ) ) { $page .= '

[Add | View ]
'; } $page .= '
'; } } else { header( 'Location: index.php' ); } return $page; } function codes() { global $db; if( isset( $_SESSION[ 'url' ] ) ) { $page = '

Codes

'; $page .= '

Copy the code below one of the banners and paste it onto your myspace page or a bulletin.

'; $page .= '
'; $page .= '
'; $page .= '
'; $page .= '
'; } else { header( 'Location: index.php' ); } return $page; } function bulletinCodes() { global $db; if( isset( $_SESSION[ 'url' ] ) ) { $page = '

Bulletins

'; $page .= '

Copy the code below and paste it into a bulletin. For every person added through your bulletin you\'ll get 5 points, and 50 points for every person that signs up through your bulletin.

'; $page .= '
'; } else { header( 'Location: index.php' ); } return $page; } function valid_action( $action ) { $valid_actions = array( "home", "login", "logout", "update", "getpoints", "adding", "bulletins", "codes", "add", "toptoday", "members", "news", "help" ); if( in_array( $action, $valid_actions ) ) { return true; } else { return false; } } function parse_admin_template( $tpl ) { $action = $_GET[ 'action' ]; $args = array( '{css}', '{scripts}', '{title}', '{header}', '{content}', '{footer}' ); $template = file_get_contents( 'tpl/' . $tpl . '/document.tpl' ); $val = array( $this->parse( 'css' ), $this->parse( 'scripts' ), $this->output( 'title' ), $this->produceAdminHeader( $tpl ), $this->produceAdminContent( $tpl, '404' ), $this->produceFooter( $tpl ) ); $template = str_replace( $args, $val, $template ); return $template; } function parse_template( $tpl ) { $action = $_GET[ 'action' ]; $args = array( '{css}', '{scripts}', '{title}', '{header}', '{content}', '{footer}' ); $template = file_get_contents( 'tpl/' . $tpl . '/document.tpl' ); if( $this->valid_action( $action ) || empty( $action ) ) { $action = ( empty( $action ) ) ? "home" : $action; $val = array( $this->parse( 'css' ), $this->parse( 'scripts' ), $this->output( 'title' ), $this->produceHeader( $tpl ), $this->produceContent( $tpl, $action ), $this->produceFooter( $tpl ) ); $template = str_replace( $args, $val, $template ); return $template; } else { $val = array( $this->parse( 'css' ), $this->parse( 'scripts' ), $this->output( 'title' ), $this->produceHeader( $tpl ), $this->produceContent( $tpl, '404' ), $this->produceFooter( $tpl ) ); $template = str_replace( $args, $val, $template ); return $template; } } } ?>