Jump to content

charlie321

Members
  • Posts

    59
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

charlie321's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Thanks for the help and suggestions. Happy to say I didn't have to go to godaddy. The password evidently wasn't strong enough so they changed it without informing me of the change. It is fixed. Didn't know how marking the worked so this is the solution. I'll try to fix it if I can.
  2. Thanks for the help and suggestions. I am sort of at a loss on this it has been so long. I am going to include all the code as it seems what I didn't include last time is the problem. Is it possible that when godaddy moved it some of the login credentials were changed? The move caused some other problems. I had the login set up for local or server access. //code <!DOCTYPE html> <HTML> <HEAD> <TITLE>CBMGA</TITLE> <link rel="stylesheet" href="css/style.css"> <style> body, html { height: 65%; margin: 0; } .bg { background-image: url("ccb.jpg"); height: 100%; background-text: testing; background-position: center; background-repeat: no-repeat; background-size: cover; } </style> </HEAD> <BODY> <p> <div class="bg"></div> <!--<DIV id="header"></DIV>--> <center> <font face="arial"> <H2>COCOA BEACH MEN'S GOLF ASSOCIATION</H2><p> Browse for c:\golfcb\info\users.csv then click on the 'submit' button below. <?php if (!$_POST) { ?> <html> <body> <form action="" method="post" enctype="multipart/form-data"> Choose your file: <br /> <p> <input name="csv" type="file" id="csv" /> <br /> <br /> <input type="submit" name="Submit" value="Submit" /> </form> </body> </html> <?php } else { if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { //echo 'This is a server using Windows!'; $servername = ""; $username = ""; $password = ""; $dbname = ""; } else { //echo 'This is a server not using Windows!'; $servername = ""; $username = ""; $password = ""; $dbname = ""; } // Create connection date_default_timezone_set("America/New_York"); $connect = new mysqli($servername, $username, $password, $dbname); if ($_FILES['csv']['size'] > 0) { //get the csv file mysqli_query($connect,'TRUNCATE TABLE users'); $file = $_FILES['csv']['tmp_name']; $handle = fopen($file, "r"); $i = 0; while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { if ($i > -1) { $import = "INSERT into users(id,lname,fname,email,password,indx,hdcp,red,phone,hide) values('$data[0]','$data[1]','$data[2]','$data[3]','".md5($data[4])."','$data[5]','$data[6]','$data[7]','$data[8]','$data[9]')"; $connect->query($import); } $i++; } mysqli_query($connect,'TRUNCATE TABLE control'); $date = date( "Y-m-d" ); $import="INSERT INTO control (tdate) VALUES('$date')"; $connect->query($import); fclose($handle); print "<p>File uploaded successfully!"; } } ?> </font> </center> </BODY> </HTML> //code
  3. Hi.. Thanks for your reply... The to part of the script is login info with passwords, etc. I get this error...... [06-May-2024 15:31:52 America/New_York] PHP Warning: mysqli::query(): Couldn't fetch mysqli in /home/rgxb6tc5wk5q/public_html/golf/login/upload.php on line 68 [06-May-2024 15:31:52 America/New_York] PHP Warning: mysqli_query(): Couldn't fetch mysqli in /home/rgxb6tc5wk5q/public_html/golf/login/upload.php on line 73 [06-May-2024 15:31:52 America/New_York] PHP Warning: mysqli::query(): Couldn't fetch mysqli in /home/rgxb6tc5wk5q/public_html/golf/login/upload.php on line 76 I believe line 68 is the while... //code while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { if ($i > -1) { $import = "INSERT into users(id,lname,fname,email,password,indx,hdcp,red,phone,hide) values('$data[0]','$data[1]','$data[2]','$data[3]','".md5($data[4])."','$data[5]','$data[6]','$data[7]','$data[8]','$data[9]')"; $connect->query($import); //code Could this have something to do with the csv file?
  4. At the end of March godaddy moved our site. I am now running php 5.6 on lynix. Just noticed yesterday that no data is being uploaded to the site since the end of March which is around when it was moved. Is there anything in the following code that isn't compatible with 5.6 and needs changed? I wrote this code 5 or 6 years ago and am not well versed in php. It has been runing fine until the end of March. Thanks for any help. //code // Create connection date_default_timezone_set("America/New_York"); $connect = new mysqli($servername, $username, $password, $dbname); if ($_FILES['csv']['size'] > 0) { //get the csv file mysqli_query($connect,'TRUNCATE TABLE users'); $file = $_FILES['csv']['tmp_name']; $handle = fopen($file, "r"); $i = 0; while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { if ($i > -1) { $import = "INSERT into users(id,lname,fname,email,password,indx,hdcp,red,phone,hide) values('$data[0]','$data[1]','$data[2]','$data[3]','".md5($data[4])."','$data[5]','$data[6]','$data[7]','$data[8]','$data[9]')"; $connect->query($import); } $i++; } mysqli_query($connect,'TRUNCATE TABLE control'); $date = date( "Y-m-d" ); $import="INSERT INTO control (tdate) VALUES('$date')"; $connect->query($import); fclose($handle); print "<p>File uploaded successfully!"; } } ?> </font> </center> </BODY> </HTML> //endcode
  5. Thanks for the suggestions. I did find a solution which seems funky, but worked. In php.ini I changed the save session to an empty string. I had seen this fix in another search. Hope this is a permanent fix. Not sure but we will see! Charlie
  6. OK.. Yes godaddy has been little help. They never got back to me and after finally figuring out how to get to the phpinfo file in cpanel, it was set to php 7.4 instead of 5.6 which is what they told me it had been set to. Water over the dam I guess. At any rate I checked in the phpinfo file and it looks like it is set to the correct file path in php.ini. BUT IT STILL DOESN'T WORK! After several hours of screwing around with this I am at a loss again. I did see that possibly set the save session to /tmp could work, but i haven't done that as I am afraid of doing more damage. I am not sure how to move forward with this but would really like to get it fixed! Any more suggestions please? Charlie
  7. Thanks so much. With your information I am hoping godaddy will be able to fix this. Charlie
  8. I am not sure if this is a cpanel problem or coding problem. I found another post from 4 years ago with almost an identical error code and it had something to do with an ini file in the cpanel i think. I am not very good with the cpanel, so im at a loss. I talked with several people from godaddy yesterday. They said they can't help even though whatever they did caused the problem. This is for a golf leage that I wrote most of the code for several years ago. They could take me back to php 5.6. This was written around 5.2 I believe. I am not very good with php! This is the error I am getting: start error [28-Mar-2024 12:52:36 UTC] PHP Warning: session_start(): open(/var/cpanel/php/sessions/ea-php56/sess_6308705c679006fc92d1c71ffed09d18, O_RDWR) failed: No such file or directory (2) in /home/rgxb6tc5wk5q/public_html/golf/login/login.php on line 20 [28-Mar-2024 12:52:36 UTC] PHP Warning: session_start(): Failed to read session data: files (path: /var/cpanel/php/sessions/ea-php56) in /home/rgxb6tc5wk5q/public_html/golf/login/login.php on line 20 end of error. Sure would appreciate any help!! Please let me know if you need code. Charlie
  9. fclose($fp); did it. Thanks very much!
  10. We had to update our Linux server from php 5.4 to php 7.4. Something has changed and I have a feeling it is due to changes in fputcsv. When running the code below, instead of opening a csv file in libre calc, it fills the browser with the result. Is there a way of fixing this so I get the csv file again? <code>date_default_timezone_set("America/New_York"); $filename = "import.csv"; $fp = fopen('php://output', 'w'); header('Content-type: application/csv'); header('Content-Disposition: attachment; filename='.$filename); $then = time() - 3601; $query = "SELECT * FROM ppb_listings where user_id = '4' and unix_timestamp(start_time) > $then"; $result = mysqli_query($conn, $query); while($row = mysqli_fetch_row($result)) { fputcsv($fp, $row); } echo $result; exit; ?> </code> Thanks for any help.
  11. Hi... Thanks so much for your help. Think I figured it out. Works this way: <code> $then = time() - 3601; $query = "SELECT * FROM ppb_listings where user_id = '4' and unix_timestamp(start_time) > $then"; </code> Nothing better than finally figuring out a stupid problem!!
  12. Thanks for the info. I tried your query and does the same thing. (nothing) I'm wondering if possibly it has something to do with sql or something. I even tried making it a week and it still finds nothing. Anyone have any other suggestions?
  13. Hi I am sorry. I forgot to mention that. start_time is a datetime field. And yes.. If starttime is 7pm, and query for the csv file, all records starting at 7pm would show up show up on the csv file until approximately 7:59 PM. Thanks for your consideration.
  14. I am trying to import into a csv file and filter the results to a particular user and only results based on the time the data was uploaded within one hour. In other words anything not uploaded within the last hour of the start_time will not appear in the csv file. Everything works fine except for the time part. I get no results at all with the 'and unix_timestamp........ For all I know possibly I am way off with my effort. The field name is start_time. Here is code below. Appreciate any help. <code> header('Content-type: application/csv'); header('Content-Disposition: attachment; filename='.$filename); $then = time() + 3601; $query = "SELECT * FROM ppb_listings where user_id = '4' and unix_timestamp(start_date) < $then"; $result = mysqli_query($conn, $query); while($row = mysqli_fetch_row($result)) { fputcsv($fp, $row); } echo $result; exit; </code>
  15. OK It does parse an html file on my localhost server. So what changed the ability to parse an html file? Linux, php, windows? Just curious to find out why I can do it on localhost (workbench-windows) and not on linux-mariadb. Thanks.
×
×
  • 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.