Exemple #1
0
    <body>
        <?php 
session_start();
include_once '../classes/profile.php';
include_once '../classes/address.php';
include_once '../funcs.php';
include_once '../conf.php';
if (!isset($_POST['submit'])) {
    echo '<h1>You have done it again, you silly!</h1>';
    exit;
}
$disease = $_POST['desc'];
$json = getProfiles();
$profiles = json_decode($json);
foreach ($profiles as $profile) {
    if ($profile->profileID == $_POST['profileID']) {
        array_push($profile->diseases, $disease);
        $profile->token = $_SESSION['token'];
        echo $insert = editProfile($profile);
        break;
    }
}
if (empty($insert)) {
    header("Location: http://" . redirectLink() . "/SafeFront/index.php?action=profileDiseases&profileID=" . $_POST['profileID'] . "&method=Disease%20added%20Sucessfully");
} else {
    echo $insert;
}
?>
    </body>
</html>
Exemple #2
0
if (!$_SESSION) {
    header("location:index.php");
}
$UserName = $_SESSION['username'];
if (!empty($_POST['infoSubmit'])) {
    if (isset($_POST['first']) || isset($_POST['last']) || !empty($_POST['gender']) || isset($_POST['quote'])) {
        $firstname = sanitizeString($_POST['first']);
        $lastname = sanitizeString($_POST['last']);
        $gender = sanitizeString($_POST['gender']);
        $quote = $_POST['quote'];
        $result = queryMysql("SELECT * FROM profile WHERE username='******'");
        //check if the user already exists
        if ($result->num_rows) {
            queryMysql("DELETE FROM profile WHERE username='******'");
        }
        editProfile($connection, $firstname, $lastname, $gender, $UserName, $quote);
    }
} else {
    if (!empty($_POST['imageSubmit'])) {
        $time = $_SERVER['REQUEST_TIME'];
        $file_name = $time . '.jpg';
        if ($_FILES) {
            $tmp_name = $_FILES['upload']['name'];
            //file on local host
            if ($tmp_name == NULL) {
                $file_name = NULL;
            }
            $dstFolder = 'users';
            move_uploaded_file($_FILES['upload']['tmp_name'], $dstFolder . DIRECTORY_SEPARATOR . $file_name);
        }
        queryMysql("UPDATE users SET FILENAME = '{$file_name}' WHERE USERNAME='******'");
include "leftwidget.php";
?>
<div class="center_table">
<table align="center" width="800" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<th scope="col"></th>
    </tr>
    <tr>
		<td>
<!-----------------------Server Side Scripting begins--------------------------->
				<?php 
if ($action == "showprofile") {
    showProfile();
} else {
    if ($action == "editprofile") {
        editProfile();
    } else {
        if ($action == "updateprofile") {
            updateProfile();
        } else {
            verify();
        }
    }
}
function verify()
{
    global $tname, $t;
    include "dbconnect.php";
    $query = "select * from team " . "where tname=\"{$tname}\"";
    $result = mysql_query($query) or die(mysql_error());
    $row = mysql_fetch_array($result);
                    //file_put_contents($userImageBaseURL.'/profile_pics/'.$image, $data);
                    $IMAGEURL = $IMAGEURLBASEURL . $username . '/profile_pics/' . $image;
                    $getUpdateProfilePic['profile_pic_f'] = $IMAGEURL;
                }
                //echo $getUpdateProfilePic['profile_pic_f'];
                $getUpdateProfilePic['pet_type_f'] = $petType;
                $getUpdateProfilePic['pet_name_f'] = $petName;
                $getUpdateProfilePic['pet_dob_f'] = $petDob;
                $getUpdateProfilePic['description_f'] = $petBio;
                $getUpdateProfilePic['species_f'] = $petSpecies;
                $updateResult = $rm->update_record($getUpdateProfilePic, 'user_details_t', 'user_id', $userId);
                if ($updateResult > 0) {
                    $result = $rm->userRegisterSuccessJson($userId);
                    return $result;
                } else {
                    $result = $rm->userUpdateProfileFail();
                    return $result;
                }
            }
            // end of else first
        } else {
            $result = $rm->ssl_error();
            return $result;
        }
    } else {
        $result = $rm->ssl_error();
        return $result;
    }
}
echo editProfile();