simple questions about php
5 posts
Page 1 of 1
hello this is my first post i like this website because of the support from all to all
i have many questions if you can answer one or many it will be appreciated
because i have little knowledge in vb.net c# java and css and html, it is easy for me to create a web page but i need to know somethings before i start a new project that will be used for PC remote control purposes
1) if my webpage is .html does it still can use php codes or javascript?, so then why we use php? and what is better
2) javascript is for clientside, php is for server side, but does that mean i should learn both, or just one, which one then?
3) if i want a simple, press button then a text file written (FTP), the codes should be in php so can i just put it in my .html page, without needing to make external file like writeTxt.php ?
4) If i have a php function in my page that writes to a file in my FTP server, will people be able to get my ftp user and pass from the source code of the page, or do i need to protect? then how?
thanks in advance
i have many questions if you can answer one or many it will be appreciated
because i have little knowledge in vb.net c# java and css and html, it is easy for me to create a web page but i need to know somethings before i start a new project that will be used for PC remote control purposes
1) if my webpage is .html does it still can use php codes or javascript?, so then why we use php? and what is better
2) javascript is for clientside, php is for server side, but does that mean i should learn both, or just one, which one then?
3) if i want a simple, press button then a text file written (FTP), the codes should be in php so can i just put it in my .html page, without needing to make external file like writeTxt.php ?
4) If i have a php function in my page that writes to a file in my FTP server, will people be able to get my ftp user and pass from the source code of the page, or do i need to protect? then how?
thanks in advance
1) If you want to use PHP, your file must end in .php . However, you can include HTML code in your .php file.
2) It really depends on what you want to do. If you would like to add interactivity to your site in a way that's not permanent, JavaScript could be useful.
3) Again, your file would need to end in .php to be interpreted as a PHP script. You could technically put all your PHP code in a single file, so yes, you could have code to write data to a TXT file on your server.
4)I wouldn't recommend using FTP for that. In fact, you don't need to. If both your PHP script and text file are on the same server, I'm pretty sure you can just write directly without needing credentials.
As for seeing your username and password, technically they can't since the PHP code isn't visible, but someone determined at getting your credentials will eventually get them.
2) It really depends on what you want to do. If you would like to add interactivity to your site in a way that's not permanent, JavaScript could be useful.
3) Again, your file would need to end in .php to be interpreted as a PHP script. You could technically put all your PHP code in a single file, so yes, you could have code to write data to a TXT file on your server.
4)I wouldn't recommend using FTP for that. In fact, you don't need to. If both your PHP script and text file are on the same server, I'm pretty sure you can just write directly without needing credentials.
As for seeing your username and password, technically they can't since the PHP code isn't visible, but someone determined at getting your credentials will eventually get them.
1.) When Server gets request from client it's like client double clicked for example video file = your default media player will open it.. Same goes for PHP files, if user requests for *.php, server will open the file with a thing called PHP interpreter. Interpreter will execute the code and display result which will web server (ie. Apache) display to client..
2.) JavaScript is executed in user's browser, it is used for dynamically editing DOM, making AJAX calls, and much more.. While PHP is server side and is used for, as name says, preprocessing.
3.) You don't need FTP for that.. And you can have all the codes in same file, example below.
4.) No, user doesn't get to see the source code of php, only interpreted HTML/Plain text.
Example for 3:
2.) JavaScript is executed in user's browser, it is used for dynamically editing DOM, making AJAX calls, and much more.. While PHP is server side and is used for, as name says, preprocessing.
3.) You don't need FTP for that.. And you can have all the codes in same file, example below.
4.) No, user doesn't get to see the source code of php, only interpreted HTML/Plain text.
Example for 3:
Code: Select all
<?php
if ($_POST) {
if(!empty($_POST['text'])) {
file_put_contents("path", $_POST['text'], FILE_APPEND);
}
}
?>
<!doctype html>
<html>
<body>
<form method="post">
<textarea name="text"></textarea>
<input type="submit" />
</form>
</body>
</html>
CodenStuff wrote:Nope, it's just your sick and dirty mind. You sick twisted warped little pervo
PHP is completely server side and can only be seen of those who have the php files, which means you cannot view them in your browser, and you can only see the php itself in your files on ftp or locally, The only thing you are able to see is the HTML, the php has written or echo'ed..
with php you can create your own cms (Content Management System) and create forums, logins and stuf like that ..
Javascript is a good language to know for creating effects and a nice, smooth running website .
with js you can create slideshows and galleries with nice and sweet effects but also make some stuff not available to php. the javascript source is visible in the browser if you look for it.
If you have time and will i will recommend learning both js and php. Thats what im currently doing wahooo;
with php you can create your own cms (Content Management System) and create forums, logins and stuf like that ..
Javascript is a good language to know for creating effects and a nice, smooth running website .
with js you can create slideshows and galleries with nice and sweet effects but also make some stuff not available to php. the javascript source is visible in the browser if you look for it.
If you have time and will i will recommend learning both js and php. Thats what im currently doing wahooo;
thanks everyone for the quick replies
very informative, i dont think it is time for me to learn JS but php for now is good, i want to focus on learning one thing which is php, now i already know basics of html and css,
again thanks to everyone who replied
very informative, i dont think it is time for me to learn JS but php for now is good, i want to focus on learning one thing which is php, now i already know basics of html and css,
again thanks to everyone who replied
5 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023