Beispiel #1
2
function PHPTutorials()
{
    //echo$ip=getIp();
    echo "\n<div class='container_fluid'>\n<center><table width='800'>\n    <tr>";
    openDB();
    $getPro_id = mysql_query("select * from products where product_link='php.php'");
    $split = 0;
    while ($row_pro = mysql_fetch_array($getPro_id)) {
        $prod_id = $row_pro['product_id'];
        $prod_title = $row_pro['product_title'];
        $prod_price = $row_pro['product_price'];
        $prod_image = $row_pro['product_image'];
        $pro_desc = $row_pro['product_desc'];
        $split++;
        echo "\n\t\t\t\t\t\t<td width='400' style='padding:5px;'><h3>{$prod_title}</h3>\n\t\t\t\t\t\t<br>\n\t\t\t\t\t\t<a href='../pages/details2.php?pro_id={$prod_id}'>\n\t\t\t\t\t\t<br>\n\t\t\t\t\t\t<image src='../Images/{$prod_image}' width='200' height='100'></image></a>\n\t\t\t\t\t\t<br>\n\t\t\t\t\t\t<h4><strong>Price: \$ {$prod_price}</strong></h4>\n\t\t\t\t\t\t<br><br><h4>Description:</h4><br>{$pro_desc}<br><br>\n\t\t\t\t\t\t<a href='../pages/details2.php?pro_id={$prod_id}'>Details</a>\n\t\t\t\t\t\t<a href='http://www.smcleodtech.com.au/index.php?add_cart={$prod_id}'>\n\t\t\t\t\t\t<button>Add to Cart</button></a></td>";
        if ($split % 3 == 0) {
            echo "\n\t\t\t\t\t\t</tr><tr>";
        }
    }
    cart();
    closeDB();
    echo "</tr><br>\n    </table></center>\n    </div>";
}
 public function save()
 {
     $connection = connectDB();
     $query = "UPDATE Transactions\n\t\t\t\tSET FirstName = '{$this->fname}',\n\t\t\t\tLastName = '{$this->lname}',\n\t\t\t\tEmail = '{$this->email}',\n\t\t\t\tPayment = '{$this->payment}',\n\t\t\t\tFinalToPay = '{$this->finalToPay}',\n\t\t\t\tPaypalMail = '{$this->PaypalMail}',\n\t\t\t\tBankNr = '{$this->BankNr}',\n\t\t\t\tAccountNr = '{$this->AccountNr}',\n\t\t\t\tStatusDate = '{$this->StatusDate}',\n\t\t\t\tRejectOption = '{$this->RejectOption}',\n\t\t\t\tOrderDate = '{$this->OrderDate}',\n\t\t\t\tReceptionDate = '{$this->ReceptionDate}',\n\t\t\t\tProcessedDate = '{$this->ProcessedDate}',\n\t\t\t\tPaymentDate = '{$this->PaymentDate}',\n\t\t\t\tFinishedDate = '{$this->FinishedDate}'\n\t\t\t\tWHERE id={$this->id}";
     echo $query;
     mysql_query($query);
     closeDB($connection);
 }
Beispiel #3
0
function getCountiesMap()
{
    global $mysqli;
    connectDB();
    $result_set = $mysqli->query("\n        SELECT * FROM `counties`\n        WHERE NOT(`map` = ' ')\n    ");
    closeDB();
    return resultSetToArray($result_set);
}
Beispiel #4
0
function getFile($limit)
{
    global $mysqli;
    connectDB();
    $result = $mysqli->query("SELECT * FROM `office`.`tbl_uploads` ORDER BY `ID` DESC LIMIT {$limit}");
    closeDB();
    return resultToArray($result);
}
function getList($table, $page, $pageSize)
{
    global $mysqli;
    connectDB();
    $first = ($page - 1) * $pageSize;
    $result = $mysqli->query("SELECT * FROM {$table} ORDER BY id DESC LIMIT {$first}, {$pageSize}");
    closeDB();
    return resultToArray($result);
}
Beispiel #6
0
function getFooter()
{
    ?>

</body>
</html>

<?php 
    closeDB();
}
Beispiel #7
0
function main()
{
    global $wonitorDb;
    $db = openDB($wonitorDb);
    try {
        queryDB($db);
    } catch (PDOException $e) {
        echo $e->getMessage();
    }
    closeDB($db);
}
Beispiel #8
0
function checkUser($login, $password)
{
    if ($login == "" || $password == "") {
        require_false;
    }
    $mysqli = connectDB();
    $result_set = $mysqli->query("SELECT password, activation FROM users WHERE login = '******'");
    $user = $result_set->fetch_assoc();
    $real_password = $user["password"];
    $act = $user['activation'];
    if ($act != "") {
        return false;
    }
    closeDB($mysqli);
    return $real_password == $password;
}
Beispiel #9
0
<div class="headline"><?php 
echo $buy_headline1;
?>
</div>
<div>
<?php 
include 'db.php';
include 'language.php';
$email = $_POST['buy_email'];
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
    $verbindung = connectDB();
    $abfrage = "SELECT Email\n\t\t\t\tFROM Feedback\n\t\t\t\tWHERE Email LIKE '{$email}'\n\t\t\t\tAND Reason LIKE 'Buy'\n\t\t\t\t";
    $ergebnis = mysql_query($abfrage);
    if (mysql_num_rows($ergebnis) > 0) {
        // The Email is allready in the Buy feedback
        echo $buy_text2;
    } else {
        // store the mail adress
        $insert = "INSERT INTO Feedback (Email, Reason)\n\t\t\t\t\tVALUES ('{$email}', 'Buy')";
        mysql_query($insert);
        echo $buy_text3;
        echo "<br />Email: {$email}";
    }
    closeDB($verbindung);
} else {
    include 'buy.php';
    echo "<br /><br /><br /><div class='orange'>{$buy_error1} {$email}</div>";
}
?>
</div>
Beispiel #10
0
function getItinerary($IID)
{
    $connection = initDB();
    $query;
    if ($IID == 0) {
        $query = "SELECT * FROM Itinerary";
    } else {
        $query = "SELECT * FROM Itinerary WHERE IID='" . $IID . "'";
    }
    $result = mysql_query($query);
    //or die ("Query Failed ".mysql_error());
    $itineraryID = 0;
    $itineraryData;
    while ($row = mysql_fetch_array($result)) {
        $GID = $row['GID'];
        $FID = $row['FID'];
        $SID = $row['SID'];
        //Retrieve Guest Information
        $query2 = "SELECT * FROM Guest WHERE GID='" . $GID . "'";
        $result2 = mysql_query($query2);
        $row2 = mysql_fetch_array($result2);
        $firstName = $row2['FirstName'];
        $lastName = $row2['LastName'];
        //Retrieve Travel Schedule Information
        $query3 = "SELECT * FROM Schedule WHERE SID='" . $SID . "'";
        $result3 = mysql_query($query3);
        $row3 = mysql_fetch_array($result3);
        $travelDate = $row3['Date'];
        //Retrieve Sector Information
        $query3 = "SELECT * FROM Flights WHERE FID='" . $FID . "'";
        $result3 = mysql_query($query3);
        $row3 = mysql_fetch_array($result3);
        $sourceSID = $row3['SourceSID'];
        $destSID = $row3['DestSID'];
        $fName = $row3['FName'];
        $query4 = "SELECT Sector FROM Sectors WHERE SID='" . $sourceSID . "'";
        $result4 = mysql_query($query4);
        $row4 = mysql_fetch_array($result4);
        $source = $row4['Sector'];
        $query4 = "SELECT Sector FROM Sectors WHERE SID='" . $destSID . "'";
        $result4 = mysql_query($query4);
        $row4 = mysql_fetch_array($result4);
        $dest = $row4['Sector'];
        //Build GuestItinerary object
        $guestItinerary = new GuestItinerary();
        $guestItinerary->set_FID($FID);
        $guestItinerary->set_FName($fName);
        $guestItinerary->set_SID($SID);
        $guestItinerary->set_source($source);
        $guestItinerary->set_dest($dest);
        $guestItinerary->set_travelDate($travelDate);
        $guestItinerary->set_GID($GID);
        $guestItinerary->set_firstName($firstName);
        $guestItinerary->set_lastName($lastName);
        $itineraryData[$itineraryID] = $guestItinerary;
        $itineraryID = $itineraryID + 1;
    }
    closeDB($connection);
    return $itineraryData;
}
Beispiel #11
0
require_once 'global.php';
require 'db_query.php';
$cookie_name = "user_id";
$uid_isset = false;
$uid_isvalid = false;
if (!isset($_COOKIE[$cookie_name])) {
    $uid_isset = false;
} else {
    $uid_isset = true;
    connectToDB();
    $table_name = 'users';
    $user_id = $_COOKIE[$cookie_name];
    $user_name = $_COOKIE["user_name"];
    $uid_isvalid = checkUsersWithID($user_id);
    closeDB();
}
?>
<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="utf-8">
        <title>Create life like you create your innovative drinks!</title>
        <link rel="stylesheet" href="/create_your_own_drink/CSS/main.css">
        <link href='http://fonts.googleapis.com/css?family=Sigmar+One|Monoton|Pinyon+Script|Rock+Salt|Kaushan+Script|Julius+Sans+One|Kranky|Coming+Soon' rel='stylesheet' type='text/css'>
    </head>

    <body>
        <header id="index-header">
            <?php 
function addUserToDB($firstName, $lastName, $username, $password, $usertype)
{
    $con = connectToDB();
    $uniqueID = uniqid();
    //echo $uniqueID;
    $sql = "INSERT INTO User VALUES('{$uniqueID}', '{$firstName}', '{$lastName}','{$usertype}');";
    if (!mysqli_query($con, $sql)) {
        echo "Errormessage: ", mysqli_error($con);
    } else {
        echo "Successfull insert.\n";
    }
    //insert into credentials
    $sql = "INSERT INTO Credentials(uniqueID, username, password) VALUES('{$uniqueID}', '{$username}', '{$password}');";
    if (!mysqli_query($con, $sql)) {
        echo "Errormessage: ", mysqli_error($con);
    } else {
        echo "Successfull insert.\n";
    }
    closeDB($con);
}
Beispiel #13
0
function performQuery($query)
{
    // Open the database.
    $db = openDB();
    // Query the database.
    $queryResult = mysql_query($query, $db);
    // If there is an error, return the error.
    if (!$queryResult) {
        $result = array("status" => 0, "error" => array("6", "Database query error: " . mysql_error()));
        packageResponse($result);
        exit;
    }
    // Close the database and return the result.
    closeDB($db);
    return $queryResult;
}
/** -----------------------------
 * add page ending tags
 ----------------------------*/
function endPage()
{
    print '</body></html>';
    try {
        closeDB();
        //not care about the exception
    } catch (Exception $e) {
    }
}
function getRawGMList($leagueID)
{
    $season = getSeason();
    $sql = "select teamDisplayName from fch_league_membership where leagueID = {$leagueID} and status = \"active\" and season = \"{$season}\" ORDER BY teamDisplayName ASC";
    $con = initializeDB();
    $result = $con->query($sql);
    if ($result->num_rows > 0) {
        // output data of each row
        while ($row = $result->fetch_assoc()) {
            $out .= $row["teamDisplayName"] . "<br/>";
        }
    }
    closeDB($con);
    return $out;
}
Beispiel #16
0
        					$channel["date"][] = $date;
        				}
        			
        				// next program
        				while ($row_program)
        				{
        					$program_time = strtotime($row_program["program_time"]);
        					$pid = number_format($program_time * 1000 / $row["piecelength"], 0, '', '');
        
        					$channel["programs"][0]["program"][] = array(
        								"pid" => $pid,
        								"time" => date('Y-m-d H:i', $program_time),
        								"name" => encodeText($row_program["title"]),
        								"contents" => encodeText($row_program["contents"])
        						);
        
        					$row_program = mysql_fetch_array($result_program, MYSQL_ASSOC);
        				}
        
        				mysql_free_result ($result_program);
        			}
        */
        $xml["channel"][] = $channel;
    }
    mysql_free_result($result);
    closeDB($conn);
    header('Content-Type: text/xml; charset=utf-8');
    $data = printXML("result", $xml);
    $data = gzcompress($data);
    echo $data;
}
Beispiel #17
0
function showTransaction($t, $e)
{
    $mysqli = connectDB();
    $abfrage = "SELECT * FROM Transactions\n\t\t\t\tWHERE id={$t} AND email LIKE '{$e}'";
    $ergebnis = $mysqli->query($abfrage);
    echo "<table>";
    while ($row = $ergebnis->fetch_object()) {
        echo "<tr>\n\t\t\t\t<td>{$row->FirstName}</td>\n\t\t\t\t<td>{$row->LastName}</td>\n\t\t\t\t<td>{$row->Email}</td>\n\t\t\t\t<td>{$row->Payment}</td>\n\t\t\t\t\n\t\t\t  </tr>";
    }
    echo "</table>";
    closeDB($verbindung);
    return $newTransactionId;
}
function sqlRefresh()
{
    $season = getSeason();
    /// /////////////////////////////////////////////////
    /// TRUNCATE SCHEDULE
    $sql = <<<SQL

\t\ttruncate table fanta66_joomla.fch_schedule;
SQL;
    $scheduleTruncateResults = executeGenericSQL($sql);
    /// /////////////////////////////////////////////////
    /// REBUILD SCHEDULE
    $sql = <<<SQL

\t\tinsert into fanta66_joomla.fch_schedule
\t\t(dateStamp,visitor,home)
\t\tselect date_stamp,visitor,home from fanta66_zudnicfchmaster.schedule_master;
SQL;
    $scheduleResults = executeGenericSQL($sql);
    /// /////////////////////////////////////////////////
    /// TRUNCATE SCHEDULE
    $sql = <<<SQL

\t\ttruncate table fanta66_joomla.fch_schedule_lastseason;
SQL;
    $scheduleTruncateResultsLY = executeGenericSQL($sql);
    /// /////////////////////////////////////////////////
    /// REBUILD SCHEDULE
    $sql = <<<SQL

\t\tinsert into fanta66_joomla.fch_schedule_lastseason
\t\t(dateStamp,visitor,home)
\t\tselect date_stamp,visitor,home from fanta66_zudnicfchmaster.schedule_lastseason;
SQL;
    $scheduleResultsLY = executeGenericSQL($sql);
    /// /////////////////////////////////////////////////
    /// TRUNCATE RESULTS
    $sql = <<<SQL

\t\tDELETE FROM fanta66_joomla.fch_consolidated_results where season = "{$season}";
SQL;
    $out .= "<HR><B>Truncate Results SQL: </B><br/>{$sql}<p/>\n";
    $truncateResultsResults = executeGenericSQL($sql);
    /// /////////////////////////////////////////////////
    /// REBUILD RESULTS - SKATERS
    $sql = <<<SQL

insert into fanta66_joomla.fch_consolidated_results
(dateStamp
,totalPoints
,season
,playerID
,schoolID
,opponent
,opponentDisplayName
,playerDisplayName
,position
,schoolDisplayName
,statLine
,dateLine
,atVs)

SELECT DISTINCT 
\t`fanta66_zudnicfchmaster`.`results_skaters`.`date_stamp` AS `date_stamp`

\t,`fanta66_zudnicfchmaster`.`results_skaters`.`total_points` AS `totalPoints`
\t,convert(CONCAT (
\t\t\tsubstr(`fanta66_zudnicfchmaster`.`results_skaters`.`season`, 1, 4)
\t\t\t,"-"
\t\t\t,substr(`fanta66_zudnicfchmaster`.`results_skaters`.`season`, 5, 4)
\t\t\t) using utf8) AS `season`
\t,replace(replace(replace(replace(replace(`fanta66_zudnicfchmaster`.`results_skaters`.`player`, "'", ""), "-", ""), ".", ""), " ", ""), "~", "") AS `playerID`
\t,`fanta66_zudnicfchmaster`.`player_master`.`school_id` AS `schoolID`
\t,

IF (
\t\t(`fanta66_zudnicfchmaster`.`player_master`.`school_id` = `fanta66_zudnicfchmaster`.`results_skaters`.`visitor`)
\t\t,`fanta66_zudnicfchmaster`.`results_skaters`.`home`
\t\t,`fanta66_zudnicfchmaster`.`results_skaters`.`visitor`
\t\t) AS `opponent`
\t,`fanta66_zudnicfchmaster`.`school_master`.`school_shortname` AS `opponentDisplayName`
\t,CONCAT (
\t\t`fanta66_zudnicfchmaster`.`player_master`.`first_name`
\t\t," "
\t\t,`fanta66_zudnicfchmaster`.`player_master`.`last_name`
\t\t,", "
\t\t,`fanta66_zudnicfchmaster`.`player_master`.`school_name`
\t\t) AS `playerDisplayName`
\t,`fanta66_zudnicfchmaster`.`player_master`.`position` as position
\t,`fanta66_zudnicfchmaster`.`player_master`.`school_name` as schoolDisplayName

\t,CONCAT (
\t\tconvert(IF (
\t\t\t\t(1 > `fanta66_zudnicfchmaster`.`results_skaters`.`goals`)
\t\t\t\t,"0"
\t\t\t\t,`fanta66_zudnicfchmaster`.`results_skaters`.`goals`
\t\t\t\t) using latin1 )
\t\t\t," G, "
\t\t\t,convert(IF (
\t\t\t\t\t(1 > `fanta66_zudnicfchmaster`.`results_skaters`.`assists`)
\t\t\t\t\t,"0"
\t\t\t\t\t,`fanta66_zudnicfchmaster`.`results_skaters`.`assists`
\t\t\t\t\t) using latin1 )
\t\t\t\t," A "
\t\t\t\t,`fanta66_zudnicfchmaster`.`results_skaters`.`info` ) AS `statLine`
\t\t\t\t,CONCAT (convert(date_format(`fanta66_zudnicfchmaster`.`results_skaters`.`date_stamp`, "%c/%e") using latin1)) AS `dateLine`
\t\t\t\t,convert(IF (
\t\t\t\t\t\t(`fanta66_zudnicfchmaster`.`player_master`.`school_id` = `fanta66_zudnicfchmaster`.`results_skaters`.`visitor`)
\t\t\t\t\t\t," at "
\t\t\t\t\t\t," vs "
\t\t\t\t\t\t) using latin1 ) AS `atVs` FROM (
\t\t\t\t\t(
\t\t\t\t\t\t`fanta66_zudnicfchmaster`.`results_skaters` JOIN `fanta66_zudnicfchmaster`.`player_master`
\t\t\t\t\t\t) JOIN `fanta66_zudnicfchmaster`.`school_master`
\t\t\t\t\t) WHERE (
\t\t\t\t\t\t(`fanta66_zudnicfchmaster`.`player_master`.`text_id` = `fanta66_zudnicfchmaster`.`results_skaters`.`player`)
\t\t\t\t\t\tAND (
\t\t\t\t\t\t\t`fanta66_zudnicfchmaster`.`school_master`.`school_id` = IF (
\t\t\t\t\t\t\t\t(`fanta66_zudnicfchmaster`.`player_master`.`school_id` = `fanta66_zudnicfchmaster`.`results_skaters`.`visitor`)
\t\t\t\t\t\t\t\t,`fanta66_zudnicfchmaster`.`results_skaters`.`home`
\t\t\t\t\t\t\t\t,`fanta66_zudnicfchmaster`.`results_skaters`.`visitor`
\t\t\t\t\t\t\t\t) ) ) ORDER BY `fanta66_zudnicfchmaster`.`results_skaters`.`date_stamp` DESC;
SQL;
    $skaterInsertResults = executeGenericSQL($sql);
    $out .= "<HR><B>Skater Results SQL: </B><br/>{$sql}<p/>\n";
    /////////////////////////////////////////
    // GOALIE RESULTS
    $sql = <<<SQL

\tinsert into fanta66_joomla.fch_consolidated_results
(dateStamp
,totalPoints
,season
,playerID
,schoolID
,opponent
,opponentDisplayName
,playerDisplayName
,position
,schoolDisplayName
,statLine
,dateLine
,atVs)
\tSELECT DISTINCT `fanta66_zudnicfchmaster`.`results_goalies`.`date_stamp` AS `date_stamp`
\t,`fanta66_zudnicfchmaster`.`results_goalies`.`points` AS `total_points`
\t,convert(CONCAT (
\t\t\tsubstr(`fanta66_zudnicfchmaster`.`results_goalies`.`season`, 1, 4)
\t\t\t,"-"
\t\t\t,substr(`fanta66_zudnicfchmaster`.`results_goalies`.`season`, 5, 4)
\t\t\t) using utf8) AS `season`
\t,replace(replace(replace(replace(replace(`fanta66_zudnicfchmaster`.`results_goalies`.`player`, "'", ""), "-", ""), ".", ""), " ", ""), "~", "") AS `playerID`
\t,`fanta66_zudnicfchmaster`.`player_master`.`school_id` AS `schoolID`
\t

,IF (
\t\t(`fanta66_zudnicfchmaster`.`player_master`.`school_id` = `fanta66_zudnicfchmaster`.`results_goalies`.`visitor`)
\t\t,`fanta66_zudnicfchmaster`.`results_goalies`.`home`
\t\t,`fanta66_zudnicfchmaster`.`results_goalies`.`visitor`
\t\t) AS `opponent`
\t,`fanta66_zudnicfchmaster`.`school_master`.`school_shortname` AS `opponentDisplayName`
\t,CONCAT (
\t\t`fanta66_zudnicfchmaster`.`player_master`.`first_name`
\t\t," "
\t\t,`fanta66_zudnicfchmaster`.`player_master`.`last_name`
\t\t, ", "
\t\t,`fanta66_zudnicfchmaster`.`player_master`.`school_name`

\t\t) AS `playerDisplayName`
\t,`fanta66_zudnicfchmaster`.`player_master`.`position` AS position
\t,`fanta66_zudnicfchmaster`.`player_master`.`school_name` as schoolDisplayName
\t,CONCAT (
\t\t`fanta66_zudnicfchmaster`.`results_goalies`.`goals_allowed`
\t\t," GA, "
\t\t,`fanta66_zudnicfchmaster`.`results_goalies`.`saves`
\t\t," saves, "
\t\t,round(`fanta66_zudnicfchmaster`.`results_goalies`.`gaa`, 3)
\t\t," GAA, "
\t\t,`fanta66_zudnicfchmaster`.`results_goalies`.`decision`
\t\t) AS `statLine`
\t,CONCAT (convert(date_format(`fanta66_zudnicfchmaster`.`results_goalies`.`date_stamp`, "%c/%e") using latin1)) AS `dateLine`
\t,convert(IF (
\t\t\t(`fanta66_zudnicfchmaster`.`player_master`.`school_id` = `fanta66_zudnicfchmaster`.`results_goalies`.`visitor`)
\t\t\t," at "
\t\t\t," vs "
\t\t\t) using latin1 ) AS `atVs` FROM (
\t\t(
\t\t\t`fanta66_zudnicfchmaster`.`results_goalies` JOIN `fanta66_zudnicfchmaster`.`player_master`
\t\t\t) JOIN `fanta66_zudnicfchmaster`.`school_master`
\t\t) WHERE (
\t\t\t(`fanta66_zudnicfchmaster`.`player_master`.`text_id` = `fanta66_zudnicfchmaster`.`results_goalies`.`player`)
\t\t\tAND (
\t\t\t\t`fanta66_zudnicfchmaster`.`school_master`.`school_id` = IF (
\t\t\t\t\t(`fanta66_zudnicfchmaster`.`player_master`.`school_id` = `fanta66_zudnicfchmaster`.`results_goalies`.`visitor`)
\t\t\t\t\t,`fanta66_zudnicfchmaster`.`results_goalies`.`home`
\t\t\t\t\t,`fanta66_zudnicfchmaster`.`results_goalies`.`visitor`
\t\t\t\t\t) ) ) ORDER BY `fanta66_zudnicfchmaster`.`results_goalies`.`date_stamp` DESC;
SQL;
    $goalieInsertResults = executeGenericSQL($sql);
    $out .= "<HR><B>Goalie Results SQL: </B><br/>{$sql}<p/>\n";
    $out .= "Skater Results Insert: " . $skaterInsertResults["msg"] . "\n<br/>";
    $out .= "Goalie Results Insert: " . $goalieInsertResults["msg"] . "\n<br/>";
    $playerTruncateResults = executeGenericSQL("truncate table fanta66_joomla.fch_players");
    $out .= "Player Truncate: " . $playerTruncateResults["msg"] . "\n";
    $sql = <<<SQL

\tinsert into fanta66_joomla.fch_players
(playerID, lastName, firstName, schoolDisplayName, schoolID, playerYear, position, season)
select distinct
\treplace(replace(replace(replace(replace(`fanta66_zudnicfchmaster`.`player_master`.`text_id`, "'", ""), "-", ""), ".", ""), " ", ""), "~", "") AS `playerID`
\t,`fanta66_zudnicfchmaster`.`player_master`.`last_name` as lastName
\t,`fanta66_zudnicfchmaster`.`player_master`.`first_name` as firstName
\t,`fanta66_zudnicfchmaster`.`player_master`.`school_name` as schoolDisplayName
\t, `fanta66_zudnicfchmaster`.`player_master`.`school_id` as schoolID
\t, `fanta66_zudnicfchmaster`.`player_master`.`year_in_school` as playerYear
\t, `fanta66_zudnicfchmaster`.`player_master`.`position` as position
\t, convert(CONCAT (
\t\t\tsubstr(`fanta66_zudnicfchmaster`.`player_master`.`season`, 1, 4)
\t\t\t,"-"
\t\t\t,substr(`fanta66_zudnicfchmaster`.`player_master`.`season`, 5, 4)
\t\t\t) using utf8) AS `season`
\tfrom `fanta66_zudnicfchmaster`.`player_master`
\twhere `fanta66_zudnicfchmaster`.`player_master`.`test` = "prod"
SQL;
    $sql .= " and season = \"" . preg_replace("/[^A-Za-z0-9 ]/", '', getSeason()) . "\";";
    $playerInsertResults = executeGenericSQL($sql);
    $out .= "Player refresh insert: " . $playerInsertResults["msg"] . "\n";
    echo "Full Insert playerInsertResults: {$sql}<p>\n\n";
    $lastSeason = preg_replace("/[^A-Za-z0-9 ]/", '', getLastSeason());
    $season = getSeason();
    $sql = <<<SQL

\tinsert into fanta66_joomla.fch_players
(playerID, lastName, firstName, schoolDisplayName, schoolID, playerYear, position, season)
select distinct
\treplace(replace(replace(replace(replace(`fanta66_zudnicfchmaster`.`player_master`.`text_id`, "'", ""), "-", ""), ".", ""), " ", ""), "~", "") AS `playerID`
\t,`fanta66_zudnicfchmaster`.`player_master`.`last_name` as lastName
\t,`fanta66_zudnicfchmaster`.`player_master`.`first_name` as firstName
\t,`fanta66_zudnicfchmaster`.`player_master`.`school_name` as schoolDisplayName
\t, `fanta66_zudnicfchmaster`.`player_master`.`school_id` as schoolID
\t, "?" as playerYear
\t, `fanta66_zudnicfchmaster`.`player_master`.`position` as position
\t, {$season} AS `season`
\tfrom `fanta66_zudnicfchmaster`.`player_master`
\twhere `fanta66_zudnicfchmaster`.`player_master`.`year_in_school` != "Sr" 
SQL;
    $sql .= " and `fanta66_zudnicfchmaster`.`player_master`.`season` = \"{$lastSeason}\" ";
    $sql .= " and `fanta66_zudnicfchmaster`.`player_master`.`school_id` not in (select distinct schoolID from fanta66_joomla.fch_players where season = \"" . getSeason() . "\");";
    SQL;
    echo "Delta Insert: {$sql}<BR>\n\n";
    $deltaInsertResults = executeGenericSQL($sql);
    $out .= "Player delta insert: " . $deltaInsertResults["msg"] . "\n";
    $deltaUpdateResults = executeGenericSQL("UPDATE fch_players SET season = \"" . getSeason() . "\", playerYear = NULL where playerYear = \"?\"");
    $out .= "Player delta update: " . $deltaInsertResults["msg"] . "\n";
    // Draft times are in eastern time. No offset.
    $sql = "SELECT u.email as email, DATE_FORMAT(l.draftTime ,'%W, %b %d %h:%i %p, Eastern time') as draftTime, l.id as id\r\r\n\tFROM fch_users u, fch_leagues l, fch_league_membership lm\r\r\n\tWHERE l.draftTime > DATE_ADD( NOW( ) , INTERVAL +24 HOUR ) \r\r\n\tAND l.draftTime < DATE_ADD( NOW( ) , INTERVAL +48 HOUR ) \r\r\n\tAND lm.leagueID = l.id\r\r\n\tAND l.draftReminderSent != TRUE\r\r\n\tAND lm.userID = u.id";
    /*
    $sql = "
    SELECT u.email AS email, DATE_FORMAT( l.draftTime,  '%W, %b %d %h:%i %p, Eastern time' ), l.id AS draftTime
    FROM fch_users u, fch_leagues l, fch_league_membership lm
    WHERE lm.leagueID = l.id
    AND lm.userID = u.id
    AND l.id =35";
    */
    $con = initializeDB();
    $result = $con->query($sql);
    if ($result->num_rows > 0) {
        // output data of each row
        while ($row = $result->fetch_assoc()) {
            $body = "Hi,\n";
            $body .= "This is a reminder that your Fantasy College Hockey draft is tomorrow, " . $row[draftTime] . ".\n\n";
            $body .= "The draft is live on fantasycollegehockey.com. The draft is available in the League menu and includes a live chat.\n\n";
            $body .= "One hour prior to draft time, the system will close new registrations to the league and generate the draft order. The order will be e-mailed to you.\n\n";
            $body .= "Your league administrator will need to open the draft. When the draft is over, the administrator will close the draft and your drafted players will be moved onto your roster.\n\n";
            $body .= "** DO NOT REPLY ** to this email. Please contact us at fantasycollegehockey@gmail.com if you have questions.\n\n";
            $body .= "Have fun!\n";
            $updateDraftReminder = "UPDATE fch_leagues SET draftReminderSent = TRUE WHERE id = " . $row[id];
            $out .= "<HR>Draft Reminder, SQL: {$updateDraftReminder}";
            executeGenericSQL($updateDraftReminder);
            sendEmail($row[email], "Reminder: Your Draft Is Tomorrow", $body);
            $emailSentTo .= $row[email] . ", ";
        }
    }
    $truncateByTeamResult = executeGenericSql("DELETE FROM fanta66_joomla.fch_schedule_byteam");
    $out .= "<hr/>Delete all from fch_scheduleByTeam: " . $truncateByTeamResult["msg"];
    $sql = "\r\r\n\t\tinsert into fch_schedule_byteam (id,dateStamp,schoolID,atVs,opponent) \r\r\n\t\t(select NULL, dateStamp, home, \"vs\" , visitor  from fch_schedule)\r\r\n\t\tunion all\r\r\n\t\t(select NULL, dateStamp, visitor as schoolID, \"at\" as atVs, home as opponent from fch_schedule)";
    $rebuildByTeamResult = executeGenericSql($sql);
    $out .= "<hr>Rebuild fch_scheduleByTeam: <p/>\n{$sql}<p/>\nResult:" . $rebuildByTeamResult["msg"];
    closeDB($con);
    $out .= "<p/>\n\tEmail sent to: {$emailSentTo}";
    sendEmail("*****@*****.**", "FCH Cron Results", $out);
    echo $out;
}
Beispiel #19
0
function main()
{
    global $data;
    global $wonitorDb, $wonitorStructure;
    global $ns2plusDb, $ns2plusStructure;
    readData();
    checkWhitelist();
    checkData();
    try {
        if ($_POST['messageType'] == 'MatchEnd') {
            $db = openDB($wonitorDb);
            createTables($db, $wonitorStructure);
            insertRoundData($db, $data);
            closeDB($db);
            echo "MatchEnd post successful\n";
        }
        if ($_POST['messageType'] == 'NS2PlusStats') {
            $db = openDB($ns2plusDb);
            createTables($db, $ns2plusStructure);
            insertNS2PlusData($db, $data);
            closeDB($db);
            echo "NS2PlusStats post successful\n";
        }
    } catch (PDOException $e) {
        echo $e->getMessage();
    }
}
Beispiel #20
0
                }
            } else {
                // Знайти збіги невдалось
                $text = '<p>По вашому запиті нічого не знайдено.</p>';
            }
        }
    } else {
        $text = '<p>Заданий порожній пошуковий запит.</p>';
    }
    echo "</tr></table>";
    //Повертаєм сформованую рядок пошукової видачі
    return $text;
}
///////////// Сам скріпт обробки ///////////////
if (isset($_POST['query'])) {
    // Відкриваєм зєднання з базою даних
    $connect = connectDB();
    $search_result = search($_POST['query']);
    echo $search_result;
    // Закриваєм зєднання з базою данних
    closeDB($connect);
}
?>

				</div>
</div>
<?php 
include 'util/footer.php';
?>
			
        }
        break;
    case "drop-results":
        if ($v && $r['submit'] == "ja") {
            query("delete from " . ZUG);
            query("delete from " . RES);
            echo "ergebnisse gelöscht";
        } else {
            if ($v) {
                include STATIC_DIR . "admin-welcome";
            } else {
                areyousure("?drop-results=true", "ergebnisse löschen", "achtung! alle ergebnisdaten werden dabei gelöscht! NUR NACH ENDE DER TESTPHASE AKTIVIEREN, IN KEINEM FALL WÄHREN DEM BETRIEB!");
            }
        }
        break;
    default:
        include STATIC_DIR . "admin-welcome";
        break;
}
echo "   </td>";
echo " </tr>";
echo " <tr class='foot'>";
echo "   <td colspan='2'>" . TITLE . "</td>";
echo " </tr>";
echo "</table>";
echo "</body>";
closeDB($db);
//end page
?>

</html>
Beispiel #22
0
function main()
{
    global $wonitorDb, $wonitorStructure;
    global $ns2plusDb, $ns2plusStructure;
    $table = 'rounds';
    if (isset($_GET['table'])) {
        $table = $_GET['table'];
    }
    $db = null;
    $structure = null;
    if (isset($wonitorStructure[$table])) {
        $db = openDB($wonitorDb);
        $structure = $wonitorStructure;
    } elseif (isset($ns2plusStructure[$table])) {
        $db = openDB($ns2plusDb);
        $structure = $ns2plusStructure;
    } else {
        exit;
    }
    try {
        queryDB($db, $structure, $table);
    } catch (PDOException $e) {
        echo $e->getMessage();
    }
    closeDB($db);
}
    $result = $con->query($sql);
    //echo "debug ". isDebug();
    $leagueSelector .= "<form name = \"leagueSelector\" method = \"POST\"><SELECT name = \"league\">";
    if ($result->num_rows > 0) {
        // output data of each row
        while ($row = $result->fetch_assoc()) {
            $selectLeague = "";
            debug("<B>Checking {$dbLeague}</B> = " . $row["leagueID"]);
            if ($row["leagueID"] == $dbLeague) {
                $usingAs = "";
                //Now viewing your team in " . $row['leagueDisplayName'];
                $selectedLeagueID = $row["leagueID"];
                $selectLeague = "SELECTED";
            } else {
                $selectLeague = "";
            }
            $leagueSelector .= "<OPTION value = \"" . $row['leagueID'] . "\" {$selectLeague}>" . $row['leagueDisplayName'] . "</OPTION>";
        }
    }
    $leagueSelector .= "<input name = \"action\" value = \"leagueChange\" type = \"hidden\">";
    $leagueSelector .= "<input name = \"go\" value = \"Change League &gt;&gt;\" class=\"btn btn-primary validate\" type = \"button\" onClick = \"javaScript:document.forms['leagueSelector'].submit()\">";
    $leagueSelector .= "</form>";
    echo $usingAs . $leagueSelector;
    closeDB($con);
    executeGenericSQL("UPDATE fch_user_preferences SET displayLeague = {$selectedLeagueID} WHERE userID = {$userID}");
}
?>



$count = executeSQL($mysqli, $sql);
$logger->debug("tbl_user_macid:" . $count);
// 清理关联表 macid
$sql = "select um.id from tbl_user_macid um ,(select max(id) id, userid from tbl_user_macid where delete_flag=0 group by userid) u where um.userid=u.userid and um.id<>u.id and um.update_date < '{$before_day}'";
$logger->debug(preg_replace('/\\s+/', ' ', $sql));
$result = querySQL($mysqli, $sql);
$data = array();
while ($row = mysql_fetch_assoc($result)) {
    $data[] = $row['id'];
}
$sql = "delete from tbl_user_macid where id in (" . join(',', $data) . ")";
$logger->debug(preg_replace('/\\s+/', ' ', $sql));
$count = executeSQL($mysqli, $sql);
$logger->debug("clear tbl_user_macid:" . $count);
// 清理关联表 status
$sql = "select um.id from tbl_user_status um ,(select max(id) id, userid from tbl_user_status where delete_flag=0 group by userid) u where um.userid=u.userid and um.id<>u.id and um.update_date < '{$before_day}'";
$logger->debug(preg_replace('/\\s+/', ' ', $sql));
$result = querySQL($mysqli, $sql);
$data = array();
while ($row = mysql_fetch_assoc($result)) {
    $data[] = $row['id'];
}
$sql = "delete from tbl_user_status where id in (" . join(',', $data) . ")";
$logger->debug(preg_replace('/\\s+/', ' ', $sql));
$count = executeSQL($mysqli, $sql);
$logger->debug("clear tbl_user_status:" . $count);
// 关闭DB
closeDB($mysqli);
?>