-
Posts
323 -
Joined
-
Last visited
-
Days Won
5
Everything posted by jodunno
-
so try to change the default style: border: none; outline: none; then specify a solid 2px gray border. input[type="password"], input[type="text"], textarea { background-color:#ffffff; font-weight:bold; color:#000000; border: none; outline: none; border: solid 2px gray; border-width: thin; border-radius: 20px; border-color:green; } input[type="input"]:focus, input[type="password"]:focus, input[type="text"]:focus, textarea:focus { background-color:#f4cd81; font-weight:bold; color:Blue; border-width: thick; border-radius: 20px; border-color:green; } meantime, input type="input"? please review input types. let us know how it goes...
-
Hello again, i've decided to write an hsv converter using known formulas. i had to laugh because alot of proposed solutions are not correct. hsv is degrees percentage percentage and alot of code on the internet does not factor degrees for hue and the code is actually division by zero, which means the author is a mathematical idiot. i found a couple of examples actually implementing degrees. Anyway, i've tinkered with the code and i have it producing correct results as compared with the hsv values in my photoimpact 256color palette. it still isn't sorted by groups correctly. I'm not interested in solving the sorting problem when a world full of smarter people should be doing it. Anyway, i'll see if i can produce a 6-6-6, 6-8-5 method and move on. colors do not need anymore of my time. a simple hex palette is all that i need. if i wanted to group the colors it would be a manual color group flag before a sort. Have a great day.
-
Hi StevenOliver, so you answer my question with a question. LOL. I know why i have a lenny face but i don't know why yours is missing :-) - just poking fun. hopefully you see it that way. anyway, i'm quite happy with a hexidecimal arranged palette. I have no intentions of organizing it via hsv. I think that adding hsv is simple enough. I've added some quick code to illustrate my point: <?php declare (strict_types = 1); $rgbhex = ['00','33','66','99','cc','ff']; $rgbdec = ['0','51','102','153','204','255']; $hexpalette = array(); $decpalette = array(); $palette = array(); $colors = 0; foreach ($rgbhex as $redhex) { foreach ($rgbhex as $greenhex) { foreach ($rgbhex as $bluehex) { $hexKey = $redhex . $greenhex . $bluehex; $decVal = hexdec($redhex) . ',' . hexdec($greenhex) . ',' . hexdec($bluehex); array_push($hexpalette, $hexKey); array_push($decpalette, $decVal); ++$colors; } } } echo 'there are ' . $colors . ' colors in this palette'; echo '<br><br>'; $palette = array_combine($hexpalette, $decpalette); unset($hexpalette); unset($decpalette); print_r($palette); foreach ($palette as $rgbVal) { list($r,$g,$b) = explode(',',$rgbVal); $r = ($r / 255); $g = ($g / 255); $b = ($b / 255); $cMax = max($r, $g, $b); $cMin = min($r, $g, $b); $delta = $cMax - $cMin; $hsV = $cMax; //et cetera... } exit; ?> one could just continue with the hsv conversion and saving it to a new hex key hsv value array for output to the screen. I think it should work. Anyway, i was just wondering if there is a mathematical way to represent the hex codes in a 6-6-6 fashion. so that maybe i could alter the code to support a 6-8-5 palette, which is also nice. besides the wonder of an alternate method, i was hoping for a method easier than three loops. Meantime, i am not really interested in using php to dynamically create a css file with headers. I just want to allow members to change my default bg color if they dislike it. I recommend that members use my bg photos but i offer a setting to turn them off and use colors instead. I'm just trying to be thoughtful but not behave like a serf. Thus, grouping colors seems to servant like to your every whim. I'm just not interested in anything more than a palette structured by hex codes. Best wishes to all and stay safe and healthy.
-
Hello everyone, i use content security policy set at self for javascript and css. unsafe-inline is forbidden. However, i want to allow the background to be changed in tow ways: foto selection and color selection if photos are turned off. I have accomplished all of this but unsafe inline does not help my purpose. I need the color to be accessible via css file. Thus, input color cannot be used here unless i dynamically crete a css file based upon a selection. I don't want to do this, so i hardcoded the 216 colors into a css file which is only 6kb. perfect! now i need to loop through the color values to dynamically create the 216 color palette. I've never done this before so i had to think about it and try to recognize a pattern. I noticed that red is first follwed by green and blue. so green and blue should be together inside a red loop. I've tested my theory and it works. yipee. Now i want to know if there is a better method for accomplishing this task? i've tried searching google with no luck at all. i don't know what to search for other than 'build a 256 color palette using php loops'. I really find nothing of value. Amazing! here is my code which is working. so can someone offer a more professional method? <?php declare (strict_types = 1); $rgb = ['00','33','66','99','cc','ff']; $colors = 0; foreach ($rgb as $red) { foreach ($rgb as $green) { foreach ($rgb as $blue) { echo $red . $green . $blue . ', '; ++$colors; } } echo '<br><br>'; } echo 'there are ' . $colors . ' colors in this palette'; exit; ?> Thank you very much and i hope that you all have a fantastic day 🙂
-
wow! Thank you for this info! I really did not know that this is a Windows-specific situation. Your post has saved me a huge headache because my host will be a linux machine. Thus my website would not work correctly at launch because of this case mismatch in my code. Thank You, mac_gyver! meantime, i am too tired to code today. I cannot believe that i missed the i modifier when i posted. alot like locking a door then asking why the door doesn't open. LOL! Best wishes to all.
-
haha, /i. i am working with microvision today. man, that is funny! wasted space on the server for this stupid post. My apologies.
-
Dear members, I have recently noticed something about php and my regex filter: a-z still allows A-Z. The same is true of a filename in php. I name a file hello.php and it is included if i call it as Hello.php. if (preg_match("/^[a-z\/\s_-]{3,116}$/i", $variable) === 0) { break(2); } is my regex incorrect? i am trying to check an entire string for matching characters. I usually create an array as a key and say if not in array. However, i cannot create an array for this particular string which could contain over 100,000 possibilities. Thus the use of regex. Perhaps my regex is incorrect or php is case insensitive. summary: the string Abc/Xyz gets through despite only regex of a-z. I would think that it should be A-Za-z. No? Best wishes.
-
change input NaN in non-chromium Edge browsers
jodunno replied to jodunno's topic in Javascript Help
sensitive data has many meanings. my site will be subscription based and member content is sensitive in my opinion. I don't want my private pages cached. one must pay me to view my work. I only use servers with unlimited data rates. My files are small. css is a bit large at 50kb for all site content but my html pages are typically under 10kb. I'm not concerned with cache. big tech companies do the opposite: 12kb css and a whopping 400+kb pages. I can see why they need that cache 🙂 I'd like to cache some things but caching headers are clear: cache or no cache (nostore). Private is not guaranteed so nostore is the best option for me. I've tried to find ways to reduce my code as much as possible. I am happy with 50kb css and 10kb pages. 15kb of the css is background photo data because i use a content security policy which disallows unsafe inline. I have no other way to allow background images other than including the css change in the css file and using php to dynamically write the selection to the body class. body class="myclass userselectedbg"I once tried using php tp dynamically create css files but it didn't work out very well. sometimes the css was missing and the data was broken (caching revalidation problem i guess). -
How to merge inline css into an existing .css file
jodunno replied to larry29936's topic in CSS Help
Hi, I notice that you have the exaxt same code in several places but you use different selectors. .divL { box-sizing: border-box; padding: 5px; border-right: solid 1px #000000; border-left: solid 1px #000000; background: #eaeaea; width: 50% ; } .divR { box-sizing: border-box; padding: 5px; border-right: solid 1px #000000; border-left: solid 1px #000000; background: #eaeaea; width: 50% ; } nothing is different between divL and div R. You could combine the two as .LR and apply them to the class: div clas="MainClass LR h1" Best wishes. -
change input NaN in non-chromium Edge browsers
jodunno replied to jodunno's topic in Javascript Help
Hi requinix, I am torn between version differences and corruption because i started having problems with Edge when i set cache control to no-store. Honestly. All of my css was breaking and it worked just fine up to the nostore change in xampp. I panicked and tried to fix the possible problems and it snowballed out of control. I almost wanted to cry about it because i've worked hard on my website now for three years. it is very upsetting. I decided to download the new edge and see if it works in new edge. I decided to place old edge browsers in the unsupported browsers section of my system requirements. i hate to do that but i am not a fan of browser detection and customized code. I never use browser detection in fact. Anyway, i've spent the past three weeks recoding my site. Everything that used to work in Edge is no longer working. I do remember downloading a critical update and installing it last year. Maybe something has changed since then. it just seems like Edge is broken somehow. Everything worked until the nostore policy. I cannot figure it out. By the way, i have two computers for different purposes: the one i am using to type here now is my internet computer. The other computer is my work computer which i never connect to the internet on the work computer. i activated my Windows system at purchase and never reconnected. I like to keep it clean and protect my files from the world. I have given up on this issue because i cannot find the problem. I have no idea why my code started breaking. little things like wobbly transitions, slow transitions, no word breaking when i explicitly code it, etc. so many things have gone wrong since i changed my cache control. On a positive note: i've cleaned my code and i am now in the reusable css group :-) I've also implemented image sprites which i've never done before, so the site is actually better now. I still wonder what happened. The exact same code inline was working last year. I am stumped. Best wishes. -
change input NaN in non-chromium Edge browsers
jodunno replied to jodunno's topic in Javascript Help
Hi requinix, I'm sorry for the delay. I've been so busy the past few days. I've also recoded this slider since my last post. I've tested this slider and script for days now and it still breaks in Edge 38 on my work pc. Today i tried the code with Edge 44 on my Mother-in-law's computer and it works. Something must be corrupted with Edge on my work pc. I have no idea what is the problem. It seems like Edge 38 on my system is trying to apply all of my custom css instead of just -ms commands. I removed the -ms commands and the webkit code was displayed as well as NaN disappeared. I'll move on from this. I have the new chromium Edge and i can always test old Edge on my Mother-in-law's pc. Thank you. -
change input NaN in non-chromium Edge browsers
jodunno replied to jodunno's topic in Javascript Help
Hello again, I've made progress with this problem. When inline it is working, so i checked my event code. Somehow the following code doesn't make sense to me. Perhaps it is not the correct method of acquiring updates numbers (slides through the range). document.getElementById('MyRangeLabel').innerHTML=MySlider.value; my slider works in Edge when i remove this code from the javascript. I can't figure out a way to update the innerHTML as i slide through the ranges. Anyone able to offer a solution? <label for="MySlider">TestRanges: <span id="MyRangeLabel">0</span></label> <input type="range" min="0" max-"5" value="0" id="MySlider" step="1"> onchange and oninput: how do i take the new range when sliding and change the innerHTML of the MyRangeLabel span? Thank you for any help. -
i have a range slider and i use it to change the innerhtml of a label element to reflect the slide through the range. the code did not work until i added both onchange and oninput to the form element. I believe that ie browser requires onchange to work. I can't remember why i need both methods. All was working when it was inline. I now try to add both change and input as events attached to an external javascript file. The change and input works in chrome, new edge browser, firefox, ie and opera. The new code breaks in older Edge browsers. what is the problem? it works in Edge when the javascript is inline. Edge doesn't show the slider track and displays Nan when i try to use the slider thumb. Anyone know why? By the way, i can never get events to work for me. I have no idea why. I found a site with code that uses DOMContentLoaded and now my events work. So i stick with this code. I am not a JavaScript guru. event code: document.addEventListener('DOMContentLoaded', function () { document.getElementById('MySlider').addEventListener('change', function () { var MyRange = document.getElementById('MySlider').value; MySlideFunction(MyRange); }); }); Again, when the code is inline everything works in Edge. <form onchange="" oninput=""> Thank you for any help.
-
Update: this isn't an Apache problem. I have battled this issue now for three days and i found a culprit: Edge browser (versions 38 up until new chrome based version) break my css button tranform if clear cached data and files is selected. That is ridiculous. Like saying we aren't allowed to clear our cache to help espionage and data centralization. Absolutely garbage. I will be sure to mention this in my specifications/requirements page. All other browsers handle my files correctly. Microsoft is a piece of work. Anyway, Thank you for your time. By the way, no-store is the correct method of having pages not cached. no-cache is not correct. private is not correct. I had to research this subject. Best wishes and please stay healthy everyone. Corona virus is a big problem for us all.
-
so the problem persists after a boatload of testing. I have tried separating headers in apache: HEADER set Cache-Control "no-cache" HEADER set Cache-Control "no-store" HEADER set Cache-Control "private" I've discovered a new cause. I have my site set as homepage in Edge. The problem is started whenever i just close the browser (not log out), then open the browser and log back in. It appears as though the homepage is a cached version of the site? which should still check the server and detect a no-cache header. The problem is especially noticeable whenever i have Chrome open at the same time. I cannot recreate this wobbly css cache problem with new versions of Firefox but old versions also make my css unstable. Anyone know of a solution to this problem? otherwise, i have to tell people that they cannot make my site their home page and that they have to manually clear the cache. that is sh1tty.
-
Hello everyone, I don't know where to post this question because it is related to Apache and web browsers as well as php and programming design. I chose Apache because this is where the problem begins for me. problem: i have css code that uses transitions, transorm scale and transparency etc. so graphics heavy. Everything is okay in major browsers (IE/Edge, Firefox, Chrome and Opera). Now i want to control the cache. I set a Header in Apache to maxage=3600, private. I don't want a public cache when i have private protected pages (member subscriptions). Every browser except Edge is okay with my changes. Edge is creating multiple problems! My css transform icons are now unstable or wobbly during the transform/transition state. It is horrible. However, a bigger problem exists: my single page routing system breaks the home page in Edge. I route all requests through an page router, which then loads the appropriate content for index.php Now Edge does not show my home page. Instead i see only the last page loaded from the page router. understand? so home page, then click on link, linked page loads. click home link and it simply reloads the current page as index file. Why is this happening? All of my links are post requests, home page links are anchors. So i need to make home links also post requests? I wonder if my routing is the problem and other browsers are ignoring it? or is this an Edge issue, since only Edge is giving me a problem. Honestly, i am not a server configuration guru and i have no experience with proper headers. Anyone able to understand my problem and offer a solution? Best wishes.
-
Hi again, I have 20+ years experience in programming. Do whatever you want but consider the following: When i first tried xampp with phymyadmin i couldn't login to my site either. I had to switch to the console. I rebuilt my database through the console and i logged in just fine. I think that phpmyadmin is difficult to use somehow. I filled in all of the data but it wasn' working. I find that the console makes it easier to build a database. Try to verify that your database is working using the console. If you need help with that, then let us know. Honestly, i have no problems since i switched to the console. Good luck.
-
Hi gizmola, Thank you for taking time to reply. I appreciate your expertise with this subject. I'm a bit like a programming sheriff: trust noone and nothing / suspect everything. I don't even trust my own code. i use a counter in my foreach loops to be certain that they cannot become infinite loops via tampering: $count = 0; $maxentries = 100; ++$count; if ($count === $maxentries) { //i said 100 so why is this still going? exit now } i have designed my site to detect as many errors as possible. if file exists, if function exists, if isset everything. I don't want to help a hacker wreck my site. No stepping stones from me. I look at everything and question everything. In this case, i was startled by the history of background image names in the idb file like a fingerprint. Your explanation is most helpful to me. I am comfortable with this info. I've retained update as it is the best option. I can only do so much anyway. Atleast now i know more than i did yesterday. Best wishes to you and all members. I hope that you have a pleasant day. Stay safe and healthy and make the most of life, my friends.
-
Hi requinix, No need to sigh, i'm sticking with update. Your opinion is good enough for me. Thank you for the lovely posts. You have been very helpful. Best wishes to you and all members.
-
Hi slotegraafd, I'm just a normal user here so you should wait for pros to help you. However, i would still like to offer my opinion about your posted code: pdo is a safer solution to interacting with a database. I recommend that you switch to pdo: https://phpdelusions.net/pdo I've never understood error arrays and pushing data into them. a simple binary switch can be used to deal with error scenarios and a variable or array for error messages only: $error = 0; if (empty(bla_bla)) { $errors = 1; $message = 'bla_bla contains no usable data'; } if($errors) { //code to handle errors } //else continue or no else if header relocation exit is used if $errors if one of the required fields is empty or erroneous then just cut out completely and stop evaluating the rest of the data. you should use password_verify to check the password. MAJOR security error here. Also, hashing passwords as a student testing login scripts is not necessary but it is absolutely necessary on live site. encryption is not a protection mechnism. Use hashes. skip for now but never forget to hash the passwords (which also requires a rehash if php changed something as the default encryption method.) you use a header relocate without an exit: header('location: home.php'); change this to: header('location: home.php'); exit; to stop evaluation of the rest of the script. i wouldn't escape input. I recommend that you validate input then compare login values. In any event, just use htmlentities with ENT_QUOTES or html special chars before outputting post data or using it in anyway. you have the following code: f (mysqli_num_rows($results) == 1) you need to verify that the usernames match and that the passwords match: if ($username === $resultfromdb && password_verify()) { } else {} password verify works like so: if (hash_equals($usernameFromDB, $username) && password_verify($password, $passwordFromDB)) { } else { } Start with pdo then try again. I'm sure that pro members will help you further. Good luck and i hope that you switch to pdo for security purposes. Learn proper coding early to save many headaches and problems.
-
Hi Requinix, it is a lovely informative post by you (as usual because i always enjoy your messages. I learn alot from you. I remember always that you helped me learn regex on my own and i always appreciate you.) Still, i am having difficulty excusing the history. I don't like that user background photo preferences are stored like a history or cache. bg preferences should be private. I have tried to find a method that removes the entry (from idb file as well), thereby replacing it with a new value. I thought that update does it but apparently not. interesting. I'd hate to have a history of user names and passwords even hashed passwords (which i use hashed passwords). i am not familiar with the term atomicity but i all ready think about this concept. worry is a better word. I know that i have to deal with delete at some point and i am not experienced enough to know correct methods. I figure that i would have to loop while error is not present or maximum tries/loops have been met. then store the original data before delete (via session variable at login). if delete successful then insert new value. if no error then operation complete. select new data and compare to new data post to verify no corruption. finished or rinse and repeat until max tries then restore old data and exit with error. I really don't know if this is correct procedure or not and it sounds alot like the built in transaction. anyway, i tried replace and it works but it seems to me that it is like deleting then reinserting. I suppose that i could encrypt all of my data and stick with update. But i would like to know what you think of replace? here is my quick and dirty test code at the console: create database testBed character set utf8mb4 collate utf8mb4_unicode_ci; use testBed; create table usersettings(id mediumint unsigned not null auto_increment, bgphoto varchar(32) default 'bgfactory', bgcategory varchar(3) default '0', primary key(id)); INSERT into usersettings SET bgcategory = 0; INSERT into usersettings SET bgphoto = 'testinsert', bgcategory = 1; describe usersettings; SELECT bgphoto FROM usersettings WHERE id = 1; SELECT * FROM usersettings; REPLACE INTO usersettings SET id=1, bgphoto = 'namechanged'; SELECT * FROM usersettings; what do you think about replace? do you suggest that i just encrypt and stick with update? Thank you very much for your expertise. Please stay healthy, requinix.
-
Hello, I am not a very good programmer and i really don't know professional methods to accomplish many taska. I've managed to build a login system for my website and it works. I've finally started revisiting my sql code to add new features and i noticed some files in mysql folder. One particular file is named after my user_settings table with .ibd extension. I looked at the file with Notepad++ and i see a sort of history of background images. I have a feature on my site which allows users to choose a background photo for the site. It seems that all of my selections are stored in this file like a history. I use the update sql command to write your new selection to the database. I now think that delete and insert is a better method to avoid this history. How is this process of changing field data normally done by pros? delete, then insert? update with a history is not good when changing passwords and usernames. I guess that i chose update because it worked. I thought that it deleted the current field data then added the new data. oops! Thank you and stay healthy.
-
Hi Barand, Amazing code and you only read a description of my bookmark profile. You are a 'helluva' coder. Your expertise and mastery shows in your replies. I don't really need to change anything that you have posted other than names but i didn't post to get free code. I am trying to learn from your example. I'm reading about sql now so that i can think better about these problems and approprite solutions. I'd like to come to the same conclusions as you oneday. I really learn alot from you and i thank you for that. Meantime, i've changed the last login code and it works well. I was actuly just inserting your login into lastlogin then inserting the current login into current login. I guess it is easier to say that login becomes your last login before i update the login. I guess i was thinking wrong here. Your idea is better. I don't have time to add the book mark code today. I have alot of things to do and i am behind schedule. I'll read more about sql before i go to bed, then tomorrow i will tackle this topic. I finished adding the bookmark profile to each page, so all i have to do now is submit it to the dbase. This code example is a great start! I also have to read the data from the db before i can display the bookmarks. I do not have so much coding experience as you do, so i am a bit slow. I'll update the post when i can finish this feature. I'll let you see the final code here so you can offer an opinion if you want to do so. Thank you, Barand, i have learned alot about sql today. You are steeringme in the right direction!
-
Hi Barand, wow! that is a pretty elegant way of including last login data. You're clearly an sql expert. I didn't know about COALESCE and i didn't think about a separate table for logins. Very nice example. Thank you! I will make a copy of your post and use it as a guideline for revamping my code. I will also need to redesign my database. I'll let you know how it goes. I am learning alot from you but most importantly how to be a better database designer/programmer. Thank you very much! I really appreciate your wisdom. Best wishes :-)
-
well i've tried the if (empty($lastLogin)) method and it works. I just display a simple message: 'details unavailable'. I don't want to detect a first login and maybe the null value isn't a first login anyway (perhaps corruption, tampering, etc). So, i will just use if empty(), unless there is a better method. Thank you.