Jump to content

Lamez

Members
  • Posts

    1,686
  • Joined

  • Last visited

    Never

Everything posted by Lamez

  1. ya I fixed that after I posted, the variable. I fixed all the errors, I just missed some ; and some " but the out come it not what I want it when you view the board it would look like this Subject one another topic a new title or whatever they name it, and it will link to the post, but it does not link it right I want the link to look like ?topic=subject one or whatever they name it, then in the topic, it shows the message, and username that is working either. any help? Sorry guys
  2. Alright, I am making a message board, and I cannot get it to work properly I want the viewboard to look like this (those will be links) A Title Another Title One More Title then you can click on the links, or titles and it redirects you to the page with the message, and other info like user and so on.. Well I am getting errors all over the place this is what I have: on post.php: (already connected to the DB, I took it out the code.) <html> <head> <title>Post a Topic</title> </head> <body> <?php if (!isset($_POST['submit'])) { ?> <form action="" method="post"> :title: <label> <input name="title" type="text" id="title" maxlength="50"> </label> <br> message: <textarea name="message" cols="50" rows="15" id="message"></textarea> <br> <input type="submit" name="submit" value="Submit!"> </form> <?php } else { $title = $_POST['title']; $username = $session->username; $comment = $_POST['message']; mysql_query("INSERT INTO `comment` (title, username, message) VALUES ('$title','$username', '$message')"); echo "Your Comment has been added.<br>"; print '<a href="view.php">View Message Here</a>'; } ?> </body> </html> view.php: (this is the page I am having trouble with) $query = "SELECT title, username, message FROM board"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $getlink = $_GET["topic"]; if ($getlink == "{$row['title']}") { echo "Username :{$row['username']} <br>" . "Subject : {$row['title']} <br>" . "Message : {$row['message']} <br><br>"; } else { echo "<a href=\"?topic={$row['title']}\">{$row['title']}</a><br>"; } } The ouput is it shows all the messages on one page, not divided up like I wanted (?topic=<TOPIC TITLE>) I am not sure what I am doing wrong, any help?
  3. Well I just figured it out, here is my script, well a test script: <?php include ("../style/include/session.php"); $db_host = " "; $db_user = " "; $db_pwd = " "; $db_name = " "; mysql_connect($db_host, $db_user, $db_pwd); mysql_select_db($db_name); ?> <html> <head> <title>My first MySQL form submission</title> </head> <body> <?php if (!isset($_POST['submit'])) { ?> <form action="" method="post"> Comment: <input type="text" name="comment"><br> <input type="submit" name="submit" value="Submit!"> </form> <?php } else { $username = $session->username; $comment = $_POST['comment']; mysql_query("INSERT INTO `comment` (username, comment) VALUES ('$username', '$comment')"); $query = "SELECT username, comment FROM comment"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "Name :{$row['username']} <br>" . "Comment : {$row['comment']} <br>"; print '<br><br>'; } } ?> </body> </html> I was playing around with variables, and such, then I googled mySQL data, and found some help there, so that is what I came up with above. Thanks though, I guess I need to research before posting!
  4. Lamez

    Cron Jobs

    I have a online script, it tells when I am online, or any other user I set using my variables, and it also tells how many guest are online, and such want it? you can see it here: www.lamezz.com (in the top left corner) and here: www.lamezz.com/user/viewmembers.php
  5. how do I pull information from a table in a MySQL database, and display it in a webpage? I am guessing you would select the table, then set the rows into strings, then place the strings where I want them, but how?
  6. Hey Guys, How do I make it when I hit enter in a text area, into a line break? -Thanks
  7. You will need to some researching, start with one form system, and find out how the login script works, do that will all, then edit all the form actions to fit your needs.
  8. Alright, I have another question. I have been working on this for a couple of weeks now, nothing is turning out good at all. After deleting my last script, I decided to ask here. How do I take the information that the user just uploaded to a directory and add it to the database under their name? I want my users to be able to upload a image, and set it as their avatar. Any Help? Thanks guys!
  9. It might not be the scripts, if you are hosting the site on your own server, then it might be your hardware. Are you, if so what are the server specs.?
  10. well, the session.php is my code, that is why I asked here sorry. please answer this: do I need to remove some cookies, if so where?
  11. oh thanks guys, I downloaded the script, I really did not read over the script. So I need to move my cookies
  12. Here is some of the code session.php: <? /** * Session.php * * The Session class is meant to simplify the task of keeping * track of logged in users and also guests. * * Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC) * Last Updated: August 19, 2004 */ include("database.php"); include("mailer.php"); include("form.php"); class Session { var $username; //Username given on sign-up var $userid; //Random value generated on current login var $userlevel; //The level to which the user pertains var $time; //Time user was last active (page loaded) var $logged_in; //True if user is logged in, false otherwise var $userinfo = array(); //The array holding all user info var $url; //The page url current being viewed var $referrer; //Last recorded site page viewed /** * Note: referrer should really only be considered the actual * page referrer in process.php, any other time it may be * inaccurate. */ /* Class constructor */ function Session(){ $this->time = time(); $this->startSession(); } /** * startSession - Performs all the actions necessary to * initialize this session object. Tries to determine if the * the user has logged in already, and sets the variables * accordingly. Also takes advantage of this page load to * update the active visitors tables. */ function startSession(){ global $database; //The database connection session_start(); //Tell PHP to start the session /* Determine if user is logged in */ $this->logged_in = $this->checkLogin(); I do not think it is session.php, I think it is this file: pwcode.php: <?php ############################################################### # Page Password Protect 2.13 ############################################################### # Visit http://www.zubrag.com/scripts/ for updates ############################################################### # # Usage: # Set usernames / passwords below between SETTINGS START and SETTINGS END. # Open it in browser with "help" parameter to get the code # to add to all files being protected. # Example: password_protect.php?help # Include protection string which it gave you into every file that needs to be protected # # Add following HTML code to your page where you want to have logout link # <a href="http://www.example.com/path/to/protected/page.php?logout=1">Logout</a> # ############################################################### /* ------------------------------------------------------------------- SAMPLE if you only want to request login and password on login form. Each row represents different user. $LOGIN_INFORMATION = array( 'zubrag' => 'root', 'test' => 'testpass', 'admin' => 'passwd' ); -------------------------------------------------------------------- SAMPLE if you only want to request only password on login form. Note: only passwords are listed $LOGIN_INFORMATION = array( 'root', 'testpass', 'passwd' ); -------------------------------------------------------------------- */ ################################################################## # SETTINGS START ################################################################## // Add login/password pairs below, like described above // NOTE: all rows except last must have comma "," at the end of line $LOGIN_INFORMATION = array( 'work' => 'test' ); // request login? true - show login and password boxes, false - password box only define('USE_USERNAME', false); // User will be redirected to this page after logout define('LOGOUT_URL', 'http://www.lamezz.info/'); // time out after NN minutes of inactivity. Set to 0 to not timeout define('TIMEOUT_MINUTES', 160); // This parameter is only useful when TIMEOUT_MINUTES is not zero // true - timeout time from last activity, false - timeout time from login define('TIMEOUT_CHECK_ACTIVITY', true); ################################################################## # SETTINGS END ################################################################## /////////////////////////////////////////////////////// // do not change code below /////////////////////////////////////////////////////// // show usage example if(isset($_GET['help'])) { die('Include following code into every page you would like to protect, at the very beginning (first line):<br><?php include("' . str_replace('\\','\\\\',__FILE__) . '"); ?>'); } // timeout in seconds $timeout = (TIMEOUT_MINUTES == 0 ? 0 : time() + TIMEOUT_MINUTES * 60); // logout? if(isset($_GET['logout'])) { setcookie("verify", '', $timeout, '/'); // clear password; header('Location: ' . LOGOUT_URL); exit(); } if(!function_exists('showLoginPasswordProtect')) { // show login form function showLoginPasswordProtect($error_msg) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="style/default.css"/> <link rel="shortcut icon" href="style/img/favicon.ico"> <title>Registration Code</title> </head> <body> <div class="body"> <div class="logo"><img src="style/img/logo.png" alt="March Madness Logo" border="0"/></div> <?php include ("style/include/cons/nav.php"); ?> <div class="box"> <h2>Registration Code</h2> <form method="post"> <table width="378" border="0"> <tr> <td width="62" align="left">Code</td> <td width="150" align="left"><input type="password" name="access_password" /></td> <td width="152" align="left"><font color="red"><?php echo $error_msg; ?></font></td> </tr> <tr> <td align="left"> </td> <td align="left"><input name="Submit" type="submit" id="Submit" value="Continue" /></td> <td align="left"> </td> </tr> </table> </form> </div> <div class="footer"> Site Template & Original Site Content<br /> © 2007-2008 <a href="mailto:wizkid916@yahoo.com">James Little</a> </div> </div> </body> </html> <?php // stop at this point die(); } } // user provided password if (isset($_POST['access_password'])) { $login = isset($_POST['access_login']) ? $_POST['access_login'] : ''; $pass = $_POST['access_password']; if (!USE_USERNAME && !in_array($pass, $LOGIN_INFORMATION) || (USE_USERNAME && ( !array_key_exists($login, $LOGIN_INFORMATION) || $LOGIN_INFORMATION[$login] != $pass ) ) ) { showLoginPasswordProtect("* Invalid Code"); } else { // set cookie if password was validated setcookie("verify", md5($login.'%'.$pass), $timeout, '/'); // Some programs (like Form1 Bilder) check $_POST array to see if parameters passed // So need to clear password protector variables unset($_POST['access_login']); unset($_POST['access_password']); unset($_POST['Submit']); } } else { // check if password cookie is set if (!isset($_COOKIE['verify'])) { showLoginPasswordProtect(""); } // check if cookie is good $found = false; foreach($LOGIN_INFORMATION as $key=>$val) { $lp = (USE_USERNAME ? $key : '') .'%'.$val; if ($_COOKIE['verify'] == md5($lp)) { $found = true; // prolong timeout if (TIMEOUT_CHECK_ACTIVITY) { setcookie("verify", md5($lp), $timeout, '/'); } break; } } if (!$found) { showLoginPasswordProtect(""); } } print '</div>'; ?>
  13. I tried putting it at the top, nothing, same error. I have also read that thread, before posting. I am not too sure what is wrong, should I post some more code?
  14. alright, on my registration page, I made it where you enter a code before you can register, well after you enter the code correct, it gives me these errors: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /mounted-storage/home48c/sub007/sc33591-LWQU/lamezz.info/style/include/pwcode.php:194) in /mounted-storage/home48c/sub007/sc33591-LWQU/lamezz.info/style/include/session.php on line 45 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /mounted-storage/home48c/sub007/sc33591-LWQU/lamezz.info/style/include/pwcode.php:194) in /mounted-storage/home48c/sub007/sc33591-LWQU/lamezz.info/style/include/session.php on line 45 here is line 45 of session.php: session_start(); when I take this line out, the registration does not work. any help?
  15. you are right, it is defined in the registration script like this: <input type="text" name="code" maxlength="50" value="<? echo $form->value("code"); ?>" />
  16. This is a code I will give out to people to use on the registration
  17. alright I have changed up the code a bit, just variables really. but now I get the error * Code not entered here is the whole code checking: $field = "code"; //Use field name for code if(!$code || strlen($subcode = trim($code )) == 0){ $form->setError($field, "* Code not entered"); } else{ $ncode = "testcode"; if ($code != $ncode) { $form->setError($field, "* Invaild Code"); }
  18. I am trying to have a sign up code on my website, this will allow the user to sign up, only permitted users will have the code. Well I have been racking my brain on how to do this. I want to set the password through the php script, this is what I have so far: else{ $code = "testcode"; if ($_POST['code'] != $code {$form->setError($field, "* Invaild Code"); } } but it does not work, what am I doing wrong? User still can sign up.
  19. ya, I think I am going to take it off, and just have the blue background
  20. everyone, mostly teenagers
  21. can you guys post your resolution. I am running ff 2.x on 1440x900 and it looks fine, and a screen shot would be good as well
×
×
  • 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.