Jump to content

Agony

Members
  • Posts

    34
  • Joined

  • Last visited

Agony's Achievements

Newbie

Newbie (1/7)

2

Reputation

  1. EDIT: added a missing else{ return false; } after the time check.
  2. private $file; private $time; public function __construct($filename,$cachefolder,$cachetime){ $this->file = $cachefolder.$filename; $this->time = $cachetime; } thats all - values are passed to the class through the constructor. $gallery_cache = new cache($gallerycachename,$cachefolder,$cachetime); $cashetime is from the database a and its stored in seconds. in Varchar field.The value is accessed: $cachetime = intval ($config['data']['assoc']['cachetime']);
  3. failure is here: public function check_cache(){ if(file_exists($this->file)){ if((time() - $this->time) < filemtime($this->file)){ return include($this->file); } } else{ return false; } } It works fine most of the time - but around once a day, the whole statement fails and ends up as null. Which means it wont include the cached file and wont start the code to cache new one. it seems to fail at timecheck - even tho manually echoing each side i compare - it should be ether true or false but it seems to do fail - so its nether true or false and there for even the else part wont run.Will it automatically round the timestamps somehow at one point so they are equal?
  4. what part of it didnt work? using the array or declaring it? works fine when i run it.You need to specify for what are you using the array for - textarea, drop list, etc.
  5. well the charset seem to be set - for every row, table etc. but it still seems to have issues with the 4 byte utf8mb4 characters.
  6. So... again - on a wamp setup for test/local inserting the text works. The same text however on production server fails and returns the error. The collation for the column and table is set as utf8mb4_unicode_ci So is the server connection under general settings. Everything looks identical to the wamp server setup yet it doesn't seem to recognize the 4byte utf8. mysql is Server version: 5.6.19 windows 2008 R2 to make sure i even run (edited): ALTER DATABASE database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;# For each table:ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;# For each column:ALTER TABLE table_name CHANGE column_name column_name VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; and: character_set_client utf8mb4 character_set_connection utf8mb4 character_set_database utf8mb4 character_set_filesystem binary character_set_results utf8mb4 character_set_server utf8 character_set_system utf8 collation_connection utf8mb4_unicode_ci collation_database utf8mb4_unicode_ci collation_server utf8_general_ci the charachter_set_server for some reason is still utf8 - even to in the my.ini its set to utf8mb4 [client]no-beepdefault-character-set = utf8mb4port=3306[mysql]default-character-set = utf8mb4[mysqld]port=3306datadir="C:/ProgramData/MySQL/MySQL Server 5.6/data"character-set-server = utf8mb4collation-server = utf8mb4_unicode_cidefault-storage-engine=INNODBsql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"log-output=FILEgeneral-log=0general_log_file="FALCON578.log"slow-query-log=1slow_query_log_file="FALCON578-slow.log"long_query_time=10log-error="FALCON578.err"max_connections=151query_cache_size=0table_open_cache=2000tmp_table_size=181Mthread_cache_size=10myisam_max_sort_file_size=100Gmyisam_sort_buffer_size=352Mkey_buffer_size=8Mread_buffer_size=64Kread_rnd_buffer_size=256Ksort_buffer_size=256Kinnodb_additional_mem_pool_size=25Minnodb_flush_log_at_trx_commit=1innodb_log_buffer_size=13Minnodb_buffer_pool_size=2Ginnodb_log_file_size=48Minnodb_thread_concurrency=17innodb_autoextend_increment=64innodb_buffer_pool_instances=8innodb_concurrency_tickets=5000innodb_old_blocks_time=1000innodb_open_files=300innodb_stats_on_metadata=0innodb_file_per_table=1innodb_checksum_algorithm=0back_log=80flush_time=0join_buffer_size=256Kmax_allowed_packet=4Mmax_connect_errors=100open_files_limit=4161query_cache_type=0sort_buffer_size=256Ktable_definition_cache=1400binlog_row_event_max_size=8Ksync_master_info=10000sync_relay_log=10000sync_relay_log_info=10000 its in programdata and the mysql folder itself. i restarted mysql after edits.
  7. Agony

    php if else

    North & Islands might be breaking it. a single & would be considered as an operatoras in "if var is equal to north and islands is true". var_dump($db_oregion=="North & Islands"); It should ether return true or false. So use single quotes(the specials will not be processed) or escape it like: &
  8. Agony

    PHP Insert Into

    Thats where prepared statement comes handy. This way any " or ' or special keywords wotn break ur query. They are inserted purely as a value. A piece of code from my project for example: public function set_post($author,$title,$content,$id){ $db = $this->connect(); $sql = "UPDATE posts SET author = ?, title = ?, content = ? WHERE id = ?"; $rows = null; if ($db === false) { $rows['error'] = "DB connection error"; } else{$result = $db->prepare($sql); if ($result === false) { $rows['error'] = "Query syntax error"; } else { $result->bind_param('ssi',$author,$title,$content,$id); $result->execute(); return true; $result->close(); } } return $rows; } Also, you can use var_dump(); If you dont want to use prepared statements. At least separate the query itself to a new variable. like $sql = "INSERT INTO messages (to, from, subject, message)VALUES ('$to', '$from', '$subject', '$message')";//Then u can use the $result = mysqli_connect($con,$sql);//Alsovar_dump($sql); //to test if the whole query looks allright
  9. I assume u have a listbox with select options made with that array ( with a loop)? static public $time_day = array(1=>"Morning", 2=>"Afternoon", 0=>"custom"); Would give you an array like where 1 is the key and the word is the value. But if you need to show a day based of the int but you need the int value as well.Use multidimensional array. static public $time_day = array( 0=> array ("daytime" => "custom", "time" => 6), 1=> array ("daytime" => "Morning", "time" => 12), 2=> array ("daytime" => "Afternoon", "time" => 2) ); Then you can populate the list with name as the $time_day[0]["daytime"],$time_day[1]["daytime"],$time_day[2]["daytime"] and value as ​ $time_day[0]["time"],$time_day[1]["time"],$time_day[2]["time"] And then use the value with javascript as a value for the 2nd textbox or what ever it is.
  10. EDIT: added custom http response header for the whole js folder and moved to non minimized version. Guess i have to minimize them myself and hopefully it would work then.
  11. Test server ( where it works) Accept-Ranges:bytesCache-Control:max-age=604800Connection:Keep-AliveContent-Encoding:gzipContent-Type:application/javascriptDate:Thu, 05 Jun 2014 02:42:11 GMTETag:"41474-4fa5780af25bf-gzip"Expires:Thu, 12 Jun 2014 02:42:11 GMTKeep-Alive:timeout=5, max=99Last-Modified:Tue, 27 May 2014 01:20:34 GMTServer:Apache/2.4.9 (Win32) PHP/5.5.12Transfer-Encoding:chunkedVary:Accept-Encoding iis: Accept-Ranges:bytesDate:Thu, 05 Jun 2014 02:40:34 GMTETag:"7bf915dc4979cf1:0"Last-Modified:Tue, 27 May 2014 01:20:34 GMTServer:Microsoft-IIS/7.5X-Powered-By:ASP.NET iid response doesn't seem to include content-type.
  12. Running the same site with the same files on a local test ( wamp 2.5 based) - it all runs fine. no jscript errors and everything works. Even jquery doesn't work. I have set the permissions and browser does seem to download the .js files. I could even access them and run a compare ( to the one browser sees from my test and vs iis7 on win2008r2) - identical. what i get in console is: Uncaught SyntaxError: Unexpected token ILLEGAL for line 1. its referring to ink-all.min.js from ink.sapo.pt framework. event tried adding the "; charset=Windows-1252" to the .js mime type - assuming it might be in ansi.. but nothing. ​is there something special u have to set/change on iis?
  13. nop, no error messages. that's why i don't understand why its not working.It should just reset the form to original values ( hide the image, show the button) - but button stays hidden and image wont vanish.using console.log or alert in the code sections that lead to it - works fine. But the function itself doesn't seem to get called.
  14. <IfModule mod_expires.c>ExpiresActive OnExpiresByType image/jpg "access 1 week"ExpiresByType image/jpeg "access 1 week"ExpiresByType image/gif "access 1 week"ExpiresByType image/png "access 1 week"ExpiresByType text/css "access 1 week"ExpiresByType text/html "access 1 week"ExpiresByType application/pdf "access 1 week"ExpiresByType text/x-javascript "access 1 week" ExpiresByType text/javascript "access 1 week" ExpiresByType application/javascript "access 1 week" ExpiresByType application/x-javascript "access 1 week"ExpiresByType text/plain "access 1 week"ExpiresByType application/json "access 1 week"ExpiresByType application/x-shockwave-flash "access 1 week"ExpiresByType image/x-icon "access 1 week"ExpiresByType application/x-font-woff "access 1 week"ExpiresDefault "access 1 week"</IfModule> in apache that works nicely - clean and simple.But all iv found this far in iis is an option that caches EVERYTHING - or some web.config option u can edit for every file manually. This is no good for dynamic site.Can you specify mime /filetypes like that with expire time?
  15. jquery.form.js library. The alert i added there shows up, so it does succeed and work there. if (options.resetForm) { alert('eeffeS'); callbacks.push(function() { $form.resetForm(); }); } this alerts as well: options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg var context = options.context || this ; // jQuery 1.4+ supports scope context for (var i=0, max=callbacks.length; i < max; i++) { callbacks[i].apply(context, [data, status, xhr || $form, $form]); } alert('eeffeS'); }; /** * Resets the form data. Causes all form elements to be reset to their original value. */$.fn.resetForm = function() { return this.each(function() { // guard against an input with the name of 'reset' // note that IE reports the reset function as an 'object' if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) { this.reset(); } });}; it all works - but the resetForm: true that is sent as a parameter and runs the function above on success fails to reset the form. once code runs it does this: $('#submit-btn').hide();$('#loading-img').show(); but the function above doesn't seem to reset it to default values.
×
×
  • Create New...