change background color with page refresh (lavalair)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    change background color with page refresh (lavalair)

    friends any ideas how can i change background color of a page every time a page refreshes , but i want it for lavalair script

    #2
    PHP Code:
    session_start();
    if(!isset(
    $_SESSION['color'])) $_SESSION['color'] = 'red';
    $color $_SESSION['color'];
    echo 
    '<body bgcolor="'.$color.'">';
    if(
    $color=="red"$_SESSION['color'] = 'blue';
    if(
    $color=="blue"$_SESSION['color'] = 'yellow';
    if(
    $color=="yellow"$_SESSION['color'] = 'red';
    //etc 

    Comment


      #3
      Originally posted by something else View Post
      PHP Code:
      session_start();
      if(!isset(
      $_SESSION['color'])) $_SESSION['color'] = 'red';
      $color $_SESSION['color'];
      echo 
      '<body bgcolor="'.$color.'">';
      if(
      $color=="red"$_SESSION['color'] = 'blue';
      if(
      $color=="blue"$_SESSION['color'] = 'yellow';
      if(
      $color=="yellow"$_SESSION['color'] = 'red';
      //etc 
      can it b done using css

      Comment


        #4
        change it to style.php
        PHP Code:
        <?php
        session_start
        (); 
        if(!isset(
        $_SESSION['color'])) $_SESSION['color'] = 'red'
        $color $_SESSION['color']; 
        ?>
        body {background-color:<?=$color?>;}
        <?
        if($color=="red") $_SESSION['color'] = 'blue'; 
        if($color=="blue") $_SESSION['color'] = 'yellow'; 
        if($color=="yellow") $_SESSION['color'] = 'red';
        ?>

        Comment


          #5
          Originally posted by something else View Post
          change it to style.php
          PHP Code:
          <?php
          session_start
          (); 
          if(!isset(
          $_SESSION['color'])) $_SESSION['color'] = 'red'
          $color $_SESSION['color']; 
          ?>
          body {background-color:<?=$color?>;}
          <?
          if($color=="red") $_SESSION['color'] = 'blue'; 
          if($color=="blue") $_SESSION['color'] = 'yellow'; 
          if($color=="yellow") $_SESSION['color'] = 'red';
          ?>
          if i'd use this, i'd use this way, as i hate short open tags LOL
          PHP Code:
          <?php
          session_start
          (); 
          if(!isset(
          $_SESSION['color'])) $_SESSION['color'] = 'red'
          $color $_SESSION['color']; 
          ?>
          body {background-color:<?php echo $color?>;}
          <?php
          if($color=="red"$_SESSION['color'] = 'blue'
          if(
          $color=="blue"$_SESSION['color'] = 'yellow'
          if(
          $color=="yellow"$_SESSION['color'] = 'red';
          ?>
          Last edited by metulj; 21.04.12, 13:19.
          It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt.
          ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ !
          ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.
          キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

          Comment


            #6
            Originally posted by metulj View Post
            i i'd use this, i'd use this way, as i hate short open tags LOL
            PHP Code:
            <?php
            session_start
            (); 
            if(!isset(
            $_SESSION['color'])) $_SESSION['color'] = 'red'
            $color $_SESSION['color']; 
            ?>
            body {background-color:<?php echo $color?>;}
            <?php
            if($color=="red"$_SESSION['color'] = 'blue'
            if(
            $color=="blue"$_SESSION['color'] = 'yellow'
            if(
            $color=="yellow"$_SESSION['color'] = 'red';
            ?>
            can you explain in brief (uses).

            Comment


              #7
              PHP Code:
              * {
                  
              margin0;
                  
              padding0;
              }
              .
              alignleft {
              floatleft;
              }
              .
              alignright {
              floatright;
              }
              .
              boxed {
                  
              width99%;
                  
              margin-bottom3px
                  
              border1px solid #000000;
              }
              .
              boxedTitle {
                  
              height18px;
                  
              padding0 0 0 2px;
                  
              background".$thm[1]." url(images/".$thm[2]."repeat-x;
              }
              .
              boxedTitleText {
                  
              font-size11px;
                  
              color".$thm[3].";
              }
              .
              boxedContent {
                  
              padding2px 2px 2px 2px;
                  
              background".$thm[4].";
                  
              font-size$fsize;
              }
              .
              logo {
                  
              padding2px 2px 2px 2px;
                  
              background".$thm[9]." url(images/".$thm[11]."repeat-x;
              }
              .
              footer {
                  
              width100%;
                  
              padding5px;
                  
              backgroundurl(images/".$thm[18]."repeat-x;
              }
              .
              gt {border-bottom1px solid #A9BF74; 0px 3px 3px;margin:0px 0px 8px; color: silver;}
              h1 {
                  
              color#000000;
              }
              a:visited {
                  
              color".$thm[6].";
              }
              a:link {
                  
              color".$thm[5].";
              }
              h5 {
                  
              height30px;
                  
              padding0 0 0 2px;
                  
              background".$thm[7]." url(images/".$thm[8]."repeat-x;
                  
              color".$thm[3].";
              }
              body 
              background".$thm[9]." ;
              fontnormal small ArialHelveticasans-serifVerdana;
              color".$thm[10].";
              }
              .
              inputText {
                  
              background-color".$thm[12].";
                  
              color".$thm[13].";
                  
              border1px solid ".$thm[14].";
              }
              .
              inputButton {
                  
              background-color".$thm[15].";
                  
              color".$thm[16].";
                  
              border1px solid ".$thm[17].";
              }
              </
              style
              thats my css in core.php , i want to change the background color of boxedContent on page refresh , m not able to use above given codes bro , when i tried it only used to show background color red , on refresh yellow , next on refresh i get blue , but in words it showed , colors didnt change
              Last edited by mirror; 21.04.12, 13:25.

              Comment


                #8
                Originally posted by icedroplet1987 View Post
                can you explain in brief (uses).
                well.. as for typing purpose
                PHP Code:
                <?=
                is ofcourse shorter to type than
                PHP Code:
                <?php echo
                but...
                short open tag imho isnt really convenient...
                let's say you write a script with short tags,
                then you move the script to server which original
                settings is open_short_tag=off, and you dont have access to php.ini... BAD
                which is case on most shared hosts...
                but hey.. it could only my imagination..
                It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt.
                ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ !
                ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.
                キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

                Comment


                  #9
                  I Like php short tag being enabled..... you dont need php.ini can do it via .htacess:
                  PHP Code:
                  php_value short_open_tag 1 
                  also it reduces echo`s which slow your site down....
                  hence why ori wrote wapdesire v2 all with variables and one echo at the bottom of the page

                  Comment


                    #10
                    Originally posted by something else View Post
                    I Like php short tag being enabled..... you dont need php.ini can do it via .htacess:
                    PHP Code:
                    php_value short_open_tag 1 
                    also it reduces echo`s which slow your site down....
                    hence why ori wrote wapdesire v2 all with variables and one echo at the bottom of the page
                    Only if your coding style is mixing markup and php, which is not quite efficiently. PHP turns on, php turns off, turns on, turns off, on, off, on off on off...
                    <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

                    Comment


                      #11
                      Originally posted by something else View Post
                      I Like php short tag being enabled..... you dont need php.ini can do it via .htacess:
                      PHP Code:
                      php_value short_open_tag 1 
                      also it reduces echo`s which slow your site down....
                      hence why ori wrote wapdesire v2 all with variables and one echo at the bottom of the page

                      interesting and good advice at same time, although i have to say i do prefer full tags, it just looks cleaner
                      and makes it look like you wanted to go that extra mile lol ;)
                      <?php
                      include ('Ghost');
                      if ($Post == true) {
                      echo '

                      sigpic
                      alt='coding-talk.com!!' />';
                      echo 'Sharing Is Caring!';
                      } else {
                      echo '

                      alt='the username GHOST has been comprimised!' />';
                      echo 'OMG SOMEBODY HELP ME!!';
                      }
                      ?>

                      Comment


                        #12
                        lol i think the opposite .... i think it looks cleaner without millions of echo`s and also looks like you know a little more about server config etc
                        but its personal choice i guess

                        Comment


                          #13
                          Depends, take a look at this post http://coding-talk.com/f14/css-editi...510/#post93920 , and imagine all the way short tag for that type of needs but in quantity more than 400 lines for writing and reading, line by line. ;)
                          <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

                          Comment


                            #14
                            lol if you have got such a large .css of 400 lines then it would be far better off doing it on a variables anyway rather than 400 echo`s or <?=

                            Comment


                              #15
                              I love php

                              Code:
                               function include_emulating_short_tags ($viewFile)
                                {
                                  // Alternate method for making <?= valid
                                  $raw = file_get_contents ($viewFile);
                                  $raw = str_replace ('<?=', '<?php echo ', $raw); 
                               
                                  $html = '';
                                  $phptokens = @token_get_all ($raw);
                               
                                  $mode    = 'text';
                                  $phpcode = '';
                                  foreach ($phptokens as $ptoken)
                                  {
                                    if (($mode == 'text') && is_array ($ptoken) && ($ptoken[0] === T_OPEN_TAG)) {
                                      $mode = 'php';
                                      continue;
                                    }
                               
                                    if (($mode == 'php') && is_array ($ptoken) && ($ptoken[0] === T_CLOSE_TAG)) {
                                      ob_start();
                                      eval ($phpcode . ';');
                                      $html .= ob_get_contents();
                                      ob_end_clean();
                               
                                      $mode    = 'text';
                                      $phpcode = '';
                                      continue;
                                    }
                               
                                    if ($mode == 'text') { 
                                      $html .= is_array ($ptoken) ? $ptoken[1] : $ptoken;
                                    }
                                    else {
                                      $phpcode .= is_array ($ptoken) ? $ptoken[1] : $ptoken;
                                    }
                                  }
                               
                                  if (($mode == 'php') && ($phpcode !== '')) {
                                    ob_start();
                                    eval ($phpcode);
                                    $html .= ob_get_contents();
                                    ob_end_clean();
                                  }
                               
                                  return $html;
                                }
                              <?php=shif();?> or <?php echo shif(); ?> or plain <?php shif(); ?>


                              Tells PHP whether the short form (<? ?>) of PHP's open tag should be allowed. If you want to use PHP in combination with XML, you can disable this option in order to use <?xml ?> inline. Otherwise, you can print it with PHP, for example: <?php echo '<?xml version="1.0"?>'; ?>. Also, if disabled, you must use the long form of the PHP open tag (<?php ?>).

                              Note:

                              This directive also affected the shorthand <?= before PHP 5.4.0, which is identical to <? echo. Use of this shortcut required short_open_tag to be on. Since PHP 5.4.0, <?= is always available.

                              PHP: Description of core php.ini directives - Manual
                              Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
                              Visit: WapMasterz Coming Back Soon!
                              _______
                              SCRIPTS FOR SALE BY SUBZERO
                              Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
                              FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
                              _______
                              Info & Tips
                              php.net
                              w3schools.com

                              Comment

                              Working...
                              X