Jump to content

maxxd

Gurus
  • Posts

    1,660
  • Joined

  • Last visited

  • Days Won

    52

Posts posted by maxxd

  1. 12 hours ago, NotionCommotion said:

    Maxxd, where can I get a Honda with a Hemi or a V8?  Been looking for one, but they don't seem to be available

    Yeah, I got nothin'. The only thing I know about cars is where the gas goes and where to take it when something sounds weird.

    12 hours ago, NotionCommotion said:

    it does not address the specific attributes such as the engine serial number

    Again, I know very little but serial numbers should be specific to each engine, correct? So that doesn't seem like an issue in any way.

    12 hours ago, NotionCommotion said:

    or the torque I cinched down the spark plugs which make it unique

    Wut?

    At any rate, I would think if you're trying to keep track of modifications to cars and car parts the best bet would be a car table, a parts table, and a modifications table with a compound foreign key of car_id and part_id. That _theoretically_ should give you a time-specific snapshot of parts and mods per car.

  2. 8 hours ago, NotionCommotion said:

    And a couple of unique constraints can be used to limit to one on both sides.

    I strongly recommend against that.

    As one who will drive a car until it falls apart completely, I can see a situation where a single car can could have multiple motors, the defining data of which could be repeated. [Disclaimer: I know nothing about cars or engines, so please don't take my example as a real-world situation] If my Honda Element has a Hemi when I buy it, but I drive it to the point that the hemi dies and I put a V8 in there, cool with the unique limiter. However, if I then drive the same Element until the V8 dies and I decide to put different hemi in there, well then there's a problem.

    Play it safe for the future - Barand's junction table is the way to go; even if you don't use it as a many-to-many junction point right now, you may have to later.

  3. 14 hours ago, robb28 said:

    what i try to do is the lane 1 2 3 4 is now on 1 1 5 2 but what i want is that if i press on one button that it will be stored on the button I last clicked on.

    I'm sorry, but what? I'm not trying to be an ass, but take a breath, step back, and describe what you want to do one simple step at a time. Write out the pseudo-code, then post it here.

  4. The two chunks of code you've posted are completely unrelated. I don't know what mf_get_option('login_reg_popup') should or could return, but if it's falsey it'll set the action parameter of your checkout button link to the login page. If it's truthy it'll set it to ... nothing, really.

    Your second chunk of code redirects everything to $_SERVER['HTTP_REFERRER'] (which I'm pretty sure is a massive security issue, not to mention the fact that it applies to everything). Then, later - assuming the code gets there after the ill-advised redirect - it sets up an action handler for template_redirect that again calls the wpse_131562_redirect() function on every page load.

    Assuming mf_get_option('login_reg_popup') returns false if the user is not logged in, I think what you want to do is replace the '#' in your first code chunk with wc_get_checkout_url().

    • Thanks 1
  5. OK - we don't know what playServerURL() or getURL() look like, so no idea what those are doing in the meantime. However, in my experience when you're dealing with AJAX you'll need to stop the actual click event from happening until you want it to. However, before we even consider that, there's a syntax error you should be seeing:

    $('.btn').click( function()
    	startSound();
    });

    Note that there's no opening brace after the function() declaration, but there is a closing brace before the closing parenthesis. This alone should be breaking everything. Once that's fixed, I still think you'll need to block the submit until you've got done what you need done, so update like so:

    $('.btn').click( function(e){
    	e.preventDefault();
    	startSound();
    });

     

  6. You don't have a function named 'drop_2'. Check the documentation - the second parameter of add_action() is the function to be run. So instead of randomly having this:

    if (isset($_GET['func'])&& $_GET['func'] == 'drop_bl' ) {
        drop_bl($_GET['drop_var']); 
    }

    in your functions file, change the 'action' parameter of your AJAX call to 'drop_bl'. Then don't expect to pass a parameter to the function, just check $_POST directly. Which brings up another point, you're checking $_GET but using jQuery's post() method, which is basically a shortcut for using jQuery's ajax() function with method $_POST.

  7. Few things here.

    1. I could be wrong, but I think it's too late to call the wp_enqueue_scripts hook after the template is loaded.
    2. In the JavaScript file, your AJAX url value is incorrectly formed - you're using `nova_ajax_url,ajax_url`. You need to use a period between the object and the property, not a comma.
    3. WordPress doesn't know what 'func' means as a parameter passed to the AJAX handlers - it's looking for 'action'.
    4. I don't have the slightest idea what `drop_var` is.
    5. You show a functions file, but there's no AJAX handling in what you've shown. WordPress looks for `wp_ajax_{whatever_your_action_value_is}` and `wp_ajax_nopriv_{whatever_your_action_value_is}` action hooks to handle AJAX functionality.
    6. If you're using setTimeout() to wait for a response to be returned, it's unnecessary - AJAX is asynchronous and the .done() or .fail() chained functions await the promise resolution.
  8. 18 hours ago, davidhb21l6 said:

    interesting that there's outputted blocks for admin or users, i'll have to look into that.

     

    its the header.php file. should be present on every page,in fact it is.. 

    The rest of the JS is coming out OK , such as the config tag,  the initial async line  etc..

    Depending on what theme you're using, it's very possible that that exact code is duplicated across multiple templates, so you could be in the wrong file without knowing it. WordPress doesn't exactly require - or even in a lot of ways promote - good practices when it comes to PHP and coding for the web. And some of the Automattic plugins are the worst offenders (WooCommerce, I'm looking at you), so don't assume it's good just because it came from the same company as WP or it's got a lot of stars.

  9. 2 hours ago, ajetrumpet said:

    $dbHost apparently has to be "localhost".  now why in the hell is that the case!?

    Because the database server is on the same machine as the web server.

     

    2 hours ago, ajetrumpet said:

    have you ever heard of this?

    All the time, actually.

     

    2 hours ago, ajetrumpet said:

    it should be an ip address or domain name, shouldn't it?

    If you feel strongly about using an IP address you can try http://127.0.0.1 and that should work - although honestly, it's GoDaddy so I can't guarantee it.

  10. Are you not getting syntax errors with this? From my formatting of the code, you've got mismatched braces all over the place. It's hard to tell because you're bouncing between using braces and not (please stop doing that), but it looks like there are some nesting issues going on unless I'm mistaken.

    <?php
    $response = array("error" => false , "success" => false , 'redirect' => false);
    
    function post_content($query){
      $query_array = array();
      foreach( $query as $key => $key_value )
        $query_array[] = urlencode( $key ) . '=' . urlencode( $key_value );
      
      return implode( '&', $query_array );
    }
    
    global $API;
    $opts = array('http' =>  array('method'  => 'POST',"header" => "Content-type: application/x-www-form-urlencoded\r\nAuthorization:".base64_encode($API["api_key"].":".$API["secret_key"])."\r\n", "content" => post_content($content)));
    
    return stream_context_create($opts);  // WHAT ARE YOU RETURNING FROM?
    
    }   //WHERE DOES THIS START?
    
    function submit(){
      global $API;
    
      if(empty($captcha) || $captcha == '' || !isset($captcha))
        return array(    "error" => "Please solve the captcha.");
    
      if (empty($_POST['account']) || !ctype_alnum($_POST['account']))
        return array(    "error" => "Invalid account id.");
          
      $checkAccount = checkAccount($_POST['account']);
    
      if (isset($checkAccount["error"]))
        return array("error" => $checkAccount["error"]);
    
      if (isset($checkAccount["success"])){
        $account_unique_id = (isset($_SESSION['kal_id'])) ? $_SESSION['kal_id'] : $checkAccount["success"]; 
        $result = json_decode(file_get_contents($API["API_Domain"] . '/api/generate/vote-rewards-token', false, postParams(array('callback' => $API["callback"],'account_unique_id' => $account_unique_id    ))) , true);
    
      { // WHAT IS THIS FOR?
    
        echo '<br><center><h3>Please wait...</h3></center>';
      }
      if (!empty($result)){
        if (isset($result["response"])){
          if (isset($result["response"]["error"]))
            return array("error" => $result["response"]["error"]);
    
          elseif (isset($result["response"]["success"]))
            return array("redirect" => '<script type="text/javascript">setTimeout(function () { window.location.href = "'.$result["response"]["success"].'";}, 500)</script>');
    
        }
      }
      } //  WHAT?
    }
    
    if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['account'])){
      $response = submit();
      if (isset($response['redirect']) && $response['redirect']){
        echo $response['redirect'];
        die;
      }
    }elseif (isset($_GET['return'])){
      $result = json_decode(file_get_contents($API["API_Domain"] . '/api/verify/vote-rewards-token', false, postParams(array('returned_code' => $_GET['return']))) , true);
      if (!empty($result)){
        if (isset($result["response"])){
          if (isset($result["response"]["error"]))
            $response['error'] = $result["response"]["error"];
    
          elseif (isset($result["response"]["success"])){
            insertRewards($result["response"]["account_unique_id"]);
            $response['success'] = '<b>Thank you, Your vote has been recorded and the server rank will be updated soon.<b><br />You will receive your rewards in storage of your account.<p>Your next vote in : <b>' . $result["response"]["NextVote"] . '</b></p>';
          }
        }
      }
    }
    ?>

     

  11. Hi y'all. So I'm currently working a project in CodeIgniter and I can't get the frigging thing to pass data from a form. At all.

    My autoload.php:

    $autoload['helper'] = [
      'text',
      'form',
      'url',
    ];

    Here's the view code:

    <header>
    	<div>
    		<?php
    			print form_open('/location/change', ['id'=>'location']);
    			print form_label('Location', 'locations');
    			print form_dropdown('locations', $locations, (!empty($_SESSION['location'])) ? $_SESSION['location'] : '');
    			print form_submit('change_location', 'Change');
    			print form_close();
    		?>
    	</div>
    </header>

    The route:

    $route['location/change']['post'] = 'location/change';

    And the controller code:

    class Location extends CI_Controller{
       public function change(){
    
        $this->output->enable_profiler(true);
    
        $vars = $this->input->post();
    
        print("<pre>".var_export($_POST, true)."</pre>");
        print("<pre>".var_export($vars, true)."</pre>");
      }
    }

    The output:

    array (
    )
    
    array (
    )

    WTF? This is quite literally the simplest thing to do - I just want to pass data... Any ideas why it's not working?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.