Example #1
0
			$profield = $_SGLOBAL['profield'][$fieldid];
			if($profield['formtype'] == 'multi') {
				if($values && is_array($values)) {
					foreach ($values as $value) {
						$s = stripslashes($value);
						if(in_array($s, $profield['choice'])) {
							if($mtag = mtag_join('tagname', $s, $fieldid)) {
								$mtags[] = $mtag;
							}
						}
					}
				}
			} elseif($profield['formtype'] == 'select') {
				$s = stripslashes($values);
				if(in_array($s, $profield['choice'])) {
					if($mtag = mtag_join('tagname', $s, $fieldid)) {
						$mtags[] = $mtag;
					}
				}
			} else {
				continue;
			}
		}
		if(empty($mtags)) {
			showmessage('do_success', 'cp.php?ac=mtag');
		} else {
			$_GET['op'] = 'multiresult';
			include template("cp_mtag");
			exit();
		}
	}
Example #2
0
     if (in_array(stripslashes($_POST['tagname']), $profield['choice'])) {
         $mtag = mtag_join('tagname', $_POST['tagname'], $fieldid);
     }
     if (empty($mtag)) {
         showmessage('mtag_join_error');
     } else {
         showmessage('join_success', "space.php?uid={$_SGLOBAL['supe_uid']}&do=mtag&tagid={$mtag['tagid']}", 0);
     }
 } else {
     $tagname = getstr($_POST['tagname'], 40, 1, 1, 1);
     if (strlen($tagname) < 2) {
         showmessage('mtag_tagname_error');
     }
     if (!empty($_POST['joinmode'])) {
         //二次确认
         $mtag = mtag_join('tagname', $tagname, $fieldid);
         if (empty($mtag)) {
             showmessage('mtag_join_error');
         } else {
             $url = $mtag['grade'] >= 8 ? "cp.php?ac=mtag&op=manage&tagid={$mtag['tagid']}" : "space.php?uid={$_SGLOBAL['supe_uid']}&do=mtag&tagid={$mtag['tagid']}";
             showmessage('join_success', $url, 0);
         }
     } else {
         //寻找
         $findmtag = $likemtags = array();
         $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('mtag') . " WHERE tagname='{$tagname}' AND fieldid='{$fieldid}'");
         if (!($findmtag = $_SGLOBAL['db']->fetch_array($query))) {
             $newtagname = stripslashes($_POST['tagname']);
             $key = stripsearchkey($_POST['tagname']);
             //找相似的
             $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('mtag') . " WHERE fieldid='{$fieldid}' AND tagname LIKE '%{$key}%' ORDER BY membernum DESC LIMIT 0,20");