calling another file???

is there a way to call another php file which starts a unique html page??? Here is the script:[php]<?php
//session_start();
//error_reporting(E_ALL);
ini_set(‘display_errors’, ‘1’);
$homedir="/home/gimpware/public_html/test";

function getemail() {
?>

What is your email: <?php }

function isemailvalid($email,$homedir) {
chdir(“data”);
if(!(file_exists($email))) {
chdir($homedir);
return true;
break;
}
else {
chdir($homedir);
return false;
}
}

// main
echo ’

As they uniquely identify an user, email addresses will be used for logging into the website… Please, only 1 account per user, ok??? Abusers of this policy risk having both their accounts eliminated, forcing them to start all over, again, and we do not want that, do we??? Also, do not share your password with anyone, under any circumstances, because this account is solely yours, and is good for all my websites…

'; //$email=$_POST['emailaddress']; do { if(isset($_POST['Submit'])) { if(isemailvalid($_POST['emailaddress'],$homedir) == true) { $_SESSION['email']=$_POST['emailaddress']; // include 'submitinfo.php';
} 

} else {
getemail();
}
} while (isemailvalid($_POST[‘emailaddress’],$homedir) == false);
?>[/php]
is there a way in any language???

Could you clarify the question?

If I understand you correctly, yes you can include an HTML page based on a specific criteria…

Now, why are you doing a loop on line 36? It doesn’t help or do anything for you.

Corrections to your code:
Change:
[PHP][/PHP]
To:
[PHP][/PHP]

In:
[php]if(!(file_exists($email))) {
chdir($homedir);
return true;
break;
}[/php]
There is no need to break after [PHP]return true;[/PHP] anywhere, ever.

As for your question, yes, there is a way to call another php file, you can use any of the two functions:
include(‘filename.php’) / include_once(‘filename.php’)
or
require(‘filename.php’) / require_once(‘filename.php’)

If you must have that HTML loaded up every time on one specific page I recommend using require_once.

[member=72302]odedta[/member] , and OP, Do not ever use $_SERVER[‘PHP_SELF’]. It is vulnerable to XSS.

Use $_SERVER[‘SCRIPT_NAME’] instead.

Yeah, that or you could just do htmlspecialchars($_SERVER[‘PHP_SELF’])

Thanks for the notice.

Why use anything at all? If you leave out the action property the form will by default submit to itself…

The answer to that is that it is not to spec. You can still use and it works, but it’s not right according to spec.

Form action is not required any more (HTML5), the center tag on the other hand is no longer valid. So your arguement is kinda wrong on both levels ^^

Yeah but if you want to be backwards compatible, say for IE8… does html5shiv.js take care of that? if not I rather use action just to be on the safe side.

It violates HTML4 standards but I can not remember seeing any browser acting up on it. Just tested IE8 (VM with WinXP/IE8) and it submits fine to self without the action property.

[php]

test [/php]

Used method GET just because it makes it easier to see it actually works. Inspecting/debugging requests in IE8 isn’t exactly up to par to what we have in browsers today…

You can get (free) virtual machines for testing IE here:
https://www.modern.ie/en-us/virtualization-tools

Sweet as! thanks!

To the second part, you misunderstood, I know center is not valid. What I was saying is that if you used it, the browser will still center something even though it is not valid. Point being, just because it works in the browser doesnt make it right according to spec. That just means the browser does not enforce the spec.

To the first part, you are half right. Action is not required if it is NOT specified

HTML5 Spec:

The action and formaction content attributes, [b]if specified[/b], must have a value that is a [b]valid non-empty URL[/b] potentially surrounded by spaces.

A valid url according to html5 spec (Which DOES NOT include # by the way)

A URL is a valid URL if at least one of the following conditions holds:

The URL is a valid URI reference [RFC3986].

The URL is a valid IRI reference and it has no query component. [RFC3987]

The URL is a valid IRI reference and its query component contains no unescaped non-ASCII characters. [RFC3987]

The URL is a valid IRI reference and the character encoding of the URL’s Document is UTF-8 or UTF-16. [RFC3987]

Valid Spec (Although I have experienced a form not submitting this way)

Not Valid Spec

Not Valid Spec

Source: http://www.w3.org/TR/2011/WD-html5-20110525/association-of-controls-and-forms.html#attr-fs-action

http://www.w3.org/TR/2011/WD-html5-20110525/urls.html#valid-non-empty-url

How was I only half right in saying the action param is optional? It is 100% optional…

[member=71845]JimL[/member] , I may have misunderstood how you meant optional. I now assume you are meaning, not there at all, as in the first example I posted which IS 100% optional, while MY thought and comments regarded the last two examples I posted.

Let me know if thats how you meant.

Yeah I was talking about the entire action parameter, not its value :slight_smile:

Either way this topic is way over-complicated atm ^^

TL:DR

The form action parameter is optional in every browser I know of, they all default to “action=‘self’”.
The parameter is not optional in HTML4
The parameter is optional in HTML5, but if present it should have a valid value

LOL, I figured we were not talking about the same thing. ;D

Ok, I knew I ran across an instance where the form did not submit without a full action attribute. It was with a bootstrap form. The following will not submit if you completely leave out the action attribute, nor using action with no value, nor using action with a #. I don’t have the answer as to why at the moment. Anyone wish to investigate?

DOES NOT WORK

DOES WORK

[php]<?php
echo “

”;
print_r($_POST);
echo “
”;
?> Bootstrap, from Twitter
Password
Sign in
[/php]

That code works fine here. Which browser are you using?

Note: I had to add a name to the password field. Inputs without name aren’t useful / not submitted :slight_smile:

Thanks [member=71845]JimL[/member] ,

After testing I discovered that the issue is the missing name=""

That code came from a new WYSIWYG bootstrap editor that needs some work. So, it has nothing to do with the action attribute.

It seems this is all arguing whether or not the action="" attribute is required in order for PHP (or any Server Side Language), to process data sent from a static-HTML form.

:smiley:

Sponsor our Newsletter | Privacy Policy | Terms of Service