Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Atsitiktinis headeris

Parašė adulis· 2008 Lie. 21 15:07:32
#1

Kodas:

$text = array("<center><a href='http://www.musis.xz.lt/news.php'><img src='http://www.musis.xz.lt/images/120x60_1.gif' border=0 alt='Musis.xz.lt Krepsinis' /></a> <center>","<center><a href='http://www.tinklalapis.net'><img src='http://www.tinklalapis.net/images/pro120x60.gif'><center>","<center><a href='http://www.musis.xz.lt/news.php'><img src='http://www.musis.xz.lt/images/120x60_1.gif' border=0 alt='Musis.xz.lt Krepsinis' /></a> <center>");
$cc = count($text) ;
$cl = $cc-1;
$rand = rand(0,$cl);
echo"$text[$rand]";





Kaip šį koda integruot i header.php kad kaskartus atidarius puslapį atverstų vis kita headerį?

Header.php
<?php
global $theme_width,$settings,$aidlink,$locale,$userdata,$db_prefix;
echo "<table width='$theme_width' border='0' align='center' cellpadding='0' cellspacing='0' background='".THEME."images/done.jpg' height='299' style='background-repeat: no-repeat;'>
      <tr>
        <td valign='bottom' style='padding-left:80px;' width='725'>
      <a href='".BASEDIR."index.php'><img src='".THEME."images/hb1.png' border='0' alt='Pagrindinis'></a>
      <a href='".BASEDIR."forum/index.php'><img src='".THEME."images/hb2.png' border='0' alt='Forumas'></a>
      <a href='".BASEDIR."search.php'><img src='".THEME."images/hb3.png' border='0' alt='Paie&#240;ka'></a>
      </td>

      <td width='235' style='padding-right:90px; padding-top:20px;'  valign='middle'>";
      if (iMEMBER) {
   $msg_count = dbcount("(message_id)", "messages", "message_to='".$userdata['user_id']."' AND message_read='0'AND message_folder='0'");
   echo "<table width='235' border='0' cellspacing='2' cellpadding='2'>
  <tr>
    <td>\n";
   if ($userdata['user_avatar'] != "") {
   echo "<center><img src='".BASEDIR."images/avatars/".$userdata['user_avatar']."' width='100' height='100' style='border:1px'></center>\n";
   } else {
   echo "<center><img src='".THEME."images/noavatar.gif' width='100' height='100' border='0'></center>\n";
   }
   echo "</td>
    <td valign='top'><img src='".THEME."images/bullet.gif' alt=''> <a href='".BASEDIR."edit_profile.php' class='side'>Redaguoti profil&#225;</a><br>
   <img src='".THEME."images/bullet.gif' alt=''> <a href='".BASEDIR."profile.php?lookup=".$userdata['user_id']."' class='side'>A&#240; i&#240; &#240;alies</a><br>
<img src='".THEME."images/bullet.gif' alt=''> <a href='".BASEDIR."messages.php' class='side'>&#222;inut&#235;s [naujø: <b><span style='color:#990000'>".sprintf($msg_count)."</span></b>]</a><br>
<img src='".THEME."images/bullet.gif' alt=''> <a href='".BASEDIR."members.php' class='side'>Nariai</a><br>\n";
   if (iADMIN && (iUSER_RIGHTS != "" || iUSER_RIGHTS != "C")) {
      echo "<img src='".THEME."images/bullet.gif' alt=''> <a href='".ADMIN."index.php".$aidlink."' class='side'>Administracija</a><br>\n";
   }
   echo "<img src='".THEME."images/bullet.gif' alt=''> <a href='".BASEDIR."setuser.php?logout=yes' class='side'>".$locale['084']."</a><br><br>
   <b><span class='ip'>IP: </span></b>";
   $userip = $_SERVER['REMOTE_ADDR'];
      $host = gethostbyaddr($userip);
      echo "<span class='ip'>".$userip."</span><br /></td></tr></table>\n";
   } else {
   echo "<table width='170' border='0' cellspacing='0' cellpadding='0' align='center'><form name='loginform' method='post' action='".FUSION_SELF."'>
  <tr>
    <td align='right' class='ip'>Vardas: </td>
    <td>&nbsp;<input type='text' name='user_name' class='textbox' style='width:100px;filter:alpha(opacity=70)'></td>
  </tr>
  <tr>
    <td align='right' class='ip'>".$locale['062'].": </td>
    <td>&nbsp;<input type='password' name='user_pass' class='textbox' style='width:100px;filter:alpha(opacity=70)'></td>
  </tr>
  <tr>
    <td align='right'><input type='checkbox' name='remember_me' value='y'></td>
    <td>&nbsp;<input type='submit' name='login' value='Prisijungti' class='button'></td>
  </tr>
  </form>\n";
   if ($settings['enable_registration']) {
      echo "<a href=".BASEDIR."register.php>Registracija</a> / <a href=".BASEDIR."lostpassword.php>Slapta&#254;odis</a>\n";
   }
   echo"</table>\n";
}
echo "</td>
      </tr>
    </table>\n";
echo"</td></tr><tr></tr><tr><td></td></tr></table>";
    echo "<table width='100%' cellspacing='0' cellpadding='0' class='sub-header' style='border-right: solid #b5b5b5 1px; border-left: solid #b5b5b5 1px;' >\n<tr>";
   echo "<td align='right'>Dabar nar&#240;o: ".dbcount("(*)","online","")." [".dbcount("(*)","online","online_user = '0'")."]";
   echo ($i == 0 ? "&nbsp;" : "")."</td>";
   echo "</td></tr></table>\n";
   echo "<table width='100%' cellpadding='4' bgcolor='#F8F8F8' cellspacing='0' border='0'><tr>";   
   
    ?>



Parašė Dandžu· 2008 Lie. 21 15:07:30
#2

Imk. Susirašyk adresus header'ių.
<?php
global $theme_width,$settings,$aidlink,$locale,$userdata,$db_prefix;

$text = array("<center><a href='http://www.musis.xz.lt/news.php'><img src='http://www.musis.xz.lt/images/120x60_1.gif' border=0 alt='Musis.xz.lt Krepsinis' /></a> <center>","<center><a href='http://www.tinklalapis.net'><img src='http://www.tinklalapis.net/images/pro120x60.gif'><center>","<center><a href='http://www.musis.xz.lt/news.php'><img src='http://www.musis.xz.lt/images/120x60_1.gif' border=0 alt='Musis.xz.lt Krepsinis' /></a> <center>");
$cc = count($text) ;
$cl = $cc-1;
$rand = rand(0,$cl);
echo"";

echo "<table width='$theme_width' border='0' align='center' cellpadding='0' cellspacing='0' background='$text[$rand]' height='299' style='background-repeat: no-repeat;'>
      <tr>
        <td valign='bottom' style='padding-left:80px;' width='725'>
      <a href='".BASEDIR."index.php'><img src='".THEME."images/hb1.png' border='0' alt='Pagrindinis'></a>
      <a href='".BASEDIR."forum/index.php'><img src='".THEME."images/hb2.png' border='0' alt='Forumas'></a>
      <a href='".BASEDIR."search.php'><img src='".THEME."images/hb3.png' border='0' alt='Paie&#240;ka'></a>
      </td>

      <td width='235' style='padding-right:90px; padding-top:20px;'  valign='middle'>";
      if (iMEMBER) {
   $msg_count = dbcount("(message_id)", "messages", "message_to='".$userdata['user_id']."' AND message_read='0'AND message_folder='0'");
   echo "<table width='235' border='0' cellspacing='2' cellpadding='2'>
  <tr>
    <td>\n";
   if ($userdata['user_avatar'] != "") {
   echo "<center><img src='".BASEDIR."images/avatars/".$userdata['user_avatar']."' width='100' height='100' style='border:1px'></center>\n";
   } else {
   echo "<center><img src='".THEME."images/noavatar.gif' width='100' height='100' border='0'></center>\n";
   }
   echo "</td>
    <td valign='top'><img src='".THEME."images/bullet.gif' alt=''> <a href='".BASEDIR."edit_profile.php' class='side'>Redaguoti profil&#225;</a><br>
   <img src='".THEME."images/bullet.gif' alt=''> <a href='".BASEDIR."profile.php?lookup=".$userdata['user_id']."' class='side'>A&#240; i&#240; &#240;alies</a><br>
<img src='".THEME."images/bullet.gif' alt=''> <a href='".BASEDIR."messages.php' class='side'>&#222;inut&#235;s [naujø: <b><span style='color:#990000'>".sprintf($msg_count)."</span></b>]</a><br>
<img src='".THEME."images/bullet.gif' alt=''> <a href='".BASEDIR."members.php' class='side'>Nariai</a><br>\n";
   if (iADMIN && (iUSER_RIGHTS != "" || iUSER_RIGHTS != "C")) {
      echo "<img src='".THEME."images/bullet.gif' alt=''> <a href='".ADMIN."index.php".$aidlink."' class='side'>Administracija</a><br>\n";
   }
   echo "<img src='".THEME."images/bullet.gif' alt=''> <a href='".BASEDIR."setuser.php?logout=yes' class='side'>".$locale['084']."</a><br><br>
   <b><span class='ip'>IP: </span></b>";
   $userip = $_SERVER['REMOTE_ADDR'];
      $host = gethostbyaddr($userip);
      echo "<span class='ip'>".$userip."</span><br /></td></tr></table>\n";
   } else {
   echo "<table width='170' border='0' cellspacing='0' cellpadding='0' align='center'><form name='loginform' method='post' action='".FUSION_SELF."'>
  <tr>
    <td align='right' class='ip'>Vardas: </td>
    <td>&nbsp;<input type='text' name='user_name' class='textbox' style='width:100px;filter:alpha(opacity=70)'></td>
  </tr>
  <tr>
    <td align='right' class='ip'>".$locale['062'].": </td>
    <td>&nbsp;<input type='password' name='user_pass' class='textbox' style='width:100px;filter:alpha(opacity=70)'></td>
  </tr>
  <tr>
    <td align='right'><input type='checkbox' name='remember_me' value='y'></td>
    <td>&nbsp;<input type='submit' name='login' value='Prisijungti' class='button'></td>
  </tr>
  </form>\n";
   if ($settings['enable_registration']) {
      echo "<a href=".BASEDIR."register.php>Registracija</a> / <a href=".BASEDIR."lostpassword.php>Slapta&#254;odis</a>\n";
   }
   echo"</table>\n";
}
echo "</td>
      </tr>
    </table>\n";
echo"</td></tr><tr></tr><tr><td></td></tr></table>";
    echo "<table width='100%' cellspacing='0' cellpadding='0' class='sub-header' style='border-right: solid #b5b5b5 1px; border-left: solid #b5b5b5 1px;' >\n<tr>";
   echo "<td align='right'>Dabar nar&#240;o: ".dbcount("(*)","online","")." [".dbcount("(*)","online","online_user = '0'")."]";
   echo ($i == 0 ? "&nbsp;" : "")."</td>";
   echo "</td></tr></table>\n";
   echo "<table width='100%' cellpadding='4' bgcolor='#F8F8F8' cellspacing='0' border='0'><tr>";   
   
    ?>





Redagavo Dandžu· 2008 Lie. 21 15:07:41

Parašė adulis· 2008 Lie. 21 16:07:52
#3

Kažkur čia klaida:
<table width='$theme_width' border='0' align='center' cellpadding='0' cellspacing='0' background='$text[$rand]' height='299' style='background-repeat: no-repeat;'>



Vietoj headerio rodo :
' height='299' style='background-repeat: no-repeat;'>



Parašė Dandžu· 2008 Lie. 21 16:07:35
#4

O tai tų banner'ių adresus sudedi gerai? :? Beje Qrmiz yra forume parodęs kitu būdu.

Parašė MAnjack· 2008 Lie. 21 16:07:06
#5

Va mano būdas:
<img src='".BASEDIR."images/headers/".rand(1,3)."'>

Headerio pavadinimas turi būti kažkoks skaičius telpantis į intervalą 1,3. Intervalą galima plėsti.