Thoughts? 04-14-2020, 12:17 AM
#1
So I added a couple new features to crimin4l.cc/proxies over the last week or so and I think the page is 100% complete now ![Biggrin Biggrin](https://sinister.ly/images/smilies/set/biggrin.png)
Let me know what you guys think: https://streamable.com/uc2q2i
Also before all this, I would get the date from a date.txt that I would have to update everytime I updated proxies.txt. Got very annoying and immediately was trying to figure out how to pull the last modified date from the proxies.txt file. Finally did and feels like a huge accomplishment because i really had minimal help/googling on this one![Biggrin Biggrin](https://sinister.ly/images/smilies/set/biggrin.png)
![Biggrin Biggrin](https://sinister.ly/images/smilies/set/biggrin.png)
Let me know what you guys think: https://streamable.com/uc2q2i
Also before all this, I would get the date from a date.txt that I would have to update everytime I updated proxies.txt. Got very annoying and immediately was trying to figure out how to pull the last modified date from the proxies.txt file. Finally did and feels like a huge accomplishment because i really had minimal help/googling on this one
![Biggrin Biggrin](https://sinister.ly/images/smilies/set/biggrin.png)
(04-14-2020, 05:38 AM)Crimin4L Wrote: Thank you @mothered
I feel so accomplished relearning my old rootsIt went from having a date.txt file where I would have to write the date in every time I updated the proxy list, to automatic
I said goodbye to date.txt with these simple lines:
PHP Code:$pfile = "proxies.txt"; //Declare file
$pfiletime = date("U", filemtime($pfile)); //Formatting the file's last modified time into seconds <<Used again in second code box>>
$hoursToSubtract = 4; //UTC offset (In Hours) For me I am UTC-4
$secToSubtract = ($hoursToSubtract * 60 * 60); //converts the $hoursToSubtract into seconds; 4 x 60 minutes x 60 seconds
$mytime = $pfiletime - $secToSubtract; //Subtracting the 4 hours (in seconds) from the files time (to get UTC-4 timezone)
//Reformat the new UTC-4 time ($mytime) to a readable format (Because it's in seconds)
$time1 = date("F j, Y", $mytime);
$time2 = date("g:i", $mytime);
$time3 = date(":s", $mytime);
$time4 = date("A [e-4]", $mytime)
//You can also do this in 1 line. I just needed to display the date on two separate lines and make the seconds smaller, so I had to separate it all.
$example1line = date("F j, Y g:i:s A [e-4]", $mytime); //pfile's last modified date and time in UTC-4 Timezone
Then since having the the $pfiletime in seconds already, I grabbed the current time (also in UTC; where server is located) and subtract them to get the time of how long ago it was modified:
PHP Code:$currenttime = time(); //getting time in seconds
$updatedlast = $currenttime - $pfiletime; //subtracting current time from $pfiletime
//Then once again changing the time from seconds to a readable format, also can be done in 1 line but I separated it so it can be displayed separately in a sentence.
$uphrs = date("G", $updatedlast);
$upmins = date("i", $updatedlast);
$upsecs = date("s", $updatedlast);
$example1line = date("G:i:s", $updatedlast); //Will display as "Hours:Minutes:Seconds"
Super easy, once I knew the date and filemtime functions I was able to really do it all by myself
I hope someone finds this information useful
(This post was last modified: 04-14-2020, 05:51 AM by Crimin4L.)