Home Community Mys-Script Creative Off-Topic |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Give people an adoptable/cash on ther birthday!
With this script, users will get an adoptable or cash on ther birthday. Nice gift, not?
Specials thanks to fadillzzz who helped me fixing errors etc. 1) Search in account.php for this; //Loop out code $i=0; while ($i < 1) { $newmessagenotify=@mysql_result($result,$i,"newmes sagenotify"); $website=@mysql_result($result,$i,"website"); $aim=@mysql_result($result,$i,"aim"); $yahoo=@mysql_result($result,$i,"yahoo"); $msn=@mysql_result($result,$i,"msn"); Under that part of the code, add this; $birthday=@mysql_result($result,$i,"birthday"); 2) We are not done with account.php ! Look for this code; </p> <p>MSN Username: <input name='msn' type='text' id='msn' value='".$msn."'> <input name='act' type='hidden' id='act' value='changesettings'> </p> Under that, add this; <p>Birthday: <input name='birthday' type='text' id='birthday' value='".$birthday."'> !! The birthday must be entered so; Example for 31 Jan. 31 01 So 2 figures for the day, then a space end then 2 figures for the month. 3) Now we are done with account.php Open now accountpost.php end look for this part of the code; $aim = $_POST["aim"]; $aim = secure($aim); $yim = $_POST["yim"]; $yim = secure($yim); $msn = $_POST["msn"]; $msn = secure($msn); Under that, add this; $birthday= $_POST["birthday"]; $birthday= secure($birthday); 4) We must edit another thing in accountpost.php ! Look for this code; $query = "UPDATE ".$prefix."users SET msn='".$msn."' WHERE username='".$loggedinname."'"; mysql_query($query); End ad this; $query = "UPDATE ".$prefix."users SET birthday='".$birthday."' WHERE username='".$loggedinname."'"; mysql_query($query); 5) Accountpost.php is ready. Now you need to creat 2 new colum in _users ; Name: alreadybirthday Type: Varchar 10 Collation: latin1_swedish_ci Null: No Default Value: Not & Name: birthday Type: Varchar 10 Collation: latin1_swedish_ci Null: No 6) We edited our _users table, so we must update our register.php ! Search for ; //All checks are done, actually create the user's account on the database $date = date('Y-m-d'); mysql_query("INSERT INTO ".$prefix."users VALUES ('', '$username', '$pass1','$email','3','1', '$date', '0','','','','','')"); & change it to //All checks are done, actually create the user's account on the database $date = date('Y-m-d'); mysql_query("INSERT INTO ".$prefix."users VALUES ('', '$username', '$pass1','$email','3','1', '$date', '0','','','','','','','')"); 7) Now users can set ther birthday. Now you can use this file to give your users a special adoptable on ther birthday; <?php // ************************************************** ******************** // Basic Configuration Info // ************************************************** ******************** include("inc/functions.php"); include("inc/config.php"); $themeurl = grabanysetting("themeurl"); // ************************************************** ******************** // Define our top links by calling getlinks() // ************************************************** ******************** $links = getlinks(); // ************************************************** ******************** // Define our ads by calling getads() // ************************************************** ******************** $ads = getads("any"); // ************************************************** ******************** // Grab any settings that we will need for the current page from the DB // ************************************************** ******************** $browsertitle = grabanysetting("browsertitle"); $sitename = grabanysetting("sitename"); $slogan = grabanysetting("slogan"); // ************************************************** ******************** // Check and see if the user is logged in to the site // ************************************************** ******************** $loginstatus = logincheck(); $isloggedin = $loginstatus[loginstatus]; $loggedinname = $loginstatus[username]; // ************************************************** ******************** // End Prepwork - Output the page to the user // ************************************************** ******************** $query = "SELECT * FROM ".$prefix."users WHERE username='$loggedinname'"; $result = mysql_query($query); $num = mysql_num_rows($result); //Loop out code $i=0; while ($i < 1) { $birthday=@mysql_result($result,$i,"birthday") ; $alreadybirthday=@mysql_result($result,$i,"already birthday") ; $date = date("d m"); $code = rand(1, 20000); $i++; } if($birthday == $date){ if ($alreadybirthday != "yes"){ $article_title = "Happy Birthday!"; $article_content = "As gift you get a special adoptable!"; mysql_query("INSERT INTO ".$prefix."owned_adoptables VALUES ('', 'TYPEOFSPECIALADOPTABLE', 'Happy B-day!','$loggedinname','1','2', '$code', '','no','notfortrade','no')" ); $query = "UPDATE ".$prefix."users SET alreadybirthday='yes' WHERE username='".$loggedinname."'"; mysql_query($query); } elseif ($alreadybirthday == "yes"){ $article_title = "Is it your birthday?"; $article_content = "Yes, but you got already a gift! It's today: ".$date." ! "; } } else{ $article_title = "Is it your birthday"; $article_content = "No :(! ! It's today ".$date." !"; } // ************************************************** ******************** // Begin Template Definition // ************************************************** ******************** //Define our current theme $file = $themeurl; // Do the template changes and echo the ready template $template = file_get_contents($file); //echo $file; $template = replace(':ARTICLETITLE:',$article_title,$template) ; $template = replace(':ARTICLECONTENT:',$article_content,$templ ate); $template = replace(':ARTICLEDATE:',$article_date,$template); $template = replace(':BROWSERTITLE:',$browsertitle,$template); $template = replace(':SITENAME:',$sitename,$template); //Define our links $template = replace(':LINKSBAR:',$links,$template); //Get the content for the side bar... $sidebar = getsidebar(); $template = replace(':SIDEFEED:',$sidebar,$template); echo $template; // ************************************************** ******************** // End Template Definition // ************************************************** ******************** ?> You can do this also with cash etc. , will come soon! Last edited by PokePets; 02-20-2011 at 11:51 AM. |
#2
|
|||
|
|||
You forgot to tell everyone to update the INSERT query in the register.php to insert 2 more values for the new columns that were created.
|
#3
|
|||
|
|||
Quote:
*editing* |
#4
|
||||
|
||||
Well yeah, this is usually the cause of bugs regarding changes of table prefix_users. I pointed it out to Anna on her avatar mod before, but seems that she still made the same mistake when doing her whos online script. I will post a thread to remind every aspiring coders about something like this when Mys v1.2.0 is released.
__________________
Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
#5
|
||||
|
||||
lol, I'm a slow learner, I guess?
I usually do mention always check the code because I have LOTS of special and different stuff in there, but ....yeah, always forget that part! Last edited by Missy Master; 02-22-2011 at 12:57 PM. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Hi People | Taintedkitten | Newcomer Center | 3 | 01-06-2013 06:06 PM |
ok im new and i give up i am asking for help | chinchillapals | Questions and Supports | 12 | 04-18-2012 05:22 PM |
Buying 'cash' with cash? | Quillink | Questions and Supports | 4 | 07-20-2009 04:21 AM |
Prevent people making multiple accounts | kisazeky | Addons/Mods Graveyard | 6 | 04-24-2009 02:44 AM |
Let's give this another shot | Killgore | Questions and Supports | 7 | 02-07-2009 01:03 AM |
What's New? |
What's Hot? |
What's Popular? |