Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by maxxd

  1. Yeah, it's clearly a typo. It's been patched (apparently) in 4.8, but even adding the ppa:nijel/phpmyadmin repository, the most recent version I can get is 4.6.6. I could update it manually from the VM command line, but I'm trying to automate this as much as possible with the Vagrant provision script, and I'm admittedly a little behind the times with Vagrant.
  2. Hi y'all. First off, I suck at RegEx (like, massively) and I'm not what anyone would call an expert on the command line (I'm not useless, but certainly not a whiz). More than happy to admit that. However, I'm trying to deal with a bug that's apparently cropped up in phpMyAdmin when used on php7.2 - there's this in the conditional: || (count($analyzed_sql_results['select_expr'] == 1) and it needs to be: || (count($analyzed_sql_results['select_expr']) == 1) Now, I'm trying to automate this via a Vagrant provision script, so I figured I'd use sed to replace the line - it's working on the php.ini file just fine. This is what I've come up with as my sed command: sudo sed -i "s/\(count\(\$analyzed_sql_results\['select_expr'\] == 1 .*/\(count\(\$analyzed_sql_results\['select_expr'\]\) == 1/" /usr/share/phpmyasdmin/libraries/sql.lib.php and for the life of me I can't figure out why it's not doing anything at all and I don't see any errors in PowerShell. If it matters, I've added the ppa:nijel/phpmyadmin repository to my apt on the Vagrant machine. Many thanks in advance for any and all advice!
  3. As patient and helpful as @Barand and @ginerjm have been through this conversation, I feel like we're slipping into @benanamen specialty, the XY problem. What are you actually trying to accomplish? It seems like the same question has been answered several times already, only to be met with new and slightly different requirements.
  4. What I've always done in this situation is used fopen({$loc}, 'w') to write the file to the server, then return a json-encoded array with a boolean true success index as well as a path to the newly created file. Use JavaScript's window.open({ajaxResponse.fileLocation}, '_blank'); to prompt the download. That way the browser doesn't try to redirect the user because it will recognize the download link and not actually open a new tab.
  5. I didn't read any of the posted code because ... well, yeah .. but @ginerjm - 'FKM' cracked me up. Never seen it before. Thank you ever so much after a rough week or so.
  6. What exactly are you trying to do? The sample code (not the source code, but the usage example) is pretty straight-forward. Select the action hook you want to use (codex listing) and call the bp_notifications_add_notifications() function at that point. Note the difference in the sample code between the ' bp_activity_at_mention_add_notification ' function and the called system ' bp_notifications_add_notification ' function - the first calls the second at the time the ' bp_activity_sent_mention_email ' action fires. If you're not familiar with WordPress's action and filter hooks, I'd recommend doing some digging into them. It's a pretty easy concept to grasp, though admittedly the WP documentation can be lacking and/or outdated, especially right now as some major changes are happening with the core.
  7. Personally, I learned from books - specifically, 'Core PHP Programming second edition - revised for PHP4!'. Don't even bother looking it up; it's still there but it was published in 2000 so it's a joke at this point. My favorite book is 'PHP Objects, Patterns, and Practice' (currently on edition 5), but that's sounds like it's higher-level than what you're currently looking for. However, the point is that different people learn different ways. I've met people who just jumped in and started cobbling some code together from S.O. and Google and somehow (to me) still ended up being good programmers. I've also heard good things about Codecademy, but have never actually used it myself. There are a plethora of YouTube tutorials, books, and written tutorials out there - just vet them carefully before you use any of what they have to say on a publicly-accessible site (this is a great place to do that). Whatever you do, make sure to find forums like this one and ask questions when you have them - and take the answers and code reviews that may be given.
  8. maxxd

    PHP sessions

    Any page with php on it needs to have a .php extension unless your server is set up to parse pages with an HTML extension, which it's hopefully not (it'll slow down plain HTML pages). Beyond that, what you're describing is a basic multi-page form and yes, using sessions is a good solution to this. As to how to use sessions, the manual is a great place to start.
  9. @phpsane, @benanamen is right - you should know the difference between single and double quotes by now. For review, please read this: http://php.net/manual/en/language.types.string.php#language.types.string.parsing. In case it's still confusing, please note this line: When a string is specified in double quotes or with heredoc, variables are parsed within it.
  10. Ah - yes, blur will occur on focus in and focus out. Forgot about that, but glad you figured out the trigger you needed!
  11. To add to the point that @ignace is making here, it's also very simple to load a page containing a form, open the inspector for your browser and change any value for any form field. Client-side validation may not catch this, but the server-side processing (model) code validation will.
  12. If you're specifically looking for a PHP solution, DateTime::diff() sounds about perfect. You'll have your difference, but be able to format that difference in a variety of ways. Unless I'm not understanding the issue.
  13. Have you tried the blur() event on the field? I can't guarantee it'll do what you want (I'm away from my computer right now), but I'm pretty sure that element.onblur() fires when a form field autocompletes as well as when the user navigates away from that field.
  14. Public repositories on GitHub are, as both benanamen and gizmola have pointed out, free. If you don't want (or don't have the time) to learn the command line aspects of git, you can use SourceTree or GitKraken. I have to say, if you're developing in Windows, SourceTree has problems - on mac, it's excellent. SourceTree is completely free, and GitKraken is free for non-commercial use. Neither is required for help here, but either will change your life if you're not currently using a versioning system. And both will give the people on this forum the chance to look at the entirety of the code you're using, which will help us help you.
  15. What framework are you using?
  16. What hook are you using to call the function that uses get_option()? Are you using AJAX to get the value? If so, are you using it correctly? Post your code - that'll help.
  17. You're going top have to describe the problem better. Are you saying you want the user to fill out the form then immediately be redirected to the new page? If so, there are a couple other things to consider, but ginerjm is correct in his statement about gathering the values and using a header redirect. Are you saying you've got the form saving the information properly to the database and need to know how to get the data from the database? If so, it's going to depend on how and where you saved the data. Either way, it's probably going to involve using an action hook at some point, so where is this code happening? Are you creating a custom theme, a child theme, or a plugin? Basically, what does mean exactly?
  18. The code you've posted doesn't have anything to do with a database. You're making a curl call to update-availability.php. If that file is supposed to update a database value, we'd need to see the code in that file.
  19. Applying opacity to a div affects everything within the div, including type and nested divs. Use background opacity via rgba() to do what you're wanting: body{ background: url("https://image.ibb.co/h93Ndo/abstract.jpg") top right no-repeat; background-attachment: fixed; } .body-container{ display: flex; flex-direction: column; justify-content: stretch; align-items: stretch; background: red; color: white; min-height: 100vh; } .header{ flex-grow: 0; background: rgba(58, 152, 253, 1); } .two-cols{ flex-grow: 1; display: flex; flex-direction: row; justify-content: stretch; } .left-container{ display: flex; flex-direction: column; justify-content: flex-start; flex-grow: 1; flex-basis: 20%; background: rgba(59, 74, 83, 1); } .content{ display: flex; flex-direction: column; justify-content: flex-end; flex-grow: 1; flex-basis: 80%; background: rgba(255, 255, 255, .7); } Also, is there any reason why you needed to add the !important to the display rule on the .body-container div? @gizmola - apparently I'm going to need to read that article as well as I've not found float collapse to be an issue using flexbox. Or at least I've not recognized that that's what it is... Anyway - thanks for the link!
  20. You've applied the top margin to the body element, so of course it's pushing the body down. Apply top padding to body-container? Sorry - not quite sure what you're asking on this one. As for the background, that really shouldn't be a problem with the structure as it is. gizmola's correct about float collapse, but (I could be wrong here) I'm not sure it applies in this case. If you need to add z-index (again, not sure why at this point) add position: relative; to the divs. That should allow the z-index to work as expected.
  21. For this simple situation, I'd use flex. With a decent transpiler it'll work well in ie11 (10 mostly works once transpiled). .body-container{ display: flex; flex-direction: column; justify-content: stretch; align-items: stretch; background: red; color: white; min-height: 100vh; } .header{ flex-grow: 0; background: gold; } .two-cols{ flex-grow: 1; display: flex; flex-direction: row; justify-content: stretch; } .left-container{ display: flex; flex-direction: column; justify-content: flex-start; flex-grow: 1; flex-basis: 20%; background: green; } .content{ display: flex; flex-direction: column; justify-content: flex-end; flex-grow: 1; flex-basis: 80%; background: blue; } <div class="body-container"> <div class="header">Here's the header</div> <div class="two-cols"> <div class="left-container">menu</div> <div class="content">hello world</div> </div> </div> Give that a shot. Once you get that working, you could always start the move toward semantic markup with header, main, article, and sidebar elements.
  22. Note that requinex's snippet checks for the existence of all the variables, so it's the equivalent of using '&&', not '||'.
  23. Also, you might want to look into PHPMailer - it's safer and more reliable than PHP's native mail() function, and it has debugging options for situations just like this.
  24. You're checking to make sure $_POST['submit'] is set, but not checking $_POST['timer'] before you attempt to assign its value to $result. As to the stop() function issue, that's weird - there's a jQuery stop() function but you're not using jQuery. I'm not aware of a stop() function in JavaScript itself, but that doesn't mean it doesn't exist. Either way, naming the function stopTimer() is more descriptive and probably a better idea anyway.
  25. This is not the code that cyberRobot was talking about. I have to assume there's a startTimer() and stop() function somewhere? If not, then figuring out why this isn't working just got a lot easier... Also, you've got an empty h1 element and you don't have the '>' at the end of your </form> tag.
  • 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.