예제 #1
0
function buildPage()
{
    global $mysql;
    $MySQLConnection = new Mysql($mysql['host'], $mysql['port'], $mysql['user'], $mysql['password'], $mysql['database']);
    $MySQLConnection->connect();
    if ($result = $MySQLConnection->getQuery('SELECT x.matchID AS matchID, x.matchDate AS matchDate, y.teamName AS matchHomeTeam, y.teamLogo AS matchHomeTeamLogo, z.teamName AS matchForeignTeam, z.teamLogo AS matchForeignTeamLogo FROM matches AS x JOIN teams AS y ON y.teamID = matchHomeTeam JOIN teams AS z ON z.teamID = matchForeignTeam;')) {
        while ($row = mysqli_fetch_assoc($result)) {
            $userTips = getUserTips($MySQLConnection, $row["matchID"]);
            echo '
						<div class="panel panel-default">
							<form id="match_' . $row["matchID"] . '" method="POST">
								<div class="panel-body">
									<div class="panel-heading">' . $row["matchHomeTeam"] . ' vs. ' . $row["matchForeignTeam"] . '</div>
									<div class="input-group">
									 	<label>' . $row["matchHomeTeam"] . '</label>
									 	<input type="number"min="0"value="' . $userTips["tipScoreHome"] . '" name="ScoreHome" id="ScoreHome"  required/>
									 </div>
									<div class="input-group">
									 	<label>' . $row["matchForeignTeam"] . '</label>
									 	<input type="number"min="0" value="' . $userTips["tipScoreForeign"] . '" name="ScoreForeign" id="ScoreForeign" required/>
									 	<input type="button" value="Place Tip" onclick="placeTip(' . $row["matchID"] . ');"/>
									</div>
								</div>
							</form>
						</div>
					';
        }
    }
}
예제 #2
0
function buildPage()
{
    global $mysql;
    $MySQLConnection = new Mysql($mysql['host'], $mysql['port'], $mysql['user'], $mysql['password'], $mysql['database']);
    $MySQLConnection->connect();
    if ($result = $MySQLConnection->getQuery('SELECT * FROM users JOIN countries ON	userCountry = iso3166 WHERE userID = ' . $_GET["userID"] . ';')) {
        while ($row = mysqli_fetch_assoc($result)) {
            echo '
				 	<div class="col-md-2">
					 	<div class="panel panel-default">
							<div class="panel-heading">' . $row["userLogin"] . '</div>
							<div class="panel-body">
								<div class="media">
									<div class="media-left">
										<a href="img/avatar/' . $row["userAvatar"] . '">
											<img class="media-object" src="img/avatar/' . $row["userAvatar"] . '" />
										</a>
									</div>
								</div>
								<p><b>First Name: </b>' . $row["userFirstName"] . '</p>
								<p><b>Last Name: </b>' . $row["userLastName"] . '</p>
							</div>
						</div>
					</div>
				 ';
        }
    }
}
예제 #3
0
function buildPage()
{
    global $mysql;
    $MySQLConnection = new Mysql($mysql['host'], $mysql['port'], $mysql['user'], $mysql['password'], $mysql['database']);
    $MySQLConnection->connect();
    if ($result = $MySQLConnection->getQuery('SELECT messageID, messageRecipient, messageSender, messageTime, messageSubject, messageBody, userLogin, userID FROM messages JOIN users ON  messageSender = userID WHERE messageRecipient = ' . $_SESSION["userID"] . ' LIMIT 0,25;')) {
        echo '
					<div class="col-md-2">
				';
        while ($row = mysqli_fetch_object($result)) {
            $messageJSON = (string) json_encode($row);
            echo '
						<div class="list-group">
							<a href="#" onclick="displayMessage(\'' . $row->messageID . '\');"" class="list-group-item">
								<p class="list-group-item-text">' . $row->messageTime . ' - ' . $row->userLogin . '</p>
								<h4 class="list-group-item-heading">' . $row->messageSubject . '</h4>
							</a>
						</div>
					';
        }
        echo '</div>';
    } else {
        echo '<script type="text/javascript">', 'printError(\'Error while getting your messages!\')', '</script>';
    }
}
예제 #4
0
function printCountrySelect()
{
    global $mysql;
    $MySQLConnection = new Mysql($mysql['host'], $mysql['port'], $mysql['user'], $mysql['password'], $mysql['database']);
    $MySQLConnection->connect();
    $result = $MySQLConnection->getQuery('SELECT * FROM countries;');
    echo '<select id="userCountry" name="userCountry"><option value="">---NO COUNTRY SELECTED---</option>';
    while ($row = mysqli_fetch_assoc($result)) {
        echo '<option value="' . $row["iso3166"] . '">' . $row["countryName"] . '</option>';
    }
    echo '</select>';
}
예제 #5
0
<?php

$JSONerror = new stdClass();
include_once 'mysql.class.php';
include_once 'include/conf.php';
if (isset($_POST)) {
    if (isset($_POST['userLogin']) && isset($_POST['userPassword']) && isset($_POST['userEmail']) && $_POST['userPassword'] == $_POST['userPasswordRepeat']) {
        $userData = $_POST;
        $userData["userPassword"] = password_hash((string) $userData['userPassword'], PASSWORD_DEFAULT);
        $MySQLConnection = new Mysql($mysql['host'], $mysql['port'], $mysql['user'], $mysql['password'], $mysql['database']);
        $MySQLConnection->connect();
        if ($MySQLConnection->getQuery('INSERT INTO users (userLogin, userPassword, userEmail, userFirstName, userLastName, userGender, userBirthDay, userValid, userCountry) VALUES ("' . $userData["userLogin"] . '","' . $userData["userPassword"] . '","' . $userData["userEmail"] . '","' . $userData["userFirstName"] . '","' . $userData["userLastName"] . '","' . $userData["userGender"] . '","' . $userData["userBirthDay"] . '",0,"' . $userData["userCountry"] . '");')) {
            $JSONerror->state = 0;
            $JSONerror->message = 'Success!';
            print_r(json_encode($JSONerror));
        } else {
            $JSONerror->state = 1;
            $JSONerror->message = 'MySQL Error!';
            print_r(json_encode($JSONerror));
        }
    } else {
        $JSONerror->state = 1;
        $JSONerror->message = 'Some Fields contain invalid Data!';
        print_r(json_encode($JSONerror));
    }
} else {
    $JSONerror->state = 1;
    $JSONerror->message = 'General Error!';
    print_r(json_encode($JSONerror));
}
예제 #6
0
<?php

$JSONerror = new stdClass();
include_once 'mysql.class.php';
include_once 'include/conf.php';
include_once 'include/session.php';
if (isset($_POST)) {
    if (isset($_POST["matchID"]) && isset($_POST["ScoreHome"]) && isset($_POST["ScoreForeign"])) {
        global $mysql;
        $MySQLConnection = new Mysql($mysql['host'], $mysql['port'], $mysql['user'], $mysql['password'], $mysql['database']);
        $MySQLConnection->connect();
        $result = $MySQLConnection->getQuery('SELECT count(*) FROM tippchampion.tips WHERE tipUser = '******'userID'] . ' AND tipMatch = ' . $_POST['matchID'] . ';');
        $update = mysqli_fetch_assoc($result);
        if ($update['count(*)']) {
            $MySQLConnection->getQuery('UPDATE tips SET tipUser = '******'userID'] . ', tipScoreHome = ' . $_POST['ScoreHome'] . ', tipScoreForeign = ' . $_POST['ScoreForeign'] . ' WHERE tipMatch = ' . $_POST['matchID'] . ';');
        } else {
            $MySQLConnection->getQuery('INSERT INTO tips (tipUser, tipMatch, tipScoreHome, tipScoreForeign) VALUES (' . $_SESSION['userID'] . ',' . $_POST['matchID'] . ',' . $_POST['ScoreHome'] . ',' . $_POST['ScoreForeign'] . ');');
        }
    }
} else {
    $JSONerror->state = 1;
    $JSONerror->message = 'General Error!';
    print_r(json_encode($JSONerror));
}
?>