Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Releases
now, next and later script
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="DDDDec" data-source="post: 465031" data-attributes="member: 75952"><p>how it works:</p><p>shows the current next and later event by the hour.</p><p></p><p>sql:</p><p>[CODE=sql]DROP TABLE IF EXISTS `cms_events`;</p><p>CREATE TABLE `cms_events` (</p><p> `id` int(11) NOT NULL,</p><p> `event_name` varchar(255) NOT NULL,</p><p> `time` varchar(255) NOT NULL,</p><p> `day` varchar(255) NOT NULL,</p><p> PRIMARY KEY (`id`)</p><p>) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;[/CODE]</p><p></p><p>css:</p><p>[CODE=css].events {</p><p> width: 100%;</p><p> margin-top: 10px;</p><p> display: grid;</p><p> grid-template-columns: 1fr 1fr 1fr;</p><p> grid-gap: 1%;</p><p>}</p><p>.event-image {</p><p> display: inline-block;</p><p> height: 130px;</p><p> width: 100;</p><p> overflow: hidden;</p><p> padding-right: 10px;</p><p> padding-bottom: 10px;</p><p> color: white;</p><p> border-radius: 3px;</p><p> display: inline-block;</p><p> background-image: url('http://localhost/cms_images/dump/lpromo_nov20_gen.png');</p><p> background-repeat: no-repeat;</p><p> background-position: bottom right;</p><p> font-weight: bold;</p><p> text-align: center;</p><p>}</p><p>.event-time {</p><p> padding: 10px;</p><p> margin-top: 10px;</p><p> width: 70%;</p><p> background-color: #00000075;</p><p> border-radius: 3px;</p><p> display: inline-block;</p><p> margin-left: 10px;</p><p>}</p><p>.event-type {</p><p> padding: 10px;</p><p> margin-top: 10px;</p><p> width: 70%;</p><p> background-color: #00000075;</p><p> border-radius: 3px;</p><p> display: inline-block;</p><p> margin-left: 10px;</p><p>}[/CODE]</p><p></p><p>php:</p><p>[CODE=php]class events {</p><p> </p><p> public function timeCheck($time) {</p><p> </p><p> if ($time == '25') {</p><p> </p><p> $time = '0';</p><p> </p><p> }</p><p> </p><p> if ($time == '26') {</p><p> </p><p> $time = '1';</p><p> </p><p> }</p><p> </p><p> }</p><p> </p><p> public function now_plugin() {</p><p> </p><p> global $db;</p><p> </p><p> $time = date('H') - 1 + 1;</p><p> $day = date('N');</p><p> </p><p> $now_plugin = $db->prepare("</p><p> SELECT * FROM cms_events WHERE time = :time AND day = :day</p><p> ");</p><p> $now_plugin->bindParam(":time", $time);</p><p> $now_plugin->bindParam(":day", $day);</p><p> $now_plugin->execute();</p><p> </p><p> if ($now_plugin->RowCount() > 0) {</p><p> </p><p> $now_plugin_data = $now_plugin->fetch();</p><p> echo "</p><p> <div class='event-image'></p><p> <div class='event-time'>{$now_plugin_data['time']}:00</div></p><p> <div class='event-type'>{$now_plugin_data['event_name']}</div></p><p> </div></p><p> ";</p><p> </p><p> } else {</p><p> echo "</p><p> <div class='event-image'></p><p> <div class='event-time'>$time:00</div></p><p> <div class='event-type'>NO EVENT BOOKED</div></p><p> </div></p><p> ";</p><p> }</p><p> </p><p> }</p><p> </p><p> public function next_plugin() {</p><p> </p><p> global $db;</p><p> </p><p> $time = date('H') - 1 + 2;</p><p> $day = date('N');</p><p> </p><p> self::timeCheck($time);</p><p> </p><p> $next_plugin = $db->prepare("</p><p> SELECT * FROM cms_events WHERE time = :time AND day = :day</p><p> ");</p><p> $next_plugin->bindParam(":time", $time);</p><p> $next_plugin->bindParam(":day", $day);</p><p> $next_plugin->execute();</p><p> </p><p> if ($next_plugin->RowCount() > 0) {</p><p> </p><p> $next_plugin_data = $next_plugin->fetch();</p><p> echo "</p><p> <div style='opacity: 0.5;' class='event-image'></p><p> <div class='event-time'>{$now_plugin_data['time']}:00</div></p><p> <div class='event-type'>{$now_plugin_data['event_name']}</div></p><p> </div></p><p> ";</p><p> </p><p> } else {</p><p> echo "</p><p> <div style='opacity: 0.75;' class='event-image'></p><p> <div class='event-time'>$time:00</div></p><p> <div class='event-type'>NO EVENT BOOKED</div></p><p> </div></p><p> ";</p><p> }</p><p> </p><p> }</p><p> </p><p> public function later_plugin() {</p><p> </p><p> global $db;</p><p> </p><p> $time = date('H') - 1 + 3;</p><p> $day = date('N');</p><p> </p><p> self::timeCheck($time);</p><p> </p><p> $later_plugin = $db->prepare("</p><p> SELECT * FROM cms_events WHERE time = :time AND day = :day</p><p> ");</p><p> $later_plugin->bindParam(":time", $time);</p><p> $later_plugin->bindParam(":day", $day);</p><p> $later_plugin->execute();</p><p> </p><p> if ($later_plugin->RowCount() > 0) {</p><p> </p><p> $later_plugin_data = $later_plugin->fetch();</p><p> echo "</p><p> <div style='opacity: 0.5;' class='event-image'></p><p> <div class='event-time'>{$now_plugin_data['time']}:00</div></p><p> <div class='event-type'>{$now_plugin_data['event_name']}</div></p><p> </div></p><p> ";</p><p> </p><p> } else {</p><p> echo "</p><p> <div style='opacity: 0.5;' class='event-image'></p><p> <div class='event-time'>$time:00</div></p><p> <div class='event-type'>NO EVENT BOOKED</div></p><p> </div></p><p> ";</p><p> }</p><p> </p><p> }</p><p> </p><p>}[/CODE]</p><p></p><p>image i used:</p><p>[ATTACH=full]11635[/ATTACH]</p><p></p><p>put this anywhere before you run the script, change the timezone if your not using londons timezone:</p><p>date_default_timezone_set('Europe/London');</p><p></p><p>how it looks:</p><p></p><p>[ATTACH=full]11634[/ATTACH]</p><p></p><p>Alternative: <a href="https://github.com/BigDeclan/now-next-later-script" target="_blank">https://github.com/BigDeclan/now-next-later-script</a></p></blockquote><p></p>
[QUOTE="DDDDec, post: 465031, member: 75952"] how it works: shows the current next and later event by the hour. sql: [CODE=sql]DROP TABLE IF EXISTS `cms_events`; CREATE TABLE `cms_events` ( `id` int(11) NOT NULL, `event_name` varchar(255) NOT NULL, `time` varchar(255) NOT NULL, `day` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;[/CODE] css: [CODE=css].events { width: 100%; margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr 1fr; grid-gap: 1%; } .event-image { display: inline-block; height: 130px; width: 100; overflow: hidden; padding-right: 10px; padding-bottom: 10px; color: white; border-radius: 3px; display: inline-block; background-image: url('http://localhost/cms_images/dump/lpromo_nov20_gen.png'); background-repeat: no-repeat; background-position: bottom right; font-weight: bold; text-align: center; } .event-time { padding: 10px; margin-top: 10px; width: 70%; background-color: #00000075; border-radius: 3px; display: inline-block; margin-left: 10px; } .event-type { padding: 10px; margin-top: 10px; width: 70%; background-color: #00000075; border-radius: 3px; display: inline-block; margin-left: 10px; }[/CODE] php: [CODE=php]class events { public function timeCheck($time) { if ($time == '25') { $time = '0'; } if ($time == '26') { $time = '1'; } } public function now_plugin() { global $db; $time = date('H') - 1 + 1; $day = date('N'); $now_plugin = $db->prepare(" SELECT * FROM cms_events WHERE time = :time AND day = :day "); $now_plugin->bindParam(":time", $time); $now_plugin->bindParam(":day", $day); $now_plugin->execute(); if ($now_plugin->RowCount() > 0) { $now_plugin_data = $now_plugin->fetch(); echo " <div class='event-image'> <div class='event-time'>{$now_plugin_data['time']}:00</div> <div class='event-type'>{$now_plugin_data['event_name']}</div> </div> "; } else { echo " <div class='event-image'> <div class='event-time'>$time:00</div> <div class='event-type'>NO EVENT BOOKED</div> </div> "; } } public function next_plugin() { global $db; $time = date('H') - 1 + 2; $day = date('N'); self::timeCheck($time); $next_plugin = $db->prepare(" SELECT * FROM cms_events WHERE time = :time AND day = :day "); $next_plugin->bindParam(":time", $time); $next_plugin->bindParam(":day", $day); $next_plugin->execute(); if ($next_plugin->RowCount() > 0) { $next_plugin_data = $next_plugin->fetch(); echo " <div style='opacity: 0.5;' class='event-image'> <div class='event-time'>{$now_plugin_data['time']}:00</div> <div class='event-type'>{$now_plugin_data['event_name']}</div> </div> "; } else { echo " <div style='opacity: 0.75;' class='event-image'> <div class='event-time'>$time:00</div> <div class='event-type'>NO EVENT BOOKED</div> </div> "; } } public function later_plugin() { global $db; $time = date('H') - 1 + 3; $day = date('N'); self::timeCheck($time); $later_plugin = $db->prepare(" SELECT * FROM cms_events WHERE time = :time AND day = :day "); $later_plugin->bindParam(":time", $time); $later_plugin->bindParam(":day", $day); $later_plugin->execute(); if ($later_plugin->RowCount() > 0) { $later_plugin_data = $later_plugin->fetch(); echo " <div style='opacity: 0.5;' class='event-image'> <div class='event-time'>{$now_plugin_data['time']}:00</div> <div class='event-type'>{$now_plugin_data['event_name']}</div> </div> "; } else { echo " <div style='opacity: 0.5;' class='event-image'> <div class='event-time'>$time:00</div> <div class='event-type'>NO EVENT BOOKED</div> </div> "; } } }[/CODE] image i used: [ATTACH type="full" width="348px" alt="lpromo_nov20_gen.png"]11635[/ATTACH] put this anywhere before you run the script, change the timezone if your not using londons timezone: date_default_timezone_set('Europe/London'); how it looks: [ATTACH type="full" alt="nownextlater.png"]11634[/ATTACH] Alternative: [URL]https://github.com/BigDeclan/now-next-later-script[/URL] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
now, next and later script
Top