⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 user_functions.php

📁 本代码是为客户联系管理而做的系统
💻 PHP
📖 第 1 页 / 共 2 页
字号:
	} else {
		return 0;
	}
}

/*****************************************************
	function checkvalue

-----DESCRIPTION: -----------------------------------
	- checks if number is value
	- used in templates during looping

-----RETURNS:----------------------------------------
	true / false

*****************************************************/

function checkvalue(&$number, $value) {
	if ($number == $value) {
		$number = 0;
		return true;
	} else {
		return false;
	}
}

/*****************************************************
	function login_form

-----DESCRIPTION: -----------------------------------
	- displays login form
	- keeps track of any submitted variables and passes them on

-----RETURNS:----------------------------------------
	displays login form

*****************************************************/

function login_form($error='', $getvars='', $postvars='', $filevars='') {

	global $r, $t, $css, $settings, $_SERVER, $_POST, $this_language, $_GET, $_FILES, $user, $dplang, $session;
	
	if ($error) {
		$log_out = 1;
	}

	// transfer form data depending upon 1st/2nd time of login
	if ($getvars OR $postvars OR $filevars) {
		$_getvars = htmlspecialchars($getvars);
		$_postvars = htmlspecialchars($postvars);
		$_filevars = htmlspecialchars($filevars);
	} else {
		$_getvars = htmlspecialchars(serialize($_GET));
		$_postvars = htmlspecialchars(serialize($_POST));
		$_filevars = htmlspecialchars(serialize($_FILES));
	}

	if (!$page) {
		$action = 'index.php';
	}

	$currentpage = $_SERVER[PHP_SELF] . $session_url;
	$page = 'login';
 
	header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
	header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
	header("Cache-Control: no-cache, must-revalidate");
	header("Pragma: no-cache"); 

	eval(makeeval('header', 'HF_header'));
	eval(makeeval('footer', 'HF_footer'));
	eval(makeeval('echo', 'PROFILE_login'));
	exit();

}

/*****************************************************
	function error

-----DESCRIPTION: -----------------------------------
	- displays error message

-----RETURNS:----------------------------------------
	displays error message

*****************************************************/

function error($message='', $notice = 0) {

	global $r, $t, $css, $user, $this_language, $session, $header, $footer, $settings, $dplang, $headinclude, $navbar, $footer;


	if ($dplang[$message] != '') {
		$message = $dplang[$message];
	}

	eval(makeeval('header', 'HF_header'));
	eval(makeeval('footer', 'HF_footer'));
	eval(makeeval('echo', 'ERROR_default'));
	
	exit();

}

/*****************************************************
	function jump

-----DESCRIPTION: -----------------------------------
	- jumps to another page

-----RETURNS:----------------------------------------
	echos the html to jump to the next page

*****************************************************/

function jump($url, $message='', $time=1) {
	
	global $r, $css, $session_url, $this_language, $dplang;
	
	// we need to change the url to take account of session
	if ($session_url) {
		if (in_string('php?', $url)) {
			$url = str_replace('php?', "php" . $session_url . '&', $url);
		} else {
			$url = str_replace('php', "php" . $session_url, $url);
		}
	}

	$message = $dplang[$message];

	eval(makeeval('echo', 'REDIRECT_standard_redirect'));
	exit();

}

/*****************************************************
	function form_input

*****************************************************/

function form_input($name, $value="", $size="30", $to_array='') {
	
	if ($to_array != "") {
		$name = $to_array . "[" . $name . "]";
	}
	
	$value = htmlspecialchars($value);
	$html= "<input type=\"text\" name=\"$name\" value=\"$value\" size=\"$size\">";
	return $html;
}

/*****************************************************
	function form_select

-----VALS: -----------------------------------
	$name		- name of form element
	$data		- the array of data to popluate select menu
	$start		- the selected value
	$array		- if name of form element should include an array
	$same		- should the key/val be the same
	$size		- if a big select box

*****************************************************/

function form_select($name, $data, $start='', $array='', $same='', $size='') {

	if ($to_array != "") {
		$name = $to_array . "[" . $name . "]";
	}

	if ($size) {
		$name = $name . '[]';
		$html .= "<select name=\"$name\" size=\"$size\" MULTIPLE>\n";
	} else {
		$html .= "<select name=\"$name\">\n";
	}
	
	while (list ($key, $val) = each ($data)) {
		if ($same) {
			$key = $val;
		}
		if ($key == $start) {
			$html .= "<option selected=\"selected\" value=\"$key\">$val</option>\n";
		} else {
			$html .= "<option value=\"$key\">$val</option>\n";
		}
	}
	$html .= "</select>\n";
	return $html;
}

/*****************************************************
	function form_checkbox

-----VALS: -----------------------------------
	$name		- name of form element
	$data		- the array of data to create checkboxes
	$checked	- should the select box be selected
	$array		- if name of form element should include an array
	$perline	- used to specify a number of checkboxes per line

*****************************************************/

function form_checkbox($name, $data, $checked, $array, $perline) {
	
	if ($to_array != "") {
		$name = $to_array . "[" . $name . "]";
	}
	
	if ($perline) {
		$html .= "<table><tr>";
	}
	
	if (is_array($data)) {
		$i=0;
		while (list ($key, $val) = each ($data)) {
			
			if ($perline) {
				
				if ($i == $perline) {
					$html .= "</tr><tr>";
					$i=0;
				}
				
				$html .= "<td><b>$name</b> <input type=\"checkbox\" name=\"$name\" value=\"$value\" $checked[$key]></td>\n";
				$i++;
				
			} else {
				$html .= "<b>$name</b> <input type=\"checkbox\" name=\"$name\" value=\"$value\" $checked[$key]>\n";
			}
		}
		
		if ($perline) {
			if ($perline == $i) {
				$html .= "</tr></table>";
			} else {
				$html .= str_repeat("<td></tr>", $perline - $i);
				$html .= "</tr></table>";
			}
		}
		
	} else {
		$html = "<b>$name</b> <input type=\"checkbox\" name=\"$name\" value=\"$value\" $checked>\n";
	}
	
	return $html;
	
}

/*****************************************************
	function form_radio

*****************************************************/

function form_radio($name, $value, $start='') {

	global $r;
	$num_elements = count($value);
	$form = "<table>";
	for ($idx = 0; $idx < $num_elements; ++$idx) {
		$form .= "<tr><td>$r[normalfont]$value[$idx]:</font></td><td>";
		if ($value[$idx] == $start) {
			$form .= "<input type=\"radio\" name=\"$name\" value=\"$value[$idx]\" checked></td></tr>\n";
		} else {
			$form .= "<input type=\"radio\" name=\"$name\" value=\"$value[$idx]\"></td></tr>\n";
		}
	}
	$form .= "</table>";
	return $form;
}

/*****************************************************
	function form_radio_yn

*****************************************************/

function form_radio_yn($name, $array='', $yes='0') {

	if ($array) {
		$name = $array . "[" . $name . "]";
	}
	if ($yes) {
		$html .= "<font face=\"verdana, arial, helvetica\" size=\"2\"><b>";
		$html .= "Yes: <input type=\"radio\" name=\"$name\" value=\"1\" checked>\n";
		$html .= "No: <input type=\"radio\" name=\"$name\" value=\"0\">\n";
		$html .= "</b></font>";
	} else {
		$html .= "<font face=\"verdana, arial, helvetica\" size=\"2\"><b>";
		$html .= "Yes: <input type=\"radio\" name=\"$name\" value=\"1\">\n";
		$html .= "No: <input type=\"radio\" name=\"$name\" value=\"0\" checked>\n";
		$html .= "</b></font>";
	}
	return $html;
}

/*****************************************************
	function form_textarea

*****************************************************/

function form_textarea($name, $cols='30', $rows='5', $value='', $to_array='') {

	$value = htmlspecialchars($value);
	if ($to_array != "") {
		$name = $to_array . "[" . $name . "]";
	}

	$temp = "<textarea name=\"$name\" cols=\"$cols\" rows=\"$rows\">$value</textarea>\n";
	return $temp;
}

/*****************************************************
	function form_hidden

*****************************************************/
function form_hidden($name, $value) {

	$temp = "<input type=\"hidden\" name=\"$name\" value=\"$value\">\n";
	return $temp;
}

/*****************************************************
	function form_password

*****************************************************/

function form_password($name, $size, $maxlength, $value) {

	return "<input type=\"password\" name=\"$name\" size=\"$size\" maxlength=\"$maxlength\" value=\"$value\">\n";
}

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -