Python Forum
Use Python to change a PHP file on my little webpage
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use Python to change a PHP file on my little webpage
#1
On my little, simple webpage I have a PHP login system, because my boss needs a record of attendance from me.

At the moment, I need to change the time, date (the PHP variable $beginclass, see below) by hand.

I read a bit about requests. Could I do this from my laptop?

The login part for MySQL is below. I need to change the date, say : August 21, 2021 10:00:00 for August 28, 2021 10:00:00, that's all.

Would be great if I could do that automatically for all classes with a simple Python program.

Is requests the way to go??

The path to the login.php file looks like: www.mywebpage.com/httpdocs/20BE1cw/

Quote:// MY STUFF HOPE THIS WORKS!!
try{
$timenow = new DateTime('NOW');
// change this each week
$beginclass = new DateTime("August 21, 2021 10:00:00");
if($timenow > $beginclass) {
// attendance will not increase with multiple logins. Before next week, reset 'has_been_inc' to zero from phpmyadmin
// also, if the student comes late, no attendance
$mystmt = $pdo->prepare('UPDATE allstudents20BE1 SET has_been_inc = has_been_inc + 1, logon_time = LOCALTIME() WHERE email = :email AND has_been_inc != 1');
}
elseif($timenow < $beginclass) {
$mystmt = $pdo->prepare('UPDATE allstudents20BE1 SET attendance = attendance + 1, has_been_inc = has_been_inc + 1, logon_time = LOCALTIME() WHERE email = :email AND has_been_inc != 1');
}
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  What does .flush do? How can I change this to write to the file? Pedroski55 3 221 Apr-22-2024, 01:15 PM
Last Post: snippsat
  logging: change log file permission with RotatingFileHandler erg 0 1,047 Aug-09-2023, 01:24 PM
Last Post: erg
  How can I change the uuid name of a file to his original file? MaddoxMB 2 937 Jul-17-2023, 10:15 PM
Last Post: Pedroski55
  unittest generates multiple files for each of my test case, how do I change to 1 file zsousa 0 974 Feb-15-2023, 05:34 PM
Last Post: zsousa
  find some word in text list file and a bit change to them RolanRoll 3 1,548 Jun-27-2022, 01:36 AM
Last Post: RolanRoll
Photo (Beginners problem) Does file change during this code? fiqu 3 1,899 Nov-03-2021, 10:23 PM
Last Post: bowlofred
  change csv file into adjency list ainisyarifaah 0 1,509 Sep-21-2021, 02:49 AM
Last Post: ainisyarifaah
  how to change the range of read CSV file every time python file runs greenpine 6 4,491 Dec-08-2020, 10:11 PM
Last Post: greenpine
  Matrix Operations Without Numpy or Incorporating Python into Webpage ebryski 1 2,928 Nov-26-2020, 12:50 PM
Last Post: jefsummers
  Change variable in an outside file ebolisa 5 2,665 Nov-11-2020, 04:41 AM
Last Post: ebolisa

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020