PHP Code:
// Now we check those three conditions we have in the Admin CP
if($row['whenisavail'] == "conditions") {
// If we have a restriction on the number of times this can be adopted...
if($row['freqcond'] == "enabled") {
// Select from the database and determine how many times this adoptable type has been adopted
$num = 0;
$query = "SELECT * FROM ".$GLOBALS['prefix']."owned_adoptables WHERE type='$type'"; // QUERYPROBLEM
$result = runquery($query);
$num = mysql_numrows($result);
if($num > $number) {
return "no";
}
}
// Begin the date restriction check
$today = date('Y-m-d');
if($row['datecond'] == "enabled" and $row['date'] != $today) {
return "no";
}
// We are checking to see how many of this adoptable a user owns
// If they own more than the specifed number, they cannot adopt...
if($row['moreless'] == "enabled") {
$num = 0;
$query = "SELECT * FROM ".$GLOBALS['prefix']."owned_adoptables WHERE owner='$loggedinname' and type='$type'";
$result = runquery($query);
$num = mysql_numrows($result);
if($num > $row['morelessnum']) {
return "no";
}
}
// Check if the user is of a specified usergroup...
if($row['levelgrle'] == "enabled") {
$ourgid = getgroup();
// If the two numbers do not match, do not allow the adoption...
if($ourgid != $row['grlelevel']) {
return "no";
}
}
} // end conditions
return "yes";
}
// MESSY
function getaltstatus($parentid, $childid, $childlevel) {
// This function determines if we will use alternate images...
$alt = "Cannot find adopt with given parent id.";
// First we need to see if this adoptable type has alternate images enabled...
$query = "SELECT * FROM ".$prefix."adoptables WHERE id='".$parentid."'";
$result = mysql_query($query);
$num = mysql_num_rows($result);
$alternates=@mysql_result($result, $i,"alternates");
// Let's see if the level we are on is the level that requires alternates
if($alternates == "enabled") {
// Alternates for adoptable type are enabled, next check to see if this adopt is already using an alternate.
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE aid='".$childid."'";
$result = mysql_query($query);
$num = mysql_num_rows($result);
$usealt=@mysql_result($result, $i,"usealternates");
$currentimage=@mysql_result($result, $i,"altimage");
if($usealt == "no"){
// Alternates are not currently being used, next check for alternate image w/ specified entry level.
$query = "SELECT * FROM ".$prefix."alternates WHERE entry='".$childlevel."' AND adoptid='".$parentid."'";
$result = runquery($query);
while($row = mysql_fetch_array($result)){
$method=$row['method'];
$data=$row['data'];
$newurl=$row['alturl'];
// check what kind of method we're using to choose an alternate.
if($method == "random"){
$chance = rand(1, $data);
if($chance == 1){
$alt = $newurl;
}
else{
$alt = "The random finder did not pick 1.";
}
}
else{
$alt = "Not finding method random...";
}
$i++;
}
}
else if($usealt == "yes"){
Lines 400-500.
I'll bet anything I pasted it in wrong.