Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Reply
 
Thread Tools Display Modes
  #1  
Old 11-15-2020, 04:29 PM
Micolai's Avatar
Micolai Micolai is offline
Loving Mysidia
 
Join Date: May 2020
Location: Tennessee
Posts: 87
Gender: Female
Credits: 4,781
Micolai is on a distinguished road
Question Stripslashes and server time zone?

So I have a couple questions. First one is needing help with stripslashes in users bios. I found one post that helped fix some of the other areas with this same issue but I'm still stuck with the bio one.
I keeps running into things with the ' into having slashes. So

I'm

becomes

I/'m.

I found in accountview.php a bio section:

Quote:
$profileForm->add(new Comment("Name: ", FALSE));
$profileForm->add(new TextField("nickname", $profile->getNickname()));
$profileForm->add(new Comment(""));
$profileForm->add(new Comment("Gender: ", FALSE));
$profileForm->add(new TextField("gender", $profile->getGender()));
$profileForm->add(new Comment(""));
$profileForm->add(new Comment("Bio: "));
$profileForm->add(new TextArea("bio", $profile->getBio()));
$profileForm->add(new Comment($lang->bio));
but I'm unsure if this is the area I need to use to fix it, or what code to even use.
________________

My next question is what is the time zone for the server? I'm trying to make a code that changes an image based on thy hour, and for some reason results are turning out weird lol like my time zone didn't match the server was my only guess.

Any help would be really appreciated,

thank you!
__________________
"You try you fail, you try you fail, but the only true failure is if you stop trying. So try again." - Haunted Mansion
Reply With Quote
  #2  
Old 11-16-2020, 04:07 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 845
Gender: Unknown/Other
Credits: 45,828
Kyttias is on a distinguished road
Default

I believe I fixed this in my own install once upon a time. In classes/class_userprofile.php, replace
PHP Code:
      $basicinfo "<br><strong>Member Since:</strong> {$membersince}<br>
                    Gender: 
{$this->gender}<br>
                    Favorite Color: 
{$this->color}<br>
                    Nickname: 
{$this->nickname}<br>
                    Bio: 
{$this->bio}"
with this (we're added stripslashes)
PHP Code:
 $str_bio stripslashes($this->bio);
      
$basicinfo "<br><strong>Member Since:</strong> {$membersince}<br>
                    Gender: 
{$this->gender}<br>
                    Favorite Color: 
{$this->color}<br>
                    Nickname: 
{$this->nickname}<br>
                    Bio: 
{$str_bio}"
________________

Short of asking the hosting provider what timezone it is (or checking the php.ini file), you could try running this code to find that out?
PHP Code:
if (date_default_timezone_get()) {
    echo 
'date_default_timezone_set: ' date_default_timezone_get() . '<br />';
}

if (
ini_get('date.timezone')) {
    echo 
'date.timezone: ' ini_get('date.timezone');

__________________
Please do not contact me. I cannot offer tech support on any coding I've done prior to 2018.
Reply With Quote
  #3  
Old 11-17-2020, 03:54 PM
Micolai's Avatar
Micolai Micolai is offline
Loving Mysidia
 
Join Date: May 2020
Location: Tennessee
Posts: 87
Gender: Female
Credits: 4,781
Micolai is on a distinguished road
Default

Thank you so much! :D that worked, time zone is apparently UTC. Do you know how I would change it to EST? and the stripslashes worked! I appreciate you.
__________________
"You try you fail, you try you fail, but the only true failure is if you stop trying. So try again." - Haunted Mansion
Reply With Quote
  #4  
Old 11-18-2020, 01:54 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 845
Gender: Unknown/Other
Credits: 45,828
Kyttias is on a distinguished road
Default

Usually hosting providers can't or won't change the entire server's timezone, as its usually shared hosting, and they'd rather it be local to timezone the server is physically in.

You can change the default time zone for use in particular code on a particular page but don't expect it to carry between pages without specifically making sure its set. (And, of course, this makes the code local to whatever YOU set it to be, not whatever the timezone it currently is for any viewer, so it'll be off for anyone who doesn't share your timezone. Dynamically getting the appropriate timezone is not quite possible without a bit of hackery, which users will always be able to find ways around, anyway.)

But if it helps your mental math to have things based around your own understanding of what time it is, I don't blame you!

Since you're wanting to display code between particular hours, it's worth noting that hours can be checked between midnight 0000 and the minute just before midnight 2359 -- military time. I'm not sure what exactly you're up to, but I hope this can help!

PHP Code:
date_default_timezone_set('America/New_York');
// echo date('Y-m-d H:i:s');

$currentTime date('Hi');
$breakfastStart "0200"$breakfastEnd "1129";
$lunchStart "1130"$lunchEnd "1559";
$dinnerStart "1600"$dinnerEnd "2129";
$lateStart "2130"$lateEnd "0159";

if( 
$currentTime >= $breakfastStart && $currentTime <= $breakfastEnd ){ 
  
/*BREAKFAST*/
    
$timefor 'Breakfast';
} elseif( 
$currentTime >= $lunchStart && $currentTime <= $lunchEnd ){ 
  
/*LUNCH*/
    
$timefor 'Lunch';
} elseif( 
$currentTime >= $dinnerStart && $currentTime <= $dinnerEnd ){ 
  
/*DINNER*/
    
$timefor 'Dinner';
} else { 
  
/*LATE NIGHT SNACK*/
    
$timefor 'Late Night';

Just know that it won't necessarily make sense to everyone viewing it because they won't be in the same time you are. While you're eating breakfast, they could be eating dinner. Even though its dinner time for them in the real world, on your website it's breakfast time because it is where you are. Hope that makes sense!
__________________
Please do not contact me. I cannot offer tech support on any coding I've done prior to 2018.
Reply With Quote
Reply

Tags
slashes, stripslashes, time, timezone, zone

Thread Tools
Display Modes

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


All times are GMT -5. The time now is 05:42 PM.

Currently Active Users: 371 (0 members and 371 guests)
Threads: 4,035, Posts: 31,786, Members: 15,694
Welcome to our newest members, rome002.
BETA





What's New?

What's Hot?

What's Popular?


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