Kupiki-Hotspot-Script icon indicating copy to clipboard operation
Kupiki-Hotspot-Script copied to clipboard

help portal i can't execute php script inside index.html

Open kwaknet01 opened this issue 4 years ago • 4 comments

i have python script to read the rfid card uid
`#main.py #!/usr/bin/python import time import RPi.GPIO as GPIO import MFRC522 import os, sys import string from random import *

Create an object of the class MFRC522

GPIO.setwarnings(False) MIFAREReader = MFRC522.MFRC522() #form = cgi.FieldStorage()

#Welcome message #print("Tap Card Please") #print("---------------")

This loop checks for chips. If one is near it will get the UID

try:

while True:

# Scan for cards
(status,TagType) = MIFAREReader.MFRC522_Request(MIFAREReader.PICC_REQIDL)

# Get the UID of the card
(status,uid) = MIFAREReader.MFRC522_Anticoll()

# If we have the UID, continue
if status == MIFAREReader.MI_OK:

    #print("Card UID: "+str(uid[0])+","+str(uid[1])+","+str(uid[2])+","+str(uid[3]))
    uidstr = '{}{}{}{}'.format(uid[0], uid[1], uid[2], uid[3])
    print(uidstr)

`

php script execute python

image

the code works and prints the UID.

i want to use the UID of the RFID card use as Username in index.html. i've tried but it doesnt work. ignore comment.

image

kwaknet01 avatar Aug 20 '19 07:08 kwaknet01

Not sure that php5-fpm is installed and configured in the nginx configuration file to support PHP

pihomeserver avatar Aug 20 '19 07:08 pihomeserver

how can i update nginx configuration file?

i also want to add my custom dashboard. don't know how set settings or where to edit nginx config file.

add to portal config.? is this correct? location ~* .php$ { fastcgi_pass unix:/run/php/php7.0-fpm.sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; }

kwaknet01 avatar Aug 20 '19 09:08 kwaknet01

Search google to add php support to nginx (not related to this project)

What is your custom dashboard ? Look at the configuration of NGINX and daloradius and adapt it for a new folder/url

pihomeserver avatar Aug 20 '19 09:08 pihomeserver

thanks sir.

kwaknet01 avatar Aug 20 '19 09:08 kwaknet01