function outputList($list) { $out = '<ul>'; foreach ($list as $key => $value) { $out .= '<li class="' . (is_array($value) ? 'array' : 'string') . '">'; $out .= '<h2 style="display:inline;">' . $key . '</h2> '; $out .= is_array($value) ? outputList($value) : $value; $out .= '</li>'; } $out .= '</ul>'; return $out; }
function outputDefaultFilterData() { $android_list = getList("", "android_version"); $android_list = outputList($android_list); $brand_list = getList("", "phone_brand"); $brand_list = outputList($brand_list); $model_list = getList("", "phone_model"); $model_list = outputList($model_list); $android = getFilterValue("android"); $brand = getFilterValue("brand"); $model = getFilterValue("model"); $android_data = array('id' => "android", 'selected' => getSelectedIndex($android, $android_list), 'list' => $android_list); $brand_data = array('id' => "brand", 'selected' => getSelectedIndex($brand, $brand_list), 'list' => $brand_list); $model_data = array('id' => "model", 'selected' => getSelectedIndex($model, $model_list), 'list' => $model_list); $out = array($android_data, $brand_data, $model_data); echo json_encode($out); }
$model_list = getList($sql, "phone_model"); $model_list = outputList($model_list); } else { $android_list = getList("", "android_version"); $android_list = outputList($android_list); $brand_list = getList("", "phone_brand"); $brand_list = outputList($brand_list); $model_list = getList("", "phone_model"); $model_list = outputList($model_list); } } } break; default: $android_list = getList("", "android_version"); $android_list = outputList($android_list); $brand_list = getList("", "phone_brand"); $brand_list = outputList($brand_list); $model_list = getList("", "phone_model"); $model_list = outputList($model_list); $android = ""; $brand = ""; $model = ""; break; } $android_data = array('id' => "android", 'selected' => getSelectedIndex($android, $android_list), 'list' => $android_list); $brand_data = array('id' => "brand", 'selected' => getSelectedIndex($brand, $brand_list), 'list' => $brand_list); $model_data = array('id' => "model", 'selected' => getSelectedIndex($model, $model_list), 'list' => $model_list); $out = array($android_data, $brand_data, $model_data); echo json_encode($out); }
<?php include 'includes/mysql_connect.inc.php'; include 'includes/results_format.inc.php'; if (isset($_GET['userid'])) { $user_id = $_GET['userid']; $query = 'SELECT * FROM users WHERE userid=' . $user_id . ''; $result = basicQuery($query); $cells = array('userid', 'username', 'firstname', 'lastname', 'usercreated'); $list_style = 'ol'; $link = '<a href="user_viewer.inc.php?usercontent='; $link_end = '">View User Content</a>'; outputList($cells, $result, $list_style, $link, $link_end); } else { if (isset($_GET['usercontent'])) { $user_id = $_GET['usercontent']; $headers = array('content id', 'content name', 'description', 'content', 'created', 'link'); $cells = array('contentid', 'contentname', 'contentdesc', 'contenttext', 'contentcreated'); $query = 'select content.contentid, content.contentname, content.contentdesc, content.contenttext, content.contentcreated from content_lookup, content where content_lookup.content_id=content.contentid and content_lookup.user_id=' . $user_id . ''; $result = basicQuery($query); $link = '<a href="content_viewer.inc.php?contentid='; $link_end = '">View content</a>'; outputTable($headers, $cells, $result, $link, $link_end); } else { exit('No user requested. Please return to <a href="./">home menu</a>'); } }