PHP filepath messing html links - php

I have an issue migrating a site where the links are all broken. It's a html site but uses php file system. The links in the index.html has \ in front of it. There's a file of php files like: Configuration.php, FileSystem.php, Bootstrap.php, Handler.php. How do I revert to just regular hmtl links.
Thanks!

If all you want to do is convert the dynamic PHP based website to a static HTML is easy.
Open the website in Firefox (Chrome will probably work too, but I did not test).
Go to File->Save Page As... and select a directory on your PC.
Firefox will then download the main file and needed dependencies to the PC eliminating all the PHP since it doesn't even know the server generated the page dynamically using PHP.
You can now deploy the site where ever you like.
Please note that if there are JS files that actively communicate with the server to download content dynamically you'll have to edit them yourself.

Related

creating a registration and login page with php and mysql on apache server (raspbian jessie)

Hello and thanks in advance for the help. I am running a LAMP server on my raspberry pi and I need help creating a registration and login page using mysql database. All my php files have to be in the /var/www/html. I've been googling this for about a week and I have some questions.
Where do I save css files
Can I make a subdirectory in the html that will create a website (I have tried to do this already but when i navigate to the site it tells me the page isnt working)
How do I make it secure (this is for a personal project so it doesnt have to be extremely secure I just want to know some common security issues)
I tried to follow http://www.allphptricks.com/simple-user-registration-login-script-in-php-and-mysqli/ steps and it showed nothing but a blank page.
I am not asking someone to just write all the code for me, I want to learn and understand what I am doing wrong so if you could direct me to a better tutorial or explain it that would be great.
Thanks
First off make sure all of your CSS files paths are set correctly in the HTML files that you are trying to style. As long as the CSS files are included correctly then it should style your page. The final destination of the CSS files should not matter as long as you have the correct path set to the CSS file in the HTML file.
Linking a CSS file to an HTML file W3Schools
All I did was search "mysql php security best practices" I'm sure you can find more but here is what I found (the first link in my case) OWASP

How To Open A Website's (Built on Wordpress) PHP file in my browser?

I came across a website and liked its look. So, I wanted to know how its style.css is coded.
I got there style.css file by visiting to Network Tab of Inspect Element and then opening that file in a new tab. We can open JS files also in the same way.
But, how can I open a PHP file? I know the directory where the PHP file of that website is located, but when I type that directory in the browser's address, it shows a blank page (full white blank page with nothing on screen), so I thought I need PHP installed on localhost.
So, alternatively, to get the PHP file, I downloaded that file and opened it in Sublime Editor, but there too, it shows blank.
So, how can I get that PHP file?
[Note: This is just a question for educational purposes. This thought suddenly came in my mind when I was going through that CSS file and just for the sake of my anxiety and knowledge, I'm asking this question. No offense or criminal minded tendency..]
It´s not possible. PHP files are executed on server side and can´t be downloaded like HTML files.
More information on this can be found here:
StackOverflow: Can a client view server-side PHP source code?
Can someone steal my PHP script without hacking server?
security.stackexchange.com: Is it possible for a hacker to download a php file without executing it first?

HTML file dosent work when it is saved as php and using any php code

I designed my web page using ms office frontpage 2003 as I am little bit familiar with that.Later I saved that using php extension as I want to use more php code in there.But soon after i include any php code it only shows the HTML code in the browser.
Your kind consideration given with this regard is highly appreciated.
You seem to be confused about how PHP and HTML work.
Feel free to use whatever text editor you wish, but PHP code will not show up in the browser. This is the intended behavior. PHP is executed server side, and therefore it is completely invisible to the eyes of the clients (browsers.) If you're not using a server with PHP installed, then your PHP code wont execute, obviously, but under no circumstances should you see PHP code in your browser.
Use an editor like Notpad++ (notepad-plus-plus.org), Editpad Pro (www.editpadpro.com) sublime text (www.sublimetext.com) etc. to edit your html files. Go ahead open your .html or .php files in these editors and make appropriate changes.
UPDATE: PHP scripts run on web server. You cannot just open .php files in browser like .html files. For PHP scripts to execute you need to have a web server. Install XAMPP in your system. https://www.apachefriends.org

How to find files in website directory?

I'm creating a web crawler. I'm ganna give it an URL and it will scan through the directory and sub directories for .html files. I've been looking at two alternatives:
scandir($url). This works on local files but not on http sites. Is this because of file permissions? I'm guessing it shouldn't work since it would be dangerous for everyone to have access to your website files.
Searching for links and following them. I can do file_get_contents on the index file, find links and then follow them to their .html files.
Do any of these 2 work or is there a third alternative?
The only way to look for html files is to parse throuhg the file content returned by the server, unless by small chance they have enabled directory browsing on the server, which is one of the first things disabled usually, you dont have access to browse directory listings, only the content they are prepared to show you, and let you use.
You would have to start a http://www.mysite.com and work onwards scanning for links to html files, what if they have asp/php or other files which then return html content?
Have you considering using wget? It can crawl a website and download only files with a particular extension.

Adobe Air Javascript on *.php files

I'm trying to build an Adobe Air app which runs from a PHP file.
Currently I have an index.html file which then performs a location.href to move to realfile.php - this gets round the limitation that a root file has to be HTML.
My problem is that the *.php files contain JavaScript which in turn make use of Adobe Air code, specifically printing. I overwrite window.print to the Air version which works fine in HTML.
As soon as the code is copied to the PHP file it doesn't even attempt to call it, yet other JavaScript works fine.
I read around a bit more and now know that Air will only run in a HTML page. Although there is no explanation that I could find that explains why this is...
How I think I can fix this:
My current idea is to add a RewriteRule in my htaccess to make PHP files accessible via a .html file extension. This should trick Air into thinking it's a HTML document, whilst the server is still able to process the PHP that is on the page.
When I get around to it, I'm more than happy to re-write the app to make it fully AJAX driven, which is what everyone else seems to be doing.

Categories