Jump to content

Notretsam

Members
  • Posts

    144
  • Joined

  • Last visited

About Notretsam

  • Birthday 01/08/1978

Previous Fields

  • Languages
    PHP, HTML, MySql

Contact Methods

  • Website URL
    http://www.shaunmasterton.co.uk

Profile Information

  • Location
    Scotland
  • Interests
    creating, supernatural type TV shows, poker

Recent Profile Visitors

3,336 profile views

Notretsam's Achievements

Member

Member (2/7)

1

Reputation

  1. well that was easy to do, thank you $stmtgetwrest = $connnewish->prepare("SELECT wreid, wretotmats, wrewins, wreloses, wrepoints, wrepercent FROM leagueDivisions WHERE leagueid=? AND leagueseason=? AND divisid=? ORDER BY wrepoints DESC , wreseed");
  2. doesn't seem like it is by primary, I changed primary from unique id to seed, which seed is basically a number from 1 to 16. I changed some numbers around manually in phpmyadmin for seed, and it didn't change the order the items came out, same as always. I didn't know you could order by more than one column, that would be handy, have to look into that. thanks
  3. I'll have to double check that. the primary key is a unique ID for each entry, so numeric value , could be that.
  4. This isn't a bug or a how too inquiry, I know how to order items with mysql queries. What I am wondering though is, how does mysql determine what result goes first between 2 matching results? A quick example, I do a SQL Query ordering by "total wins", so a numeric value. 2 people have 7 wins each, how does the SQL Query determine the order for the 2 people? In my testing of leagues that am coding, I actually have two divisions of 8 people with 7 wins/ 7 losses each, always showing on leaderboard at same position. I am thinking its ordered by who was added first to database table? but am not sure if mysql has the capability to remember that? As I said, its not a bug or a big deal really, am just curious on this. I also figured I might get asked in future by someone playing my game.
  5. tested this morning and using " worked it is amazing that something so simple to do , is all that was needed to fix it lol thank you for help Ingolme
  6. ok thanks, its 8.46PM for me now, so shall be tomorrow before I can try. I do echo the text out due to there being a variety of different match lists and options person viewing can select on page. echo "<div class='contframeturn' onclick='matchshow(&quot;$matchID&quot;)'>"; Presume the &quot; won't work in the above echo line?
  7. <div class='contframeturn' onclick='matchshow(151636871863316991)'> function is called in div opening tag, basically there is a mysql query that loops through database and outputs each match on a page, during that the above id for match is attached to the onclick event oh while I type this , am wondering if is it because I wrapped it with ' and not " ?
  8. well javascript is just magically rounding the number up as you can clearly see by my original post, where I have shown the actual/showing numbers. I have already investigated why it occurring, I looked at view source and the form with the onclick event, I can clearly see the correct number in there. The number is correct before the function shown in my original post, then during the javascript function, or the window.location event changing you to match.php page, the number is rounded up. I have read about javascripts limitations with numbers, and a friend mentioned using string. I tried below and the onclick event wouldn't occur at all. <script type="text/javascript"> function matchshow(string($sids)) { var x=$sids; var cstyle = document.getElementById('fcstyle').value; window.location.href = "match.php?sid=" + x + "&cstyle=" + cstyle; } </script> I also tried var x = string($sids); I don't know javascript very well , so maybe am using it incorrectly? Also when I manually type the url into browser with the actual number id, the page works fine, so there no issues on match.php I really have exhausted every possible fix that I can think off, and already worked backwards, which is why I identified the actual number for match id being incorrect, and it appearing too being rounded up.
  9. Am more familiar with PHP than Javascript, so not sure how to fix this strange bug. basically have a wrestling game where people can do matches against other people, naturally I have a match list that person can view there current active matches and click to go to match. I use a onclick event, which contains the $matchid, then the following javascript <script type="text/javascript"> function matchshow($sids) { var x=$sids; var cstyle = document.getElementById('fcstyle').value; window.location.href = "match.php?sid=" + x + "&cstyle=" + cstyle; } </script> Don't need to worry about the cstyle, that is the current tab the person is viewing in match. The var x=$sids is what contains the match id number. Now I just recently moved hosting companies, and the match list was working fine on old host and new host, but all of a sudden today it stopped working. I managed to figure out why, but just don't know how to fix it. actual=151636871863316991 showing=151636871863317000 actual=1516368718560392395 showing=1516368718560392400 The actual is the actual match id, the showing is what javascript is sending across in the window.location.href, its the last 4 digits that are wrong and appears it rounding the figure up. I have no idea why it all of a sudden doing this, is there a way to prevent it from rounding the number up? I did just have to increase the length of the match id today, due to another bug I run into, so presume that is related to why this suddenly happening.
  10. site is to big? as of right now, I can not see that being why, site is large but not a lot of images, css file is 27KB. Maybe I am missing something that is causing it on website but doubt it. I have cut back caching to just the image files and being waiting to see how it goes. Looks like it going be trial and error, just have to keep adding/removing a line and seeing how cache size is effected, was hoping not to take this long route.
  11. well after some thinking decided to remove the following lines and see how that goes ExpiresByType text/css "access plus 1 month" ExpiresByType application/pdf "access plus 1 month" ExpiresByType text/x-javascript "access plus 1 month" ExpiresByType application/x-shockwave-flash "access plus 1 month" ExpiresByType image/x-icon "access plus 1 year" was hoping people on here would tell me what they would do.
  12. I presume the cache items related to specific type, image/jpg would cache jpg images and so on with the others. Since I only wanted to cache image files, presume the non image file extensions can be removed. ok so it resizes content and makes it smaller, handy to have. don't have answer to these questions , which is why am on this forum asking. just seems like a big jump in my chrome cache since i added this to my htaccess fille.
  13. I know I do the cache via my .htaccess file but it seems like from my browser, that am caching to much. always have about 500MB+ , which seems a lot , only started to happen after I set cache for my website. I only want the images cached and below is what I have. ## EXPIRES CACHING ## <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access plus 1 week" ExpiresByType image/jpeg "access plus 1 week" ExpiresByType image/gif "access plus 1 week" ExpiresByType image/png "access plus 1 week" ExpiresByType text/css "access plus 1 month" ExpiresByType application/pdf "access plus 1 month" ExpiresByType text/x-javascript "access plus 1 month" ExpiresByType application/x-shockwave-flash "access plus 1 month" ExpiresByType image/x-icon "access plus 1 year" ExpiresDefault "access plus 2 days" </IfModule> ## EXPIRES CACHING ## I presume the type lines for css, pdf, javascript , shockwave-flash and x-icon can be deleted? am wondering about the ExpiresDefault line is needed? I also have the below coding, which I can't remember what it is for lol I found it on the web, sure it was related to the internet cache. <IfModule mod_deflate.c> # Compress HTML, CSS, JavaScript, Text, XML and fonts AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/vnd.ms-fontobject AddOutputFilterByType DEFLATE application/x-font AddOutputFilterByType DEFLATE application/x-font-opentype AddOutputFilterByType DEFLATE application/x-font-otf AddOutputFilterByType DEFLATE application/x-font-truetype AddOutputFilterByType DEFLATE application/x-font-ttf AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE font/opentype AddOutputFilterByType DEFLATE font/otf AddOutputFilterByType DEFLATE font/ttf AddOutputFilterByType DEFLATE image/svg+xml AddOutputFilterByType DEFLATE image/x-icon AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/xml # Remove browser bugs (only needed for really old browsers) BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html <FilesMatch "\.(js|css|xml|gz)$"> Header append Vary: Accept-Encoding </FilesMatch> </IfModule>
  14. Got a completely working selecting color solution done on this test page https://wrestlestarz.c7.ixsecure.com/avatars/test5.php Am very happy with this, still a tonne of work to do on a avatar system, but this is a very nice start. thank you very much @dsonesuk , also appreciate your time @justsomeguy and @Ingolme here is full coding that I have for anyone who is curious, which works from a mysql database. <?php $image1 = "maletshirtred.png"; $image2 = "maletshirtredTrans.png"; $membid = "betatesting"; $conn = new mysqli($host, $user, $password, $database); /* create a prepared statement */ $stmtgetwrest = $conn->prepare("SELECT tshirtcolor FROM avatarColors WHERE membid=?"); /* bind parameters for markers */ $stmtgetwrest->bind_param("s", $membid); /* execute query */ $stmtgetwrest->execute(); $stmtgetwrest->bind_result($tshirtcolor); /* fetch value */ $stmtgetwrest->fetch(); /* close statement */ $stmtgetwrest->close(); $hex= "$tshirtcolor"; list($r, $g, $b) = sscanf($hex, "#%02x%02x%02x"); echo "$hex -> $r $g $b"; $tshirtcolred = "$r"; $tshirtcolgreen = "$g"; $tshirtcolblue = "$b"; ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>WrestleStarz - Account Panel for Member</title> <meta name="description" content="Members account panel that offers a variety of features for there account."> <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"> <script type="text/javascript"> //Global variables var picWidth = 200; // width of the canvas var picHeight = 222; // height of the canvas var picLength = picWidth * picHeight; // number of chunks var myImage = new Image(); // Create a new blank image. var myImage2 = new Image(); // Create a new blank image. // Load the image and display it. function displayImage() { // Get the canvas element. canvas = document.getElementById("myCanvas"); // Make sure you got it. if (canvas.getContext) { // Specify 2d canvas type. ctx = canvas.getContext("2d"); // When the image is loaded, draw it. myImage.onload = function() { // Load the image into the context. ctx.drawImage(myImage, 0, 0); // Get and modify the image data. getColorData(); // Put the modified image back on the canvas. putColorData(); }; // Define the source of the image. // This file must be on your machine in the same folder as this web page. var mainimage = document.getElementById('mainimage').value; var maskimage = document.getElementById('maskimage').value; myImage.src = mainimage; myImage2.src = maskimage; } } function getColorData() { myImage = ctx.getImageData(0, 0, picWidth, picHeight); // Loop through data. Maskcolor = [255, 255, 255]; //white var tshirtcolred = document.getElementById('tshirtcolred').value; var tshirtcolgreen = document.getElementById('tshirtcolgreen').value; var tshirtcolblue = document.getElementById('tshirtcolblue').value; // newcolor = [0, 255, 0]; //lime // newcolor = [255, 0, 0]; // red newcolor = [tshirtcolred , tshirtcolgreen, tshirtcolblue]; // newcolor = [0, 0, 255];// navy // newcolor = [255, 255, 255]; for (var i = 0; i < myImage.data.length; i += 4) { myImage.data[i] = newcolor[0]; myImage.data[i + 1] = newcolor[1]; myImage.data[i + 2] = newcolor[2]; } } function putColorData() { ctx.putImageData(myImage, 0, 0); myImage2.onload = function() { ctx.drawImage(myImage2, 0, 0); }; } </script> </head> <style> #mask_shadow_wrap {position: relative;} #mask_shadow_wrap img:last-child {position: absolute; top:0; left:0;} </style> <body onLoad="displayImage()"> <form id="myformlarge" action="yourpathhere" enctype="multipart/form-data" method="post"> <input type="hidden" id="mainimage" name="mainimage" value="<?php echo "$image1"; ?>"> <input type="hidden" id="maskimage" name="maskimage" value="<?php echo "$image2"; ?>"> <input type="hidden" id="tshirtcolred" name="tshirtcolred" value="<?php echo "$tshirtcolred"; ?>"> <input type="hidden" id="tshirtcolblue" name="tshirtcolblue" value="<?php echo "$tshirtcolblue"; ?>"> <input type="hidden" id="tshirtcolgreen" name="tshirtcolgreen" value="<?php echo "$tshirtcolgreen"; ?>"> <input id="background-color" type="color" value="<?php echo "$hex"; ?>" onChange="javascript:document.getElementById('chosen-bgcolor').value = document.getElementById('background-color').value;"/> <input id="chosen-bgcolor" name="bodycolor" type="text" size="5" value="<?php echo "$hex"; ?>"/> <input type="Submit" class="button" value="Select Color"> <hr> </form> <div id="mask_shadow_wrap"> <img src="<?php echo "$image2"; ?>" alt=""> </div> <canvas id="myCanvas" width="200" height="222"> </canvas> </body> </html>
  15. https://wrestlestarz.c7.ixsecure.com/avatars/test5.php This is testing page am working on, just need to figure out how to get the rgb value of the selected color now. Like this does but sadly couldn't get working today https://www.w3schools.com/colors/colors_converter.asp
×
×
  • Create New...