Jump to content

Lumi

Member
  • Posts

    486
  • Joined

  • Last visited

Reputation Activity

  1. Agree
    Lumi got a reaction from Bren00x in website Proxy for only one website   
    It'd be pretty easy with php.
  2. Informative
    Lumi got a reaction from Joveice in L55 Carbon, display time until next time etc (11:00)   
    I have no idea about Carbon in laravel but from a pure PHP perspective I would.
     
    $date = new DateTime('2000-01-01 9:00:00'); //your next time/date - make sure it's in the future //$date is equal to Jan 1st 2000 9am $ts1 = $date->getTimestamp();   $res = $ts1 - time(); //this will give you seconds until the time  
    I'm sure you can figure out the rest.
  3. Agree
    Lumi got a reaction from Gung Pow Chicken in One plus one on it's last legs   
    If your one plus one lasted that long stretch the extra 100 and get a one plus 5.
  4. Like
    Lumi got a reaction from redbullvodka in Is this RAM usage normal?   
    Uh, yeah? I don't know why that surprises anyone..
  5. Agree
    Lumi got a reaction from Unimportant in What do you think of my code? (C++)   
    We both know there's a lot of foolish people out there.
  6. Like
    Lumi reacted to Mira Yurizaki in Web Development! Mac VS Windows   
    If it's front-end stuff, whatever you want. Though make sure you test it on Firefox, Chrome, and yes, Internet Explorer (or Edge).
     
    If it's full-stack, I'd argue development of server end stuff is better on a POSIX-like system. You could run it a VM if you'd like.
  7. Agree
    Lumi got a reaction from kirashi in Hosting my HTML Project   
    y o u d o n t n e e d a s e r v e r t o m a k e h t m l p a g e s a n d p r o p e r l y l i n k s h i t
  8. Agree
    Lumi got a reaction from kirashi in Hosting my HTML Project   
    Then you clearly have no idea what you're doing.
  9. Agree
    Lumi got a reaction from kirashi in Hosting my HTML Project   
    yes it will lmfao
    if you put img src="./imgs/mypicture.jpg"
    then the browser will automatically try to fetch mysite.com/imgs/mypicture.jpg
     
    and if ur not gonna upload ur entire site convert your images to data urls
  10. Agree
    Lumi got a reaction from kirashi in Hosting my HTML Project   
    Literally what you're saying makes no sense at all. 
  11. Agree
    Lumi got a reaction from kirashi in Hosting my HTML Project   
    >filepaths
    they dont have to be in the root on ur local either because ../../  
    ......
  12. Like
    Lumi got a reaction from Sebivor in security question   
    Make a vlan and make ssh accessible only from it. Also use key auth instead of password.
  13. Agree
    Lumi got a reaction from minibois in Big Vulnerability Found in Surface Pro 3   
    I get excited when I hear the term vulnerability then I read this garbage.
  14. Funny
    Lumi got a reaction from suchamoneypit in Big Vulnerability Found in Surface Pro 3   
    I get excited when I hear the term vulnerability then I read this garbage.
  15. Agree
    Lumi got a reaction from GoodBytes in Big Vulnerability Found in Surface Pro 3   
    I get excited when I hear the term vulnerability then I read this garbage.
  16. Agree
    Lumi got a reaction from Tsuki in Big Vulnerability Found in Surface Pro 3   
    I get excited when I hear the term vulnerability then I read this garbage.
  17. Agree
    Lumi got a reaction from roast in Hosting my HTML Project   
    yes it will lmfao
    if you put img src="./imgs/mypicture.jpg"
    then the browser will automatically try to fetch mysite.com/imgs/mypicture.jpg
     
    and if ur not gonna upload ur entire site convert your images to data urls
  18. Informative
    Lumi got a reaction from mrchow19910319 in JS closure and how it behaves   
    Nothing gets removed per say, it's mainly dealing with scope.
  19. Like
    Lumi got a reaction from scighera2 in Can you lock a GPUs Franerate?   
    1070 can handle ultra at 120+fps in new triple A games?
    (at 1440p)
  20. Like
    Lumi got a reaction from IAmAndre in Search inside threads   
    You'd have to go one page at a time searching, his point is on threads with a mass amount of replied.
  21. Agree
    Lumi got a reaction from Luke Moll in Ultimate Programming Resources Thread   
    w3 schools has a lot of examples and php documentation for beginners.
  22. Agree
    Lumi got a reaction from mikat in Bootstrap CSS problem   
    purge your cache / development mode on cf
    also, you can't load stylesheets / jscripts via http if you're connected using https
  23. Like
    Lumi got a reaction from jameshumphries47 in website Proxy for only one website   
    It'd be pretty easy with php.
  24. Like
    Lumi got a reaction from DevBlox in When can you say "I know PHP"   
    when you don't have to ask questions like this and have confidence in yourself.
  25. Agree
    Lumi reacted to Hazy125 in Pass value from jquery to php on same page instantly   
    It wasn't that long ago when I was able to wake up, check out the forums I followed and not have to reply becuase the answers were always perfect.
     
    You want to run a function when a user clicks on one of the shipping options. You have 2 options for triggers. onChange() and onInput(). They both do almost the same thing, but for the function to run with onChange(), the user has to click off of the <select>, meaning that it won't happen instantly as you wanted.
     
    First, you need to alter your HTML code slightly. You need to wrap this line in a span tag like so
    With shipping, your price comes out to <!-- Dynamic Price: $priceWithTax + shipping --> <span id="dynamicTotal">With shipping, your price comes out to <!-- Dynamic Price: $priceWithTax + shipping --></span> Doing this will allow us to target this element with Jquery on completion of the call.
     
    As for getting server side interaction, I would honestly prefer to use straight javascript for everything but the actual AJAX call, however, you seem to want more weight on Jquery. To do this we're going to add an 'event listener' which will detect whether or not the onInput() tigger has occured.
    $( "#shipping" ).on( "input", function() { //make the AJAX call }); If you're not super familiar with Jquery I will explain a little, otherwise skip to the next code block. The first item in the brackets is the <select> for shipping, then we attach an 'on' event to it. Similar to plain javascript, where you have onChange, onSubmit, onLoad etc. the 'on' event does the same thing, you just specify which event later. Which is the next part in brackets, you can specify which event as the first variable. The function is what runs after the 'input' has been triggered.
     
    Next, we need to actually make the AJAX call, thankfully Jquery makes it extremely easy
    $.ajax({ url: 'resolvePrice.php', type: 'GET', data: data, success: function(data){ $('#dynamicTotal').html(data); } }) Note that we still need to tell javascript what actually gets sent to PHP. Right now, we have data: data, which is telling it to send the data variable.... Which doesn't exist. We need to create that. We need to send 2 variables, the current total, plus the shipping option. Luckily, your code already supports both of these things. We just need to format it for PHP, so, like a query string.
    We can do this like so
    var currentTotal = $('#priceWithTax').value(); var option = $('#shipping').value(); var data = 'currentTotal=' + currentTotal + '&option=' + option That's the parts to the Jquery function, so together it is
    $( "#shipping" ).on( "input", function() { var currentTotal = $('#priceWithTax').value(); var option = $('#shipping').value(); var data = 'currentTotal=' + currentTotal + '&option=' + option; $.ajax({ url: 'resolvePrice.php', type: 'GET', data: data, success: function(data){ $('#dynamicTotal').html(data); } }); }); This code goes between a <script></script> tag in your HTML.
     
    Finally, we need to make the PHP page to handle what you're sending it. I named it resolvePrice.php, but it can be whatever. In it, you need to have something similar to this
    <?php $possibe_results = array("4.99", "3.99", "1.99", "0"); if(!in_array($_GET['option'], $possibe_results)){ exit(); }else{ $shipping = $_GET['option']; } $currentTotal = $_GET['currentTotal']; $newTotal = $currentTotal + $shipping; echo htmlspecialchars('With shipping, your price comes out to <!-- Dynamic Price: ' . $newTotal . ' + shipping -->'); ?> As you only have set possible options, this code checks against this, and if the query doesn't match one of the possible results, it's likely that something malicious is going on, so the script just exits. Otherwise, it's all relatively straight forward...... Aaaaaaaaaaaaaaaand, sorry for the long post
×