hi, i looked all the codes but i could not really see it - i dont really understand coding-. after registration this website send an activation code but i want to make the user active when they actually register. when they register their status is set to A but for them to be active it needs to be P on the database. below is the closest code i could find.

can you please help me what i should look for or what can i do make the user active when they register?
thnank you

function verifyMember($username, $password) {
		$this->setDebugMsg("Method: verifyMember()");
		$ret = 0;
		$q = sprintf("SELECT id, member_status_code FROM member WHERE username='%s' AND password='%s' LIMIT 1",
		mysql_real_escape_string($username),
		mysql_real_escape_string($password)
		);
		$rs = $this->db->query($q);
		if ($rs) {
			if($this->db->numRows($rs) > 0) 
			{
				$row = $this->db->fetchAssoc($rs);
				if ($row["member_status_code"]!="A")
				{
					$ret = $row["member_status_code"];
				}
				else
				{
					$ret = $row["id"];
				}
			}
			else
			{
				$ret = 0;
			}
		}
		return $ret;
	}

Recommended Answers

All 7 Replies

Find the query that inserts the user's data into the database and change the status_code to equal P instead of A. The code you posted is not relevant to what you are asking for help with so I can't be more specific.

i understand but i could not find it, i found these too
i will look more

function setMemberStatusCode($val) {
		$this->member_status_code = $val;
	}

	/**
	 * Status Desc set
	 * @param String $val
	 * @return Void
	 */
	function setMemberStatusDesc($val) {
		$this->member_status_desc = $val;
	}

and this, any of it could help me?

function activateMember($username, $activation_code) {
		$ret = array("status"=>false, "err_msg"=>"", "msg"=>"");
		$q = sprintf("UPDATE member SET member_status_code='A' WHERE username='%s' AND activation_code='%s' AND member_status_code='P' LIMIT 1",
		mysql_real_escape_string($username),
		mysql_real_escape_string($activation_code)
		);
		//echo $q;
		$rs = $this->db->query($q);
		if ($rs) {
			$ret["status"] = true;
			$ret["msg"] = "<br><br>done. <br><a href=\"Login\">Login</a>";
		} else {
			$ret["err_msg"] = "problem!";
		}
		return $ret;
	}

There must be an INSERT query somewhere but looking at the first code you posted you could just try changing this

function setMemberStatusCode() {
		$this->member_status_code = 'P';
	}

it did not work,

i still could not find it but i changed this, it should not cause me any problem right

$row = $this->db->fetchAssoc($rs);
				//if ($row["member_status_code"]!="A")
				if ($row["member_status_code"]!="P")
function verifyMember($username, $password) {
		$this->setDebugMsg("Method: verifyMember()");
		$ret = 0;
		$q = sprintf("SELECT id, member_status_code FROM member WHERE username='%s' AND password='%s' LIMIT 1",
		mysql_real_escape_string($username),
		mysql_real_escape_string($password)
		);
		$rs = $this->db->query($q);
		if ($rs) {
			if($this->db->numRows($rs) > 0) 
			{
				$row = $this->db->fetchAssoc($rs);
				//if ($row["member_status_code"]!="A")
				if ($row["member_status_code"]!="P")
				{
					$ret = $row["member_status_code"];
				}
				else
				{
					$ret = $row["id"];
				}
			}
			else
			{
				$ret = 0;
			}
		}
		return $ret;
	}

above worked but partially so it is not good

is there anyway i could insert these info with this
in the database fields are called member_status_code set to "P" admin_approve set to "Y"
can i do it below? and how could i do it?

$member_id = $member->insertMember();
									if($member_id > 0)
										{
											$member->setId($member_id);
											$communication->setMemberId($member_id);
											if($_POST["f_cifty"] != "select") 
											{
												$communication->setCity($_POST["f_city"]);
											} 
											else 
											{
												$communication->setCity($_POST["f_city_other"]);
											}
											$communication->setCountry($_POST["f_country"]);
											//
											if($communication->insertCommunication()) 
												{
													//
													if ($email->sendActivationCode($member, $config["site_hostname"], $config["admin_email"], $config["site_domain"])) 
														{
															$signup->setResult(true);
															$dbg .= "activation code sent<br>";
														}
													else
														{
															$signup->setResult(true);
															$dbg .= "could not sent the activation code<br>";
														}
												} //if($communication->insertCommunication()) 
										} //if($member_id > 0)
									$dbg .= "member_id: $member_id<br>";
								
				} 
			else 
				{
				$dbg .= "<br>check<br>";
				$dbg .= $check_username ."<br>";
				if($check_username["results"]["id"] > 0)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.