[insert_php] global $current_user;
global $wpdb;
global $sql;
global $showlogin;
global $start;
global $access;
global $thisuser;
global $baseurl;
global $pagurl;
global $showurl;

///access 5 = god admin
///access 4 = profile owner
///access 3 = management team
///access 2 = investor
///access 1 = advisor / temp access

$criteria = $_GET[‘c’];
$query = $_GET[‘q’];
$start = $_GET[‘n’];
$id = $_GET[‘id’];
$claim = $_GET[‘claim’];
$addme = $_GET[‘addme’];
$n = $_GET[‘n’];
if (!$n) { $n=0; }

$showlogin = $_GET[‘showlogin’];

$approveid = $_GET[‘approveid’];
$thisuser = get_current_user_id();

if ($id && !$criteria)
{ $singlepost = 1; }
else { $singlepost = 0; }

$claimstatus=0;
$results_limit = 100;
$results_limit_string = “top” . $results_limit;
if (!$start) { $start = 0; }
if ($start > $results_limit-10) { $start = $results_limit-10; }
if (!$limit) { $limit = 10; }
$livelink = ““;
$baseurl = “http://www.pitchdeck.asia/pitchdeck-asia-startups2?”;
$showurl = “http://www.pitchdeck.asia/show?”;
$pagurl = “http://www.pitchdeck.asia/pitchdeck-asia-startups2”;
$xs=array(
“1” => “Pre-Seed”,
“2” => “Seed”,
“3” => “Pre-Series A”,
“4” => “Series A”,
“5” => “ICO”,
“6” => “IPO”,
“S” => “Self Funded”,
“C” => “Just Closed”,
“N” => “Not Raising”
);

//get stage

$stage=”“;

if (is_user_logged_in())
{ $user_role = $current_user->roles[0]; }
if ($user_role == “administrator”)
{
$wpdb->show_errors();
$access = 5;
}

///get company details
$csql = “SELECT id,country FROM `wpen_company`,wpen_shows where country!=” and wpen_shows.showc=wpen_company.id group by country”;
$result = $wpdb->get_results($csql, OBJECT);
$company_drop= ““;

//GET CATEGORY DETAILS

$categorysql = “SELECT catid,catcode,catdesc FROM `wpen_category`”;
$result = $wpdb->get_results($categorysql , OBJECT);
$category_drop= ““;

$searchbar = “

🔍 “;

///OLD $searchbar .= “New | Featured | Category | Country“;
///$searchbar .= “Top $results_limit | On Air | New | My Follow List“;
//$searchbar .= $company_drop.” | “.$category_drop. ” | “.$stage.”

“;
$searchbar .= $company_drop.”

|

“.$category_drop. “

|

“.$stage.”

“;

if ($thisuser)
{
$extra = “SELECT wpen_company.cname, showid FROM wpen_claim, wpen_company, wpen_shows WHERE claimuserid=$thisuser and claimtype=4 and claimstatus=2 and claimcompanyid=wpen_company.id and wpen_shows.showc=wpen_company.id order by wpen_shows.showtime desc limit 1″;
if ($extraresult = $wpdb->get_row($extra,OBJECT))
{
//owns profile
$extraname = $extraresult -> cname;
$extrashowid = $extraresult -> showid;
$searchbar .= ” | $extraname“;
}
}

if (!$criteria && !$id)
{ $criteria = “new”; }

if (!$criteria)
{
if (!$id) { $id = 1; }
$sql = “SELECT showid, showyoutube, showthumbnail, showpitchdeck, showc, showf, f1name, f2name, cname, TIMESTAMPDIFF(hour,now(),showtime) as diff, IF(TIMESTAMPDIFF(hour,now(),showtime)<-1, TIMESTAMPDIFF(hour,showtime,now())+5000, TIMESTAMPDIFF(hour,now(),showtime)) as diff2, solution, catcode, catdesc, linkedin, wpen_company.country, round, showtime FROM wpen_shows, wpen_founder, wpen_company, wpen_category WHERE wpen_shows.showid = $id and wpen_founder.id=wpen_shows.showf and wpen_company.id=wpen_shows.showc and wpen_category.catcode=wpen_company.category order by showtime asc limit 1"; $title = "Startups"; }/////END !CRITERA elseif ($criteria==$results_limit_string) { $title = "Most Followed Startups"; $sql = "SELECT showid, showyoutube, showthumbnail, showpitchdeck, showc, showf, f1name, f2name, cname, TIMESTAMPDIFF(hour,now(),showtime) as diff, IF(TIMESTAMPDIFF(hour,now(),showtime)<-1, TIMESTAMPDIFF(hour,showtime,now())+5000, TIMESTAMPDIFF(hour,now(),showtime)) as diff2, solution, catcode, catdesc, linkedin, wpen_company.country, round, showtime FROM wpen_shows, wpen_founder, wpen_company, wpen_category WHERE wpen_founder.id=wpen_shows.showf and wpen_company.id=wpen_shows.showc and wpen_category.catcode=wpen_company.category order by cfollows desc limit $start, $limit"; $total_sql = "SELECT count(*) as total_records FROM wpen_shows, wpen_founder, wpen_company, wpen_category WHERE wpen_founder.id=wpen_shows.showf and wpen_company.id=wpen_shows.showc and wpen_category.catcode=wpen_company.category"; }/////END RESULTS_LIMIT elseif ($criteria=="new") { $title = "New Startups"; $cond=""; if($_REQUEST['country']!="") $cond=" and wpen_company.country='".str_replace('-', ' ', $_REQUEST['country'])."'"; if($_REQUEST['category']!="") $cond=" and wpen_category.catcode='". $_REQUEST['category']."'"; if($_REQUEST['stage']!="") $cond=" and round='". $_REQUEST['stage']."'"; if($_REQUEST['stage']=="TBC") $cond=" and round NOT IN ( '" . implode( "', '" , $arr_stage) . "' )"; $sql = "SELECT showid, showyoutube, showthumbnail, showpitchdeck, showc, showf, f1name, f2name, cname, TIMESTAMPDIFF(hour,now(),showtime) as diff, IF(TIMESTAMPDIFF(hour,now(),showtime)<-1, TIMESTAMPDIFF(hour,showtime,now())+5000, TIMESTAMPDIFF(hour,now(),showtime)) as diff2, solution, catcode, catdesc, linkedin, wpen_company.country, round, showtime FROM wpen_shows, wpen_founder, wpen_company, wpen_category WHERE wpen_founder.id=wpen_shows.showf and wpen_company.id=wpen_shows.showc and wpen_category.catcode=wpen_company.category and wpen_shows.showid>105 “.$cond.” order by diff2 asc limit $n, 10″;

$total_sql = “SELECT count(*) as total_records FROM wpen_shows, wpen_founder, wpen_company, wpen_category WHERE wpen_founder.id=wpen_shows.showf and wpen_company.id=wpen_shows.showc and wpen_category.catcode=wpen_company.category and wpen_shows.showid>105 “.$cond.” “;

}
elseif ($criteria==”live”)
{
$title = “Watch Live Shows coming up”;
$sql = “SELECT showid, showyoutube, showthumbnail, showpitchdeck, showc, showf, f1name, f2name, cname, TIMESTAMPDIFF(hour,now(),showtime) as diff, IF(TIMESTAMPDIFF(hour,now(),showtime)<-1, TIMESTAMPDIFF(hour,showtime,now())+5000, TIMESTAMPDIFF(hour,now(),showtime)) as diff2, solution, catcode, catdesc, linkedin, wpen_company.country, round, showtime FROM wpen_shows, wpen_founder, wpen_company, wpen_category WHERE wpen_founder.id=wpen_shows.showf and wpen_company.id=wpen_shows.showc and wpen_category.catcode=wpen_company.category and TIMESTAMPDIFF(hour,now(),showtime) >= -48 order by diff2 asc limit 10″;
}/////END LIVE

elseif ($criteria==”ai”)
{
$title = “AI Powered Startups”;
$sql = “SELECT showid, showyoutube, showthumbnail, showpitchdeck, showc, showf, f1name, f2name, cname, TIMESTAMPDIFF(hour,now(),showtime) as diff, IF(TIMESTAMPDIFF(hour,now(),showtime)<-1, TIMESTAMPDIFF(hour,showtime,now())+5000, TIMESTAMPDIFF(hour,now(),showtime)) as diff2, solution, catcode, catdesc, linkedin, wpen_company.country, round, showtime FROM wpen_shows, wpen_founder, wpen_company, wpen_category WHERE wpen_founder.id=wpen_shows.showf and wpen_company.id=wpen_shows.showc and wpen_category.catcode=wpen_company.category and wpen_company.solution LIKE '%AI %' order by cfollows desc limit $start, $limit"; $total_sql = "SELECT count(*) as total_records FROM wpen_shows, wpen_founder, wpen_company, wpen_category WHERE wpen_founder.id=wpen_shows.showf and wpen_company.id=wpen_shows.showc and wpen_category.catcode=wpen_company.category and wpen_company.solution LIKE '%AI %'"; }/////END RESULTS_LIMIT elseif ($criteria=="HRT") { $title = "HRTech Startups"; $sql = "SELECT showid, showyoutube, showthumbnail, showpitchdeck, showc, showf, f1name, f2name, cname, TIMESTAMPDIFF(hour,now(),showtime) as diff, IF(TIMESTAMPDIFF(hour,now(),showtime)<-1, TIMESTAMPDIFF(hour,showtime,now())+5000, TIMESTAMPDIFF(hour,now(),showtime)) as diff2, solution, catcode, catdesc, linkedin, wpen_company.country, round, showtime FROM wpen_shows, wpen_founder, wpen_company, wpen_category WHERE wpen_founder.id=wpen_shows.showf and wpen_company.id=wpen_shows.showc and wpen_category.catcode=wpen_company.category and wpen_company.category = 'HRT' order by cfollows desc limit $start, $limit"; $total_sql = "SELECT count(*) as total_records FROM wpen_shows, wpen_founder, wpen_company, wpen_category WHERE wpen_founder.id=wpen_shows.showf and wpen_company.id=wpen_shows.showc and wpen_category.catcode=wpen_company.category and wpen_company.category = 'HRT'"; }/////END RESULTS_LIMIT else { ///DEFAULT OR ERROR $title = "Most Followed Startups"; $sql = "SELECT showid, showyoutube, showthumbnail, showpitchdeck, showc, showf, f1name, f2name, cname, TIMESTAMPDIFF(hour,now(),showtime) as diff, IF(TIMESTAMPDIFF(hour,now(),showtime)<-1, TIMESTAMPDIFF(hour,showtime,now())+5000, TIMESTAMPDIFF(hour,now(),showtime)) as diff2, solution, catcode, catdesc, linkedin, wpen_company.country, round, showtime FROM wpen_shows, wpen_founder, wpen_company, wpen_category WHERE wpen_founder.id=wpen_shows.showf and wpen_company.id=wpen_shows.showc and wpen_category.catcode=wpen_company.category order by cfollows desc limit $start, $limit"; $total_sql = "SELECT count(*) as total_records FROM wpen_shows, wpen_founder, wpen_company, wpen_category WHERE wpen_founder.id=wpen_shows.showf and wpen_company.id=wpen_shows.showc and wpen_category.catcode=wpen_company.category"; } if ($title) { $title = $title . " on Pitchdeck Asia"; echo "

” . $title . “

“;
echo “

” . $searchbar . “

“;
if ($submenu)
{ echo “

” . $submenu . “

“; }
}///END TITLE

/////PAGINATION

///get num records query
if ($total_records_result = $wpdb->get_row($total_sql,OBJECT))
$total_num_records = $total_records_result -> total_records;
///check if need pagination

if ($total_num_records > 9)
{
if($_REQUEST[‘country’]!=””)$search=”&country=”.$_REQUEST[‘country’];
if($_REQUEST[‘category’]!=””)$search=”&category=”.$_REQUEST[‘category’];
if($_REQUEST[‘stage’]!=””)$search=”&stage=”.$_REQUEST[‘stage’];
///only show top 100
if ($total_num_records > $results_limit-1 ) { $total_num_records = $results_limit-1; }
echo “

“;
for ($loop_counter = 0; $loop_counter < $total_num_records; $loop_counter=$loop_counter+10) { $loop_start = $loop_counter+1; $loop_end = $loop_counter+10; if ($loop_counter>0) { echo ” | “; } ///add divider
echo “$loop_start – $loop_end“;
} /// for loop
echo “

“;
} // total_num_records > 9 – need pagination
echo “

“;

//////////////////////////////////////////////////////MAINLOOP

echo “
Warning: Invalid argument supplied for foreach() in /home/grahamdb/pitchdeck.asia/wp-content/plugins/post-snippets/src/PostSnippets/Shortcode.php(96) : eval()'d code on line 20
“;

echo “

“;

if (!$showlogin && $singlepost)
{
echo “

Pitchdeck Resources for Startup Founders

“;
}

[/insert_php]