TIME STAMP TEST

[insert_php] global $current_user;
global $wpdb;
$thisuser = get_current_user_id();
if (is_user_logged_in())
{ $user_role = $current_user->roles[0]; }
if ($user_role == “administrator”)
{ $wpdb->show_errors(); }
$criteria = $_GET[‘c’];
$query = $_GET[‘q’];
$start = $_GET[‘n’];
$id = $_GET[‘id’];
$showlogin = 0;

$livelink = ““;
$baseurl = “http://www.pitchdeck.asia/time-stamp-test?”;
$pagurl = “http://www.pitchdeck.asia/time-stamp-test”;
$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”
);

$searchbar = “πŸ” “;

///OLD $searchbar .= “Recent | Featured | Category | Country“;
$searchbar .= “Popular | On Air | Recent | Your Follow List“;

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

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"; } elseif ($criteria=="popular") { $title = "Popular 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 10"; } elseif ($criteria=="recent") { $title = "Recent 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 TIMESTAMPDIFF(hour,now(),showtime) <= 0 order by showtime desc limit 10"; } 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″;
}
elseif ($criteria==”mylist”)
{
$title = “Startups You Follow”;

if ($thisuser)
{
if ($id)
{///ADD OR DELETE ENTRY
$fsql = “SELECT followid from wpen_follow where userid=$thisuser and companyid=$id”;
if ($followresult = $wpdb->get_row($fsql,OBJECT))
{
//hasresult
$followid = $followresult -> followid;
$wpdb->delete(‘wpen_follow’, array( ‘userid’ => $thisuser, ‘companyid’ => $id ) );
}///RESULT REMOVE
else
{
//noresult
$wpdb ->insert(‘wpen_follow’, array(‘followid’=>”,’userid’=>$thisuser,’companyid’=>$id));
}///NO RESULT ADD
}///END HAS ID
$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, wpen_follow WHERE wpen_follow.companyid=wpen_company.id and wpen_follow.userid=$thisuser and wpen_founder.id=wpen_shows.showf and wpen_company.id=wpen_shows.showc and wpen_category.catcode=wpen_company.category order by followid desc "; }//end is user loggedin else { $showlogin = 1; } } if ($title) { $title = $title . " on Pitchdeck Asia TV"; echo "

” . $title . “

“;
echo “

” . $searchbar . “

“;
if ($submenu)
{
echo “

” . $submenu . “

“;
}
echo “

“;
}

if ($showlogin)
{
echo “

πŸ—³οΈ Login with Linkedin to VOTE

“;
}
else
{
////THE LOOP
$result = $wpdb->get_results($sql, OBJECT);
foreach ($result as $key => $value) {

$showid = $value -> showid;
$hasyoutube = $value -> showyoutube;
$hasthumbnail = $value -> showthumbnail;
$deck = $value -> showpitchdeck;
$showc = $value -> showc;
$showf = $value -> showf;
$f1name = $value -> f1name;
$f2name = $value -> f2name;
$cname = $value -> cname;
$diff = $value -> diff;
$diff2 = $value -> diff2;
$solution = $value -> solution;
$catcode = $value -> catcode;
$category = $value -> catdesc;
$linkedin = $value -> linkedin;
$country = $value -> country;
$round = $value -> round;
$showtime = $value -> showtime;
$companyid = $showc;
$founderid = $showf;

$followsql = “SELECT COUNT(*) as numfollowers FROM wpen_follow WHERE companyid=$companyid”;
if ($followsqlresult = $wpdb->get_row($followsql,OBJECT))
{ $numfollowers = $followsqlresult -> numfollowers;
}

$updatequery = “UPDATE wpen_company SET cfollows = $numfollowers WHERE wpen_company.id = $companyid”;
$wpdb->query($updatequery);

if ($user_role==”administrator”)
{
$adminedit = “

“;
}

if (!$fundstage = $xs[$round])
{ $fundstage = “TBC”; }

if ($hasyoutube)
{
//youtube exists
if ($id) { $youtube_show= “

Click Play to watch video

“; }
else { $youtube_show = “” . wp_get_attachment_image($hasthumbnail, $size = ‘large’) . “
“; }
}
else
{
///youtube doesn’t exist
$youtube_show = “” . wp_get_attachment_image($hasthumbnail, $size = ‘large’) . “

Startup will record Video Pitch soon

“;
$youtube_noshow = “” . wp_get_attachment_image($hasthumbnail, $size = ‘large’) . “

Startup will record Video Pitch soon

“;
}

//////////FOUNDER
$foundername = $f1name . ” ” . $f2name;
$founderurl_show = “Linkedin Profile“;
$founderurl_noshow = “$foundername”;

/////DECK
if ($deck)
{
$deckstring_show = “ Pitch deck“;
$deckstring_noshow = “Pitch deck πŸ”’”;
}//end if DECK
else
{
$deckstring_show = “Pitch deck TBC”;
$deckstring_noshow = “Pitch deck TBC”;
}
/////DECK

////CHECK IF LIVE
$live = “”;
if ($diff > 47) {
$livedays = floor($diff/24);
$live = “

πŸ”΄ ” . $livelink . “I am going LIVE in $livedays days (subscribe to Youtube)

“;
}
elseif ($diff > 23 && $diff < 48) { $live = "

πŸ”΄ ” . $livelink . “Watch me LIVE tomorrow

“; }
elseif ($diff > 1) { $live = “

πŸ”΄ ” . $livelink . “Watch me LIVE in $livediff hours

“; }
elseif ($diff == 1) { $live = “

πŸ”΄ ” . $livelink . “Watch me LIVE in just over 1 hour

“; }
elseif ($diff == 0) { $live = “

πŸ”΄ ” . $livelink . “Watch me LIVE in just under 1 hour

“; }
elseif ($diff > -1) {$live = “

πŸ”΄ ” . $livelink . “Watch me LIVE NOW

“; }
else {};
if ($live) { $livetop = “

πŸš€ON AIR: ” . date(“F jS, Y ⏰ g:i a”, strtotime($showtime)) . “

“; } else { $livetop = “”; }

/////LIVE

$fsql = “SELECT followid from wpen_follow where userid=$thisuser and companyid=$companyid”;
if ($followresult = $wpdb->get_row($fsql,OBJECT)) { $fol = “Unfollow”; }
else { $fol = “Follow”; }
$followstring = “$fol this Startup“;

/////VIEWS LOOP
$eventattendee=””;
//echo “USER ROLE: $user_role”;
if ($user_role==”administrator”)
{
//echo “ADMIN VIEW”;
$founderurl_final = $founderurl_show;
$fundamount_final = $fundamount_show;
$adminedit_final = $adminedit_show;
$deckstring_final = $deckstring_show;
$qastring_final = “Member Q & A”;
if ($event_show) { $event_final = $event_show; }
$youtube_final = $youtube_show;

}
elseif ($user_role==”investor” && $d<4) { //echo "INVESTOR VIEW WITHIN 3 DAYS"; $founderurl_final = $founderurl_show; $fundamount_final = $fundamount_show; $qastring_final = "Member Q & A"; $adminedit_final = $adminedit_noshow; $deckstring_final = $deckstring_show; if ($event_show) { $event_final = $event_show; } $youtube_final = $youtube_show; } elseif ($d<1) { //echo "PUBLIC VIEW LIVE OR FINISHED"; $founderurl_final = $founderurl_noshow; $qastring_final = "Member Q & A πŸ”’"; $fundamount_final = $fundamount_noshow; $adminedit_final = $adminedit_noshow; $deckstring_final = $deckstring_noshow; if ($eventshow) { $event_final = $event_show; } $youtube_final = $youtube_show; } else { //echo "CANNOT VIEW"; $founderurl_final = $founderurl_noshow; $qastring_final = "Member Q & A πŸ”’"; $fundamount_final = $fundamount_noshow; $adminedit_final = $adminedit_noshow; $deckstring_final = $deckstring_noshow; if ($event_show) { $event_final = $event_show; } $youtube_final = $youtube_show; } /////VIEWS LOOP if (!$id || $criteria=="mylist") { echo "

$cname – $f1name $f2name

“; }
else
{ echo “

$cname – $f1name $f2name

“; }

echo $livetop;
echo $live;

/////PRINTOUT

echo “

“;
echo “
“;
echo “
“;
echo $youtube_final;

if ($id)
{
echo “[skipto time=7:50]TIME STAMP 1[/skipto]”;
}

echo “

“;
echo “
“;
echo “[wp-svg-icons icon=’heart’ wrap=’i’] $followstring
“;

if ($user_role==”administrator”)
{ echo “[wp-svg-icons icon=’heart’ wrap=’i’] $numfollowers followers
“;
}

echo “[wp-svg-icons icon=’user-3′ wrap=’i’] $founderurl_final
“;
echo “[wp-svg-icons icon=’globe’ wrap=’i’] $country
“;
echo “[wp-svg-icons icon=’stats’ wrap=’i’] $fundstage
“;
echo “[wp-svg-icons icon=’tree’ wrap=’i’] $category
“;

//echo “[wp-svg-icons icon=’tree’ wrap=’i’] ” . $category . “
“;
echo “[wp-svg-icons icon=’wrench’ wrap=’i’] $solution
“;
echo “[wp-svg-icons icon=’download’ wrap=’i’] $deckstring_final”;
echo “

“;
echo “
“;
echo “
“;

if ($adminedit)
{
echo $adminedit;
}

if (!$criteria)
{
echo “

“;
echo “
“;
echo “
“;
echo “

Management TeamπŸ”’

“;
echo “

“;
echo “
“;
echo “

List of InvestorsπŸ”’

“;
echo “

“;
echo “
“;
echo “

List of AdvisorsπŸ”’

“;
echo “

“;
echo “
“;
echo “
“;

if ($user_role==”administrator”)
{
$followers_string=””;
if (!$followers_start) { $followers_start = 0; }
$followers_sql = “SELECT userid, wpen_users.display_name from wpen_follow, wpen_users where companyid=$companyid and wpen_users.ID=wpen_follow.userid order by followid desc limit $followers_start,25”;
$followers_result = $wpdb->get_results($followers_sql, OBJECT);
foreach ($followers_result as $key => $followers_value) {
$followers_id = $followers_value -> userid;
$followers_displayname = $followers_value -> display_name;

$followers_string .= “[wp-svg-icons icon=’user-3′ wrap=’i’] ” . $followers_displayname . “
“;
}

echo “

“;
echo “
“;
echo “[wp-svg-icons icon=’heart’ wrap=’i’] Followers of this Startup:
“;
echo $followers_string;
echo “
“;
echo “
“;
}

if ($user_role==”administrator”)
{
echo “

“;
echo “
“;
echo “[wp-svg-icons icon=’user-3′ wrap=’i’] We are hiring for 1 role:
UX Designer”;
echo “
“;
echo “
“;
}

if ($user_role==”administrator”)
{
echo “

“;
echo “
“;
echo “[wp-svg-icons icon=’coin’ wrap=’i’] Funding Data:
(Pre-Seed) 2018 Mar – Undisclosed
(Seed) 2018 Dec – US$ 1.2 million
“;
echo “
“;
echo “
“;
}

if ($user_role==”administrator”)
{
echo “

“;
echo “
“;
echo “[wp-svg-icons icon=’calendar’ wrap=’i’] Events:
(Speaking) 2019 Mar – Echelon Singapore
(Attending) 2019 Mar – Founders Day Meetup”;
echo “
“;
echo “
“;
}

if ($user_role==”administrator”)
{
echo “

“;
echo “
“;
echo “[wp-svg-icons icon=’bubbles-2′ wrap=’i’] Member Q & A”;
echo “
“;
echo “
“;
}

}//end l=0

///////////////////PRINTOUT
}//////////END FOREACHLOOP
}////END SHOW LOGIN

echo “

“;

if ($id && !$showlogin && !$criteria)
{
echo “

Pitchdeck Resources for Startup Founders

“;
}

[/insert_php]