. */ class CandCountryCode extends Cand { public function __construct($candidate_id) { $this->candidate_id = $candidate_id; $this->name = "CountryCode"; $this->compulsory = false; } public function get_print_name() { return "Country"; } public function get_print_name_short() { return "Country"; } public function get_print_value($readonly=false) { $r = ""; return $r; } public function set($value) { if( !preg_match("/(^(\d)+$)/", $value) ) $value=0; $query="SELECT `Code` FROM `countrycodes` WHERE `Code`=".addslashes($value); $numrows = @mysql_num_rows( doquery($query) ); if( $numrows!=1 AND $value!=0 ) { // Not found in the list, but something selected $this->error = true; $this->error_txt = "The nationality specified is not valid. Make sure you select one from the list"; return false; }else { $this->value = $value; return true; } } public function get($oldvalue=false) { $query="SELECT `Name` FROM `countrycodes` WHERE `Code`="; if( $oldvalue ) $query.=addslashes($this->oldvalue); else $query.=addslashes($this->value); if( $row=@mysql_fetch_array( doquery($query) ) ) { return ucwords(strtolower($row['Name'])); }else { return "!ERROR!"; } } public function get_accesspublic() { return $this->get_accesspublic_privacy(false); } } ?>