Example #1
0
function storeData($response)
{
    for ($i = 0; $i < count($response); $i++) {
        // echo "This is pid : ".$response[$i]->pid."<br></br>" ;
        // echo "This is aid : ".$response[$i]->aid."<br></br>" ;
        // echo "This is owner_id : ".$response[$i]->owner_id."<br></br>" ;
        // storeImages($response[$i]->sizes, $response[$i]->pid);
        // echo "This is likes : ".$response[$i]->likes->count."<br></br>" ;
        // echo "************** <br></br>" ;
        $sql = "INSERT INTO PHOTOS (PID, AID, OWNER_ID, LIKES) \n    VALUES ('" . $response[$i]->pid . "','" . $response[$i]->aid . "','" . $response[$i]->owner_id . "','" . $response[$i]->likes->count . "')";
        $res = mysql_query($sql);
        $msg = $res ? successMessage("Uploaded and saved to Photos.") : errorMessage("Problem in saving to photos");
        echo $response[$i]->pid . " : " . $msg . " <br>";
        if ($res) {
            storeImages($response[$i]->sizes, $response[$i]->pid);
        }
        echo "item :" . $i . "<br></br>";
    }
    echo "=== count : " . count($response) . "<br></br>";
}
Example #2
0
session_start();

include './sharedkeys.php';
$loc = PROJECT_URL . 'login.php';
if(!isset($_SESSION["fname"])){
    
    header( 'Location: '.$loc);
    die();
}
*/
if (isset($_POST["title"]) && isset($_POST["description"])) {
    print "data Received <br>";
    $title = $_POST["title"];
    $description = $_POST["description"];
    print "Storing The title<br>";
    $images = storeImages();
    print "image stored<br>";
    $xml = new SimpleXMLElement('<data/>');
    $xml->addChild('title', $title);
    $xml->addChild('description', $description);
    $image = $xml->addChild('images');
    for ($i = 0; $i < count($images); $i++) {
        $link = $image->addChild('link');
        $link->addChild('image', PROJECT_URL . $images[$i][0]);
        $link->addChild('thum', PROJECT_URL . $images[$i][1]);
    }
    include_once './db_functions.php';
    $con = new DB_Functions();
    $registatoin_ids = getReceivers($con);
    if (count($registatoin_ids) == 0) {
        print "No users <br>";