Jump to content


  • Content count

  • Joined

  • Last visited

  • Days Won


Everything posted by maxxd

  1. maxxd

    classes, interfaces and methods

    There's that, too - plus I've been trying to bone up on my ESNext skills over the past month or so, so that's kinda where my head is right now.
  2. maxxd

    classes, interfaces and methods

    Yeah, it's correct but somehow it feels like JavaScript - it's probably because I forgot you don't use dollar signs on constants...
  3. maxxd

    classes, interfaces and methods

    Why are you stumped? You're not calling the methods. @Barand beat me to it, but here's another take on what he is saying. interface animal{ public function walk(); public function fly(); public function swim(); } class Cat implements animal{ public function walk(){ echo "Cat can walk"; } public function fly(){ echo "Cat no fly"; } public function swim(){ echo "Cat no like"; } } class Dog implements animal{ public function walk(){ echo "Dog loves walk!"; } public function fly(){ echo "Dog doesn't fly..."; } public function swim(){ echo "Dog LOVES swim!!!!!!!"; } } class Animals{ private $_animal; public function __construct(animal $animal){ $this->_animal = $animal; } public function display(){ $this->_animal->walk(); $this->_animal->fly(); $this->_animal->swim(); } } $cat = new Animals(new Cat()); $dog = new Animals(new Dog()); $cat->display(); $dog->display(); Also, it almost looks like you're mixing PHP and JavaScript - in PHP all variables are prepended with a dollar sign. And the use of const is possible in PHP, but the way you've used it here looks a bit more like JavaScript to me.
  4. maxxd

    php libraries

    MLS search functionality is (mostly) determined by the system serving the stream. If your client is using RETS, you can use PHPRets to interact with the database. If your client is using FlexMLS, you'll use the SparkAPI for PHP. Both are well documented and easy to use, though in my experience FlexMLS is significantly faster and offers more robust on-the-fly searching and sorting. Also note that even using one of these libraries, you'll have to write custom code to make it actually do anything. Some sites have a cron set up to use one of the APIs above to download the day's MLS listings to a local database each night, at which point the filter, sort, and search functionality is all yours to design and develop.
  5. maxxd

    Need help with password validation

    http://us1.php.net/manual/en/function.password-verify.php and http://us1.php.net/manual/en/function.password-hash.php
  6. The other obvious solution is to paginate results. Infinite loading is fine and all, but there are issues with it (as you're finding now) that don't happen with simple pagination. For instance, if the user has JavaScript turned off - admittedly not very likely, but possible - window.history and state won't do anything.
  7. maxxd

    Transfer JS data to PHP

    I'm not sure what you mean by "re-shaped", but yes technically you could grab the contents of any structural element via JavaScript and then send that content as data to PHP via AJAX. However, you're not saving yourself any "lines of code". In fact, you're adding complexity to what should be a fairly simple system, given what you've described. Perhaps you could explain what exactly you're trying to do and why you're determined to do it this way?
  8. maxxd

    Sending mail from multiple table

    Pretty much exactly what @Barand said.
  9. 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).
  10. maxxd

    Getting hacked

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

    pulling from database

    In all the unformatted code you just posted (use the "<>" button next time), there's no PHP.
  12. Absolutely needs to be validated on the server side as well. My wording could have been better - thanks!
  13. Or JavaScript; check the value on submit - call an alert() can return false if it's empty, otherwise proceed as normal.
  14. 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...
  15. 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.
  16. 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.
  17. 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.
  18. 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.
  19. 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!
  20. 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!
  21. 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.
  22. 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.
  23. 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.
  24. 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.
  25. 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.

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.