Jump to content

Unholy Prayer

Members
  • Posts

    166
  • Joined

  • Last visited

    Never

Everything posted by Unholy Prayer

  1. Ok, so far so good... not getting any error messages when I click on the link to the forum from the index, but there aren't any threads in it yet.  How do I display a message saying that there aren't any?  Here is my code: [code]<?php include('styles/default/page_header.tpl'); require_once('config.php'); $fid = $_GET['id']; echo "<table align='center' width='95%' cellspacing='1' cellpadding='1' border='0' class='table'>         <tr>           <td colspan='4' class='bgcat>Viewing Threads in: $forumname</td>         </tr><tr>           <td align='left' width='50%' class='cellnames'>Thread Subject</td>           <td align='left' width='20%' class='cellnames'>Thread Starter</td>           <td align='left' width='10%' class='cellnames'>Replies</td>           <td align='left' width='20%' class='cellnames'>Last Updated</td>         </tr><tr>"; $threads = mysql_query("select * from threads where fid = $fid order by id"); while($t=mysql_fetch_array($threads))   {       $id=$t["id"];       $author=$t["author"];       $subject=$t["subject"];       $message=$t["message"];       $date=$t["date"];       $time=$t["time"];   echo "<td align='left' width='50%' class='forumrow'><a href='viewthread.php?id=$id'>$subject</a></td>         <td align='left' width='20%' class='forumrow'>$author</td>         <td align='left' width='10%' class='forumrow'>0</td>         <td align='left' width='20%' class='forumrow'>On $date at $time</td>       </tr><tr>";   } ?>[/code]
  2. How do I make it so it displays it by the number in the url?
  3. Ok, I'm trying to make a forum for my website.  I have my idex page pretty much done, but how do I make the viewforum.php page so it shows threads from the forum that they clicked on?
  4. Ok, I know all this other crap about databases and strings, but how do I make my links so it's only one page?  Like instead of a seperate page for a members list, it would be index.php?act=memberslist or index.php?act=login etc?
  5. So just add "DESC" to the end of the query?
  6. This is probably a noob question, but how do I change the order that table fields are displayed in? This is my query: [code] $result = mysql_query("select * from news order by id limit 5"); [/code] Instead of displaying the news from the first news posted to the most recent news posted, I want the most recent news posted displayed first.
  7. Ok, I got this from a tutorial from a different website, but their site is too inactive to get any help from them.  I'm using their members system tutorial and the part where it displays the users that are online won't work.  This is the error message I'm getting: [quote] Fatal error: Cannot redeclare online() in /home/dev/public_html/portal/functions.php on line 8 [/quote] This is my code: [code] <?php /* First, I want to set a function to clean the string with all the preset functions that want in one line. */ function clean($string) { # I've named the function clean() $string = addslashes($string); # addslashes to prevent SQL injections $string = strip_tags($string); # strip any tags $string = htmlspecialchars($string); # set any html left over to special characters $string = trim($string); # trim the string of any unwanted spaces at the start or end return $string; # retrun the cleaned string } ?> <?php /* This function will allow you to show and log users that are online. */ function online($id) { # create a function called online(); /* To register a user as online.. */ if (!empty($id)){ # first check to see if the user is logged in $time = time(); # set a new time mysql_query("UPDATE `users` SET `time` = '$time' WHERE `id` ='".$id."' LIMIT 1"); # update the row of the online user setting time as the current time stamp } /* Now to display the online users */ $online_time = 300; # 300 is 5 minutes $check_time = time() - $online_time; # take $online_time off the current time for the query $query = "SELECT * FROM `users` WHERE time > '$check_time'"; $query = mysql_query($query); # get the users set as online by getting users with their online time # more than the current time minus the online time $count = mysql_num_rows($query); # count the total online users $s = ($count > 1) ? "s " : " "; # this is to be next to "User". # If $count is more than one add an 's ', else add a " " echo $count.' User'.$s.'Online<br />'; # Format: "# User(s) Online" while ($row = mysql_fetch_array($query)){ # now to output the usernames, start a while loop echo stripslashes($row['username']); # first echo the username $i++; # this is for the punctuation. # Create a number to compare with the $count variable if ($i == $count){ # $i == $count, use a full stop $add = "."; } elseif ($i == ($count - 1)){ # if $i == $count - 1, use "and" $add=" and "; } else { # else, it must be a comma $add=", "; } echo "$add"; # echo the $add variable } # end the while loop } ?> [/code] Can someone please help me?
  8. Ok, I'll try it. Edit:  Ahh, thanks.  That worked.
  9. Ok, I'm making my own forum software for my website and I am stuck.  I have it working somewhat, but it only displays the first category and the forums that are in it.  Can someone please help me fix this? Here is my forums page: http://www.mtechdev.com/bbultimate/index.php and here is my code: [code] <?php require_once('config.php'); //Let's start the category selection. $result = mysql_query("select * from categories"); while($r=mysql_fetch_array($result)) {     $id=$r["id"];   $name=$r["name"];   $description=$r["description"];       echo "<table align='center' width='95%' cellspacing='1' cellpadding='1' style='background-color: #000000;'>           <tr>   <td align='center' colspan='2' style='background-color: #e4e4e4;'><p align='left'><b>$name</b>- $description</p></td>   </tr>"; //Now we find the forums for the selected category. $result = mysql_query("select * from forums where cid = $id order by fid"); while($r=mysql_fetch_array($result)) {     $fid=$r["fid"];   $forumname=$r["forumname"];   $fdescription=$r["description"];   $cid=$r["cid"];     echo "<tr>         <td align='left' style='background-color: #e4e4e4;'>$forumname<br>$fdescription</td> </tr>"; }   echo "</table>";   }   ?>[/code]
  10. Nothing happened.  It just reset the form.
  11. Ok, I can't figure out what's wrong with this php form to add information into the database.  This is my table structure: [IMG]http://img119.imageshack.us/img119/5787/phptablewe9.gif[/img] This is my script: [code] <?php require_once('config.php'); if(isset($_POST['submit'])) {     $name = $_POST['name'];   $url = $_POST['message'];   mysql_query("INSERT INTO menu_links (name,url)       values ('$name', '$url')");   echo "The link was successfully added."; } echo "<table align='center' width='50%' cellspacing='1' cellpadding='1' border='0'> <form action='addlink.php' method='POST'>         <tr>   <td align='center' colspan='2'><b>Add a Menu Link</b></td> </tr><tr>   <td align='right'>Link Name:</td>   <td align='left'><input type='text' name='name' size='20'></td> </tr><tr>   <td align='right'>Link URL:</td>   <td align='left'><input type='text' name='url' size='20'></td> </tr><tr>   <td align='center' colspan='2'><input type='submit' value='submit'></td> </tr> </form>   </table>"; ?>[/code] I'm not getting any error messages, but the message that should come up with the submit button is hit doesn't come up and nothing is inserted into the database.
  12. Erg, it was working for a little bit but now it says this: [quote] Parse error: syntax error, unexpected '<' in /home/mtechdev/public_html/portal/styles/default/menuright.tpl on line 7[/quote]
  13. Ok, I'm making a CMS for my hosting company's customers to use as a default portal for their site.  I'm trying to make the code that switches the link if the user is not logged in or logged in.  For example, if the user is logged in, it will say "Logged in as: <user_name>".  If they are not logged in, a link to the "register.php" page will appear.  The error I am getting is this: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/mtechdev/public_html/portal/styles/default/menuright.tpl on line 5 Line five of menuright.tpl is the following: [code] </tr><tr> [/code] This is the coding for the whole page: [code] <td align="right"><table align="right" width="160" cellspacing="0" cellpadding="0" border="0"> <tr> <td height="17" class="menuhead">Members Area</td> </tr><tr> <td height="17" class="navlinkrow"><?php if (!empty($online['id'])){ echo "Logged In As: '.stripslashes($online['username']).'"}; else { echo "<a href='login.php'>Login</a>"; } ?></td> </tr><tr> <td height="17" class="navlinkrow"><a href="register.php">Register</td> </tr><tr> <td height="17" class="navlinkrow"><a href="#">Password Retrieval</a></td> </tr><tr> <td height="17" class="navlinkrow"><a href="register.php?act=why">Why Register?</a></td> </tr><tr> <td height="17" class="navlinkrow"><a href="register.php?act=faqs">Registration FAQ's</a></td> </tr><tr> <td height="17" class="menuhead">Weekly Poll</td> </tr><tr> <td height="202" class="navlinkrow" align="left">Do you like this template?<br><input type="radio" name="vote">I love it!<br><input type="radio" name="vote">It's alright.<br><input type="radio" name="vote">I hate it.<br><br><input type="submit" value="Vote Now!"><br><br><br><br><br><br><br></td> </tr> </table></td>[/code] Can anyone help me? Anyone know why it would do this?
  14. Ok, I am making a php script where a user can add a scheduled clan match and select the date that it takes place on.  How do I insert values from multiple dropdown menus into one database column?
  15. Ok, I have my sessions code for my user authentication script, but I want to display the user's username once they are logged in.  I also want the links in a certain part of the page to change once they are logged in.  Here is my coding: [code] //check cookie if ($_SESSION['logged_in'] != 1 && isset($_COOKIE['login_cookie'])) {     list($user, $pass) = explode('[]', $_COOKIE['login_cookie']);     $qu = mysql_query("SELECT `user_password` FROM `members` WHERE `username` = '".addslashes($user)."'");     if (mysql_num_rows($qu) == 1) {         $passw = mysql_fetch_object($qu);         if ($passw->user_password == $pass) {           $_SESSION['logged_in'] = 1;           $_SESSION['username'] = $user;             $_SESSION['password'] = $pass;         }     } } if(!isset($_SESSION['username']) && !isset($_SESSION['password'])) {   $_SESSION['logged_in'] = 0;   $user = "Guest"; }[/code] How would I do this?
  16. Ok, I'm making a member registration form and I have a field for their date of birth.  I have 3 different drop down menus for it:  one for the month they were born in, one for the day the were born on, and one for the year they were born in.  How do I make it so it will insert the data from all three dropdown menus into one table field? 
  17. Ok, there's no error now, but it doesn't change the file contents.  Lol, now it's displaying the CSS in the text area like 10 times.
  18. It's close.  I don't get errors before I click "Edit CSS", but when I click it, I get the same errors.
  19. Ok, I am trying to make a css editor, and the error message I get on my page is this: [code] Warning: fwrite(): supplied argument is not a valid stream resource in /home/mtech/public_html/programs/editor.php on line 17 Warning: fclose(): supplied argument is not a valid stream resource in /home/mtech/public_html/programs/editor.php on line 19 The CSS has been updated.[/code] This is my code: [code]<?php $filecontent = file_get_contents("bbultimate.css"); ?> <form method="post" action="editor.php"> <input type="hidden" name="filename" value="bbultimate.css"> <br> <textarea name="theText" cols="50" rows="15"><?php echo "$filecontent"; ?></textarea> <br> <input type="submit" value="Edit CSS"> </form> <?php $filename = $_POST["bbultimate.css"]; $theText = $_POST["theText"]; $theText = stripslashes($theText); $data = fopen($filename, "a"); fwrite($data,$theText); fclose($data); echo "The CSS has been edited"; ?>[/code] Can someone please help me?  Here is a link to the page: http://www.mtechdev.com/programs/editor.php
  20. Ok, I want to show a login form on my index page if the user isn't logged in.  How do I make it so the login form only shows up for users that aren't logged in?
  21. Ok, there's no error now, but it's not displaying anything...  Here it is: http://www.mutant-designs.com/programs/index.php Note:  That is the correct URL, I just forgot to add the "affiliates" directory and put all the files in it.  I'll get to it when I'm done with the program.
×
×
  • 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.