user_nicename || $current_user->user_nicename!='' && $_GET['user']==''){ $userid = $current_user->ID; $iscurrent = 'yes'; } else { $queryuser = mysql_query('SELECT * FROM wp_users WHERE user_nicename="'.$_GET['user'].'" LIMIT 1'); if(mysql_num_rows($queryuser)!=0){ $row = mysql_fetch_array($queryuser); $userid = $row['ID']; } } if($_POST['update-dog-data']){ $dogage = strtotime($_POST['dog-age']); $dogpregnant = $_POST['dog-pregnant']; if($dogpregnant=='on'){ $dogpregnant=1; } else { $dogpregnant=0; } $microchip = $_POST['microchip']; $allergies = $_POST['allergies']; $nutritioninfo = $_POST['nutrition-info']; mysql_query('UPDATE wp_dog_base SET dog_name="'.$_POST['dog-name'].'", dog_weight='.$_POST['dog-weight'].', dog_pregnant='.$dogpregnant.', microchip="'.$microchip.'", allergies="'.$allergies.'", nutrition_info="'.$nutritioninfo.'", dog_age='.$dogage.' WHERE id='.$_POST['dog-id'].'') or die(mysql_error()); } /* picture measures */ function measures($pilt){ $max = 150; list($width, $height) = getimagesize($pilt); if($width > $max or $height > $max){ if($width > $height){ $height = round(($max/$width)*$height); $width = $max; }elseif($width < $height){ $width = round(($max/$height)*$width); $height = $max; }else{ $width = $max; $height = $max; } } return 'width = "'.$width.'" height = "'.$height.'"'; } /* end of picture measures */ get_header(); ?>

Koera CV


Sorteeri tõu järgi kahanevalt

'; } elseif($_GET['sorteeri']=='toug-al'){ $order=' ORDER BY wdbr.breed DESC'; echo 'Sorteeri tõu järgi kasvavalt

'; } else { $order=' ORDER BY wdbr.breed ASC'; echo 'Sorteeri tõu järgi kahanevalt

'; } $queryuserdogs = mysql_query('SELECT wdb.sex, wdb.lifestyle, wdb.color, wdb.description, wdb.location, wdb.owners_id, wdb.vaccine, wdb.owners_address, wdb.show_cv, wdb.dog_pregnant, wdb.microchip, wdb.allergies, wdb.nutrition_info, wdb.dog_picture, wdb.id, wdb.dog_name, wdb.dog_weight, wdb.dog_age, wdbr.breed FROM wp_dog_base AS wdb INNER JOIN wp_dog_breed AS wdbr ON wdb.dog_breed=wdbr.id WHERE owners_id="'.$userid.'" AND show_cv="1"'.$order.'') or die(mysql_error()); if(mysql_num_rows($queryuserdogs)!=0){ while($row = mysql_fetch_array($queryuserdogs)){ if($row['show_cv']==1){ $dogid=$row['id']; echo '
'; echo '
'; /*koera pilt*/ if($row['dog_picture']==''){ echo '
'; } else { echo '
'.$row['dog_name'].''; } echo '
'; /*koera nimi*/ echo $row['dog_name']; echo '

'; /*koera sugu*/ echo $row['breed']; echo '

'; /*koera vanus*/ $agestamp = time()-$row['dog_age']; echo date('d.m.Y',$row['dog_age']).' ('.ceil($agestamp/60/60/24/365).' a.)'; echo '

Kaal:
'; /*koera kaal*/ echo $row['dog_weight']; echo ' kg
'; /*koera mikrokiip*/ if($row['microchip']!=''){ echo '
Mikrokiip:
'; echo $row['microchip']; echo '
'; } else { echo '
Mikrokiip:
Puudub
'; } /*koera allergiad*/ if($row['allergies']!=''){ echo '
Allergiate info:
'; echo $row['allergies']; echo '
'; } /*koera toitumisalane info*/ if($row['nutrition_info']!=''){ echo '
Toitumislaane info:
'; echo $row['nutrition_info']; echo '
'; } /*koera vaktsiin*/ if($row['vaccine']!=''){ echo '
Vaktsineerimiste info:
'; echo $row['vaccine']; echo '
'; } /*koera sugu*/ if($row['sex']!=''){ echo '
Sugu:
'; echo $row['sex']; echo '
'; } /*koera asukoht*/ if($row['location']!=''){ echo '
Asukoht:
'; echo $row['location']; echo '
'; } /*koera eluviis*/ if($row['lifestyle']!=''){ echo '
Eluviis:
'; echo $row['lifestyle']; echo '
'; } /*koera lühikirjeldus*/ if($row['description']!=''){ echo '
Lühikirjeldus:
'; echo $row['description']; echo '
'; } /*koera värvus*/ if($row['color']!=''){ echo '
Värvus:
'; echo $row['color']; echo '
'; } /*koera tiinus*/ if($row['dog_pregnant']==1){ echo '
Tiine:
Jah
'; } else { echo '
Tiine:
Ei
'; } echo '
'; /*koera omaniku nimi*/ $queryownername = mysql_query('SELECT * FROM wp_dog_base AS wdb INNER JOIN wp_users AS wu ON wu.ID='.$row['owners_id'].''); $row = mysql_fetch_array($queryownername); if($row['display_name']!=''){ echo '
Omaniku nimi:
'.$row['display_name'].'
'; } /*koera omaniku aadress*/ if($row['owners_address']!=''){ echo '
Omaniku aadress:
'; echo $row['owners_address']; echo '
'; } echo '

Koera saavutused

'; $querydogevents = mysql_query('SELECT * FROM wp_dog_events WHERE dog_id="'.$dogid.'" ORDER BY event_date DESC'); if(mysql_num_rows($querydogevents)!=0){ while($row = mysql_fetch_array($querydogevents)){ echo '
Üritus:
'.$row['event'].'
Ürituse lühikirjeldus:
'.$row['event_description'].'
Ürituse aeg:
'.date('d.m.Y',$row['event_date']).'
'; } } else { echo 'Üritusi ja näitusi pole.
'; } echo '
'; } } } else { echo 'Kasutaja on otsustanud, et ei jaga oma koerte/koera informatsiooni!'; } //echo $iscurrent; ?>