Jump to content

maxxd

Gurus
  • Content Count

    988
  • Joined

  • Last visited

  • Days Won

    24

maxxd last won the day on June 7

maxxd had the most liked content!

Community Reputation

69 Excellent

About maxxd

  • Rank
    Prolific Member

Contact Methods

  • Website URL
    https://maxxwv.com

Profile Information

  • Gender
    Not Telling
  • Location
    North Carolina

Recent Profile Visitors

13,011 profile views
  1. 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.
  2. Also, <%php is not the correct opening tag. Use <?php. However, sounds like requinix is right - you're in an admin or restricted area of the template. What's the file name and location you're working with?
  3. Because the database server is on the same machine as the web server. All the time, actually. 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.
  4. OK - sorry. A little closer look at the question you're actually asking. first off, date's format 'h' is a 12-hour format with leading 0, so it won't read as '20'. And MySQL TIME type doesn't include AM/PM. Try changing the date format to 'H:i:s'.
  5. OK - technically, the open brace at // WHAT IS THIS FOR? matches the closing brace at // WHAT? and doesn't really do any harm programmatically (I think...), but wow is that hard to read.
  6. 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>'; } } } } ?>
  7. Create a page template in your theme or child theme. Call your functions from there.
  8. Do you really have to support IE6 or is the book you're using just really old? I've not seen that structure in forever; honestly I think that exact code is one of the main reasons jQuery blew up as big as it did as quickly as it did.
  9. I still don't know what the issue was - another form on the same page worked fine. I ended up refactoring to use text links instead of a drop-down and got it working. Thanks for the help!
  10. 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?
  11. Not to be a pedantic ass, but sometimes the data is client-created HTML content. Any CMS runs into this, and a lot of application-style sites I've worked on (including my current job) offer clients the option of customizing display text where it makes sense, and it can include lists and images and whatnot.
  12. How do you expect it to print anything when there is no code to output anything? No echo, no return, no nothing. Also, there is no additional code. It's the same code twice. I'll add to benanamen's request and ask that you post the actual code along with the actual problem.
  13. Sorry, folks. Had a typo that apparently I'd reverted without catching it. Fixed now, I think.
×
×
  • 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.