Example #1
0
$place = $row['place'];
$ts = $row['ts'];
echo "<p class=\"color_value\"></p>";
echo "<p class=\"tags_display\">";
$query = "SELECT name FROM Tags, PhotosTags WHERE PhotosTags.photo_id = {$photo_id} AND Tags.tag_id = PhotosTags.tag_id";
if ($result = mysql_query($query, $link)) {
    while ($row = mysql_fetch_array($result)) {
        echo "<span>#" . $row['name'] . "</span>";
    }
} else {
    session_start();
    $_SESSION['error'] = mysql_error($link);
    header('location:error.php');
}
echo "</p>";
if (!IsNullOrEmpty($place)) {
    echo "<p>@ {$place}</p>";
}
echo "<abbr class=\"ts\" title=\"{$ts}\"></abbr>";
?>
			<br>
			<a onClick="FBshare();" href="#">Share to Facebook</a><br>
			<p class="filename"></p>

			<div data-role="popup" id="color_popup">
				<a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-left">Close</a>
				<ul>
				</ul>
			</div>
			
		</div>
Example #2
0
} else {
    $photo_query = "INSERT INTO Photos (save_path, palette_id, category, user_id, geolat, geolng, place, is_fav, frequency) VALUES ('{$save_path}', {$palette_id}, {$category}, {$user_id}, NULL, NULL, NULL, 0, 0)";
}
if (mysql_query($photo_query, $link)) {
    $photo_query = "SELECT * FROM Photos where save_path = '{$save_path}' and user_id = {$user_id}";
    $result = mysql_query($photo_query);
    $array = mysql_fetch_array($result);
    $photo_id = $array['photo_id'];
    //process the tags
    if (!IsNullOrEmpty($tag_string)) {
        $tags = explode(",", $tag_string);
        $tag_query = "";
        for ($i = 0; $i < count($tags); $i++) {
            $tag = trim($tags[$i]);
            //remove spaces
            if (IsNullOrEmpty($tag)) {
                continue;
            }
            $tag_query = "SELECT * FROM Tags WHERE name = '{$tag}'";
            $result = mysql_query($tag_query);
            //if tag exists
            if (mysql_num_rows($result) != 0) {
                $array = mysql_fetch_array($result);
                $tag_id = $array['tag_id'];
                $tag_query = "INSERT INTO PhotosTags VALUES ({$photo_id}, {$tag_id})";
                if (!mysql_query($tag_query, $link)) {
                    echo mysql_error($link);
                }
            } else {
                $tag_query = "INSERT INTO Tags (name) VALUES ('{$tag}')";
                if (!mysql_query($tag_query, $link)) {
Example #3
0
<?php

include "config.php";
include "helper.php";
$email = $_POST["new_email"];
$password = $_POST["new_password"];
if (checkEmail($email) && !IsNullOrEmpty($password)) {
    //see whether the email has already registered
    $query = "SELECT * from Users WHERE email = '{$email}'";
    $result = mysql_query($query);
    //if not, register new user
    if (mysql_num_rows($result) == 0) {
        $query = "INSERT into Users (email, password) VALUES ('{$email}', '{$password}');";
        if (mysql_query($query, $link)) {
            $query = "select * from Users where email = '{$email}' and password = '******'";
            $result = mysql_query($query);
            $array = mysql_fetch_array($result);
            //set the max life time of session to 8 hours
            ini_set(’session . gc_maxlifetime’, 8 * 60 * 60);
            session_start();
            $_SESSION['user_id'] = $array['user_id'];
            header('location:my_b.php');
        } else {
            session_start();
            $_SESSION['error'] = mysql_error($link);
            header('location:error.php');
        }
    } else {
        session_start();
        $_SESSION['account_error'] = "Oops, looks like the email has already been registered.";
        header('location:new.php');