Jump to content

While in a var?


unidox

Recommended Posts

Here:

 

function add($array, $link, $log) {
	foreach ($array as $v) {
		if (preg_match("/password/i", $v)) {
			eval("$" . $v . " = " . pass($_POST[$v]) . ";");
			if ($password == "") {
				header("Location: index.php?p=error&h=" . $link . "&e=" . $link . "_4");
				exit();
			} elseif ($password_check == "") {
				header("Location: index.php?p=error&h=" . $link . "&e=" . $link . "_5");
				exit();
			} else {
				if ($password != $password_check) {
					header("Location: index.php?p=error&h=" . $link . "&e=" . $link . "_6");
					exit();
				}
			}
		} elseif (preg_match("/url/i", $v)) {
			eval("$" . $v . " = " . url($_POST[$v]) . ";");
			if ($url == "") {
				header("Location: index.php?p=error&h=" . $link . "&e=" . $link . "_7");
				exit();
			}
		} elseif (preg_match("/level/i", $v)) {
			if ($this->check == true) {
				eval("$" . $v . " = " . escape_data($_POST[$v]) . ";");
				if ($level == 1) {
					$level = $this->chklvl("Users");
				}
				if (!is_numeric($level)) {
					header("Location: index.php?p=error&h=" . $link . "&e=" . $link . "_8");
					exit();
				} elseif ($level == "") {
					$level = $this->chklvl("Users");
				}
				$q = mysql_query("SELECT * FROM `pcp_groups` WHERE `level` = '$level'") or die(mysql_error());
		        $r = mysql_fetch_array($q);
		        $group = $r['name'];
			} else {
				$level = $this->chklvl("Users");
			}
		} elseif (preg_match("/active/i", $v)) {
			eval("$" . $v . " = " . escape_data($_POST[$v]) . ";");
			if (!is_numeric($active)) {
				header("Location: index.php?p=error&h=" . $link . "&e=" . $link . "_9");
				exit();
			} elseif ($active == "") {
				$active = 2;
			}
		} else {
			eval("$" . $v . " = " . escape_data($_POST[$v]) . ";");
			if (preg_match("/_required/i", $v)) {
				if ("$" . $v . "" == "") {
					header("Location: index.php?p=error&h=" . $link . "&e=" . $link . "_10&field=" . $v . "");
					exit();
				}
			}
		}
	}

	if (($username != "") || ($email != "")) {
		$q = mysql_query("SELECT * FROM `pcp_users` WHERE `username` = '$username' || `email` = '$email'");
		$r = mysql_fetch_array($q);

		if (($r['username'] == $username_required)) { // If there is already a member in the db
		    header("Location: index.php?p=users&s=add_user&e=6"); // Redirects to error "Sorry, that username/email is already in use, please use forget password to retrieve your account.".
		    exit();
		} elseif (($r['email'] == $email_required)) { // If there is already a member in the db
		    header("Location: index.php?p=users&s=add_user&e=7"); // Redirects to error "Sorry, that username/email is already in use, please use forget password to retrieve your account.".
		}
	}

	$this->create_log("Added " . $log . ": \"" . $username . "\"", $user_name);

}

 

I just need to insert it into sql now. Which I am trying to figure out.

Link to comment
https://forums.phpfreaks.com/topic/108049-while-in-a-var/#findComment-553838
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.