function get_newid($table) { $arr = get_arr($table,"id","","id DESC",1); $new_id = $arr[0]['id'] + 1; return $new_id; }
if ($init == "do") { $data = get_row("referenz","id,name,txt,img_titles,imgs,pos","id=".$id); $f_name = $data['name']; $f_txt = $data['txt']; $pos = $data['pos']; if ($data['img_titles']) { $pic_tits = explode("#",$data['img_titles']); for ($x = 0; $x < count($pic_tits); $x++) { ${"f_pic_title_".$x} = $pic_tits[$x]; } } $picstr = $data['imgs']; $init = "done"; } else { $list = get_arr("referenz","name,pos","","pos",""); } echo "<body>\n"; echo "<div align=\"center\">\n"; echo "<center>\n"; echo "<form method=\"POST\" action=\"$PHP_SELF\" enctype=\"multipart/form-data\" name=\"edit_form\">\n"; echo "<input type=\"hidden\" name=\"id\" value=\"".$id."\">\n"; echo "<input type=\"hidden\" name=\"pos\" value=\"".$pos."\">\n"; echo "<input type=\"hidden\" name=\"picstr\" value=\"".$picstr."\">\n"; echo "<table border=\"0\" cellpadding=\"0\" width=\"770\" cellspacing=\"1\">\n"; echo "<tr>\n"; echo "<td width=\"110\" height=\"20\"></td>\n"; echo "<td width=\"110\" height=\"20\"></td>\n"; echo "<td width=\"110\" height=\"20\"></td>\n"; echo "<td width=\"110\" height=\"20\"></td>\n";
} get_value(); echo $var1; echo $var2; ?> 6. 写出如下程序的输出结果 <?php function get_arr($arr) { unset($arr[0]); } $arr1 = array(1, 2); $arr2 = array(1, 2); get_arr(&$arr1); get_arr($arr2); echo count($arr1); echo count($arr2); ?> 7. 使用五种以上方式获取一个文件的扩展名 要求:dir/upload.image.jpg,找出 .jpg 或者 jpg , 必须使用PHP自带的处理函数进行处理,方法不能明显重复,可以封装成函数,比如 get_ext1($file_name), get_ext2($file_name) 二、算法题 1. 使用PHP描述冒泡排序和快速排序算法,对象可以是一个数组
<?php include "globals.php"; include "includes/lib_common.php"; include "includes/lib_html.php"; # Default values $player = get_str("player", session("username")); $types = get_arr("type", array('P', 'D', 'T', 'Q')); HTML_Header("Map Rank"); HTML_Content_Title("Map Rank", ""); HTML_Form($player, $types); if ($_GET) { $url = "cgi-bin/maprank.cgi" . "?player=" . urlencode($player) . "&types=" . urlencode(implode($types, ',')); HTML_AnimatedLoadNestedURLs($url, $url . "&info=1", "", "<br>", "<strong>", "</strong>"); } HTML_Footer(); function HTML_Form($player, $types) { ?> <form class="ccform" action="" method="get" id="find"> <fieldset> <legend>Search</legend> <div class="field-row"> <label class="field-label" for="player">Player</label> <input type="text" class="field" name="player" id="player" maxlength="16" value="<?php echo _H($player); ?> "/> </div> <div class="field-row"> <span class="field-label">Game Type</span>
echo "</tr>\n"; echo "<tr>\n"; echo "<td width=\"500\" height=\"30\" bgcolor=\"".$menucol."\" align=\"center\"><p class=\"txt_note\">Sortiere Beiträge...</td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "</form>\n"; echo "</center>\n"; echo "</div>\n"; echo "<body onload=\"self.focus()\">\n"; echo "</html>\n"; require_once("../_shared/config.inc.php"); include_once("../_shared/func.inc.php"); open_db($db_host,$db_user,$db_passw,$datbase); $entries = get_arr("referenz","id","","pos",""); $sort_entry = $entries[$old_pos]; $dummy = array_splice($entries,$old_pos,1); for ($x = count($entries); $x > $new_pos; $x--) { $entries[$x] = $entries[$x-1]; } $entries[$new_pos] = $sort_entry; for ($x = 0; $x < count($entries); $x++) { $id = $entries[$x]['id']; update_data("referenz","pos=".$x,"id=".$id); } mysql_close; echo "<script language=\"javascript\">window.opener.location.href='list.php'</script>"; echo "<script language=\"javascript\">window.close(this)</script>";
function get_param_value($input, $type) { switch ($type) { case 'bool': return get_bool($input); break; case 'int': return get_int($input); break; case 'file': return get_file($input); break; case 'string_split': return get_arr(explode("\r\n", $input), 'presence'); break; case 'string[]': return get_arr($input, 'presence'); break; case 'int[]': return get_arr($input, 'get_int'); break; default: return presence((string) $input); } }
<? require_once("../_shared/config.inc.php"); include_once("../_shared/func.inc.php"); open_db($db_host,$db_user,$db_passw,$datbase); $data = get_arr("referenz","id,name,pos","","pos",""); echo "<html>\n"; echo "<head>\n"; echo "<meta http-equiv=\"Content-Language\" content=\"de\">\n"; echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">\n"; echo "<title></title>\n"; echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../style.css\">\n"; include("../_shared/openwin_js.php"); echo "</head>\n"; echo "<body>\n"; echo "<div align=\"center\">\n"; echo "<center>\n"; echo "<table border=\"0\" cellpadding=\"0\" width=\"770\" cellspacing=\"1\">\n"; echo "<tr>\n"; echo "<td width=\"110\" height=\"20\"></td>\n"; echo "<td width=\"110\" height=\"20\"></td>\n"; echo "<td width=\"110\" height=\"20\"></td>\n"; echo "<td width=\"110\" height=\"20\"></td>\n"; echo "<td width=\"110\" height=\"20\"></td>\n"; echo "<td width=\"110\" height=\"20\"></td>\n"; echo "<td width=\"110\" height=\"20\"></td>\n"; echo "</tr>\n"; echo "<td width=\"770\" colspan=\"7\" bgcolor=\"".$navcol."\" align=\"center\" height=\"25\">"; echo "<p class=\"txt_nav\">Referenzprojekte</td>\n";
<? require_once("../admin/_shared/config.inc.php"); include_once("../admin/_shared/func.inc.php"); open_db($db_host,$db_user,$db_passw,$datbase); $data = get_arr("referenz","id,name,txt,img_titles,imgs","","pos",""); echo "<html>\n"; echo "<head>\n"; echo "<meta http-equiv=\"Content-Language\" content=\"de\">\n"; echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">\n"; echo "<title>Mitarbeiter</title>\n"; echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"/style.css\">\n"; include("../admin/_shared/openwin_js.php"); echo "<body>\n"; echo "<div align=\"center\">\n"; echo "<center>\n"; echo "<table border=\"0\" cellpadding=\"2\" width=\"711\" cellspacing=\"0\">\n"; if ($data != 0) { for ($x = 0; $x < count($data); $x++) { echo "<tr>\n"; echo "<td width=\"711\" height=\"20\" colspan=\"3\"></td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td width=\"711\" align=\"center\" bgcolor=\"".$col_1."\" colspan=\"3\">\n"; echo "<p class=\"txt_mb_c\">".$data[$x]['name']."</td>\n"; echo "</tr>\n"; if ($data[$x]['imgs']) { $pics = explode("#",$data[$x]['imgs']); $pic_tits = explode("#",$data[$x]['img_titles']);