View Single Post
  #1  
Old 07-15-2010, 06:55 PM
HIddenPanda's Avatar
HIddenPanda HIddenPanda is offline
I Am... Da Sheep
 
Join Date: Jul 2010
Posts: 52
Gender: Male
Credits: 5,336
HIddenPanda
Default Admins Can View All Active Promo Codes

This mod simply adds a page to view all of the current promo codes.

Step One:

Open Up admin.php

Find this string of code:

...
PHP Code:
$article_content "Here you can add or edit the adoptables that are available to your site's visitors.  Please choose an option below...<br><br>
    <a href='admin.php?set=adopts&do=new'>Add a new adoptable</a><br><br>
    <a href='admin.php?set=adopts&do=addlevel'>Add A New Level to an Adoptable</a><br>
    <a href='admin.php?set=adopts&do=editlevels'>Edit Existing Levels or Images</a><br>
    <a href='admin.php?set=adopts&do=uploadimg'>Upload a new Adoptable Image</a><br>
    <a href='admin.php?set=adopts&do=manageimg'>Manage or Delete Images</a>"

Insert between the </a> and " the following code:
PHP Code:
<br>
<
a href='admin.php?set=adopts&do=viewcodes'>View Current Promo Codes</a
That creates a link in the "Change Adoptables" Page;
Now for the actual working code!

In admin.php now find (Note: This should be around Line 800 ish)
PHP Code:
    $i++;
    }

$article_content $article_content."<p>    
    <input name='page' type='hidden' id='page' value='delimg'>
<input type='submit' name='Submit' value='Submit'>
  </p>
</form>"
;



After that insert the following:
PHP Code:
else if($do == "viewcodes"){
    
    
$article_title "Promo Codes";
    
$article_content "<table width='400' border='1'><tbody><tr><td><b>Type</b></td><td><b>Reward</b></td><td><b>Promo Code</b></td></tr>";
    
$query "SELECT * FROM " $prefix "adoptables WHERE whenisavail='promo'";
    
$result mysql_query($query);
    
$promocodes mysql_fetch_array($result);
    
$num mysql_num_rows($result);
    
$i=1;
    while(
$i <= $num){
    
$article_content $article_content."<tr><td>Adoptable</td><td>".$promocodes['type']."</td><td>".$promocodes['promocode']."</td></tr>";
    
$i++;
    }
    
$article_content $article_content."</tbody></table>";

There ya go! Now if you go into the admin panel and click the Change Adoptables page, it will include a link to view any adoptables that require promo codes to get!
Reply With Quote