Jump to content

Verbose Filenames


doubledee

Recommended Posts

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

 

 

Link to comment
https://forums.phpfreaks.com/topic/253849-verbose-filenames/
Share on other sites

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>";

 

}

Link to comment
https://forums.phpfreaks.com/topic/253849-verbose-filenames/#findComment-1301408
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/253849-verbose-filenames/#findComment-1301411
Share on other sites

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

 

Link to comment
https://forums.phpfreaks.com/topic/253849-verbose-filenames/#findComment-1301413
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.