Jump to content

unemployment

Members
  • Posts

    746
  • Joined

  • Last visited

Posts posted by unemployment

  1. I'm currently running a ubuntu server which I had setup by some guy in the UK.  I don't know much about server configuration and would like to know more.  I was wondering if I could get some opinions on how to configure the best server.  I'd like to run apache, mysql, php, python, ruby, postfix, (maybe roundcube or someother better mail solution if you know of one).  I was thinking about leasing another VPS from http://virpus.com/budget-vps/ .  Let me know if there are any better solutions out there and point me towards some tutorials if you know of any that are really easy to work with.

  2. I'm not sure how to solve this codeigniter error.

     

    Error: Fatal error: Call to a member function library() on a non-object.

     

    Controller

     

    public function index()
    {
    	$this->load->helper('url');
    
    	$this->load->library('header');
    
    	$data['title'] 			= $this->header->get_page_name();
    	$data['gutter_value'] 	= $this->header->get_gutter_value();
    	$data['js_page'] 		= $this->header->get_js_page_file();
    	$data['page'] 			= $this->header->page;
    	$data['index_page'] 	        = $this->header->index_page;
    	$data['nav_names'] 		= $this->header->nav_names;
    	$data['banner_img']		= $this->header->get_banner_img();
    
    	$this->load->view('includes/header', $data);
    
    	$this->load->view('about/about_view');
    
    	$this->load->view('includes/footer');
    }
    

     

    Library File

     

    <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    
    class Header{
    
    var $page 			= '';
    var $index_page 	= '';
    var $nav_names		= array();
    var $banner_imgs 	= array();
    
    public function __construct(){
    
    	$this -> index_page = 'Writing';
    	$this -> nav_names = array('Contact', 'About', 'Tools', 'Portfolio', 'Writing');
    
    	if($_SERVER['PHP_SELF'] === '/index.php')
    	{
    		$this -> page = 'Writing';
    	}
    	else
    	{
    		$this -> page = end(explode(DIRECTORY_SEPARATOR, $_SERVER['PHP_SELF']));
    	}
    }
    
    function get_page_name()
    {
    	$this->load->library('common');
    
    	$page_names = $this->common->page_names();
    
    	$title = (array_key_exists($this->page, $page_names) !== false) ? $page_names[$this->page]: '';
    
    	if (array_key_exists($this->page, $page_names) !== false)
    	{
    		$title .= " | Jason Biondo";
    	}
    
    	return $title;
    }
    
    function get_banner_img()
    {
    	$banner_imgs = array('contact.jpg', 'about.jpg', 'tools.jpg', 'portfolio.jpg', 'writing.jpg');
    
    	foreach($this->nav_names as $k => $name)
    	{
    		if(($this->page === strtolower($name)) OR ($this->uri->segment(1) === strtolower($name)))
    		{
    			$banner_img = $banner_imgs[$k];
    		}
    	}
    
    	return isset($banner_img) ? $banner_img : 'writing.jpg';
    }
    
    function get_gutter_value()
    {
    	$gutter_values 	= array('304', '228', '158', '82', '0');
    
    	foreach($this->nav_names as $k => $name)
    	{
    		if(($this->page === strtolower($name)) OR ($this->uri->segment(1) === strtolower($name)))
    		{
    			$g_value = $gutter_values[$k];
    		}
    	}
    
    	return isset($g_value) ? $g_value : 0;
    }
    
    function get_js_page_file()
    {
    	$page = $this->page;
    
    	if (file_exists("./js/pages/${page}.js"))
    	{
    		$javascript = "<script type=\"text/javascript\" src=\"./js/pages/${page}.js\"></script>";
    	}
    
    	return isset($javascript) ? $javascript : FALSE;
    }
    }
    /* End of file header.php */ 
    /* Location: ./application/libraries/header.php */
    

  3. My syntax is pretty terrrible with jQuery.  I'm very new to it. 

     

    Can someone please tell me where I went wrong?

     

             $('#nav_list').mouseout(function() {
    	$('#nav_highlight').stop().animate({
    		var value = $(this).parent().get(0).id.substring(3)
    		left: $(value)
    	  }, 300, function() {
    		// Animation complete.
    	  });
    });
    

  4. What are your errors?  Where, specifically (read: line numbers), are they appearing?  How are you trying to use your class?

     

    Error is.. Fatal error: Cannot access empty property in /home/www-data/demo.jason.com/system/core/Model.php on line 50

     

    I am trying to use my class to set up the header data I need.  Page title, navigation info, page name...

     

    There is also an error on line 21

     

    $title = (array_key_exists($this->$page, $page_names) !== false) ? $page_names[$this->$page]: '';

  5. Here is my full class.  Can anyone optimize this?  I'm still getting errors where I have my page variables and I  don't know why.

     

    <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    
    class Header_Model extends CI_Model{
    
    var $page 			= '';
    var $nav_names		= array();
    var $banner_imgs 	        = array();
    
    public function __construct(){
    	$this -> page = substr(end(explode(DIRECTORY_SEPARATOR, $_SERVER['PHP_SELF'])), 0, -4);
    	$this -> nav_names = array('Contact', 'About', 'Tools', 'Portfolio', 'Writing');
    	$this -> banner_imgs = array('contact.jpg', 'about.jpg', 'tools.jpg', 'portfolio.jpg', 'articles.jpg');
    }
    
    function get_page_name()
    {
    	$this->load->library('common');
    
    	$page_names = $this->common->page_names();
    
    	$title = (array_key_exists($this->$page, $page_names) !== false) ? $page_names[$this->$page]: '';
    
    	if (array_key_exists($this->$page, $page_names) !== false)
    	{
    		$title .= " | Jason";
    	}
    
    	return $title;
    }
    
    function get_gutter_value()
    {
    	$gutter_values 	= array('307', '230', '161', '84', '0');
    
    	foreach($nav_names as $k => $name)
    	{
    		if($this->$page === strtolower($name))
    		{
    			$g_value = $gutter_values[$k];
    		}
    		else
    		{
    			$g_value = 0;
    		}
    	}
    
    	return $g_value;
    }
    
    function get_js_page_file()
    {
    	$page = $this->$page;
    
    	if (file_exists("./assets/js/pages/${page}.js"))
    	{
    		$javascript = "<script type=\"text/javascript\" src=\"./js/pages/${page}.js\"></script>";
    	}
    
    	return $javascript;
    }
    }
    

  6. I keep running into a bunch of error when I  declare the page variable in my model.  What syntax do I need to use throughout the class?

     

    <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    
    class Header_Model extends CI_Model{
    
    var $page = substr(end(explode(DIRECTORY_SEPARATOR, $_SERVER['PHP_SELF'])), 0, -4);
    
    function get_page_name()
    {
    	$this->load->library('common');
    
    	$page_names = $this->common->page_names();
    
    	$title = (array_key_exists($page, $page_names) !== false) ? $page_names[$page]: '';
    
    	if (array_key_exists($page, $page_names) !== false)
    	{
    		$title .= " | Jason Biondo";
    	}
    
    	return $title;
    }
    
    function get_js_page_file()
    {
    	if (file_exists("./assets/js/pages/${page}.js"))
    	{
    		$javascript = "<script type=\"text/javascript\" src=\"./js/pages/${page}.js\"></script>";
    	}
    
    	return $javascript;
    }
    
    }
    

  7. Ok, I kind of understand that even though I have little experience doing that.  What do I  do with the array data at the top of the view?  What about all the other page data?  I have no idea how I should handle the output for the foreach loops.  Do I do the foreach loops in the model since it's generating data?

     

    I could really use some examples.

  8. I'm very new to MVC and I'm trying to figure out how to transition my code and I'm not sure where to place things.  It easy to want to just put everything in the view, but I know that doesn't make sense.

     

    Can you please guide me on how I should transition the rest of my code for my header? I'm currently using codeigniter.

     

    Current View

    <?php
    
    $page = substr(end(explode(DIRECTORY_SEPARATOR, $_SERVER['PHP_SELF'])), 0, -4);
    
    $title = (array_key_exists($page, $page_names) !== false) ? $page_names[$page]: '';
    
    if (array_key_exists($page, $page_names) !== false)
    {
    $title .= " | Jason Biondo";
    }
    
    $banner_imgs 	= array('contact.jpg', 'about.jpg', 'tools.jpg', 'portfolio.jpg', 'articles.jpg');
    $nav_names 		= array('Contact', 'About', 'Tools', 'Portfolio', 'Articles');
    $gutter_values 	= array('307', '230', '161', '84', '0');
    
    $alt_page = 'Articles';
    
    foreach($nav_names as $k => $name)
    {
    if($page === strtolower($name))
    {
    	$g_value = $gutter_values[$k];
    }
    }
    
    if(!isset($g_value))
    {
    $g_value = 0;
    }
    
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" dir="ltr">
    <head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <meta http-equiv="content-script-type" content="text/javascript" />
    <meta http-equiv="content-style-type" content="text/css" />
    <meta http-equiv="content-language" content="en" />
    <meta name="description" content="Jason is a serial entrepreneur that builds web applications using advanced programming technologies and unique interface design." />
    <meta name="keywords" content="jason , entrepreneur, investors, venture capitalist, angel investor, vc, ventures, private equity, startups, startup community, startup investments, investment network, raise capital, where to find capital, fund raising, venture financing, contact investors, angel fund, angel group, investment strategy, business plan" />
    <title><?=$title?></title>
    <link rel="shortcut icon" type="image/x-icon" href="/assets/img/favicon.ico" />
    <link rel="stylesheet" type="text/css" media="screen" href="/css/style.css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
    <script src="./js/jquery.validate.min.js"></script>
    <script src="./js/jquery.corner.js"></script>
    <script src="./js/init.js"></script>
    <?php
    
    if (file_exists("./assets/js/pages/${page}.js"))
    {
    	echo "<script type=\"text/javascript\" src=\"./js/pages/${page}.js\"></script>";
    }
    
    ?>
    </head>
    <body>
    <div class="header">
    	<div class="header_container">
    		<a href="/">
    			<img class="logo" src="/assets/img/logo.png" alt="Jason" title="Jason" />
    		</a>
    		<div class="navigation f_right">
    			<div class="gutter">
    				<span id="nav_highlight" class="nav_highlight" style="left: <?php echo $g_value; ?>px;"></span>
    			</div>
    			<ul>
    			<?php
    
    			foreach($nav_names as $k => $name)
    			{
    				if(is_odd($k))
    				{
    					?>
    					<li class="pike"></li>
    					<?php
    				}
    
    				?>
    				<li>
    					<a id="<?php echo strtolower($name); ?>" <?php echo (($page === strtolower($name)) || ($alt_page === $name)) ? 'class="selected"' : ''; ?> href="/<?php echo ($name === $alt_page) ? '' : strtolower($name); ?>"><?php echo $name; ?></a>
    				</li>
    				<?php
    
    				if(is_odd($k))
    				{
    					?>
    					<li class="pike"></li>
    					<?php
    				}
    			}
    
    			?>
    			</ul>
    		</div>
    	</div>
    </div>
    <div class="stripe"></div>
    <div id="content_container" class="content_container">
    	<div id="banner" class="banner">
    		<?php
    
    		foreach($nav_names as $k => $name)
    		{
    			if(($page === strtolower($name)) || ($alt_page === $name))
    			{
    				?>
    				<img src="/assets/img/banners/<?php echo $banner_imgs[$k]; ?>" />
    				<h1><?php echo $name; ?></h1>
    				<?php
    
    				break;
    			}
    
    			if($alt_page === $name)
    			{
    				?>
    				<img src="/assets/img/banners/<?php echo $banner_imgs[$k]; ?>" />
    				<h1><?php echo $name; ?></h1>
    				<?php
    			}
    		}
    
    		?>
    	</div>
    	<div class="banner_stripe"></div>
    	<div class="content">
    

     

    Current Controller

    <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    
    class Writing extends CI_Controller {
    
    public function index()
    {
    	$this->load->library('common');
    
    	$data['page_names'] = $this->common->page_names();
    	$data['is_odd'] = $this->common->is_odd();
    
    	$this->load->view('includes/header', $data);
    
    	$this->load->view('writing_view');
    
    	$this->load->view('includes/footer');
    
    	$this->output->enable_profiler(TRUE);
    }
    }
    

  9. I’m very new to CF and MVC in general, but I have been writing php for about a year.

     

    I was working through a NetTutsPlus tutorial on how to setup a template system and I already hit some road blocks that I have no idea how to solve. I want to use a template because I want to be as efficient as possible.  If it helps, here is a link to the tutorial I worked from

     

    1.  I don’t know how to change the URL structure.

    Currently the template system forces me to go to index.php/site/blog for example.

     

    2.  I don’t know how to pass in dynamic data to my header and footer using this system.

     

    3. What does extends do?  Example: “class Site extends CI_Controller”

     

    Here is my current setup…

     

    views/template.php

    <?php
    
    $this->load->view('/includes/header');
    
    $this->load->view($main_content);
    
    $this->load->view('/includes/footer');
    
    ?> 

     

    controllers/site.php

    <?php
    
    class Site extends CI_Controller{
    
    function header()
    {
      $this->load->library('common');
      $page_names = $this->common->pages();
      
      $page = substr(end(explode(DIRECTORY_SEPARATOR, $_SERVER['PHP_SELF'])), 0, -4);
      
      $title = (array_key_exists($page, $page_names) !== false) ? $page_names[$page]: '';
      
      if (array_key_exists($page, $page_names) !== false)
      {
       $title .= " | Jason Biondo";
      }
      
      $data['header_content'] = $title;
      $this->load->view('template', $data);
    }
    
    function about_us()
    {
      $data['main_content'] = 'about_us';
      $this->load->view('template', $data);
    }
    
    function blog()
    {
      $data['main_content'] = 'blog';
      $this->load->view('template', $data);
    }
    }
    
    ?>

     

    views/includes/header.php

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html lang="en" dir="ltr">
    <head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <meta http-equiv="content-script-type" content="text/javascript" />
    <title><?php echo $title; ?></title>
    </head>
    <body>
    <div id="container">  

  10. Very impressive fenway.  I just added in your sql.  You actually made the sql work correctly as what I had before wasn't even fully working though I didn't realize this until I saw your query output.  Thanks a lot.

  11. Then if would be vote.id, not vote.uid, right?

     

    I'm not sure what you mean?  However I originally wrote the sql I had it working and I believe in some cases I reference vote.uid to get all the votes from that user.

  12. " ON `vote_sent`.`uid` = `users`.`id`"

     

    doesn't make any sense to me.  Why is there no user id in the vote table?

     

    user id in the votes table is only added if the user is logged in.  If the user is not logged in then it is a public vote and no user id is recorded.  Does that make sense?

  13. I just tested your query in 5.1.41-community, and I get this error: "column ref_id cannot be null".

     

    Are you sure that query is the one you're running, or that those tables are correct?

     

    It should be.. I even tested it out.  Here is exactly what I tested.  The Create SQL that I had two posts above is the SQL I used.

     

    
    <?php
    
    mysql_connect('127.0.0.1', '', '') or die(mysql_error());
    mysql_select_db('test') or die(mysql_error());
    
    class edge
    {
    public function get_users_edge($uid)
    {
    	$users_primary_edge = $this->get_users_primary_edge($uid);
    	$users_dynamic_edge = $this->get_users_dynamic_edge($uid);
    
    	return $users_primary_edge + $users_dynamic_edge;
    }
    
    public function get_users_primary_edge($uid)
    {
    	$uid = (int)$uid;
    
    	$sql = "SELECT
    				CHAR_LENGTH(`users`.`credentials`) AS `cred_chars`,
    				CHAR_LENGTH(`users`.`specialties`) AS `spec_chars`,
    				`companies`.`companyvideo` AS `video`,
    				`investor_info`.`accredited` AS `accredited`,
    				`blog_post`.`post_count`,
    				`vote_sent`.`vote_sent_count`,
    				`inv_vote_received`.`inv_vote_received_count`,
    				`pub_vote_received`.`pub_vote_received_count`,
    				`joined_comps`.`joined_count`,
    				`ent_ref`.`ent_count`,
    				`inv_ref`.`inv_count`,
    				`company_fans`.`company_fans_count`,
    				`recommendations`.`recommendation_count`,
    				`associates`.`associate_count`
    			 FROM `users`
    			 LEFT JOIN `investor_info` ON `investor_info`.`uid` = `users`.`id`
    			 LEFT JOIN `employees` ON `employees`.`userid` = `users`.`id`
    			 LEFT JOIN `companies` ON `employees`.`companyid` = `companies`.`companyid`
    			 LEFT JOIN (
    					SELECT
    						`user_id`,
    						COUNT(`post_id`) AS `post_count`
    					FROM `blog_posts`
    				) AS `blog_post`
    			 ON `blog_post`.`user_id` = `users`.`id`
    			 LEFT JOIN (
    					SELECT
    						`uid`,
    						COUNT(`uid`) AS `vote_sent_count`
    					FROM `votes`
    				) AS `vote_sent`
    			 ON `vote_sent`.`uid` = `users`.`id`
    			 LEFT JOIN (
    					SELECT
    						`employees`.`userid`,
    						`votes`.`company_id`,
    						COUNT(`votes`.`company_id`) AS `inv_vote_received_count`
    					FROM `votes`                                
    					LEFT JOIN `companies` ON `votes`.`company_id` = `companies`.`companyid`
    					LEFT JOIN `employees` ON `employees`.`companyid` = `companies`.`companyid`
    					WHERE `employees`.`userid` = '${uid}'
    					AND `votes`.`vote_type` = 1
    				) AS `inv_vote_received`
    			 ON `inv_vote_received`.`userid` = `users`.`id`
    			 LEFT JOIN (
    					SELECT
    						`employees`.`userid`,
    						`votes`.`company_id`,
    						COUNT(`votes`.`company_id`) AS `pub_vote_received_count`
    					FROM `votes`                                
    					LEFT JOIN `companies` ON `votes`.`company_id` = `companies`.`companyid`
    					LEFT JOIN `employees` ON `employees`.`companyid` = `companies`.`companyid`
    					WHERE `employees`.`userid` = '${uid}'
    					AND `votes`.`vote_type` = 0
    				) AS `pub_vote_received`
    			 ON `pub_vote_received`.`userid` = `users`.`id`
    			 LEFT JOIN (
    					SELECT
    						`userid`,
    						COUNT(`userid`) AS `joined_count`
    					FROM `employees`
    					WHERE `userid` = '${uid}'
    				) AS `joined_comps`
    			 ON `joined_comps`.`userid` = `users`.`id`
    			 LEFT JOIN (
    					SELECT
    						`beta_keys`.`ref_id`,
    						COUNT(`beta_keys`.`ref_id`) AS `ent_count`
    					FROM `beta_keys`
    					LEFT JOIN `users` ON `users`.`id` = `beta_keys`.`userid`
    					WHERE `beta_keys`.`ref_id` = '${uid}'
    					AND `users`.`accounttype` = 1
    					AND `users`.`status` = 3
    				) AS `ent_ref`
    			 ON `ent_ref`.`ref_id` = `users`.`id`
    			 LEFT JOIN (
    					SELECT
    						`beta_keys`.`ref_id`,
    						COUNT(`beta_keys`.`ref_id`) AS `inv_count`
    					FROM `beta_keys`
    					LEFT JOIN `users` ON `users`.`id` = `beta_keys`.`userid`
    					WHERE `beta_keys`.`ref_id` = '${uid}'
    					AND `users`.`accounttype` = 0
    					AND `users`.`status` = 3
    				) AS `inv_ref`
    			 ON `inv_ref`.`ref_id` = `users`.`id`
    			 LEFT JOIN (
    					SELECT
    						`employees`.`userid`,
    						COUNT(`company_id`) AS `company_fans_count`
    					FROM `company_fans`
    					LEFT JOIN `companies` ON `company_fans`.`company_id` = `companies`.`companyid`
    					LEFT JOIN `employees` ON `employees`.`companyid` = `companies`.`companyid`
    					WHERE `userid` = '${uid}'
    				) AS `company_fans`
    			 ON `company_fans`.`userid` = `users`.`id`
    			 LEFT JOIN (
    					SELECT
    						`user_id`,
    						COUNT(`user_id`) AS `recommendation_count`
    					FROM `recommendations`
    					WHERE `user_id` = '${uid}'
    				) AS `recommendations`
    			 ON `recommendations`.`user_id` = `users`.`id`
    			 LEFT JOIN (
    					SELECT
    						`user_id`,
    						COUNT(`partner_id`) AS `associate_count`
    					FROM `partners`
    					WHERE (`user_id` = '${uid}' OR `friend_id` = '${uid}')
    					AND `approved` = 1
    				) AS `associates`
    			 ON `associates`.`user_id` = `users`.`id`
    			 WHERE `users`.`id` = '${uid}'
    			";
    
    	$result = mysql_query($sql) or die(mysql_error());
    	$row = mysql_fetch_assoc($result);
    
    	print_array($row);
    	$score = 0;
    
    	if((!empty($row['cred_chars'])) && (!empty($row['spec_chars'])))
    	{
    		$score += 200;
    	}
    
    	if(!empty($row['video']))
    	{
    		$score += 50;
    	}
    
    	if($row['accredited'] == 1)
    	{
    		$score += 100;
    	}
    
    	$score += (50 * $row['post_count']);
    	$score += (5 * $row['vote_sent_count']);
    	$score += (3 * $row['inv_vote_received_count']);
    	$score += (1 * $row['pub_vote_received_count']);
    	$score += (200 * $row['joined_count']);
    	$score += (40 * $row['ent_count']);
    	$score += (200 * $row['inv_count']);
    	$score += (10 * $row['company_fans_count']);
    	$score += (30 * $row['recommendation_count']);
    	$score += (20 * $row['associate_count']);
    
    	return $score;
    }
    
    public function get_users_dynamic_edge($uid)
    {
    	$uid = (int)$uid;
    
    	$sql = "(	
    				SELECT 
    					`users`.`id`
    				FROM partners
    				INNER JOIN `users`
    				ON `partners`.`user_id` = `users`.`id`
    				WHERE partners.friend_id = '${uid}'
    				AND `approved` = 1
    			)
    			UNION ALL
    			(
    				SELECT 
    					`users`.`id`
    				FROM `partners`
    				INNER JOIN `users`
    				ON `partners`.`friend_id` = `users`.`id`
    				WHERE `partners`.`user_id` = '${uid}'
    				AND `approved` = 1
    			)";
    
    	$result = mysql_query($sql) or die(mysql_error());
    
    	$i 		= 0;
    	$score 	= 0;
    
    	while (($row = mysql_fetch_assoc($result)) !== false)
    	{
    		$dynamic_scores[$i] = array(
    			'uid' 	=> $row['id'],
    			'score' => $this->get_users_primary_edge($row['id']),
    		);
    
    		$i++;
    	}
    
    	foreach($dynamic_scores as $k => $dynamic_score)
    	{
    		$score += $dynamic_score['score'];
    	}
    
    	return ($score * 0.1);
    }
    }
    
    $edge = new edge;
    
    print_r($edge->get_users_primary_edge(1)); 
    
    function print_array($array)
    {
    echo '<pre>', ((is_array($array)) ?  print_r($array, true): $array), '</pre>';
    }
    
    ?>
    

  14. Here is the data you should get from the sql query I gave you... ASSUMING $uid = 1

     

    Array

    (

        [cred_chars] => 4

        [spec_chars] => 4

        =>

        [accredited] =>

        [post_count] => 2

        [vote_sent_count] =>

        [inv_vote_received_count] => 1

        [pub_vote_received_count] => 1

        [joined_count] => 1

        [ent_count] =>

        [inv_count] =>

        [company_fans_count] => 4

        [recommendation_count] => 2

        [associate_count] => 7

    )

     

    Here is the updated and working SQL

     

    -- phpMyAdmin SQL Dump
    -- version 3.3.8.1
    -- http://www.phpmyadmin.net
    --
    -- Host: 127.0.0.1
    -- Generation Time: Oct 18, 2011 at 03:29 PM
    -- Server version: 5.1.49
    -- PHP Version: 5.3.8
    
    SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
    
    
    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    /*!40101 SET NAMES utf8 */;
    
    --
    -- Database: `test_db`
    --
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `beta_keys`
    --
    
    CREATE TABLE IF NOT EXISTS `beta_keys` (
      `key_id` int(11) NOT NULL AUTO_INCREMENT,
      `key` varbinary(35) NOT NULL,
      `mail` varchar(50) NOT NULL,
      `userid` int(11) DEFAULT NULL,
      `active` tinyint(1) NOT NULL DEFAULT '1',
      `gen` int(1) NOT NULL DEFAULT '1',
      `ref_id` int(11) NOT NULL DEFAULT '0',
      PRIMARY KEY (`key_id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=104 ;
    
    --
    -- Dumping data for table `beta_keys`
    --
    
    INSERT INTO `beta_keys` (`key_id`, `key`, `mail`, `userid`, `active`, `gen`, `ref_id`) VALUES
    (1, 'NZQVGRf3yTqhLpI80Udl1Xb9JMznj2oFmeD', 'jason@test.com', 1, 0, 1, 0),
    (2, 'WzJgQ3PDx10hyFwrl9biscnCf4SRkA7detK', 'davey@test.com', 4, 0, 1, 0),
    (3, 'lazDTbPYoQFRVELn3jHgys9xw1rdk8qOZWA', 'jacek@test.com', 13, 0, 1, 0),
    (4, 'KO0AVetF95LkfXDTcowS2ImspWiEjrRBqNQ', 'yellow44@test.com', 2, 0, 1, 0),
    (5, 'UEv3Rt2pbyksA7u1FSZ0JNfq5zmWGhKMxdH', 'johntllant@test.com', 11, 0, 1, 0);
    
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `blog_posts`
    --
    
    CREATE TABLE IF NOT EXISTS `blog_posts` (
      `post_id` int( NOT NULL AUTO_INCREMENT,
      `user_id` int( NOT NULL,
      `posttitle` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
      `postdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      `postimage` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
      `postcontent` text COLLATE utf8_unicode_ci NOT NULL,
      `posttags` varchar(90) COLLATE utf8_unicode_ci NOT NULL,
      `approved` int(1) NOT NULL DEFAULT '0',
      PRIMARY KEY (`post_id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ;
    
    --
    -- Dumping data for table `blog_posts`
    --
    
    INSERT INTO `blog_posts` (`post_id`, `user_id`, `posttitle`, `postdate`, `postimage`, `postcontent`, `posttags`, `approved`) VALUES
    (1, 1, 'Welcome to the Beta!', '2011-09-19 09:09:16', '', 'Please let us know what you enjoy about our software and how we can improve.<br />\r\n', '', 1),
    (2, 1, 'New Page Released:  Known Bugs', '2011-09-21 14:20:02', '', 'We hope you get more involved and vote for issues that you want fixed more promptly. Please continue to submit feedback as it is helping us make drastic feature enhancements.', '', 1);
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `companies`
    --
    
    CREATE TABLE IF NOT EXISTS `companies` (
      `companyid` int(11) NOT NULL AUTO_INCREMENT,
      `companyname` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
      `companytag` varchar(25) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
      `companywebsite` varchar(75) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
      `companyvideo` varchar(14) NOT NULL,
      `companyvideotitle` varchar(128) NOT NULL,
      `phone` varchar(25) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
      `country` int(11) NOT NULL,
      `state` int(11) NOT NULL,
      `city` varchar(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
      `industry` int(11) NOT NULL,
      `stage` int(11) NOT NULL,
      `guestviews` int(11) NOT NULL DEFAULT '0',
      `eviews` int(11) NOT NULL DEFAULT '0',
      `iviews` int(11) NOT NULL DEFAULT '0',
      `capital` int(12) NOT NULL,
      `companytype` int(1) NOT NULL,
      `ckey` varbinary(35) NOT NULL,
      `date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      PRIMARY KEY (`companyid`),
      UNIQUE KEY `companytag` (`companytag`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=13 ;
    
    --
    -- Dumping data for table `companies`
    --
    
    INSERT INTO `companies` (`companyid`, `companyname`, `companytag`, `companywebsite`, `companyvideo`, `companyvideotitle`, `phone`, `country`, `state`, `city`, `industry`, `stage`, `guestviews`, `eviews`, `iviews`, `capital`, `companytype`, `ckey`, `date_created`) VALUES
    (1, 'test', 'testt', 'http://test.com', '', '', '860-555-5555', 231, 7, 'East', 7, 2, 84, 14, 13, 100000, 1, 'wSVgTlAntKB5NURbEoLyHxZfqazCF3h9rk8', '2011-09-19 09:02:51'),
    (4, 'Nicole test', 'entrepreneurista', 'http://www.test.com', 'JMmmUWloh9o', 'entrepreneurista: Legal Shield', '312-555-1010', 231, 10, 'Tampa', 5, 2, 150, 25, 0, 10000, 1, 'tFGnUP0kL7NHOAxypYXC4oh96lfuR8esa2r', '2011-09-22 00:14:09'),
    (3, 'UPtest', 'theUPstest', 'http://www.test.com', '', '', '646-555-5555', 231, 33, 'New York', 7, 7, 86, 145, 3, 400000, 1, 'FZ9rp3jbfnPKBw0CeWx1cVivSXQ7NIDtqlH', '2011-09-21 15:35:56'),
    (8, 'Omega Storehouse', 'Alphatest', 'http://www.test.com', '', '', '+1 508 555-1463', 231, 22, 'Middleborough', 16, 4, 43, 10, 1, 500000, 1, '7EyGtZqp1k6Vwu4fJAbca9KSgIr3hOHdNMv', '2011-09-24 18:56:09');
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `company_fans`
    --
    
    CREATE TABLE IF NOT EXISTS `company_fans` (
      `fan_id` int(11) NOT NULL AUTO_INCREMENT,
      `company_id` int( NOT NULL,
      `user_id` int( NOT NULL,
      `fan_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
      PRIMARY KEY (`fan_id`),
      UNIQUE KEY `unique` (`company_id`,`user_id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=12 ;
    
    --
    -- Dumping data for table `company_fans`
    --
    
    INSERT INTO `company_fans` (`fan_id`, `company_id`, `user_id`, `fan_date`) VALUES
    (9, 8, 1, '2011-09-24 23:12:16'),
    (2, 1, 5, '2011-09-19 10:24:36'),
    (3, 1, 6, '2011-09-19 10:32:28'),
    (4, 1, 2, '2011-09-19 17:10:38'),
    (5, 3, 5, '2011-09-21 15:46:09'),
    (6, 3, 1, '2011-09-21 15:49:39'),
    (7, 3, 10, '2011-09-21 15:50:29'),
    (8, 3, 4, '2011-09-21 16:06:29'),
    (10, 1, 17, '2011-09-25 11:08:58'),
    (11, 3, 17, '2011-09-25 16:22:44');
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `employees`
    --
    
    CREATE TABLE IF NOT EXISTS `employees` (
      `employeeid` int( NOT NULL AUTO_INCREMENT,
      `userid` int( NOT NULL,
      `companyid` int( NOT NULL,
      `admin` tinyint(1) NOT NULL,
      `function` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
      `date_employed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
      PRIMARY KEY (`employeeid`),
      UNIQUE KEY `unique` (`userid`,`companyid`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=16 ;
    
    --
    -- Dumping data for table `employees`
    --
    
    INSERT INTO `employees` (`employeeid`, `userid`, `companyid`, `admin`, `function`, `date_employed`) VALUES
    (1, 1, 1, 2, 'CEO & Co-Founder', '2011-09-19 09:02:51'),
    (13, 2, 10, 2, 'Founder', '2011-09-28 05:01:26'),
    (3, 4, 1, 2, 'Developer & Co-Founder', '2011-09-19 14:24:49'),
    (7, 15, 4, 2, 'Owner/Founder', '2011-09-22 00:14:09');
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `investor_info`
    --
    
    CREATE TABLE IF NOT EXISTS `investor_info` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `investor_type` int(11) NOT NULL DEFAULT '0',
      `uid` int(11) NOT NULL,
      `capital_available` bigint(30) NOT NULL,
      `accredited` int(1) NOT NULL,
      PRIMARY KEY (`id`),
      UNIQUE KEY `uid` (`uid`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=10 ;
    
    --
    -- Dumping data for table `investor_info`
    --
    
    INSERT INTO `investor_info` (`id`, `investor_type`, `uid`, `capital_available`, `accredited`) VALUES
    (1, 0, 3, 0, 1),
    (2, 0, 6, 100, 1),
    (3, 0, 7, 0, 1),
    (4, 0, 16, 0, 2),
    (5, 0, 17, 3750, 2),
    (6, 0, 21, 0, 1),
    (7, 0, 22, 0, 2),
    (8, 0, 29, 0, 3),
    (9, 0, 39, 0, 1);
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `partners`
    --
    
    CREATE TABLE IF NOT EXISTS `partners` (
      `partner_id` int( NOT NULL AUTO_INCREMENT,
      `user_id` int( NOT NULL,
      `friend_id` int( NOT NULL,
      `approved` tinyint(1) NOT NULL DEFAULT '0',
      `approved_date` datetime NOT NULL,
      `message` text COLLATE utf8_unicode_ci,
      PRIMARY KEY (`partner_id`),
      KEY `user_id` (`user_id`,`friend_id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=60 ;
    
    --
    -- Dumping data for table `partners`
    --
    
    INSERT INTO `partners` (`partner_id`, `user_id`, `friend_id`, `approved`, `approved_date`, `message`) VALUES
    (2, 1, 3, 0, '0000-00-00 00:00:00', ''),
    (30, 1, 19, 1, '2011-09-24 21:13:39', ''),
    (3, 1, 5, 1, '2011-09-19 14:57:45', ''),
    (4, 4, 5, 1, '2011-09-19 16:01:58', ''),
    (5, 5, 6, 1, '2011-09-20 12:42:33', 'Hey I know you ... '),
    (6, 2, 6, 1, '2011-09-20 12:42:35', ''),
    (7, 1, 8, 0, '0000-00-00 00:00:00', ''),
    (8, 1, 6, 1, '2011-09-20 12:42:35', ''),
    (9, 10, 5, 1, '2011-09-20 09:58:48', ''),
    (10, 1, 2, 1, '2011-09-20 13:51:52', ''),
    (11, 1, 10, 1, '2011-09-20 12:05:03', ''),
    (12, 1, 9, 1, '2011-09-20 21:05:29', ''),
    (13, 1, 11, 1, '2011-09-20 13:54:44', ''),
    (14, 1, 12, 0, '0000-00-00 00:00:00', '');
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `recommendations`
    --
    
    CREATE TABLE IF NOT EXISTS `recommendations` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `user_id` int(11) NOT NULL,
      `rec_id` int(11) NOT NULL,
      `recommendation` text COLLATE utf8_unicode_ci NOT NULL,
      `approved` int(11) NOT NULL,
      `approved_date` datetime NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=11 ;
    
    --
    -- Dumping data for table `recommendations`
    --
    
    INSERT INTO `recommendations` (`id`, `user_id`, `rec_id`, `recommendation`, `approved`, `approved_date`) VALUES
    (2, 1, 3, 't2 yo', 0, '0000-00-00 00:00:00'),
    (6, 2, 1, 'another test', 2, '0000-00-00 00:00:00'),
    (7, 1, 4, 'Nice guy. Cant explain code but hes cool ^^', 2, '2011-10-14 11:15:03'),
    (8, 4, 1, 'testing', 2, '2011-10-18 13:22:04'),
    (10, 2, 1, 'test', 0, '0000-00-00 00:00:00');
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `users`
    --
    
    CREATE TABLE IF NOT EXISTS `users` (
      `id` int( NOT NULL AUTO_INCREMENT,
      `firstname` varchar(35) COLLATE utf8_unicode_ci NOT NULL,
      `lastname` varchar(35) COLLATE utf8_unicode_ci NOT NULL,
      `username` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
      `email` varchar(35) COLLATE utf8_unicode_ci NOT NULL,
      `password` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
      `dateofbirth` date NOT NULL,
      `gender` tinyint(1) NOT NULL,
      `accounttype` tinyint(1) NOT NULL,
      `signupdate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
      `personalweb` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
      `country` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
      `state` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
      `city` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
      `phonenumber` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
      `code` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
      `guestviews` int(11) NOT NULL DEFAULT '0',
      `eviews` int(11) NOT NULL DEFAULT '0',
      `iviews` int(11) NOT NULL DEFAULT '0',
      `credentials` mediumtext COLLATE utf8_unicode_ci,
      `specialties` mediumtext COLLATE utf8_unicode_ci,
      `mail_status` int(1) NOT NULL DEFAULT '1',
      `status` tinyint(1) NOT NULL DEFAULT '2',
      `deleted_time` int(11) DEFAULT NULL,
      PRIMARY KEY (`id`),
      KEY `firstname` (`firstname`),
      KEY `lastname` (`lastname`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=41 ;
    
    --
    -- Dumping data for table `users`
    --
    
    INSERT INTO `users` (`id`, `firstname`, `lastname`, `username`, `email`, `password`, `dateofbirth`, `gender`, `accounttype`, `signupdate`, `personalweb`, `country`, `state`, `city`, `phonenumber`, `code`, `guestviews`, `eviews`, `iviews`, `credentials`, `specialties`, `mail_status`, `status`, `deleted_time`) VALUES
    (1, 'Jason', 'test', 'jasontest', 'jason@test.com', 'd0d170def09345353d23cac6fdfd551', '1987-04-27', 1, 1, '2011-09-19 08:51:31', 'http://test.com', '231', '7', 'hartford', '860-555-5555', '67265973', 90, 97, 0, 'test', 'test', 0, 3, NULL),
    (39, 'Rick', 'snitch', 'ricksnitch', 'ricksnitch@ben.edu', '85bd1462f0646535353adbc09428042', '1960-01-01', 1, 0, '2011-10-12 17:31:23', '', '231', '22', 'Place', '9785005537', '19781606', 2, 4, 0, NULL, NULL, 1, 3, NULL),
    (2, 'sent', 'bird', 'lovebug', 'test@aol.com', '1e21afeba935353ae1c97c88418', '1988-11-02', 0, 1, '2011-09-19 09:05:59', '', '231', '7', 'test', '860-555-5591', '25971497', 47, 74, 0, 'going to be a nurse soon!', 'not computer stuff', 1, 3, NULL),
    (3, 'Woody', 'bens', 'ben', 'sgs@sg.com', 'b5ab56bd8b5f53534e9870688', '1958-10-22', 1, 0, '2011-09-19 09:14:14', '', '231', '22', 'test', '7813555000', '97424199', 16, 13, 0, NULL, NULL, 1, 3, NULL),
    (4, 'Davey', 'test', 'test', 'davey@test.com', 'ace0f9fbbe83535d90763fa02', '1992-06-09', 1, 1, '2011-09-19 09:14:30', '', '152', '', 'test', '0035555180728', '23161251', 44, 157, 0, '', 'Webdevelopment: PHP, AJAX, xHTML, JavaScript and CSS. Learning Java and XML.', 1, 3, NULL);
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `votes`
    --
    
    CREATE TABLE IF NOT EXISTS `votes` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `uid` int(11) NOT NULL,
      `ip_address` text CHARACTER SET utf8 NOT NULL,
      `company_id` int(11) NOT NULL,
      `vote_type` int(11) NOT NULL,
      `time` datetime NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=13 ;
    
    --
    -- Dumping data for table `votes`
    --
    
    INSERT INTO `votes` (`id`, `uid`, `ip_address`, `company_id`, `vote_type`, `time`) VALUES
    (1, 6, '67.86.141.160', 1, 1, '2011-09-20 12:41:23'),
    (4, 0, '12.196.12.162', 3, 0, '2011-09-21 15:50:07'),
    (9, 0, '208.66.27.18', 3, 0, '2011-09-23 20:06:52'),
    (10, 17, '66.212.204.160', 1, 0, '2011-09-25 11:09:06'),
    (11, 17, '66.212.204.160', 3, 1, '2011-09-25 16:22:53'),
    (12, 0, '12.196.12.162', 11, 0, '2011-09-29 08:11:46');
    

     

     

    However built on top of this is another method for adding points to your score.

     

    Here is the other function...

     

    public function get_users_dynamic_edge($uid)
    {
    	$uid = (int)$uid;
    
    	$sql = "(	
    				SELECT 
    					`users`.`id`
    				FROM partners
    				INNER JOIN `users`
    				ON `partners`.`user_id` = `users`.`id`
    				WHERE partners.friend_id = '${uid}'
    				AND `approved` = 1
    			)
    			UNION ALL
    			(
    				SELECT 
    					`users`.`id`
    				FROM `partners`
    				INNER JOIN `users`
    				ON `partners`.`friend_id` = `users`.`id`
    				WHERE `partners`.`user_id` = '${uid}'
    				AND `approved` = 1
    			)";
    
    	$result = mysql_query($sql) or die(mysql_error());
    
    	$i 		= 0;
    	$score 	= 0;
    
    	while (($row = mysql_fetch_assoc($result)) !== false)
    	{
    		$dynamic_scores[$i] = array(
    			'uid' 	=> $row['id'],
    			'score' => $this->get_users_primary_edge($row['id']),
    		);
    
    		$i++;
    	}
    
    	foreach($dynamic_scores as $k => $dynamic_score)
    	{
    		$score += $dynamic_score['score'];
    	}
    
    	return ($score * 0.1);
    }

     

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.