#1
|
||||
|
||||
Giving users things (timed)
I was looking at this Code (shown below)
And I was wondering if there was a way to edit it so a specific user could only...lets say collect something from this page...once a month? so basically every 30 days they'd come back to claim their reward... and otherwise they cant access the page. PHP Code:
|
#2
|
||||
|
||||
Okay that code is from a much, much older version of Mysidia and shouldn't be referenced and use cannot be made of it. Some of those include files don't even exist anymore.
You should read this guide on making custom pages and it should cover everything you need. Please do read through it all before continuing down this post, or at least reread this post after you've read everything there. To be specific, and this is covered, you'll need to add a column to a table in your database. Now, depending on the amount of things like this you want to, I'd suggest making a table just to hold data on this. But if it's only going to be a few things, you can always just add a column to the end of the 'adopts_users' table in your database to hold a time reference. In the examples in the link I gave, we add a column 'lastday' and use it to check time. (Logically, if you're going to have more than one sort of time-based event, you'll need many more intuitively-named columns because they can't all share one.) Say your page is "/awesomepage". You will need to make awesomepage.php - PHP Code:
PHP Code:
I super recommend you obtain a nice text editor with syntax highlighting such as Notepad++ or Sublime Text, as it makes coding much easier on the eyes and you can easily see at a glance where things are breaking because the colors will mess up.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it. Last edited by Kyttias; 02-05-2016 at 02:54 AM. |
#3
|
||||
|
||||
Ohh!! Thank you so much Kyttias! you're amazing!
|
#4
|
||||
|
||||
I have another quick question- what if I wanted to have them need items to do a mission, and some of the items are consumed and others arent when they click yes?
I also cant figure out how to add a column... >_> Or what to do for that.. I pretty much need things written out in Kindergarten terms. Last edited by Ittermat; 02-05-2016 at 10:23 PM. |
#5
|
||||
|
||||
"Some of the items are and others aren't" -- based on what criteria?
To remove an item - You need to know it's name and the amount you want to remove. You'd need something this on a form (or ajax) submission. PHP Code:
To add a column to the database - Log into phpmyadmin. Visit the 'adopts_users' table. Open the Structure tab. At the bottom, hit 'Go' at the end of 'Add Column'. Call it lastday. Let's just go with it being VARCHAR 20, and NULL is an okay value if its never been filled before. Alternatively, you can just enter SQL from the third tab: Code:
ALTER TABLE `adopts_users` ADD `lastday` VARCHAR(20) NULL DEFAULT NULL ;
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it. Last edited by Kyttias; 02-06-2016 at 02:01 AM. |
#6
|
||||
|
||||
EDIT:My whole post has info...and my page has a different error now... ugh...
I did some more Messing with it...and I came across this now... Fatal error: Class 'ArewardsView' not found in /home/atrocity/public_html/classes/class_controller.php on line 135 Im really trying to figure this whole thing out on my own... but I am stumped! ________ Thank you Kyttias! I'll try this out <3 Sorry im such a bother XD I am trying to learn I just dont get it as fast and I get easily confused... so thanks for being patient with me, now and in the future. EDIT: Okay I managed to get my page to show up- This is the code Im currently using in Adminrewardsview- PHP Code:
Last edited by Ittermat; 02-06-2016 at 11:22 PM. |
|
|
What's New? |
What's Hot? |
What's Popular? |