Modules?
Author |
Message |
JHanson90
|
|
|
|
|
Sponsor Sponsor
|
|
|
Amailer
|
Posted: Sun May 16, 2004 8:39 am Post subject: (No subject) |
|
|
that can be simply done by including a file if the $module = 'w/e';
code: |
if($HTTP_GET_VARS['module'] == 'news') {
include('news.php');
}
|
and if you go to http://yoursite/index.php?module=news
it will display the information in the news.php |
|
|
|
|
|
JHanson90
|
Posted: Sun May 16, 2004 5:02 pm Post subject: (No subject) |
|
|
Meh I'm such a noob; I should have figured that out myself :-\
Oh well, thanks a bunch |
|
|
|
|
|
JHanson90
|
Posted: Sun May 16, 2004 6:22 pm Post subject: (No subject) |
|
|
OK, what I did was have one page, called membersarea.php. I put this code in inside of it: code: | <?php
if($HTTP_GET_VARS['module'] == 'login') {
include("loginset.php");
} elseif ($HTTP_GET_VARS['module'] == 'membersarea') {
include("membersareaset.php");
} else {
include("defaultset.php"); }
?> | Then in 'membersareaset.php', the code was: code: | <?php if($_POST['memberu'] == 'testuser' && $_POST['memberpass'] == 'testpass') { ?><table width="510" border="0" cellspacing="1" bgcolor="#000000">
<tr>
<td align="center" bgcolor="#000000">Welcome, <?php echo $_POST['memberu']; ?>.</td>
</tr>
</table>
<?php } else { ?>
<table width="510" border="0" cellpadding="8" cellspacing="1" bgcolor="#000000">
<tr>
<td align="center" bgcolor="#000000"><strong>WRONG!</strong><br>
<br>
Please try again, or stop trying to get into the Members' Only Area.</td>
</tr>
</table>
<?php } ?> | Then inside of 'loginset.php', the code was: code: | <td align="center" bgcolor="#000000"><strong><br>
Members Area Login</strong><br>
<form action="<?=$HTTP_GET_VARS['module']=='membersarea'?>" method="POST">
<table width="250" border="0" cellspacing="1" bgcolor="#000000">
<tbody>
<tr>
<td align="right" bgcolor="#79715C">Username:</td>
<td align="center" bgcolor="#79715C"><input name="memberu" type="text" class="form2"></td>
</tr>
<tr>
<td align="right" bgcolor="#79715C">Password:</td>
<td align="center" bgcolor="#79715C"><input name="memberpass" type="password" class="form2"></td>
</tr>
<tr align="center">
<td bgcolor="#79715C" colspan="2"><input type="submit" class="formbutton" value="Enter }R{ Members Area"> </td>
</tr>
</tbody>
</table>
</form><br>
</td> | OK, so in my MOZILLA browser I went to the /membersarea.php?module=login, then I input testuser and testpass and hit Enter, but all it did was refresh the page with the username and password fields blank. So then I tried it in my Internet Explorer browser. And instead of doing what MOZILLA did, the form didn't even show up. Everything was there except for the place where the form should go. I'm a noob...help? |
|
|
|
|
|
Amailer
|
Posted: Sun May 16, 2004 7:08 pm Post subject: (No subject) |
|
|
code: |
<form action="<?=$HTTP_GET_VARS['module']=='membersarea'?>" method="POST">
|
is your problem, hmm what exactally are you doing there-- what you did there is.. set $HTTP_GET_VARS['module'] to membersarea.. when you had to do something like this..
code: |
<form action="membersarea.php?module=membersarea" method="POST">
|
hope that helps |
|
|
|
|
|
JHanson90
|
Posted: Sun May 16, 2004 7:39 pm Post subject: (No subject) |
|
|
Stupidity and ignorance is my strongest area.
I'm going to go eat myself.
|
|
|
|
|
|
Blade
|
Posted: Thu May 27, 2004 5:39 pm Post subject: (No subject) |
|
|
Amailer wrote: that can be simply done by including a file if the $module = 'w/e';
code: |
if($HTTP_GET_VARS['module'] == 'news') {
include('news.php');
}
|
and if you go to http://yoursite/index.php?module=news
it will display the information in the news.php
wouldn't
code: | if($HTTP_GET_VARS['module']){
include($HTTP_GET_VARS['module'] . ".php");
} |
be better? ... if he is programmin his own site, then he should know which parameters to put in the links and stuff... this is more dynamic than having 1500 if statements. |
|
|
|
|
|
Amailer
|
Posted: Thu May 27, 2004 7:02 pm Post subject: (No subject) |
|
|
yes, hmm very true
*walks away* |
|
|
|
|
|
Sponsor Sponsor
|
|
|
|
|