Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Is it possible to edit a php file from itself? I would like to have a php file that a user can log into with their e-mail address and password then give them a several fields they can edit. Upon submitting their entries the actual php file they used to submit info is updated.
Lets say there are three fields displayed once logged in...
1. Email (can not be read when rendered in a browser or via source code)
2. Password (can not be read when rendered in a browser or via source code)
3. Textarea (contents you submit in the textarea would be visible if you load page in browser, in addtion, a blank username and password field would be visible in a browser, so the owner could login to edit the file)
With this system the user would be able to edit their login information and change information displayed on the page when viewed through a browser. Using the email in the file I guess I could include a sendmail function should they forget their password.
Is this possible. If so, does anyone know of a simple script that I can use to get started?
You are are better off storing the information you want to change in another PHP file. Then loading/editing it on request.
Editing the file you are using can cause issues. You could also loose all of your code if something is injected that corrupts the formatting code.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have a link called "Click Me" on 100 pages on my website. When a person clicks this link, I need to be able to write the url of where the click came from into a txt file or send me an email everytime the link is clicked.
Any ideas?
Fragments of code are requested here, please update your question. I will give you an idea on how to acomplish that:
In my opinion the general idea that will work best is:
Monitor user click with jQuery only if content is Click me.
When content of click is "Click me" load some php file via Ajax that will monit the click
Load this file with some parameters (?referer=...)
PHP file will append this $_GET['referer'] to a txt file
Remember that user can manually scam Your clicks (go to php file, and refresh it). You must think of some anti scam filter (for example after clicking lock IP clicks for few seconds or add some random hashes / etc to Your url).
Hope it helps, for more info, please upgrade your question with some code.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
So, i've be reading a lot of post here, but as my english is not that good, i cant understand all of it.
Sorry if this has been asked here before AND ANSWERED.
My problem is that, when i launch my html file wich contains a form it opens fine... but when i click the "send" buton, it opens the post.php file as a text and doesnt launch it.
I've managed since reading your posts, that it could be a link problem and it was. If i open it from the html file, the php opens at "file:///C:/wamp64/www/Pagina/Insertar.php" (and it fails) but if i type "Localhost/Pagina/Insertar.php" it opens just fine and upload the //empty// data to my database.
What can i do to make the "send" button work? i mean, make it goes to localhost instead of file://c.
Thank you in anticipate.
( and "insertar.php" is in the same folder)
PHP scripts are only executed when loaded through a server. It sounds like you're using a relative URL for the action attribute, and loading the HTML page from a local file instead of the server. So you need to change the action to point to the server.
<form action="http://localhost/Pagina/insertar.php">
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
This question may be common question. But this is my exact problem. I am not going to write my code, but explain the scenario.
I have 2 html files to get value from user and 1 php file to process request from 2 html files through XHR.
first html file have person information (like name and email etc..) and following to second html to start another input data.
I save this information in the text file using person name. I could create text file using XHR request to php from first html.
How do I take the filename again which i created in the person name to store the data from second html.
I could not store the filename in any variable because each XHR return is happening individually. So I can't pass choose the filename.
Any idea how do i tackle this?
I would use PHP session mechanism with session_start(); and save variable on session like this $_SESSION['file_name']=fileName; take closer look here PHP tutorial
As said by Marc B, there are no variables in HTML, or a way to store variables and transfer them to another HTML page. You can only use cookies to store and transfer data from one HTML page to the other. Cookies can be handled with PHP Sessions.
You can check a small tutorial on how to create cookies Here.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to send the wordpress username to a external file when the click on a button on my website.
I have test it with Post but then you can edit your username.
Hope you guys can help me
If you are worried about the user modifying the request, then the request must originate from your server rather than from the user's browser.
To do this, your button should call a script on your server. That script should then retrieve the username from user's current Wordpress session then send that directly to the other server using libcurl or a similar library.
Are you sure you don't just want to get the log in info to you? I think this might be an attempt scam people logging into your site. You aren't providing any coding info or nothing. Obviously something is wrong here.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I've created a small website with PHP and MySQL. The website allows a user to fill in a questionnaire (which is saved in a database) and then an admin person needs to view and then upload results in PDF format so the original person can view them. In fact the admin person can upload multiple PDF's (over time not in one sitting) to give more feed back which need to be accessible to the user.
My question is, what would be the best way to do this? First, should I upload files via PHP or would jQuery or the like be better? Should each person get their own directory? (does it matter if there are 100's of users?) How can I read all the files that pertain to a particular person and then allow them to view/download it?
Thanks in advance!
you can use form and php to upload file. If you need validation do it with php (for server side validation) or javascript (for client side validation), i recommend that you do both.
To distingusih between user data, you can use prefix for filename with username or something (ie. user1_file1, user1_file2, user19_file18), since i think it will be messy to create folder for each user.
To give link for user to download just add "location" column to your user database that contain the file path in your server. With this, you can check their username and every file that they upload in your database.