Jump to content
php.lv forumi

vajg nelielu palidzibu ar mazu skriptu


Swear

Recommended Posts

Man nesanāk uztaisit lai radas output ja $statuss piemeram ir online lai echo paradas noradits teksts

 

Kods:

<?
$niks = 'blablabla';

$statuss = join('', file("http://mystatus.skype.com/$niks.txt"));
$output = if $statuss == "Online" {	  //Šī rinda nestrada ka vajg
 echo "<b><body background-color:#C0C0C0>Statuss: $niks ir piesledzies skype!";
}
elseif ($statuss == "Away" ) {
	echo ('<b><body background-color:#C0C0C0>Projaam.
</body></b>');}

//te visi parejie statusi

;

echo ($output);

?>

 

Saprotu ka tas ir ļoti vienkārši bet es tikai vēl mācos...

Edited by Swear
Link to comment
Share on other sites

Nez, man arī tas http://mystatus.skype.com/ neatgriež pareizi.

 

Par kodu:

 

$statuses = array(
'Online' => 'lala',
'Offline' => 'desa',
//utt
)

$status = file_get_contents(...);
if (!empty($status) && isset($statuses[$status])) {
echo $statuses[$status];
} else {
echo 'nevaru noteikt :(';
}

Edited by andrisp
Link to comment
Share on other sites

<?
$niks = 'nick';

$statuss = join('', file("http://mystatus.skype.com/$niks.txt"));
if ($statuss == "Online") {	  //Šī rinda nestrada ka vajg
 $output = "<b><body background-color:#C0C0C0>Statuss: $niks ir piesledzies skype!";
}elseif ($statuss == "Away" ) {
 $output = '<b><body background-color:#C0C0C0>Projaam.</body></b>';
}


echo $output;

?>

man stradaa

Link to comment
Share on other sites

×
×
  • Create New...