Skip to content
Index Help & Support Faucet Owners Programming

Random Banner Code ( PHP ONLY )

Posted by freek.in 1 year ago
3 799
Random Banner Code ( PHP ONLY )
Posted 1 year ago, last edited 1 year ago
This is my second tutorial here , first one i wrote -> https://faucethub.io/forum/thread/30780 STEP 1 First add this function to your existing function.php file , or if there is no such file in your script. Then make function.php file and paste this code in there. #FUNCTION FOR BANNER ROTATOR# function bannerRot($file){ $adfile = file_get_contents($file); $adx = explode('~',$adfile); $countarray = count($adx); $randomad = rand(0,$countarray-1); return $adx; } #FUNCTION FOR BANNER ROTATOR# Now add this function.php file to the page where u want to display ads in rotation. STEP 2 Now create a .txt file , i will recommend to make separate .txt file for ad sizes. For example if u want to run 728x90 size banners make a separate 728x90.txt file , for 160x600 size make 160x600.txt file and add your codes like this an example given below. <div style="border:1px solid #000;width:468px;height:60px;text-align:center;line-height:60px;background-color:#000;color:#fff;"> BANNER ADS ONE </div> ~ <div style="border:1px solid #000;width:468px;height:60px;text-align:center;line-height:60px;background-color:#735e05;color:#fff;"> BANNER ADS TWO </div> ~ <div style="border:1px solid #000;width:468px;height:60px;text-align:center;line-height:60px;background-color:#320add;color:#fff;"> BANNER ADS THREE </div> Make sure to separate your adcodes with ~  Step 3 Use this code where you want to display Banner rotator.  <?php echo bannerRot('728x90.txt'); ?> make sure 728x90.txt file should be in same folder as that of displaying page. Or target properly.  Have a great day. Enjoy your time.
RE: Random Banner Code ( PHP ONLY )
Posted 1 year ago, last edited 1 year ago
HOW TO ADD THIS IN FAUCETINABOX SCRIPT ? Step 1 :- FTP your site and go in libs > functions.php ( open this in a notepad editor Eg : notepad ++ ) Copy paste this function in end of the page before ?> #FUNCTION FOR BANNER ROTATOR# function bannerRot($file){ $adfile = file_get_contents($file); $adx = explode('~',$adfile); $countarray = count($adx); $randomad = rand(0,$countarray-1); return $adx; } #FUNCTION FOR BANNER ROTATOR# Step 2 :- Go to public_html folder of your faucet or which ever folder u installed the faucet.  Make a .txt file with anyname suits you, recommended to make banner size files so that it can managed easily. For eg: 728x90.txt After making that .txt file copy paste this code  <div style="border:1px solid #000;width:468px;height:60px;text-align:center;line-height:60px;background-color:#000;color:#fff;"> BANNER ADS ONE </div> ~ <div style="border:1px solid #000;width:468px;height:60px;text-align:center;line-height:60px;background-color:#735e05;color:#fff;"> BANNER ADS TWO </div> ~ <div style="border:1px solid #000;width:468px;height:60px;text-align:center;line-height:60px;background-color:#320add;color:#fff;"> BANNER ADS THREE </div> Replace those divs with your adcodes or banner codes. Dont remove ~ it is required as a separator in between codes. Step 3 :- Open templates folder  , Go inside your template folder which ever u are using. And take out index.php file and open in notepad. Now find this code in the template         <div class="row">             <div class="col-xs-12 <?php echo $data . ' ' . $data; ?>">                 <?php echo $data; ?>                 </div>         </div> replace it with this          <div class="row">             <div class="col-xs-12 <?php echo $data . ' ' . $data; ?>">                 <?php //echo $data; ?>                 <?php echo bannerRot('728x90.txt'); ?>                 </div>         </div> repeat same with other custom_box_bottom , custom_box_left , custom_box_right  That's it.
RE: Random Banner Code ( PHP ONLY )
Posted 1 year ago, last edited 1 year ago
HOW TO ADD THIS CODE IN SHIRESAT FLOODGATE STEP 1 :- Copy this code in a config.php before ?> //$cfg__VERSION = '4.5.0+.mod'; #FUNCTION FOR BANNER ROTATOR# function bannerRot($file){ $adfile = file_get_contents($file); $adx = explode('~',$adfile); $countarray = count($adx); $randomad = rand(0,$countarray-1); return $adx; } #FUNCTION FOR BANNER ROTATOR# STEP 2 :- Open index.php file in editor and add this code where you want to display adverts. <?php echo bannerRot('728x90.txt'); ?> repeat same with faucet.php file.  STEP 3 :- Make a 728x90.txt file or any name .txt file and replace your banner codes. <div style="border:1px solid #000;width:468px;height:60px;text-align:center;line-height:60px;background-color:#000;color:#fff;"> BANNER ADS ONE </div> ~ <div style="border:1px solid #000;width:468px;height:60px;text-align:center;line-height:60px;background-color:#735e05;color:#fff;"> BANNER ADS TWO </div> ~ <div style="border:1px solid #000;width:468px;height:60px;text-align:center;line-height:60px;background-color:#320add;color:#fff;"> BANNER ADS THREE </div> make sure 728x90.txt file should be in same folder as of index.php and faucet.php 
RE: Random Banner Code ( PHP ONLY )
Posted 1 year ago
Make it clickable link by using this code  <a href="http://faucetname.com" target="_blank"><img src="linkforbanner" /></a>