Αλλαγες σε κοδικα

Σε αυτή την περιοχή μπορείτε να βρείτε ή να αναζητήσετε πληροφορίες σχετικές με την PHP

Συντονιστές: WebDev Moderators, Super-Moderators, PHP Moderators

Απάντηση
panagiotakis7
Δημοσιεύσεις: 29
Εγγραφή: 27 Αύγ 2009 20:20

Αλλαγες σε κοδικα

Δημοσίευση από panagiotakis7 » 27 Δεκ 2010 22:40

Γεια σας..

έχω τον εξής κώδικα που είναι για να εμφανίζει τι εκπομπή υπάρχει με το κατάλληλο banner, θέλω να του κάνω κάποιες αλλαγή ώστε να δίνει διαφορετικές πληροφορίες για κάθε μέρα, γιατί τώρα δίνει τα ιδία για όλες της μέρες της εβδομάδας

Μπορεί κάποιος να βοηθήσει για να κανω την αλλαγη;

Κώδικας: Επιλογή όλων

<?php
//set timezone
putenv &#40;'TZ=Greece/Athens'&#41;;
mktime&#40;0,0,0,1,1,1970&#41;;
$day = date&#40;"N"&#41;;
$time = date&#40;"Hi"&#41;;
if &#40;$day == 7&#41;
&#123;
switch&#40;$time&#41;
&#123;
case &#40;$time >= '0600' && $time <= '0959'&#41;&#58;
echo"<img src='images/onair/haroldgrimmett.png' alt='Harold Grimmett is On-Air Now' class='onair'/>";
break;
case &#40;$time >= '1000' && $time <= '1200'&#41;&#58;
echo"<img src='images/onair/kix103.png' alt='Harold Grimmett is On-Air Now' class='onair'/>";
break;
default&#58;
echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
break;
&#125;
&#125;
elseif&#40;$day == 6&#41;
&#123;
echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
&#125;
else
&#123;
switch&#40;$time&#41;
&#123;
case &#40;$time >= '0600' && $time <= '0959'&#41;&#58;
echo"<img src='images/onair/steveandboomer.png' alt='Steve &amp; Boomer is On-Air Now' class='onair'/>";
break;
case &#40;$time >= '1000' && $time <= '1459'&#41;&#58;
echo"<img src='images/onair/kc.png' alt='K.C. Wright is On-Air Now' class='onair'/>";
break;
case &#40;$time >= '1500' && $time <= '1859'&#41;&#58;
echo"<img src='images/onair/jr.png' alt='J.R. Schumann' class='onair'/>";
break;
case &#40;$time >= '1900' && $time <= '2359'&#41;&#58;
echo"<img src='http&#58;//driverfm.gr/images/onair/monomousiki.png' alt='Mono mousiki exei twra to menu' class='onair'/>";
break;
case &#40;$time >= '2400' && $time <= '0559'&#41;&#58;
echo"<img src='images/onair/blairgarner.png' alt='Blair Garner is On-Air Now' class='onair'/>";
default&#58;
echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
break;
&#125;
&#125;
?>
Ευχαριστω πολυ!
Εικόνα

Άβαταρ μέλους
fafos
Script Master
Δημοσιεύσεις: 6231
Εγγραφή: 30 Νοέμ 2004 03:09

Αλλαγες σε κοδικα

Δημοσίευση από fafos » 28 Δεκ 2010 03:17

Mou eixe tyxei kati paromoio prin xronia kai doulepsa me mia function...

pare ton parakato kodika kai sose ton san date_dif.php:

Κώδικας: Επιλογή όλων

<?
function CheckTime&#40;$currentTime, $startTime, $endTime&#41;&#123;
	global $cHour;
	global $cMin;
	global $sHour;
	global $sMin;
	global $eHour;
	global $eMin;

	// break up current time
	$now = explode&#40;"&#58;",$currentTime&#41;;
	$cHour = intval&#40;$now&#91;0&#93;&#41;;	// current time - hour
	$cMin = intval&#40;$now&#91;1&#93;&#41;;	// current time - minute

	// break up start time
	$start = explode&#40;"&#58;",$startTime&#41;;
	$sHour = intval&#40;$start&#91;0&#93;&#41;;	// start of range - hour
	$sMin = intval&#40;$start&#91;1&#93;&#41;;	// start of range - minute

	// brek up end time
	$end = explode&#40;"&#58;",$endTime&#41;;
	$eHour = intval&#40;$end&#91;0&#93;&#41;;	// end of range - hour
	$eMin = intval&#40;$end&#91;1&#93;&#41;;	// end of range - minute

	// this is the variable used to track the result of the checks
	$pass = true;

	if&#40;$sHour <= $eHour&#41;&#123;
		// the range is on the same day

		// compare to the start hour
		if&#40;$cHour < $sHour&#41;&#123;
			$pass = false;
		&#125;;

		// compare to the end hour
		if&#40;$cHour > $eHour&#41;&#123;
			$pass = false;
		&#125;;

		// compare to the start min
		if&#40;$cHour == $sHour&#41;&#123;
			if&#40;$cMin < $sMin&#41;&#123;
				$pass = false;
			&#125;;
		&#125;;

		// compare to the end min
		if&#40;$cHour == $eHour&#41;&#123;
			if&#40;$cMin > $eMin&#41;&#123;
				$pass = false;
			&#125;;
		&#125;;

	&#125; else &#123;
		// the range is overnight, so the logic is a little different

		if&#40; &#40;$cHour < $sHour&#41; && &#40;$cHour > $eHour&#41; &#41;&#123;
			$pass = false;
		&#125;;

		// compare to the start min
		if&#40;$cHour == $sHour&#41;&#123;
			if&#40;$cMin < $sMin&#41;&#123;
				$pass = false;
			&#125;;
		&#125;;

		// compare to the end min
		if&#40;$cHour == $eHour&#41;&#123;
			if&#40;$cMin > $eMin&#41;&#123;
				$pass = false;
			&#125;;
		&#125;;

	&#125;;

	// done with check, return the result
	if&#40;$pass == false&#41;&#123;
		return 0;	// failed
	&#125; else &#123;
		return 1;	// passed
	&#125;;

&#125;;


?>

sthn selida pou emfanizeis ta banner vazeis auta:

Κώδικας: Επιλογή όλων

<?
include 'date_dif.php';//include thn function
date_default_timezone_set&#40;"Europe/Athens"&#41;; //mono an exeis pho 5 kai ano
$day = date&#40;"N"&#41;;
$time = date&#40;"H&#58;i"&#41;;


//elegxos
if &#40;$day == 7&#41;
&#123; 

//elegxos oron
	if&#40;CheckTime&#40;$time,"06&#58;00","09&#58;59"&#41; == 1&#41; &#123;

	echo"<img src='images/onair/haroldgrimmett.png' alt='Harold Grimmett is On-Air Now' class='onair'/>"; 
	&#125;	
	elseif&#40;CheckTime&#40;$time,"10&#58;00","12&#58;00"&#41; == 1&#41; &#123;

	echo"<img src='images/onair/kix103.png' alt='Harold Grimmett is On-Air Now' class='onair'/>"; 
	&#125;
	else &#123;
	echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
	&#125;
//telos elegxos oron


&#125; elseif&#40;$day == 6&#41;
&#123;
	echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
&#125;
else
&#123; 
//elegxos oron
	if&#40;CheckTime&#40;$time,"06&#58;00","09&#58;59"&#41; == 1&#41; &#123;
	echo"<img src='images/onair/steveandboomer.png' alt='Steve &amp; Boomer is On-Air Now' class='onair'/>"; 
	&#125;	
	elseif&#40;CheckTime&#40;$time,"10&#58;00","14&#58;59"&#41; == 1&#41; &#123;
	echo"<img src='images/onair/kc.png' alt='K.C. Wright is On-Air Now' class='onair'/>"; 
	&#125;
	if&#40;CheckTime&#40;$time,"15&#58;00","18&#58;59"&#41; == 1&#41; &#123;
	echo"<img src='images/onair/jr.png' alt='J.R. Schumann' class='onair'/>";  
	&#125;	
	elseif&#40;CheckTime&#40;$time,"19&#58;00","23&#58;59"&#41; == 1&#41; &#123;
	echo"<img src='http&#58;//driverfm.gr/images/onair/monomousiki.png' alt='Mono mousiki exei twra to menu' class='onair'/>";
	&#125;	
	elseif&#40;CheckTime&#40;$time,"24&#58;00","05&#58;59"&#41; == 1&#41; &#123;
	echo"<img src='images/onair/blairgarner.png' alt='Blair Garner is On-Air Now' class='onair'/>"; 
	&#125;
	else &#123;
	echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>"; 
	&#125;
//telos elegxos oron

&#125;

?>

ksekinao kanontas include thn function (an thn soseis se diaforetiko fakello prepei na doseis kai to analogo path)

synexizo me thn date_default_timezone_set() gia na sigoureuto gia thn ora tou server (mono se php 5 kai ano douleuei)

kai meta vazo tis metavlhtes gia hmera kai ora (h ora edo einai ano-kato teleia)..


h function koitaei ti ora einai tora CheckTime($time,"06:00","09:59")

kai an einai anamesa stis ores apo "06:00" eos kai "09:59"

an einai alhthes gyrna 1 allios gyrna 0...

etsi loipon arxizo ta if kai elseif kai opou synathsei thn katallhlh hmera kai thn synthikh=1 typonei to analogo image..

auth h function exei to kalo oti mporei na douleuei kai se ores diaforetikon hmeron (p.x. apo 22:00 eos 02:00) xoris na vgazei oti thelei..
Οι πάνες και οι πολιτικοί πρέπει να αλλάζονται συχνά για τον ίδιο λόγο...

panagiotakis7
Δημοσιεύσεις: 29
Εγγραφή: 27 Αύγ 2009 20:20

Αλλαγες σε κοδικα

Δημοσίευση από panagiotakis7 » 28 Δεκ 2010 19:10

Ευχαριστω για την βοηθεια..

Δεν καταλαβα ομως πως γινετε να δεινει διαφορετικα αποτελεσματα την καθε μερα..
Εικόνα

Άβαταρ μέλους
fafos
Script Master
Δημοσιεύσεις: 6231
Εγγραφή: 30 Νοέμ 2004 03:09

Αλλαγες σε κοδικα

Δημοσίευση από fafos » 28 Δεκ 2010 19:38

panagiotakis7 έγραψε:Ευχαριστω για την βοηθεια..

Δεν καταλαβα ομως πως γινετε να δεινει διαφορετικα αποτελεσματα την καθε μερα..
ego den katalava ti rotas.. :lol:
Οι πάνες και οι πολιτικοί πρέπει να αλλάζονται συχνά για τον ίδιο λόγο...

panagiotakis7
Δημοσιεύσεις: 29
Εγγραφή: 27 Αύγ 2009 20:20

Αλλαγες σε κοδικα

Δημοσίευση από panagiotakis7 » 28 Δεκ 2010 20:04

Χαχα :lol:

Επειδη μερικες εκπομπες δεν παιζουν καθε μερα αλλα ας πουμε μερα παρα μερα θελω να γινει ετσι ωστε να περνει ο κοδικας πληρ. για ολες τις μερες της εβδομαδας..

Για να καταλαβεις..

Σου δινω ενα παραδειγμα..

Δευτερα: Ταδε εκπομπη 19:00 με 21:00
Τριτη: Ταδε εκπομπη 19:00 με 21:00
Τεταρτη: Ταδε εκπομπη 19:00 με 21:00
Πεμπτη: Ταδε εκπομπη 19:00 με 21:00
Παρασκευή: Ταδε εκπομπη 19:00 με 21:00
Σαββατο: Μαζι το Σαββατοκυριακο 00:00 με 23:59
Κυριακη: Μαζι το Σαββατοκυριακο 00:00 με 23:59
Εικόνα

Άβαταρ μέλους
fafos
Script Master
Δημοσιεύσεις: 6231
Εγγραφή: 30 Νοέμ 2004 03:09

Αλλαγες σε κοδικα

Δημοσίευση από fafos » 28 Δεκ 2010 20:10

efoson exeis thn hmera se metavlhth kaleis analoga:

Κώδικας: Επιλογή όλων

if &#40;$day ==1&#41;//Deutera
&#123; 

//elegxos oron 

&#125;if &#40;$day ==2&#41;//trith
&#123; 

//elegxos oron 

&#125;

klp klp


ena parageigma des edo: http://www.ellinikosfm.com/new/program.php

h diafora edo einai oti pairnei ta dedomena apo vash
Οι πάνες και οι πολιτικοί πρέπει να αλλάζονται συχνά για τον ίδιο λόγο...

panagiotakis7
Δημοσιεύσεις: 29
Εγγραφή: 27 Αύγ 2009 20:20

Αλλαγες σε κοδικα

Δημοσίευση από panagiotakis7 » 28 Δεκ 2010 20:41

Το εκανα αλλα επειδη δεν γνωριζω και πολλα πανω σε php εκανα λαθος και δεν δουλεψε.. :o


1000 σορρυ για την ταλαιπωρια..
Τελευταία επεξεργασία από το μέλος panagiotakis7 την 28 Δεκ 2010 20:49, έχει επεξεργασθεί 1 φορά συνολικά.
Εικόνα

Άβαταρ μέλους
fafos
Script Master
Δημοσιεύσεις: 6231
Εγγραφή: 30 Νοέμ 2004 03:09

Αλλαγες σε κοδικα

Δημοσίευση από fafos » 28 Δεκ 2010 20:46

panagiotakis7 έγραψε:Το εκανα αλλα επειδη δεν γνωριζω και πολλα πανω σε php εκανα λαθος :o

1000 σορρυ για την ταλαιπωρια..
doulepse?
Οι πάνες και οι πολιτικοί πρέπει να αλλάζονται συχνά για τον ίδιο λόγο...

panagiotakis7
Δημοσιεύσεις: 29
Εγγραφή: 27 Αύγ 2009 20:20

Αλλαγες σε κοδικα

Δημοσίευση από panagiotakis7 » 28 Δεκ 2010 20:51

οχι δεν δουλεψε..

Αν δεις κανενα χοντρο λαθος μην φωναξεις... δεν γνωριζω και πολλα πανω στο php .. :lol: :lol: :lol: :lol:

Κώδικας: Επιλογή όλων

<?
include 'date_dif.php';//include thn function
date_default_timezone_set&#40;"Europe/Athens"&#41;; //mono an exeis pho 5 kai ano
$day = date&#40;"N"&#41;;
$time = date&#40;"H&#58;i"&#41;;


//elegxos
if &#40;$day == 1&#41; //deytera
&#123;

//elegxos oron
   if&#40;CheckTime&#40;$time,"06&#58;00","09&#58;59"&#41; == 1&#41; &#123;

   echo"<img src='images/onair/haroldgrimmett.png' alt='Harold Grimmett is On-Air Now' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"10&#58;00","12&#58;00"&#41; == 1&#41; &#123;

   echo"<img src='images/onair/kix103.png' alt='Harold Grimmett is On-Air Now' class='onair'/>";
   &#125;
   else &#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
   &#125;
//telos elegxos oron


&#125; elseif&#40;$day == 2&#41; //triti
&#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
&#125;
else
&#123;
//elegxos oron
   if&#40;CheckTime&#40;$time,"06&#58;00","09&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/steveandboomer.png' alt='Steve &amp; Boomer is On-Air Now' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"10&#58;00","14&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/kc.png' alt='K.C. Wright is On-Air Now' class='onair'/>";
   &#125;
   if&#40;CheckTime&#40;$time,"15&#58;00","18&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/jr.png' alt='J.R. Schumann' class='onair'/>"; 
   &#125;   
   elseif&#40;CheckTime&#40;$time,"19&#58;00","23&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='http&#58;//none.gr/images/onair/monomousiki.png' alt='Mono mousiki exei twra to menu' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"24&#58;00","05&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/blairgarner.png' alt='Blair Garner is On-Air Now' class='onair'/>";
   &#125;
   else &#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
   &#125;
//telos elegxos oron

&#125; elseif&#40;$day == 3&#41; //tetarti
&#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
&#125;
else
&#123;
//elegxos oron
   if&#40;CheckTime&#40;$time,"06&#58;00","09&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/steveandboomer.png' alt='Steve &amp; Boomer is On-Air Now' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"10&#58;00","14&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/kc.png' alt='K.C. Wright is On-Air Now' class='onair'/>";
   &#125;
   if&#40;CheckTime&#40;$time,"15&#58;00","18&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/jr.png' alt='J.R. Schumann' class='onair'/>"; 
   &#125;   
   elseif&#40;CheckTime&#40;$time,"19&#58;00","23&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='http&#58;//none.gr/images/onair/monomousiki.png' alt='Mono mousiki exei twra to menu' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"24&#58;00","05&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/blairgarner.png' alt='Blair Garner is On-Air Now' class='onair'/>";
   &#125;
   else &#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
   &#125;
//telos elegxos oron

&#125; elseif&#40;$day == 4&#41; //pempti
&#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
&#125;
else
&#123;
//elegxos oron
   if&#40;CheckTime&#40;$time,"06&#58;00","09&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/steveandboomer.png' alt='Steve &amp; Boomer is On-Air Now' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"10&#58;00","14&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/kc.png' alt='K.C. Wright is On-Air Now' class='onair'/>";
   &#125;
   if&#40;CheckTime&#40;$time,"15&#58;00","18&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/jr.png' alt='J.R. Schumann' class='onair'/>"; 
   &#125;   
   elseif&#40;CheckTime&#40;$time,"19&#58;00","23&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='http&#58;//none.gr/images/onair/monomousiki.png' alt='Mono mousiki exei twra to menu' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"24&#58;00","05&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/blairgarner.png' alt='Blair Garner is On-Air Now' class='onair'/>";
   &#125;
   else &#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
   &#125;
//telos elegxos oron

&#125; elseif&#40;$day == 5&#41; //paraskevi
&#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
&#125;
else
&#123;
//elegxos oron
   if&#40;CheckTime&#40;$time,"06&#58;00","09&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/steveandboomer.png' alt='Steve &amp; Boomer is On-Air Now' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"10&#58;00","14&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/kc.png' alt='K.C. Wright is On-Air Now' class='onair'/>";
   &#125;
   if&#40;CheckTime&#40;$time,"15&#58;00","18&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/jr.png' alt='J.R. Schumann' class='onair'/>"; 
   &#125;   
   elseif&#40;CheckTime&#40;$time,"19&#58;00","23&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='http&#58;//none.gr/images/onair/monomousiki.png' alt='Mono mousiki exei twra to menu' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"24&#58;00","05&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/blairgarner.png' alt='Blair Garner is On-Air Now' class='onair'/>";
   &#125;
   else &#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
   &#125;
//telos elegxos oron

&#125; elseif&#40;$day == 6&#41; //savvato
&#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
&#125;
else
&#123;
//elegxos oron
   if&#40;CheckTime&#40;$time,"06&#58;00","09&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/steveandboomer.png' alt='Steve &amp; Boomer is On-Air Now' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"10&#58;00","14&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/kc.png' alt='K.C. Wright is On-Air Now' class='onair'/>";
   &#125;
   if&#40;CheckTime&#40;$time,"15&#58;00","18&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/jr.png' alt='J.R. Schumann' class='onair'/>"; 
   &#125;   
   elseif&#40;CheckTime&#40;$time,"19&#58;00","23&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='http&#58;//none.gr/images/onair/monomousiki.png' alt='Mono mousiki exei twra to menu' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"24&#58;00","05&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/blairgarner.png' alt='Blair Garner is On-Air Now' class='onair'/>";
   &#125;
   else &#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
   &#125;
//telos elegxos oron

&#125; elseif&#40;$day == 7&#41; //kyriaki
&#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
&#125;
else
&#123;
//elegxos oron
   if&#40;CheckTime&#40;$time,"06&#58;00","09&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/steveandboomer.png' alt='Steve &amp; Boomer is On-Air Now' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"10&#58;00","14&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/kc.png' alt='K.C. Wright is On-Air Now' class='onair'/>";
   &#125;
   if&#40;CheckTime&#40;$time,"15&#58;00","18&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/jr.png' alt='J.R. Schumann' class='onair'/>"; 
   &#125;   
   elseif&#40;CheckTime&#40;$time,"19&#58;00","23&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='http&#58;//none.gr/images/onair/monomousiki.png' alt='Mono mousiki exei twra to menu' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"24&#58;00","05&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/blairgarner.png' alt='Blair Garner is On-Air Now' class='onair'/>";
   &#125;
   else &#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
   &#125;
//telos elegxos oron



?>
Εικόνα

Άβαταρ μέλους
fafos
Script Master
Δημοσιεύσεις: 6231
Εγγραφή: 30 Νοέμ 2004 03:09

Αλλαγες σε κοδικα

Δημοσίευση από fafos » 28 Δεκ 2010 20:59

to tsakises sta else... :lol: to else to vazoume panta sthn teleutaia synthikh (edo einai h kyriaki):

Κώδικας: Επιλογή όλων

<?
include 'date_dif.php';//include thn function
date_default_timezone_set&#40;"Europe/Athens"&#41;; //mono an exeis pho 5 kai ano
$day = date&#40;"N"&#41;;
$time = date&#40;"H&#58;i"&#41;;


//elegxos
if &#40;$day == 1&#41; //deytera
&#123;

//elegxos oron
   if&#40;CheckTime&#40;$time,"06&#58;00","09&#58;59"&#41; == 1&#41; &#123;

   echo"<img src='images/onair/haroldgrimmett.png' alt='Harold Grimmett is On-Air Now' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"10&#58;00","12&#58;00"&#41; == 1&#41; &#123;

   echo"<img src='images/onair/kix103.png' alt='Harold Grimmett is On-Air Now' class='onair'/>";
   &#125;
   else &#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
   &#125;
//telos elegxos oron


&#125; elseif&#40;$day == 2&#41; //triti
&#123;

//elegxos oron
   if&#40;CheckTime&#40;$time,"06&#58;00","09&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/steveandboomer.png' alt='Steve &amp; Boomer is On-Air Now' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"10&#58;00","14&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/kc.png' alt='K.C. Wright is On-Air Now' class='onair'/>";
   &#125;
   if&#40;CheckTime&#40;$time,"15&#58;00","18&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/jr.png' alt='J.R. Schumann' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"19&#58;00","23&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='http&#58;//none.gr/images/onair/monomousiki.png' alt='Mono mousiki exei twra to menu' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"24&#58;00","05&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/blairgarner.png' alt='Blair Garner is On-Air Now' class='onair'/>";
   &#125;
   else &#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
   &#125;
//telos elegxos oron

&#125; elseif&#40;$day == 3&#41; //tetarti
&#123;
//elegxos oron
   if&#40;CheckTime&#40;$time,"06&#58;00","09&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/steveandboomer.png' alt='Steve &amp; Boomer is On-Air Now' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"10&#58;00","14&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/kc.png' alt='K.C. Wright is On-Air Now' class='onair'/>";
   &#125;
   if&#40;CheckTime&#40;$time,"15&#58;00","18&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/jr.png' alt='J.R. Schumann' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"19&#58;00","23&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='http&#58;//none.gr/images/onair/monomousiki.png' alt='Mono mousiki exei twra to menu' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"24&#58;00","05&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/blairgarner.png' alt='Blair Garner is On-Air Now' class='onair'/>";
   &#125;
   else &#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
   &#125;
//telos elegxos oron

&#125; elseif&#40;$day == 4&#41; //pempti
&#123;
//elegxos oron
   if&#40;CheckTime&#40;$time,"06&#58;00","09&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/steveandboomer.png' alt='Steve &amp; Boomer is On-Air Now' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"10&#58;00","14&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/kc.png' alt='K.C. Wright is On-Air Now' class='onair'/>";
   &#125;
   if&#40;CheckTime&#40;$time,"15&#58;00","18&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/jr.png' alt='J.R. Schumann' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"19&#58;00","23&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='http&#58;//none.gr/images/onair/monomousiki.png' alt='Mono mousiki exei twra to menu' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"24&#58;00","05&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/blairgarner.png' alt='Blair Garner is On-Air Now' class='onair'/>";
   &#125;
   else &#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
   &#125;
//telos elegxos oron

&#125; elseif&#40;$day == 5&#41; //paraskevi
&#123;
//elegxos oron
   if&#40;CheckTime&#40;$time,"06&#58;00","09&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/steveandboomer.png' alt='Steve &amp; Boomer is On-Air Now' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"10&#58;00","14&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/kc.png' alt='K.C. Wright is On-Air Now' class='onair'/>";
   &#125;
   if&#40;CheckTime&#40;$time,"15&#58;00","18&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/jr.png' alt='J.R. Schumann' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"19&#58;00","23&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='http&#58;//none.gr/images/onair/monomousiki.png' alt='Mono mousiki exei twra to menu' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"24&#58;00","05&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/blairgarner.png' alt='Blair Garner is On-Air Now' class='onair'/>";
   &#125;
   else &#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
   &#125;
//telos elegxos oron

&#125; elseif&#40;$day == 6&#41; //savvato
&#123;

//elegxos oron
   if&#40;CheckTime&#40;$time,"06&#58;00","09&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/steveandboomer.png' alt='Steve &amp; Boomer is On-Air Now' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"10&#58;00","14&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/kc.png' alt='K.C. Wright is On-Air Now' class='onair'/>";
   &#125;
   if&#40;CheckTime&#40;$time,"15&#58;00","18&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/jr.png' alt='J.R. Schumann' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"19&#58;00","23&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='http&#58;//none.gr/images/onair/monomousiki.png' alt='Mono mousiki exei twra to menu' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"24&#58;00","05&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/blairgarner.png' alt='Blair Garner is On-Air Now' class='onair'/>";
   &#125;
   else &#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
   &#125;
//telos elegxos oron

&#125; else &#123; // kyriaki
//elegxos oron
   if&#40;CheckTime&#40;$time,"06&#58;00","09&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/steveandboomer.png' alt='Steve &amp; Boomer is On-Air Now' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"10&#58;00","14&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/kc.png' alt='K.C. Wright is On-Air Now' class='onair'/>";
   &#125;
   if&#40;CheckTime&#40;$time,"15&#58;00","18&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/jr.png' alt='J.R. Schumann' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"19&#58;00","23&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='http&#58;//none.gr/images/onair/monomousiki.png' alt='Mono mousiki exei twra to menu' class='onair'/>";
   &#125;   
   elseif&#40;CheckTime&#40;$time,"24&#58;00","05&#58;59"&#41; == 1&#41; &#123;
   echo"<img src='images/onair/blairgarner.png' alt='Blair Garner is On-Air Now' class='onair'/>";
   &#125;
   else &#123;
   echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
   &#125;
//telos elegxos oron

&#125;

?>
Οι πάνες και οι πολιτικοί πρέπει να αλλάζονται συχνά για τον ίδιο λόγο...

panagiotakis7
Δημοσιεύσεις: 29
Εγγραφή: 27 Αύγ 2009 20:20

Αλλαγες σε κοδικα

Δημοσίευση από panagiotakis7 » 28 Δεκ 2010 21:07

Αυτος εισαι τελειος.. Ευχαριστω παρα πολυ!
Τελευταία επεξεργασία από το μέλος panagiotakis7 την 29 Δεκ 2010 12:41, έχει επεξεργασθεί 1 φορά συνολικά.
Εικόνα

Άβαταρ μέλους
fafos
Script Master
Δημοσιεύσεις: 6231
Εγγραφή: 30 Νοέμ 2004 03:09

Αλλαγες σε κοδικα

Δημοσίευση από fafos » 28 Δεκ 2010 21:22

panagiotakis7 έγραψε:Αυτος εισαι τελεια.. Ευχαριστω παρα πολυ!
:o


axaxaxa.... :kaloe:
Οι πάνες και οι πολιτικοί πρέπει να αλλάζονται συχνά για τον ίδιο λόγο...

panagiotakis7
Δημοσιεύσεις: 29
Εγγραφή: 27 Αύγ 2009 20:20

Αλλαγες σε κοδικα

Δημοσίευση από panagiotakis7 » 29 Δεκ 2010 12:41

οχχ :PPP λαθος.. :lol: :lol:
Εικόνα

panagiotakis7
Δημοσιεύσεις: 29
Εγγραφή: 27 Αύγ 2009 20:20

Αλλαγες σε κοδικα

Δημοσίευση από panagiotakis7 » 30 Δεκ 2010 22:14

Na rotiso kati akoma.. ginete na doulepsei xoris function??

Diladi se ena arxeio php na einai ola..
Εικόνα

Άβαταρ μέλους
fafos
Script Master
Δημοσιεύσεις: 6231
Εγγραφή: 30 Νοέμ 2004 03:09

Αλλαγες σε κοδικα

Δημοσίευση από fafos » 30 Δεκ 2010 23:43

panagiotakis7 έγραψε:Na rotiso kati akoma.. ginete na doulepsei xoris function??

Diladi se ena arxeio php na einai ola..
anti gia include vazeis xyma ton kodika...
Οι πάνες και οι πολιτικοί πρέπει να αλλάζονται συχνά για τον ίδιο λόγο...

Απάντηση

Επιστροφή στο “PHP Προγραμματισμός”

Μέλη σε σύνδεση

Μέλη σε αυτήν τη Δ. Συζήτηση: Δεν υπάρχουν εγγεγραμμένα μέλη και 0 επισκέπτες