Example #1
0
		<tr><td colspan=2><textarea style="width:500px;height:50px;" name="comments"><? if($editing_ref) echo $_POST["comments"]; ?></textarea></td></tr>
		<tr><td colspan=2><input type="submit" value="<? if($editing_ref) echo "Save Changes"; else echo "Add Reference"; ?>"></td></tr>
		</table>
	</form>
	<br><br>
	<table class="standardText" style="width:500px;"><tr><td colspan=2>
	<div class="slightly_bolder">Availability:</div></td></tr>
<?
	$res = mysql_query("select * from availability where babysitter='$sitterid';");
	for($x = 0; $x < mysql_numrows($res); $x++){
		?><tr><td><form name="removeavail<? echo $x; ?>" action="sitter_profile_setup.php" method="post">
		<input type="hidden" name="action" value="remove_availability">
		<input type="hidden" name="avail_id" value="<? echo mysql_result($res, $x, "id"); ?>"><?
		echo dayNumberToDay(mysql_result($res, $x, "aday")) . "s " .
			 formatHour(mysql_result($res, $x, "hourmin")) . " to " .
			 formatHour(mysql_result($res, $x, "hourmax"));
		?></td><td style="text-align:right;">
			<a href="#" onclick="removeavail<? echo $x; ?>.submit()">Remove</a></form></td></tr><?
	} 
	if(mysql_numrows($res) > 0){
		?> <tr><td><br><br></td></tr> <?
	} ?>
	<form action="sitter_profile_setup.php" method="post">
		<input type="hidden" name="action" value="addavailability">
		<tr><td>
		Choose day of the week:</td><td style="width:300px;">
			<select name="dayofweek" style="width:100%;">
				<option value="0">Sunday</option>
				<option value="1" selected="selected">Monday</option>
				<option value="2">Tuesday</option>
				<option value="3">Wednesday</option>
Example #2
0
        }
        $message = cleanMessage($_POST['message'], $max_chars, $userid);
        if (!is_numeric($message) || $message > 5) {
            $fields = array('userid' => $userid, 'message' => $message, 'img' => $img, 'time_start' => $_POST['time_start'], 'time_end' => $_POST['time_end'], 'days' => $_POST['days'], 'hour' => $_POST['hour'], 'publish_fb' => $_POST['publish_fb'], 'publish_tw' => $_POST['publish_tw'], 'publish_fbp' => $_POST['publish_fbp'], 'publish_fbgp' => $_POST['publish_group']);
            if (is_array($fields = makeTimes($fields))) {
                if ($_POST['edit'] == true) {
                    unset($fields['userid']);
                    if ($hdb->doUpdate($table, $fields, " id=" . $hdb->quote($_POST['mes_id']) . " AND userid=" . $hdb->quote($userid))) {
                        $return = array("e" => 0, "c" => array("i" => $_POST['mes_id'], "m" => $fields['message'], "p" => $fields['img'], "ts_es" => formatTimeStamp($fields['time_start']), "ts_en" => date('Y-m-d', $fields['time_start']), "te_es" => formatTimeStamp($fields['time_end']), "te_en" => date('Y-m-d', $fields['time_end']), "t_p" => $fields['img'], "d" => $fields['days'], "h" => formatHour($fields['hour']), "tw" => $fields['publish_tw'], "fb" => $fields['publish_fb'], "fbp" => $fields['publish_fbp'], "gp" => $fields['publish_fbgp']));
                    } else {
                        error_log($hdb->errorInfo());
                        $return = array("e" => 2);
                    }
                } else {
                    if ($hdb->doInsert($table, $fields)) {
                        $return = array("e" => 0, "c" => array("i" => $hdb->lastInsertId(), "m" => $fields['message'], "p" => $fields['img'], "ts_es" => formatTimeStamp($fields['time_start']), "ts_en" => date('Y-m-d', $fields['time_start']), "te_es" => formatTimeStamp($fields['time_end']), "te_en" => date('Y-m-d', $fields['time_end']), "t_p" => $fields['img'], "d" => $fields['days'], "h" => formatHour($fields['hour']), "tw" => $fields['publish_tw'], "fb" => $fields['publish_fb'], "fbp" => $fields['publish_fbp'], "gp" => $fields['publish_fbgp']));
                    } else {
                        error_log($hdb->errorInfo());
                        $return = array("e" => 2);
                    }
                }
            } else {
                $return = array("e" => $fields);
            }
        } else {
            $return = array("e" => $message);
        }
    } else {
        $return = array("e" => 1);
    }
} else {
Example #3
0
    $months = array("Enero" => "January", "Febrero" => "February", "Marzo" => "March", "Abril" => "April", "Mayo" => "May", "Junio" => "June", "Julio" => "July", "Agosto" => "August", "Septiembre" => "September", "Octubre" => "October", "Noviembre" => "November", "Diciembre" => "December");
    $day = date("d", $timestamp);
    $year = date("Y", $timestamp);
    $month = date("F", $timestamp);
    $month = array_search($month, $months);
    return "{$day} {$month}, {$year}";
}
function formatHour($hour)
{
    $hour = explode(":", $hour);
    if ($hour[0] > 12) {
        $h = $hour[0] - 12;
        $t = " PM";
    } else {
        $h = $hour[0];
        $t = " AM";
    }
    return $h . ":" . $hour[1] . $t;
}
$query = "SELECT * FROM manager_messages_scheduled WHERE userid = {$uid}";
if ($res = $db->query($query)) {
    while ($pub = $res->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_NEXT)) {
        $pub_object = new publicaciones($pub['id']);
        $pubi = array("i" => $pub['id'], "m" => $pub['message'], "p" => $pub['img'], "ts_es" => formatTimeStamp($pub['time_start'], true), "ts_en" => date('Y-m-d', $pub['time_start']), "te_es" => formatTimeStamp($pub['time_end'], true), "te_en" => date('Y-m-d', $pub['time_end']), "t_p" => $pub['img'], "d" => $pub['days'], "h" => formatHour($pub['hour']), "tw" => $pub['publish_tw'], "fb" => $pub['publish_fb'], "fbp" => $pub['publish_fbp'], "gp" => $pub['publish_fbgp']);
        $sn[] = $pubi;
    }
    $return = array("e" => 0, "sn" => $sn);
} else {
    $return = array("e" => 1);
}
echo json_encode($return);
$db = "";
$dbhandle = new mysqli($host, $user, $pass, $db);
if ($dbhandle->connect_error) {
    exit("There was an error with your connection: " . $dbhandle->connect_error);
}
$strQuery = "SELECT HOUR(login_time) as hour, COUNT(*) as count FROM login_timestamp GROUP BY hour";
// Execute the query, or else return the error message.
$result = $dbhandle->query($strQuery) or exit("Error code ({$dbhandle->errno}): {$dbhandle->error}");
// If the query returns a valid response, prepare the JSON strin
if ($result) {
    // The `$arrData` array holds the chart attributes and data
    $arrData = array("chart" => array("caption" => "Login Times by Popularity", "xAxisName" => "Hour", "yAxisName" => "Amount of Logins", "paletteColors" => "#0075c2", "bgColor" => "#ffffff", "borderAlpha" => "20", "canvasBorderAlpha" => "0", "usePlotGradientColor" => "0", "plotBorderAlpha" => "10", "showXAxisLine" => "1", "xAxisLineColor" => "#999999", "showValues" => "0", "divlineColor" => "#999999", "divLineIsDashed" => "1", "showAlternateHGridColor" => "0"));
    $arrData["data"] = array();
    // Push the data into the array
    while ($row = mysqli_fetch_array($result)) {
        array_push($arrData["data"], array("label" => formatHour($row["hour"]), "value" => $row["count"]));
    }
    /*JSON Encode the data to retrieve the string containing the JSON representation of the data in the array. */
    $jsonEncodedData = json_encode($arrData);
    /*
     Create an object for the column chart using the FusionCharts PHP class constructor. 
     Syntax for the constructor is 
     `FusionCharts("type of chart", "unique chart id", width of the chart, height of the chart, "div id to render the chart", "data format", "data source")`. 
     Because we are using JSON data to render the chart, the data format will be `json`. 
     The variable `$jsonEncodeData` holds all the JSON data for the chart, 
     and will be passed as the value for the data source parameter of the constructor.
    */
    $columnChart = new FusionCharts("column2D", "chart_logins", 600, 300, "time_chart", "json", $jsonEncodedData);
    // Render the chart
    $columnChart->render();
}