Activity Stream
48,167 MEMBERS
61732 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Hybrid View

warezrock user timezone 20th Aug 2010, 05:48 AM
cgworld Please give more info , what... 20th Aug 2010, 05:57 AM
warezrock well i am not using any software, i... 20th Aug 2010, 06:03 AM
l0calh0st I think there is a mod for diz. 20th Aug 2010, 08:53 AM
warezrock @l0calh0st... 20th Aug 2010, 09:15 AM
l0calh0st I don't have it. 20th Aug 2010, 09:16 AM
litewarez the way how to do this is not very... 20th Aug 2010, 02:51 PM
litewarez another way to do this is using the... 20th Aug 2010, 05:38 PM
Robin H In your registration form add: ... 20th Aug 2010, 09:46 PM
litewarez Yea you can ask the user if you... 21st Aug 2010, 10:32 AM
warezrock Thanks litewarez will definately... 22nd Aug 2010, 05:47 PM
Previous Post Previous Post   Next Post Next Post
  1.     
    #1
    Member

    Default user timezone

    what the way to display the timezone for user while registering on site and insert in mysql ?
    warezrock Reviewed by warezrock on . user timezone what the way to display the timezone for user while registering on site and insert in mysql ?:| Rating: 5
    Can Do :-
    PSD TO ANY CMS | PHP(Dynamic Site) | MySql | Script Customization | cUrl Related Work
    Pm me for more info ;)

  2.   Sponsored Links

  3.     
    #2
    Member
    Please give more info , what software you are talking about ?

  4.     
    #3
    Member
    well i am not using any software, i am about to make register form for user where he just input username, pass and email to register but i want to integrate the timezone function for user like one have on vbulletin register page TIMEZONE.
    i want to know what method is working on backend
    Can Do :-
    PSD TO ANY CMS | PHP(Dynamic Site) | MySql | Script Customization | cUrl Related Work
    Pm me for more info ;)

  5.     
    #4
    Member
    Website's:
    Elite.SO Defendos.com Motionite.com
    I think there is a mod for diz.

    Defendos BETA3 Released! Thread - Official Website

  6.     
    #5
    Member
    @l0calh0st

    if u have then post it here bro.
    Can Do :-
    PSD TO ANY CMS | PHP(Dynamic Site) | MySql | Script Customization | cUrl Related Work
    Pm me for more info ;)

  7.     
    #6
    Member
    Website's:
    Elite.SO Defendos.com Motionite.com
    I don't have it.

    Defendos BETA3 Released! Thread - Official Website

  8.     
    #7
    Member
    Website's:
    litewarez.net litewarez.com triniwarez.com
    the way how to do this is not very hard.

    When your php program first starts to load up it uses the default timezone set in the php.ini witch is usually en-us, the secret is to set the users timezone before any use of the date functions in php. for example

    PHP Code: 
    <?php
        
    //Script Head
        
    echo date('l jS \of F Y h:i:s A');
    ?>
    This would produce the time in accordance with en-us.

    You need to detect the timezone at the head of the script so no matter where you use the use data/time functions there always exact to the user and not the default server time.

    PHP Code: 
    class UserLocale
    {
        var 
    $locale;
        var 
    $timezone;
        var 
    $languages = array();

        public function 
    __construct()
        {
            
    //en_US or whatever.
            
    $this->locale Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']);

            
    setlocale(LC_ALL$this->locale); //Set the locale, example below

            /*
                strftime("%A %e %B %Y", mktime(0, 0, 0, 12, 22, 1978));
                Produces: vrijdag 22 december 1978
            */
            
    $this->detectAvailableLanguages();
        }

        private function 
    detectAvailableLanguages()
        {
            
    $langs = array();

            if (isset(
    $this->locale))
            {
                
    // break up string into pieces (languages and q factors)
                
    preg_match_all(
                    
    '/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i',
                    
    $_SERVER['HTTP_ACCEPT_LANGUAGE'],
                    
    $lang_parse
                
    );

                if (
    count($lang_parse[1]))
                {
                    
    // create a list like "en" => 0.8
                    
    $this->languages array_combine($lang_parse[1], $lang_parse[4]);
            
                    
    // set default to 1 for any without q factor
                    
    foreach ($this->languages as $lang => $val)
                    {
                        if (
    $val === ''$this->languages[$lang] = 1;
                    }

                    
    // sort list based on value
                    
    arsort($this->languagesSORT_NUMERIC);
               }
            }
        }

    Had enough of coding that, but the point is that you should build a class to detect as much information about the users as possible, so you can the set your server information to be the same.

    So when you insert a new row into the database you can then use time() witch will produce the time according to the best possible time-zone / locale.

    you can also do the same with languages, just detect the language from the http headers and then build a parser to get the available languages.

    then create a language folder called en_US and add your language data in there such as strings as such, or you can use a DB to store language strings.

    then just load the appropriate language strings according to the headers and then you have a real multilingual site.

    Some other good resources:

    http://stackoverflow.com/questions/2...-locale-in-php
    http://www.php.net/manual/en/functio...mezone-set.php
    http://www.php.net/manual/en/locale.acceptfromhttp.php
    http://stackoverflow.com/questions/2...uage-using-php
    http://www.thefutureoftheweb.com/blo...anguage-header
    Join Litewarez.net today and become apart of the community.
    Unique | Clean | Advanced (All with you in mind)
    Downloads | Webmasters


    Notifications,Forum,Chat,Community all at Litewarez Webmasters


  9.     
    #8
    Member
    Website's:
    litewarez.net litewarez.com triniwarez.com
    another way to do this is using the gears API!

    here's an example!

    Code: 
    var p = {};
    function geofind(successCallback, errorCallback)
    {
    	try
    	{
    		navigator.geolocation.getCurrentPosition(successCallback, errorCallback,
    		{
    			maximumAge: 600000
    		});
    	}catch(e)
    	{
    		try
    		{
    			var geolocation = {};
    			geolocation = google.gears.factory.create('beta.geolocation');
    			geolocation.getCurrentPosition(successCallback, errorCallback);
    		} catch(e)
    		{
    			try
    			{
    				p.coords = google.loader.ClientLocation;
    				successCallback(p);
    			}catch(e)
    			{
    				errorCallback({
    					message: "No Geolocation providers found"
    				});
    			}
    		}
    	}
    }
    and use like so:

    Code: 
    geofind(function(result)
    	{
    		//Success
    		$.post('set_geo_location.php',{result},function(){
    			//ask the user to reload the page as you now have a geo-location in $_SESSION
    		});
    	},
    	function(error)
    	{
    		//Error
    	}
    );
    Join Litewarez.net today and become apart of the community.
    Unique | Clean | Advanced (All with you in mind)
    Downloads | Webmasters


    Notifications,Forum,Chat,Community all at Litewarez Webmasters


  10.     
    #9
    Member
    Website's:
    epicimagehost.com
    In your registration form add:
    PHP Code: 
    <select name="TimeZone">
                  <
    option value="1">GMT</option>
                  <
    option value="2">GMT+1</option>
                  <
    option value="3">GMT+2</option>
                  <
    option value="4">GMT+ > 9000</option>
                  
    etc
    </select
    Or do it the fancy way like lite. But since you said you wanted it to be a bit like vbulletin, I think you meant this way.

  11.     
    #10
    Member
    Website's:
    litewarez.net litewarez.com triniwarez.com
    Yea you can ask the user if you wish.

    Code: 
    CREATE TABLE `timezones` (
    `id` tinyint(3) unsigned NOT NULL auto_increment,
    `timezone_location` varchar(30) NOT NULL default '',
    `gmt` varchar(11) NOT NULL default '',
    `offset` tinyint(2) NOT NULL default '0',
    PRIMARY KEY (`id`)
    ) TYPE=MyISAM AUTO_INCREMENT=143 ;
    
    --
    -- Dumping data for table `timezones`
    --
    
    INSERT INTO `timezones` VALUES (1, 'International Date Line West', '(GMT-12:00)', -12),
    (2, 'Midway Island', '(GMT-11:00)', -11),
    (3, 'Samoa', '(GMT-11:00)', -11),
    (4, 'Hawaii', '(GMT-10:00)', -10),
    (5, 'Alaska', '(GMT-09:00)', -9),
    (6, 'Pacific Time (US & Canada)', '(GMT-08:00)', -8),
    (7, 'Tijuana', '(GMT-08:00)', -8),
    (8, 'Arizona', '(GMT-07:00)', -7),
    (9, 'Mountain Time (US & Canada)', '(GMT-07:00)', -7),
    (10, 'Chihuahua', '(GMT-07:00)', -7),
    (11, 'La Paz', '(GMT-07:00)', -7),
    (12, 'Mazatlan', '(GMT-07:00)', -7),
    (13, 'Central Time (US & Canada)', '(GMT-06:00)', -6),
    (14, 'Central America', '(GMT-06:00)', -6),
    (15, 'Guadalajara', '(GMT-06:00)', -6),
    (16, 'Mexico City', '(GMT-06:00)', -6),
    (17, 'Monterrey', '(GMT-06:00)', -6),
    (18, 'Saskatchewan', '(GMT-06:00)', -6),
    (19, 'Eastern Time (US & Canada)', '(GMT-05:00)', -5),
    (20, 'Indiana (East)', '(GMT-05:00)', -5),
    (21, 'Bogota', '(GMT-05:00)', -5),
    (22, 'Lima', '(GMT-05:00)', -5),
    (23, 'Quito', '(GMT-05:00)', -5),
    (24, 'Atlantic Time (Canada)', '(GMT-04:00)', -4),
    (25, 'Caracas', '(GMT-04:00)', -4),
    (26, 'La Paz', '(GMT-04:00)', -4),
    (27, 'Santiago', '(GMT-04:00)', -4),
    (28, 'Newfoundland', '(GMT-03:30)', -3),
    (29, 'Brasilia', '(GMT-03:00)', -3),
    (30, 'Buenos Aires', '(GMT-03:00)', -3),
    (31, 'Georgetown', '(GMT-03:00)', -3),
    (32, 'Greenland', '(GMT-03:00)', -3),
    (33, 'Mid-Atlantic', '(GMT-02:00)', -2),
    (34, 'Azores', '(GMT-01:00)', -1),
    (35, 'Cape Verde Is.', '(GMT-01:00)', -1),
    (36, 'Casablanca', '(GMT)', 0),
    (37, 'Dublin', '(GMT)', 0),
    (38, 'Edinburgh', '(GMT)', 0),
    (39, 'Lisbon', '(GMT)', 0),
    (40, 'London', '(GMT)', 0),
    (41, 'Monrovia', '(GMT)', 0),
    (42, 'Amsterdam', '(GMT+01:00)', 1),
    (43, 'Belgrade', '(GMT+01:00)', 1),
    (44, 'Berlin', '(GMT+01:00)', 1),
    (45, 'Bern', '(GMT+01:00)', 1),
    (46, 'Bratislava', '(GMT+01:00)', 1),
    (47, 'Brussels', '(GMT+01:00)', 1),
    (48, 'Budapest', '(GMT+01:00)', 1),
    (49, 'Copenhagen', '(GMT+01:00)', 1),
    (50, 'Ljubljana', '(GMT+01:00)', 1),
    (51, 'Madrid', '(GMT+01:00)', 1),
    (52, 'Paris', '(GMT+01:00)', 1),
    (53, 'Prague', '(GMT+01:00)', 1),
    (54, 'Rome', '(GMT+01:00)', 1),
    (55, 'Sarajevo', '(GMT+01:00)', 1),
    (56, 'Skopje', '(GMT+01:00)', 1),
    (57, 'Stockholm', '(GMT+01:00)', 1),
    (58, 'Vienna', '(GMT+01:00)', 1),
    (59, 'Warsaw', '(GMT+01:00)', 1),
    (60, 'West Central Africa', '(GMT+01:00)', 1),
    (61, 'Zagreb', '(GMT+01:00)', 1),
    (62, 'Athens', '(GMT+02:00)', 2),
    (63, 'Bucharest', '(GMT+02:00)', 2),
    (64, 'Cairo', '(GMT+02:00)', 2),
    (65, 'Harare', '(GMT+02:00)', 2),
    (66, 'Helsinki', '(GMT+02:00)', 2),
    (67, 'Istanbul', '(GMT+02:00)', 2),
    (68, 'Jerusalem', '(GMT+02:00)', 2),
    (69, 'Kyev', '(GMT+02:00)', 2),
    (70, 'Minsk', '(GMT+02:00)', 2),
    (71, 'Pretoria', '(GMT+02:00)', 2),
    (72, 'Riga', '(GMT+02:00)', 2),
    (73, 'Sofia', '(GMT+02:00)', 2),
    (74, 'Tallinn', '(GMT+02:00)', 2),
    (75, 'Vilnius', '(GMT+02:00)', 2),
    (76, 'Baghdad', '(GMT+03:00)', 3),
    (77, 'Kuwait', '(GMT+03:00)', 3),
    (78, 'Moscow', '(GMT+03:00)', 3),
    (79, 'Nairobi', '(GMT+03:00)', 3),
    (80, 'Riyadh', '(GMT+03:00)', 3),
    (81, 'St. Petersburg', '(GMT+03:00)', 3),
    (82, 'Volgograd', '(GMT+03:00)', 3),
    (83, 'Tehran', '(GMT+03:30)', 3),
    (84, 'Abu Dhabi', '(GMT+04:00)', 4),
    (85, 'Baku', '(GMT+04:00)', 4),
    (86, 'Muscat', '(GMT+04:00)', 4),
    (87, 'Tbilisi', '(GMT+04:00)', 4),
    (88, 'Yerevan', '(GMT+04:00)', 4),
    (89, 'Kabul', '(GMT+04:30)', 4),
    (90, 'Ekaterinburg', '(GMT+05:00)', 5),
    (91, 'Islamabad', '(GMT+05:00)', 5),
    (92, 'Karachi', '(GMT+05:00)', 5),
    (93, 'Tashkent', '(GMT+05:00)', 5),
    (94, 'Chennai', '(GMT+05:30)', 5),
    (95, 'Kolkata', '(GMT+05:30)', 5),
    (96, 'Mumbai', '(GMT+05:30)', 5),
    (97, 'New Delhi', '(GMT+05:30)', 5),
    (98, 'Kathmandu', '(GMT+05:45)', 5),
    (99, 'Almaty', '(GMT+06:00)', 6),
    (100, 'Astana', '(GMT+06:00)', 6),
    (101, 'Dhaka', '(GMT+06:00)', 6),
    (102, 'Novosibirsk', '(GMT+06:00)', 6),
    (103, 'Sri Jayawardenepura', '(GMT+06:00)', 6),
    (104, 'Rangoon', '(GMT+06:30)', 6),
    (105, 'Bangkok', '(GMT+07:00)', 7),
    (106, 'Hanoi', '(GMT+07:00)', 7),
    (107, 'Jakarta', '(GMT+07:00)', 7),
    (108, 'Krasnoyarsk', '(GMT+07:00)', 7),
    (109, 'Beijing', '(GMT+08:00)', 8),
    (110, 'Chongqing', '(GMT+08:00)', 8),
    (111, 'Hong Kong', '(GMT+08:00)', 8),
    (112, 'Irkutsk', '(GMT+08:00)', 8),
    (113, 'Kuala Lumpur', '(GMT+08:00)', 8),
    (114, 'Perth', '(GMT+08:00)', 8),
    (115, 'Singapore', '(GMT+08:00)', 8),
    (116, 'Taipei', '(GMT+08:00)', 8),
    (117, 'Ulaan Bataar', '(GMT+08:00)', 8),
    (118, 'Urumqi', '(GMT+08:00)', 8),
    (119, 'Osaka', '(GMT+09:00)', 9),
    (120, 'Sapporo', '(GMT+09:00)', 9),
    (121, 'Seoul', '(GMT+09:00)', 9),
    (122, 'Tokyo', '(GMT+09:00)', 9),
    (123, 'Yakutsk', '(GMT+09:00)', 9),
    (124, 'Adelaide', '(GMT+09:30)', 9),
    (125, 'Darwin', '(GMT+09:30)', 9),
    (126, 'Brisbane', '(GMT+10:00)', 10),
    (127, 'Canberra', '(GMT+10:00)', 10),
    (128, 'Guam', '(GMT+10:00)', 10),
    (129, 'Hobart', '(GMT+10:00)', 10),
    (130, 'Melbourne', '(GMT+10:00)', 10),
    (131, 'Port Moresby', '(GMT+10:00)', 10),
    (132, 'Sydney', '(GMT+10:00)', 10),
    (133, 'Vladivostok', '(GMT+10:00)', 10),
    (134, 'Magadan', '(GMT+11:00)', 11),
    (135, 'New Caledonia', '(GMT+11:00)', 11),
    (136, 'Solomon Is.', '(GMT+11:00)', 11),
    (137, 'Auckland', '(GMT+12:00)', 12),
    (138, 'Fiji', '(GMT+12:00)', 12),
    (139, 'Kamchatka', '(GMT+12:00)', 12),
    (140, 'Marshall Is.', '(GMT+12:00)', 12),
    (141, 'Wellington', '(GMT+12:00)', 12),
    (142, 'Nuku''alofa', '(GMT+13:00)', 13);
    then just loop the results with mysql / php and set the column offset to the rel tag in the select loop and use JavaScript to try auto select.

    PHP Code: 
        var gmtHours = new Date().getTimezoneOffset() / 60;

        
    //jQuery
        
    $('#lselect[rel*='+gmtHours +']').attr('selected','selected'); 
    Join Litewarez.net today and become apart of the community.
    Unique | Clean | Advanced (All with you in mind)
    Downloads | Webmasters


    Notifications,Forum,Chat,Community all at Litewarez Webmasters


Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to change the date.timezone value in PHP?
    By Areon in forum Server Management
    Replies: 0
    Last Post: 20th Mar 2014, 01:07 PM
  2. Mysql Timezone
    By Mr.Mirchi in forum Web Development Area
    Replies: 3
    Last Post: 1st Sep 2012, 06:10 PM
  3. Ubuntu 10.04 Installtion hangs on timezone screen :(
    By sceneguy in forum Server Management
    Replies: 2
    Last Post: 14th Apr 2012, 05:31 AM
  4. Big problem with timezone
    By Spetsnaz in forum Server Management
    Replies: 4
    Last Post: 28th Mar 2012, 07:06 AM
  5. What's the timezone of Hotfile system?
    By kohkindachi in forum Webmasters, Money Making
    Replies: 3
    Last Post: 16th Jul 2010, 01:09 PM

Tags for this Thread

BE SOCIAL