codewalker message board script fault

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
mesz
Forum Contributor
Posts: 216
Joined: Fri May 23, 2003 8:11 am
Location: M/cr

codewalker message board script fault

Post by mesz »

Hello, I ave taken a script from codewalkers.
It is to build a flatfile message board service.
This is the script for the front page, however I do not seem to be able to display the form which should come up.
Why is this?
I cannot see any glaring errors....
I'm not lazy, I'll carry on looking like, but I'm stuffed if I know.
( All the pages are like this, only half the info that should be displayed, is! )

Code: Select all

<?
require "data/config.php";
?>
<title><? echo $title ?></title>
<div align="center"><? echo $stitle . $version ?></div>
<table border="0" cellspacing="1" cellpadding="0" align="center" bgcolor="#000000">
  <tr> 
    <td bgcolor="#FFFFFF">
      <table border="0" cellspacing="1" cellpadding="0" align="center">
        <tr> 
          <td bgcolor="#C7C4D5"> 
<?
   $lines = file('data/' . $users);  
    foreach($lines as $line)  
    {  
      $admin = explode("|", $line);  
 if ($admin[0] == $_REQUEST["user"] AND $admin[0] == $_REQUEST["password"]) {  

     break;   
 } else {  
    $admin = ""; 
 } 
}  
if ($admin == "") { 
?>
<div align="center"><b><font size="<?PHP echo $size ?>" face="<?PHP echo $font ?>">[Login]</font></b></div>
          </td>
        </tr>
        <tr> 
          <td bgcolor="#F2F2F2"> 
<font size="<?PHP echo $size ?>" face="<?PHP echo $font ?>"><div align="center"> 
<form method="post">
<input type="text" name="user" value="Username">
<input type="password" name="password" value="Password">
<input type="submit" value="Login">
</div>
</font>
<?
} else { 
?> 
<div align="center"><b><font size="<?PHP echo $size ?>" face="<?PHP echo $font ?>">[Member Database]</font></b></div>
          </td>
        </tr>
        <tr> 
          <td width="450" bgcolor="#F2F2F2"> 
<font size="<?PHP echo $size ?>" face="<?PHP echo $font ?>">
Welcome <? echo $admin[2] ?>, to <? echo $title ?> Member setup.<br>
      <a href="admin.php?id=profile">Edit Profile</a> (Edit Your Setup/Viewing 
      Information)<br>
      <a href="admin.php?id=delete">Delete A Post</a> (Delete One Or More Posts)</font></td>
  </tr>
  <tr> 
	<td bgcolor="#C7C4D5"> 
      <div align="center"><font size="<?PHP echo $size ?>" face="<?PHP echo $font ?>">[Others]</font></div>
    </td>
  </tr>
  <tr>
    <td bgcolor="#F2F2F2"><font size="<?PHP echo $size ?>" face="<?PHP echo $font ?>">
<a href="admin.php?username=<? echo $user ?>&password=<? echo $password ?>&id=vmembers">View Members</a> (List Of All Members)<br>
      <a href="index.php">Home</a> (Back To Message Board)
</font>
<? 
} 
?>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<div align="center"><font size="<?PHP echo $size ?>" face="<?PHP echo $font ?>"><? echo $disclaimer ?></font></div>
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

hard to tell from the code snippet; even harder to test.
Is your php configured to accept short tags like <? ?>
phpinfo(); will tell you.
User avatar
mesz
Forum Contributor
Posts: 216
Joined: Fri May 23, 2003 8:11 am
Location: M/cr

Post by mesz »

I appreciate the difficulty of testing this - it has 8 files and is spread over several directories!
However all files seem to have a problem with this admin.php page ( not admins.php - as before ).
There is generally an else statement redirecting a user to this page, which never displays properly.
( As a newbie - as my avatar will advise - I just need to check, by short PHP tags, do you mean replace all the <? ?>with <PHP>

Code: Select all

<?
   $lines = file('data/users.php');  
    foreach($lines as $line)  
    {  
      $admin = explode("|", $line);  
 if ($admin[0] == $_REQUEST["user"] AND $admin[0] == $_REQUEST["password"]) {  
     break;   
 } else {  
    $admin = ""; 
 } 
}  
if ($admin == "") { 
?>
Sorry Your May Have The Wrong Username And Password Combination
<form action="admin.php" method="get">
<input type="text" name="user">
<input type="password" name="password">
<input type="submit">
<?
} else { 
?> 
Welcome to SXMB, <? echo $admin[0] ?>
<?
}
?>
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

yo,
<? ... ?> :arrow:<?php ... ?>

might not solve your problem but just try it ;)
User avatar
mesz
Forum Contributor
Posts: 216
Joined: Fri May 23, 2003 8:11 am
Location: M/cr

Post by mesz »

Cheers bud.
The script is so flawed ( or perhaps I'm just not qualified to implement it! ) that I'm practically starting from scratch.
If whoever designed the script recognises it from reading this, I apologise fro any offence caused.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

If you want to check out other message-boards, have a look at http://phorum.org/ or, if you need the bigger thing, http://www.phpbb.com. There are many more scripts like that around if you google a bit or look at http://www.hotscripts.com.
User avatar
mesz
Forum Contributor
Posts: 216
Joined: Fri May 23, 2003 8:11 am
Location: M/cr

Post by mesz »

I think I 'll give up on this other one.
Like I say - I think it is my mistake, I've spent so long getting bogged down in it all I can't see a way out anymore.
I'll come back and send you a hyperlink to my finished forum.
Cheers for the pointers
User avatar
mesz
Forum Contributor
Posts: 216
Joined: Fri May 23, 2003 8:11 am
Location: M/cr

Post by mesz »

Dumb question alert -
I've steered clear of mySQL ( even though my host supports it ) because I read somewhere that if it is used commercially a $149 licence was needed.
Is this true?
If I use phorum - and mySQL - will I need to pay for a licenece.
Since I started learning PHP I have had to do everything with flatfiles and it seriously limits the number ot tutorials and/or scripts that are easily found.
Cheers
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

For your needs MySQL is free, check out:
http://www.mysql.com

Mac
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

MySQL is free. We use it here, for free. The commercial license is if you want to embed MySQL into a commercial application, or you want support, etc.
User avatar
mesz
Forum Contributor
Posts: 216
Joined: Fri May 23, 2003 8:11 am
Location: M/cr

Post by mesz »

:D Thanks for your reply...you have just made my life about a 1000 times easier ( I say that before I start using mySQL mind! ).
I'll start learning in earnest when I get back from Glastonbury.

cheers
Post Reply