doubledee Posted December 26, 2011 Share Posted December 26, 2011 I could use some help on naming my PHP files... The approach I have settled on for now is that I have some PHP page that does something (e.g. "change_password.php") and then another page to which the user is redirected (e.g. "change_password_results.php") which displays an outcome message like "Your Password has been re-set." Questions: 1.) Is it a problem having multi-word PHP File Names? 2.) Is it a problem separating them with underscores? 3.) Will it look *strange* to users looking at the URL to see a file name like "create_account_results.php" ?? 4.) Will this impact SEO? Thanks, Debbie Quote Link to comment https://forums.phpfreaks.com/topic/253849-verbose-filenames/ Share on other sites More sharing options...
melloorr Posted December 26, 2011 Share Posted December 26, 2011 1. No 2. No 3. Maybe but they will not go there often. 4. Crawlers/Search engines do not need to go/link to that page. Just stop crawlers going there using robots.txt Quote Link to comment https://forums.phpfreaks.com/topic/253849-verbose-filenames/#findComment-1301407 Share on other sites More sharing options...
objnoob Posted December 26, 2011 Share Posted December 26, 2011 A single PHP script should do the trick. You can analyze the postback super-globals ($_GET, $_POST, $_REQUEST) to see if the form has been submitted. You then use all of the tools at our disposal to produce programming flow. If our HTML form had a submit button: <input type='submit' name='btnSubmit' value='Reset Password'/> IF (isset($_REQUEST['btnSubmit'])){ // we got a hit on the submit button; the form was submitted, so we validate form. $errors=array(); // empty array to hold any errors we might find during validation validate_ResetPassword($errors); if(!empty($errors)) printHTML_ResetPassword($errors); // there were errors, reprint the form letting the user know about the errors else { // the form was good, do what we have to to reset password, and let user know the password was reset. echo "<html>Your password has been reset</html>"; } }else{ // form never submitted; print the form printHTML_ResetPassword(); } function validate_ResetPassword(&$errors){ if (!isset($_REQUEST['username']) || $_REQUEST['username']==''){ $errors['username']='User name is required!'; } } function printHTML_ResetPassword($errors=array()){ echo "<html>"; if (!empty($errors)){ echo "There were some errors with the form you submitted... please fix them!"; } echo "<input type='text' name='username' value=''/>"; if (isset($errors['username'])) echo "<span class='error'>{$errors['username']}</span>"; echo "<br/><input type='submit' name='btnSubmit' value='Reset Password'/></html>"; } Quote Link to comment https://forums.phpfreaks.com/topic/253849-verbose-filenames/#findComment-1301408 Share on other sites More sharing options...
doubledee Posted December 26, 2011 Author Share Posted December 26, 2011 A single PHP script should do the trick. Thanks for the response, but I'm not looking to rewrite my code in this thread. If you have ideas on my Original Post and Original Questions, then that's great. Thanks, Debbie Quote Link to comment https://forums.phpfreaks.com/topic/253849-verbose-filenames/#findComment-1301409 Share on other sites More sharing options...
objnoob Posted December 26, 2011 Share Posted December 26, 2011 Yes, I shared my ideas. Thanks Back to file naming... 1. Since PHP is multi-platform. You should consult to the operating systems file naming rules. This will tell you what file names are legal for the platform in question (the platform PHP is running on). 2. See above, but underscores ARE acceptable characters for filenames under both Windows and Linux. 3. Shouldn't be a problem. Most users are concerned with the page's content, and not the page's name. Sorry, I was so off topic the first post. Quote Link to comment https://forums.phpfreaks.com/topic/253849-verbose-filenames/#findComment-1301411 Share on other sites More sharing options...
doubledee Posted December 26, 2011 Author Share Posted December 26, 2011 Yes, I shared my ideas. Thanks Back to file naming... 1. Since PHP is multi-platform. You should consult to the operating systems file naming rules. This will tell you what file names are legal for the platform in question (the platform PHP is running on). 2. See above, but underscores ARE acceptable characters for filenames under both Windows and Linux. 3. Shouldn't be a problem. Most users are concerned with the page's content, and not the page's name. Sorry, I was so off topic the first post. Not a problem, I just have to avoid getting off topic. Debbie Quote Link to comment https://forums.phpfreaks.com/topic/253849-verbose-filenames/#findComment-1301413 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.