Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Mys v1.1.x Mods

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 02-20-2011, 11:42 AM
PokePets PokePets is offline
Premium Member
 
Join Date: Jun 2010
Posts: 228
Gender: Male
Credits: 22,532
PokePets
Default 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.
Reply With Quote
  #2  
Old 02-20-2011, 11:47 AM
fadillzzz fadillzzz is offline
Dev Staff
 
Join Date: Jan 2010
Posts: 501
Gender: Male
Credits: 37,844
fadillzzz is an unknown quantity at this point
Default

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.
Reply With Quote
  #3  
Old 02-20-2011, 11:47 AM
PokePets PokePets is offline
Premium Member
 
Join Date: Jun 2010
Posts: 228
Gender: Male
Credits: 22,532
PokePets
Default

Quote:
Originally Posted by fadillzzz View Post
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.
Thank you!
*editing*
Reply With Quote
  #4  
Old 02-20-2011, 01:29 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 490,999
Hall of Famer is on a distinguished road
Default

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.
Reply With Quote
  #5  
Old 02-22-2011, 09:57 AM
Missy Master's Avatar
Missy Master Missy Master is offline
Pet-Sim.Online
 
Join Date: Jan 2010
Posts: 475
Gender: Unknown/Other
Credits: 64,516
Missy Master is an unknown quantity at this point
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -5. The time now is 04:52 AM.

Currently Active Users: 800 (0 members and 800 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636