Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

movie.py cant retrun ugomenu from sudomemo utils (or any ugomenu for that matter) #41

Closed
mtboss124 opened this issue Oct 3, 2024 · 4 comments

Comments

@mtboss124
Copy link

mtboss124 commented Oct 3, 2024

movie.py cant retrun ugomenu from sudomemo utils (or any ugomenu for that matter)
current code (relevant code not the entire code):

from twisted.web import resource
import os
import subprocess
from hatena import Log, ServerLog, Silent, NotFound
from DB import Database
from Hatenatools import TMB

#php execution function i guess
import subprocess

def execute_php_file(php_file_path, args):
    try:
        # Create the command to execute the PHP file
        command = ['php', php_file_path]

        # Add arguments to the command if provided
        if args:
            for key, value in args.items():
                command.append(value)

        # Execute the PHP file using the PHP CLI
        output = subprocess.check_output(command, stderr=subprocess.STDOUT)

        # Decode the output to a string
        html = output.decode('utf-8')

        return html
    except subprocess.CalledProcessError as e:
        print("Error executing PHP file: " + e.output.decode('utf-8'))
        return None
    except (IOError, OSError):
        print("PHP executable not found. Please ensure PHP is installed and in the system's PATH.")
        return None
        
        #filetype check (also tired using .uls but still no reply)
        elif filetype == "ugo":
			ServerLog.write("requested ugofile")

			# Example usage:
			php_file_path = 'dsphp\profile.php'
			args = {
				'username': '%s' % (self.tmb.Username)  # Pass tmb.Username as an argument
				}	
			html = execute_php_file(php_file_path, args)
			if html:
				print("%s send php file whit following args %s" % (request.getClientIP(), args))
				return html.encode("UTF-8")	
@pbsds
Copy link
Owner

pbsds commented Oct 3, 2024

i don't understand what the code is supposed to do, how python can even parse it, nor what you want to achieve

@mtboss124
Copy link
Author

code should be catching whenever i am asking for a .ugo file or .uls file and execute a php script that returns a generated .ugo file

@mtboss124
Copy link
Author

it already catches .htm requests and thats how i generated user profiles
imagen

@mtboss124
Copy link
Author

Figured it out.
Sorry for bad formating or wording
Its my 3rd time opening issues.
Now the issue is that, the server gives 404 when requested the generated file even if its there.
It only reads the file once the server is restarted. Issue page: #42

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants