Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by maxxd

  1. maxxd

    Sending mail from multiple table

    Yes if you're trying to send three different emails to three different groups then you're pretty much out of luck. Run three queries to get the recipient pool for each email. That having been said, even if that is the goal you can definitely save some resources by using PHPMailer instead of PHP's native mail() function. You can add multiple recipients with the AddAddress() method, so instead of trying to send an email on each iteration of the while() loop, you can instead create a single instance of PHPMailer, call AddAddress on each iteration through the loop of recipients, then send them all in one call. Also, PHPMailer is more reliable and far more robust than PHP's native mail() function (unless there's been some major work to the mail() function while I wasn't watching).
  2. maxxd

    Getting hacked

    Is there a question here other than the obvious "Is this a terrible idea?" (yes. yes it is.)?
  3. maxxd

    pulling from database

    In all the unformatted code you just posted (use the "<>" button next time), there's no PHP.
  4. Absolutely needs to be validated on the server side as well. My wording could have been better - thanks!
  5. Or JavaScript; check the value on submit - call an alert() can return false if it's empty, otherwise proceed as normal.
  6. So, weird but ... I changed the ServerName to nodeserver.internal, destroyed the VM, rebooted my host machine, and ran vagrant up. It's all working now. No idea...
  7. Hi all. It's late and I'm hoping I'm just missing something simple because I can't get this working and it's driving me a bit crazy. I'm trying to set up a simple vagrant Ubuntu 18.04 box. The up and provisioning is actually working so far as I can tell - I can connect to phpmyadmin through Firefox and I can ssh into the box after up, but trying to navigate to http://node.server.test in Firefox fails with a 404. And I'm confused about that. So, my Vagrantfile contains this: config.vm.synced_folder "../pkg", "/var/www", create: true, owner: "vagrant", group: "www-data", mount_options: ["dmode=777,fmode=777"] # Provider-specific configuration so you can fine-tune various # backing providers for Vagrant. These expose provider-specific options. config.vm.provider "virtualbox" do |vb| # # Name the VirtualBox vb.name = "Node Server Testing" # # Customize the amount of memory on the VM: vb.memory = "1024" and my provision script contains this: echo "install apache" sudo apt-get -y install apache2 VHOST=$(cat <<EOF <VirtualHost *:80> ServerName "node.server.test" DocumentRoot "/var/www/public_html" <Directory "/var/www/public_html"> AllowOverride All Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> EOF ) echo "${VHOST}" > /etc/apache2/sites-available/node.server.test.conf sudo a2ensite node.server.test sudo a2enmod rewrite sudo phpenmod mcrypt sudo service apache2 restart sudo rm -r /var/www/html Directory structure on the containing Windows box is as follows: D:\node_server_testing pkg\ os\ public_html\ index.html src\ js\ less\ sysfiles\ .vagrant\ setup.sh Vagrantfile This works in my other Vagrant boxes, but this one is simply not working. And again, what's weird is that I can connect to http://node.server.test/phpmyadmin/ without a problem. So I figure it's got to be an issue in the Vagrantfile sync directive or the setup Apache virtual host setup, but I can't find it. Many thanks in advance for any advice or pointing out the glaringly obvious mistake that I've made somewhere.
  8. I was talking with someone the other day when they started singing the praises of CodeIgniter. Now I haven't look at CI in quite some time, but last time I did it was ... well, bad. I know the project got taken over by a different company, but the code base that I looked at after the conversation seemed pretty similar. It still looks like it's just one big global object that everything gets crammed into. Anyone currently working with it? No big deal really, I'm just curious.
  9. maxxd


    WORDPRESS!!! Seriously, it's easy to set up, and given your "question" and style of asking should be very doable for you without spending too much money or time. If your site ends up getting a lot of traffic or you want to do something slightly more advanced or intricate you'll want to learn some php and JavaScript, but if you're just starting out it should do you fine.
  10. maxxd

    Query Statement Help

    While you're at this point, and especially if you're going to be exploring prepared statements as mac_gyver (correctly) suggested, look at switching to PDO. It's much easier to use than mysqli_*, and it's not tied to a single SQL language so portability is easier.
  11. 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!
  12. Oooh - thank you for the link! I always thought diff and patch were git or SVN specific and had nothing to do with linux. I love it when I learn something new - let me read and experiment and I'll let you know how it goes. Thanks very much!
  13. Sorry if I sound thick here, but is that something I can automate? I can see making the change manually to a local version, then reading that in from the setup shell script and overwriting the downloaded version. Which now that I type it out seems like that may not be a bad idea, actually... Again, I'm not terrible with *nix command line, but I'm not great - diff and patch certainly sound like git or SVN commands and I don't know if that's something I can do while provisioning a virtual machine.
  14. Speaking of typos, I just saw that I spelled 'phpmyadmin' wrong in the file parameter for the sed call. Corrected that and tested and it still isn't working as I expect it to, so I assume my expression is malformed.
  15. 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.
  16. maxxd

    PHP Mysql how to Count $row['price']

    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.
  17. 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.
  18. 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.
  19. 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.
  20. 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.
  21. 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.
  22. @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.
  23. Ah - yes, blur will occur on focus in and focus out. Forgot about that, but glad you figured out the trigger you needed!
  24. maxxd

    simple entity validator - critique

    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.
  25. maxxd

    Date time comparisons

    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.

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.