Username:
Password:
Remember me:
Register

Back to forum: Web Programming (HTML, JS, CSS, PHP, MySQL)


Search forums via Google


0 Users appreciate this thread.

One page login/home
 <<  <
Started by angelrulez7
(2014-01-06 10:35:36)
SPCOxion (2014-06-29 08:43:20)
even more fun

[code=*php]<?php
// usermenu.php

$usermenu = function(){
if($islogged == true){
return "html shet for logged-in users";
} else {
return "html shet for guests, probably a login form and a link to a sign-up page";
};
};
?>[/code]

then on every page u want ur user menu

[code=*php]
<?php
include('/usermenu.php';
?>

<?php echo $usermenu; ?>
[/code]
angelrulez7 (2014-06-30 08:12:26)
You can't include from '/' @SPCOxion
a
GuitarBoy (2014-06-30 14:38:11)
Yeah. PHP's absolute paths are pretty silly, but understandable since you're managing not just a site but an entire webserver.

For x10Hosting, I ALWAYS use absolute paths starting from my home directory.

Ex. /home/cpanelUsername/public_html/

^THAT is the PHP equivalent of HTML's "/".
http://m.ajango.org - Ajango
New social networking website coming this year! Check for updates frequently!

Ajango Forum Thread
SPCOxion (2014-06-30 16:05:07)
u get da point
CoolApps (2014-07-05 15:59:26)
You can use $_SERVER['DOCUMENT_ROOT'] with the include() function to be able to access from the root of the webserver directory.



BTW Specs, if the PHP code is closed, you don't need to reopen it and then close it again.

What I mean is this:
<?php
echo 'Marmite';
?>
<?php
echo ' is';
?>
<?php
echo ' terrible.';
?>

Should be this:
<?php
echo 'Marmite is terrible.';
?>

Or:

<?php
echo 'Marmite '.'is '.'terrible.';
?>


Basically, don't put the unnecessary lines of code in.

This post has been edited one or more times, the last time was:
2014-07-05 23:13:48

Newer account: NodePoint
joemckellar20 (2014-08-26 17:07:51)
don't work add it's not 5.5.0 PHP
~Justin~ (2014-09-29 16:53:43)
He doesn't know what he is talking about ^
CoolApps (2014-10-01 16:39:46)
^ Duh. lol
Newer account: NodePoint
TwilightWinter (2014-10-07 21:09:53)
What is durdur stuff?
✋
TheAlexRider (2014-10-22 22:57:24)
Joe... go to codecademy.
<<  < 

Log in to submit a comment

This topic's ID: 67459

Back to forum: Web Programming (HTML, JS, CSS, PHP, MySQL)




Total registered users: 8321
New registered users today: 7
Newest registered user: ElegantVulpes

©  Copyright 2026 3DSPlaza. All Rights Reserved