public function news() { $Form = new Model(); $articles = $Form->query('select content_id, article_title, article_content from home_show inner join admin_articles on content_id = article_id where tag = 4'); foreach ($articles as $key => $value) { $pic = getPic($value['article_content'], C(EXP_PREFIX)); $pic = C(PREFIX) . substr($pic, 1); $articles[$key]['article_content'] = $pic; } $this->assign('newslist', $articles); //dump($articles); $this->display(); }
function editAccount($uid) { $user = getPerson($uid); $picture = $_FILES['picture']; if ($_POST['email'] == "") { return "Email may not be empty"; } if ($_POST['fullname'] == "") { return "Full name may not be empty"; } if ($picture['name'] != '') { $pic = pictureHandling($uid, $picture); } else { $pic = getPic($uid); } $purifier = new HTMLPurifier(); $fullname = $purifier->purify($_POST['fullname']); $pic = $purifier->purify($pic); $email_level = $purifier->purify($_POST['email_pref']); mysql_query('START TRANSACTION'); $failed = 0; $sql = sprintf("UPDATE user_info SET fullname='%s', picture='%s', email_level='%s' WHERE uid='%s'", mysql_real_escape_string($fullname), mysql_real_escape_string($pic), mysql_real_escape_string($email_level), mysql_real_escape_string($uid)); $result = mysql_query($sql); if ($result == FALSE) { $failed = 1; } $sql = sprintf("DELETE from user_info_values WHERE person_id = '%s'", mysql_real_escape_string($uid)); $result = mysql_query($sql); if ($result == FALSE) { $failed = 1; } $sql = sprintf("SELECT id, shortname, longname FROM user_info_key"); $result = get_rows($sql); if (!$result) { $failed = 1; } foreach ($result as $r) { $shortname = $r['shortname']; $longname = $r['longname']; $user_key_id = $r['id']; $value = $_POST[$shortname]; $value = $purifier->purify($value); if ($_POST[$shortname] != "") { $sql = sprintf("INSERT INTO user_info_values VALUES ('%s', '%s', '%s')", mysql_real_escape_string($uid), mysql_real_escape_string($user_key_id), mysql_real_escape_string($value)); $res = mysql_query($sql); if ($res == FALSE) { $failed = 1; } } } if ($failed == 1) { mysql_query('ROLLBACK'); return "Registration Failed"; } else { mysql_query('COMMIT'); return TRUE; } }
$result_of_query = $db_link->query($sql); if ($result_of_query->num_rows > 0) { $veh = $result_of_query->fetch_object(); ?> <div class="col-md-4" style="float:left; padding-top:20px;"> <div class="panel panel-default"> <div class="panel-heading"> <h2 class="panel-title"><i class="fa fa-child fa-fw"></i><?php echo nameID($veh->pid, $db_link) . "'s " . carName($veh->classname); ?> </h2> </div> <div class="panel-body"> <?php $carPic = getPic($veh->classname); echo '<center><img src="' . $settings['url'] . 'assets/img/cars/' . $carPic . '.jpg" class="img-responsive" alt="' . $veh->classname . '">'; ?> <?php echo "<h4>" . $lang['owner'] . ": <a href='" . $settings['url'] . "editPlayer/" . uID($veh->pid, $db_link) . "'>" . nameID($veh->pid, $db_link) . "</a></h4>"; echo "<h4>" . $lang['class'] . ": " . carName($veh->classname) . "</h4>"; echo "<h4>" . $lang['plate'] . ": " . $veh->plate . "</h4>"; if ($veh->alive == false) { echo "<h4><span class='label label-danger'>" . $lang["not"] . " " . $lang["alive"] . "</span></h4>"; } else { echo "<h4><span class='label label-success'>" . $lang["alive"] . "</span></h4> "; } if ($veh->active == false) { echo " <h4><span class='label label-danger'>" . $lang["not"] . " " . $lang["active"] . "</span></h4>"; } else { echo " <h4><span class='label label-success'>" . $lang["active"] . "</span></h4>";
<meta name="viewport" content="initial-scale=1.0,width=device-width"> <title>My Profile</title> </head> <body> <div id="wrapper"> <h2>My Profile</h2> <div id="username"><?php getUsername(); ?> </div> <div id="email"><?php getEmail(); ?> <div id="changeEmail"></div></div> <div id="pic"><?php getPic(); ?> <div id="uploadNewPic"></div></div> </div> </body> </html> <?php class user { var $username; var $email; var $picUrl; var $profile; function __construct() {
public function articleUpdate() { if (session('?userid') && session('?usertype') && ($_SESSION[usertype] == 1 || $_SESSION[usertype] == 2)) { //dump($_POST); $Form = new Model(); $date = date("Y-m-d H:i:s"); $id = date("Ymdhis"); //'update project_info set status=%d where project_id="%s"' //生成缩略图 $info = htmlspecialchars_decode(I('post.key6')); $origin = getPic($info, C(EXP_PREFIX)); //dump($origin); if ($origin != null) { $thumb = substr($origin, 0, strlen($origin) - 4) . 'thumb.jpg'; //ThinkImage类方法 $image = new \Think\Image(); $image->open($origin); $unlink = $image->thumb(240, 135, \Think\Image::IMAGE_THUMB_CENTER)->water('./Public/pic/water.png', \Think\Image::IMAGE_WATER_NORTHWEST, 80)->text(' ' . C('MODULE_CODE')[I('post.key2', 0)], './Public/fonts/1.ttf', 12, '#FFFFFF', \Think\Image::IMAGE_WATER_NORTHWEST)->save($thumb); if ($unlink !== false) { $thumb = C(PREFIX) . substr($thumb, 1); } else { $thumb = ''; } } else { $thumb = ''; } $sqlstr = sprintf("update admin_articles set admin_id='%s',article_title='%s',article_type=%d,\n article_field=%d,article_object=%d,article_about=%d,article_content='%s',article_time='%s',\n article_abstract='%s', thumb='%s' \n where article_id='%s'", $_SESSION['userid'], $_POST['key1'], $_POST['key2'], $_POST['key3'], $_POST['key4'], $_POST['key5'], $_POST['key6'], $date, $_POST['key0'], $thumb, $_POST['key7']); $result = $Form->execute($sqlstr); if ($result) { echo $result; } else { echo $result; } } }
function renderResource($gRes, $type) { // $node = new DOMNode('div'); // $node->setAttribute('class', 'section'); // $node->setAttribute('res', $gRes->toString()); // $node->setAttribute('emph', 'major'); $relations = array("dct:creator" => array('text' => "Has creator: ", 'type' => "person"), "-dct:creator" => array('text' => "Is creator of: ", 'type' => "paper"), "ecs:memberOf" => array('text' => "Is member of: ", 'type' => "project"), "-ecs:memberOf" => array('text' => "Has member: ", 'type' => "person"), "dct:hasPart" => array('text' => "Has part: ", 'type' => "none"), "rdfs:seeAlso" => array('text' => "Has link to: ", 'type' => "none")); //} ob_start(); echo '<div class="section" id="' . $gRes->toString() . '" emph="major">'; if (($pic = getPic($gRes, $type)) != "") { echo '<img src="' . $pic . '" class="lpic" />'; } echo '<span class="resTitle">'; if ($type == 'person') { echo $gRes->get("foaf:name"); } else { echo $gRes->get("dct:title"); } echo ' <a target="_blank" href="http://graphite.ecs.soton.ac.uk/browser/?uri=' . urlencode($gRes->toString()) . '">[link]</a>'; echo '</span><span class="resDesc">'; if ($type == 'person') { $s = htmlspecialchars_decode($gRes->get("ecs:hasBiography")); } else { $s = $gRes->get("bibo:abstract", "dct:description"); } if ($s == "[UNKNOWN]") { echo "No Data Found."; } else { echo $s; } echo '</span><div class="relatedlink"><ul class="relatedlinks">'; foreach ($relations as $predicate => $a) { foreach ($gRes->all($predicate) as $res) { // $res->load(); if ($res->label() == "[UNKNOWN]" || $res->label() == "[NULL]") { continue; } echo '<li>'; echo '<a href="#'; // echo 'http://graphite.ecs.soton.ac.uk/browser/?uri='; // echo urlencode($res->toString()); echo $res->toString(); echo '">'; if (($pic = getPic($res, $a['type'], 'small')) != "") { echo '<img src="' . $pic . '" class="spic" />'; } echo '<span class="resTitlesml">'; echo $a['text'] . substr($res->label(), 0, 50); if (substr($res->label(), 51, 1) != "") { echo "..."; } echo '</span>'; echo '</a>'; echo '</li>'; } } echo '</ul></div>'; echo '</div><hr class="small" />'; return ob_get_clean(); }
/** * 编辑文章 */ public function updateArt() { if ($this->create()) { if (empty($_FILES['image']['tmp_name'])) { if ($_POST['checkThumb'] && $_POST['content'] != '') { $num = I('numThumb', 1, 'intval'); $info = getPic($_POST['content'], $num - 1); if (!$info == null) { $image1 = './Public/Ueditor/php/upload/' . $info; } } } else { $image1 = $this->uploadImg(); } if ($image1 != '') { $img = new \Think\Image(); $img->open($image1); $image = './Uploads/' . date('Y-m-d') . '/' . basename($image1); // 按照原图的比例生成一个最大为 150*150 的缩略图并保存为 thumb.jpg $img->thumb(150, 150)->save($image); $_POST['image'] = $image ? ltrim($image, '.') : $_POST['image']; if ($image1) { $url = M('article')->field('image')->find($_POST['id']); unlink('.' . $url['image']); } } //添加水印 if (!empty($_POST['image']) && C('WATER_ON')) { import('Common/Org/Util/Image'); $img = new \Image(); $img->water($_POST['image']); } $_POST['time'] = time(); if (empty($_POST['summary'])) { $_POST['summary'] = $this->getSummary($_POST['content']); } if ($_POST['images']) { $more_imgs = $_POST['images']; $imgs_remark = $_POST['imgs_remark']; $arr = array(); foreach ($more_imgs as $k => $v) { $arr[] = trim($more_imgs[$k] . ',' . $imgs_remark[$k], ','); } $arr = implode('|', $arr); $_POST['images'] = $arr; unset($_POST['imgs_remark']); } M('article')->save($_POST); M($this->tablename)->where(array('aid' => $_POST['id']))->save($_POST); M('tag')->where(array('aid' => $_POST['id']))->delete(); if (isset($_POST['tag'])) { $this->tag($_POST['id'], $_POST['tag']); } M('article_attr')->where(array('bid' => $_POST['id']))->delete(); if (isset($_POST['attr'])) { $this->attr($_POST['id'], $_POST['attr']); } return true; } else { return false; } }
$sql = 'SELECT * FROM `vehicles` WHERE `id` ="' . $vehID . '";'; $result_of_query = $db_connection->query($sql); if ($result_of_query->num_rows > 0) { while ($row = mysqli_fetch_assoc($result_of_query)) { ?> <div class="col-md-4" style="float:left; padding-top:20px;"> <div class="panel panel-default"> <div class="panel-heading"> <h2 class="panel-title"><i class="fa fa-child fa-fw"></i><?php echo nameID($row["pid"]) . "'s " . carName($row["classname"]); ?> </h2> </div> <div class="panel-body"> <?php $carPic = getPic($row["classname"]); ?> <center><img src="assets/img/cars/<?php echo $carPic; ?> .jpg" /> <?php echo "<h4>" . $lang['owner'] . ": " . nameID($row["pid"]) . "</h4>"; echo "<h4>" . $lang['class'] . ": " . carName($row["classname"]) . "</h4>"; echo "<h4>" . $lang['plate'] . ": " . $row["plate"] . "</h4>"; if ($row["alive"] == false) { echo "<h4><span class='label label-danger'>" . $lang["not"] . " " . $lang["alive"] . "</span> "; } else { echo "<h4><span class='label label-success'>" . $lang["alive"] . "</span> "; } if ($row["active"] == false) {