Esempio n. 1
0
function sendNotify($userid, $msg, $link, $subject = null)
{
    $umail = "*****@*****.**";
    $ufname = "eDart";
    $ulname = "User";
    $domail = 1;
    //PART I: Write to the database
    $con = mysqli_connect(host(), username(), password(), mainDb());
    $q = "INSERT INTO notify(`usr`,`date`,`message`,`link`) VALUES('" . mysqli_real_escape_string($con, $userid) . "','" . mysqli_real_escape_string($con, time()) . "','" . mysqli_real_escape_string($con, $msg) . "','" . mysqli_real_escape_string($con, $link) . "')";
    //Insert a new row into the author's notifications
    mysqli_query($con, $q);
    //Execute
    $user_call = new User(array("action" => "get", "id" => $userid));
    $user_info = $user_call->run(true);
    if (count($user_info) != 0) {
        $user_info = $user_info[0];
        $umail = $user_info["email"];
        $ufname = ucwords($user_info["fname"]);
        $ulname = ucwords($user_info["lname"]);
        $domail = $user_info["do_mail"];
    }
    $greetings = array("Just wanted to let you know that:<br><br> %s. <br><br>That is all. Have a good rest of your day!", "In case you didn't know: <br><br>%s<br><br> Better go check it out.", "We hope you're having a good day! Just thought you might you want to know:<br><br> %s. <br><br>That is all. Carry on!", "Don't mean to break your flow, but we just thought you might want to know that<br><br> %s. <br><br>If you get the chance, you can check it out back at eDart. For now, live long and prosper!", "Hope your day is going splendidly! Just thought we'd let you know that:<br><br> %s. <br><br>When you have the time, check it out on eDart. Cool. For now, bye.");
    $fullmsg = sprintf($greetings[rand(0, count($greetings) - 1)], $msg);
    if ($subject == null) {
        $subject = $msg;
    }
    //PART II: Send them an email
    if ($domail == 1) {
        sendMail($umail, $ufname, $ulname, $subject, $fullmsg, $link, "View on eDart");
    }
}
Esempio n. 2
0
 function __construct($type)
 {
     global $con, $table;
     $con = mysqli_connect(host(), username(), password(), mainDb());
     switch ($type) {
         case ITEM:
             $table = "item";
             break;
         case USER:
             $table = "usr";
             break;
     }
 }
Esempio n. 3
0
 private static function match_class_code($class, $code)
 {
     $connect = mysqli_connect(host(), username(), password(), mainDb());
     if ($code) {
         $return_array = sqlToArray($connect, "SELECT `text` FROM `lookup` WHERE class={$class} AND code={$code}");
         if (count($return_array) != 0) {
             return $return_array[0]["text"];
         } else {
             return NULL;
         }
     } else {
         $return_array = sqlToArray($connect, "SELECT * FROM `lookup` WHERE class={$class}");
         return $return_array;
     }
 }
Esempio n. 4
0
 function __construct($parameters)
 {
     global $con, $argv;
     $con = mysqli_connect(host(), username(), password(), mainDb());
     $argv = $parameters;
 }
Esempio n. 5
0
<?php

$one_week_ago = strtotime("-1 weeks");
$current_date = time();
$con = mysqli_connect(host(), username(), password(), mainDb());
$user_query = mysqli_query($con, "SELECT * FROM `usr` WHERE `joindate` > " . $one_week_ago);
while ($row = mysqli_fetch_array($user_query)) {
    $message = "Hey! Welcome to eDart! ";
}
mysqli_close($con);
Esempio n. 6
0
function print_header($ctrl)
{
    check_version();
    //Check to make sure the browser is supported
    /* * * MOBILE FORMATTING AND FAVICON * * */
    $additional = "";
    //Additional things we'll be adding to the header
    //If the device is mobile...
    if (is_mobile()) {
        //...use a mobile stylesheet
        $additional .= "<link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"/scripts/css/mob/mobile.css\">";
    }
    //Changes favicon URL based on browser
    if (strpos(strtolower($_SERVER["HTTP_USER_AGENT"]), "safari")) {
        $additional .= "<link rel=\"SHORTCUT ICON\" href=\"/favicon.ico?v=2\" />";
    } else {
        $additional .= "<link rel=\"SHORTCUT ICON\" href=\"/favicon.ico\" />";
    }
    /* * * MAIN BANNER CONTENTS * * */
    $banner_contents = "";
    //If we aren't on the homepage..
    if (getcwd() !== $_SERVER["DOC_ROOT"]) {
        //Create a 'return home' or 'return to feed' button
        $text = "Return Home";
        //If we're logged in...
        if (isset($_SESSION["userid"])) {
            //...it'll be 'return to feed'
            $text = "Return to Feed";
        }
        //Add this to our banner
        $banner_contents .= "<div onclick=\"window.location='/';\" class=\"backbtn\">{$text}</div>";
    } else {
        //Make it the logo
        $banner_contents .= "<div id=\"logo\"><a href=\"/\"><img src=\"/img/logo.png\"></a></div>";
        //If we aren't logged in...
        if (!isset($_SESSION["userid"])) {
            //Display that text that shows how many members we have
            //Connect to MySQL
            $con = mysqli_connect(host(), username(), password(), mainDb());
            //Get the user count (not possible through API)
            $query = mysqli_query($con, "SELECT COUNT(*) AS count FROM `usr`");
            //Get the number of users
            $user_count = mysqli_fetch_array($query);
            $user_count = $user_count[0];
            $all_items = new Item(array("action" => "get"));
            $items_array = $all_items->run(true);
            $item_count = count($items_array);
            //...add it to the banner
            $banner_contents .= "<div id=\"subtxt\">Now with {$user_count} members worldwide.</div>";
            //Close the connection
            mysqli_close($con);
        }
    }
    $add_box = "";
    //If we are going to show the login/profile panel...
    if ($ctrl) {
        //If the user is logged in
        if (isset($_SESSION["userid"])) {
            //Print their control panel and search box
            $banner_contents .= get_search_box();
            $banner_contents .= get_profile_box($_SESSION["userid"]);
            //$add_box 		 .= get_add_box();
        } else {
            //Print the login box
            $banner_contents .= get_login_box();
        }
    }
    $user_menu = get_user_menu();
    /* * * MAIN HEADER * * */
    $header = <<<HEAD
\t\t\t\t\t<meta http-equiv="X-UA-Compatible" content="IE=edge" />
\t\t\t\t\t<meta name="viewport" content="width=device-width, initial-scale=1.0" />
\t\t\t\t\t<meta name="description" content="eDart is a first-of-its-kind, completely web-based, universal trading application for WPI students." /> 
\t\t\t\t\t<meta name="keywords" content="edart,beta,bartering,tradegrouper,trade,trading,tradby,college,worcester,polytechnic,institute,wpi,2013,free,online,database" /> 
\t\t\t\t\t<meta name="robots" content="index, follow" /> 
\t\t\t\t\t<meta name="Headline" content="Welcome to eDart!">
\t\t\t\t\t<meta name="CPS_SITE_NAME" content="Welcome to eDart!">
\t\t\t\t\t<meta property="og:title" content="eDart is a first-of-its-kind, completely web-based, universal trading application for WPI students."> 
\t\t\t\t\t<meta property="og:type" content="website"> 
\t\t\t\t\t<meta property="og:description" content="eDart is a first-of-its-kind, completely web-based, universal trading application for WPI students.">
\t\t\t\t\t<meta property="og:site_name" content="eDart">
\t\t\t\t\t<meta charset="UTF-8">

\t\t\t\t\t<noscript>
\t\t\t\t\t\t<meta http-equiv="refresh" content="0;URL=/noscript.php">
\t\t\t\t\t</noscript>

\t\t\t\t\t<link rel="stylesheet" type="text/css" media="screen" href="/files/fonts/Vegur/stylesheet.css">
\t\t\t\t\t<link rel="stylesheet" type="text/css" media="screen" href="/files/fonts/Titillium/stylesheet.css">
\t\t\t\t\t<link rel="stylesheet" type="text/css" media="screen" href="/lib/min/?g=css">

\t\t\t\t\t<script>
\t\t\t\t\t\tdocument.cookie='';

\t\t\t\t\t\t(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
\t\t\t\t\t\t(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
\t\t\t\t\t\tm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
\t\t\t\t\t\t})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

\t\t\t\t\t\tga('create', 'UA-44057002-1', 'wewanttotrade.com');
\t\t\t\t\t\tga('send', 'pageview');
\t\t\t\t\t</script>

\t\t\t\t\t{$additional}
\t\t\t\t\t{$add_box}
\t\t\t\t\t{$user_menu}

\t\t\t\t\t<div id="bpho" style="height:60px;width:100%;">
\t\t\t\t\t\t<div id="banner">
\t\t\t\t\t\t\t{$banner_contents}
\t\t\t\t\t\t</div>
\t\t\t\t\t</div>
HEAD;
    echo $header;
    //Print the header
}