0

this is in the config.php5 file:

    <?php


       $host_name = "dbxxxxxxxxx.db.1and1.com";
       $db = "xxxxxxxxx";
       $user_name = "dboxxxxxxx";
       $password = "password";
        $connect = mysql_connect($host_name, $user_name, 
        $password);

My host upgraded me to php7 without my consent. When they did that the mysql_connect function failed to connect returning an err code 'unable to connect.....' They reset php back to 5.5 version but I am still not connecting. this is the code that attempts to connect by calling the config file

some code here: <* require_once("config.php5");*> some code here:

Up until two days ago this program has worked for over 20 years. Does anybody have any ideas?

tadman
  • 208,517
  • 23
  • 234
  • 262
Jimbo
  • 1
  • 2
  • check if the mysql server is still running. – nbk Feb 20 '20 at 21:21
  • PHP 7 deleted the `mysql_query` function so you're going to need to upgrade to `mysqli` at the very least. Given you're using that interface your code may have sever SQL injection bugs, so advertising your sites here is a really bad idea. – tadman Feb 21 '20 at 00:17
  • At worst, you can use a shim such as [this one](https://github.com/dshafik/php7-mysql-shim) which just implements all the `mysql_` functions but uses `mysqli` under the hood to make the actual database calls. This means that code which tries to call `mysql_` functions won't complain that they're missing. (Of course it won't fix any SQL injection issues etc but it will at least allow you to temporarily run your application on PHP7 while you re-write your database code to use something up-to-date.) – ADyson Feb 21 '20 at 00:58
  • P.S. I would just like to point out that `mysqli` has existed since 2004, the `mysql_` functions were deprecated in 2013 and PHP 7 was released in 2015. PHP 5.6 stopped being supported in 2018. So it's not like you haven't already had time to do something about this. It was inevitable at some point that hosting companies would no longer wish to allow you to run code on an unsupported platform which might potentially have unpatched security vulnerabilities, yet you seem to be surprised they upgraded you.I assume they warned you beforehand. Did you think you could just run the same code forever? – ADyson Feb 21 '20 at 01:00
  • I did not use a case tool to write the code in php5.4. I protected against sql injection in the code itself. I am 73 and the code has run fine since the 90's. I don't need php extension support because I am not writing other code for others. I am hoping this proof of concept can be upgraded by a competent programmer if it gets funded. It is ugly and needs to be polished. I have restored the old php and it works with some small tweeks. Using php7 is far more difficult to learn.. My code for me runs smoothly and I understand how it works to fix bugs that may pop up. Thanks to everyone! – Jimbo Feb 21 '20 at 23:11
  • to ADyson. I wrote places where a user can register (id)numeric(course (numeric from a dropdown) (lname)text (fname)text,(addr),(city),(st)from dropdown, sign up for an event, (user id)text,(teebox)from a list,post a score(user id) (score) numeric. At each entry point I tested for sql injections. before I pass the data to a table I test for validity. I keep them running today because there is hope that they will be funded. go to worldwidesportspromotions.com (wordpress) for details of what I am attempting. I may be calling on some of you that need work. – Jimbo Feb 21 '20 at 23:30

0 Answers0