
3raser
Members-
Posts
815 -
Joined
-
Last visited
Everything posted by 3raser
-
Oh, alright. Thank you.
-
Because in the database it's a 1.
-
Why can I still post when the thread is locked? It's basically doing, if $locked==1 - You cannot post. Why won't it stop me from posting? <?php session_start(); ?> <style> a { color:black; font-weight:bold; } holder { width:600px; } table { width:600px; } </style> <?php session_start(); $session = $_SESSION['user']; $thread = $_GET['thread']; mysql_connect($mysql_host, $mysql_user, $mysql_password); mysql_select_db($mysql_database); $get_thread_exist = mysql_query("SELECT COUNT(id) FROM topics WHERE id='$id'"); $reply = $_POST['message']; $reply = mysql_real_escape_string($reply); $thread_post = $_POST['hidden']; $ip = $_SERVER['REMOTE_ADDR']; $date = date("M-D-Y"); $get_thread_lock = mysql_query("SELECT locked FROM topics WHERE id='$id'"); $locked = mysql_fetch_assoc($get_thread_lock); if(!$session) { echo "<center><div class='holder'><table border='1'><tr><td><center>Sorry, you must be logged in to access this page! <a href='index.php'>Home</a></center> <br/></td></tr></table></div></center>"; } elseif(!$thread && !$thread_post) { echo "". $locked ."<center><div class='holder'><table border='1'><tr><td><center>You haven't selected a thread to reply to! <a href='index.php'>Home</a></center> <br/></td></tr></table></div></center>"; } elseif(!$get_thread_exist) { echo "<center><div class='holder'><table border='1'><tr><td><center>You are trying to reply to a thread that doesn't exist! <a href='index.php'>Home</a></center> <br/></td></tr></table></div></center>"; } elseif($locked==1) { echo "<center><div class='holder'><table border='1'><tr><td><center>This topic is locked! <a href='viewtopic.php?id=". $id ."'>Back to topic</a></center> <br/></td></tr></table></div></center>"; } elseif(!$reply) { echo "<center><div class='holder'><table border='1'><tr><td><center><form action='reply.php' method='POST'><br/>Message: <br/><textarea name='message' rows='20' cols='35' maxlength='3000'></textarea><br/><br/> <input type='hidden' value='". $thread ."' name='hidden'><input type='submit' value='Submit Post'></form></center> <br/></td></tr></table></div></center>"; } elseif(strlen($reply) >= 15) { mysql_query("INSERT INTO posts VALUES ('', '$ip', '$date', '$session', '$reply', '$thread_post')"); mysql_query("UPDATE users SET postcount = postcount + 1 WHERE username='$session'"); mysql_query("UPDATE topics SET replies = replies + 1 WHERE id='$thread_post'"); echo "<center><div class='holder'><table border='1'><tr><td><center>Your post has been posted! <a href='viewtopic.php?id=". $thread_post ."'>Go back to thread</a>.</center> <br/></td></tr></table></div></center>"; } else { echo "<center><div class='holder'><table border='1'><tr><td><center>Sorry, you need to have at least 15 characters in your post!</center> <br/></td></tr></table></div></center>"; } ?>
-
The variable $choosen isn't getting the data from the form for some reason. <?php session_start(); ?> <style> a { color:black; font-weight:bold; } holder { width:600px; } table { width:600px; } </style> <?php session_start(); $session = $_SESSION['user']; mysql_connect($mysql_host, $mysql_user, $mysql_password); mysql_select_db($mysql_database); if(!$session) { echo "Sorry, you must be logged in to access this page!"; } else { $topic_title = $_POST['title']; $topic_message = $_POST['message']; $choosen = $_POST['select']; $topic_title = mysql_real_escape_string($topic_title); $topic_message = mysql_real_escape_string($topic_message); $ip = $_SERVER['REMOTE_ADDR']; $date = date("M-D-Y"); if(!$topic_title || !$topic_message || !$choosen) { echo "<center><div class='holder'><table border='1'><tr><td><center><form action='topic.php' method='POST'>Category:"; echo "<select name='select'>"; $sql = mysql_query("SELECT name FROM categories"); while ($row = mysql_fetch_assoc($sql)) { echo "<option value='". $row['id'] ."'>". $row['name'] ."</option>"; } echo "</select>"; echo "<br/><br/>Thread Title: <input type='text' name='title' maxlength='20'><br/><br/>Message: <br/><textarea name='message' rows='20' cols='35' maxlength='3000'></textarea><br/><br/><input type='submit' value='Post Thread'></form></center> <br/></td></tr></table></div></center>"; } elseif(strlen($topic_message) <= 15) { echo "<center><div class='holder'><table border='1'><tr><td><center>Sorry, you must have at least 15 characters in your topic message! <a href='topic.php'>Back</a></center> <br/></td></tr></table></div></center>"; } else { mysql_query("INSERT INTO topics VALUES ('', '$ip', '$date', '$session', '', '$topic_title', '$topic_message', '0')"); $id = mysql_insert_id(); mysql_query("INSERT INTO category_holder VALUES ('$choosen', '$id')"); echo $category; mysql_query("UPDATE users SET postcount = postcount + 1 WHERE username='$session'"); echo "<center><div class='holder'><table border='1'><tr><td><center>Posted! <a href='index.php'>Go home</a></center> <br/></td></tr></table></div></center>"; } } ?>
-
Thank you! Thats a new function to me. Thank you, once again!
-
I'm adding a category system to my forum script, and it's almost done. I'm just wondering, how am I suppose to get the thread ID to insert into category_holder? mysql_query("INSERT INTO topics VALUES ('', '$ip', '$date', '$session', '', '$topic_title', '$topic_message', '0')"); mysql_query("INSERT INTO category_holder (cat_id, topic_id) VALUES ('$category', '')");
-
What do you mean? I believe that is what I'm trying to do with the session.
-
How do I make like this: Someone clicks on item one or two, and it adds it to the cart. So say I added Item One to my cart two times, and Item Two to my cart three times. The session should (this is what I want it to do) look like this: 1-1-2-2-2 I'm trying to achieve this via the explode function. <?php $item_1 = "Item One <a href='loops_test.php?add=1'>Add Item</a>"; $item_2 = "Item Two <a href='loops_test.php?add=2'>Add Item</a>"; if($_GET['add'] == 1 || $_GET['add'] == 2) { $item = $_GET['add']; if($item == 1) { $item = 1; } else { $item = 2; } $generate_items = explode("-", $session); $_SESSION['items']=$generate_items; } echo $item_1."<br/>"; echo $item_2."<br/>"; echo $_SESSION['items']; ?>
-
Oh, alright. But how come this shows in my toolbar/taskbar: And when I right click it, and then select connect to a network: So why does it show an X, when I'm connected?
-
It's normal to have 218 million received packets and only 9 million sent?
-
My internet/computer is running smoothly. But why do I have so many packets? Sent: 4,198,684 Received: 67,417,941
-
Why is it {$row['username']} Why the {}'s
-
I'm trying to get a users information for each post that is displayed. I know the way my code is set-up is incorrect, but I couldn't think of any other ways. $get_replys = mysql_query("SELECT * FROM posts WHERE tothread='$id'"); while ($row = mysql_fetch_assoc($get_replys)) { $get_user_info = mysql_query("SELECT postcount FROM users WHERE username=$row['username']"); while ($row_info = mysql_fetch_assoc($get_user_info)) { $posts = $row_info['postcount']; $rights = $row_info['rights']; } switch($rights) { default: $rights = "User"; break; case 1: echo $rights = "MOD"; break; case 2: $rights = "ADMIN"; break; } echo "<center><table border='1'><tr><td>Reply posted by <b>". $row['username'] ." (". $posts ." posts - ". $rights .")</b></td></tr></table><table border='1'><tr><td>Posted on ". $row['date'] ."</td></tr><center></center>"; echo "<center><div class='holder'><table border='1'><tr><td><center>". $row['message'] ."</center></td></tr></table></div></center><br/><br/>"; }
-
Keep getting a parse error? Parse error: parse error in C:\wamp\www\learning\loops.php on line 12 <?php $array; $array[0] = "1"; $array[1] = "7"; $array[2] = "3"; $array[3] = "4"; $array[4] = "3"; $variable = "3"; foreach($array as => $variable) { $number = 1 + $number; echo $number; } ?>
-
Thank you! But why does it still say Failure?
-
Now I'm starting to get the hang of it, but I just introduced arrays to functions and it's a bit confusing. <?php include("functions.php"); $name[0] = "Justin"; $name[1] = "John"; $name[2] = "Tanner"; echo Test($name); ?> <?php function Test($name) { if($name[0]=="Justin") { echo "Success."; } else { echo "Failure."; } return $name; } ?> Why is that giving me the result: Failure.Justin
-
Rofl....... Thank you.
-
My first or second time learning/using functions. My error: Parse error: parse error in C:\wamp\www\learning\functions.php on line 9 Index.php <?php include("functions.php"); $array = array("dog","cat","wolf"); echo ImplodeTest($array, $space_them); ?> Functions.php <?php function ImplodeTest($array, $space_them) { $space_them = implode('-', $array); return $space_them; { ?>
-
What does the PHP implode really do, and how do you use it? I looked up a tutorial on the PHP manual, but the tutorials their are to complicated and are for more experienced users. Any tutorials or examples for walk throughs?
-
Parse error: syntax error, unexpected T_STRING in /home/hero/public_html/forums/post_config.php on line 110 if(isset($_SESSION['admin']) || $authorized || isset($_SESSION['mod'])) { $ids = implode(', ', $_POST['post']); $error = false; foreach($_POST['post'] as $thread) { if(!is_numeric($thread)) { $error = true; break; } } if(!$error) { switch($_POST['action']) { case 'delete': if(mysql_query("DELETE FROM {$prefix}posts WHERE id IN ($ids)")) { mysql_query(UPDATE users SET dp = dp - 0.005 WHERE id IN (SELECT author FROM posts WHERE id IN ($ids))); echo '<p>Post(s) successfully deleted. <a href="index.php">Back to forum</a>.</p>'; } break; default: echo '<p>You have not selected an action. <a href="index.php">Click Here</a> to go to the forum index</p>'; } } else { echo '<p>You have chosen invalid IDs. Please choose new ones <a href="index.php">here</a>.'; } } else { echo '<p>You need to be logged in as an administrator or moderator to do this.</p><p><a href="login.php">Click Here</a> to log in.'; }
-
No. 1) A moderator selects one or multiple posts. 2) They click "GO" 3) $ids is basically getting all or one of the posts selected 4) I'm trying to extract the info for EACH post selected $get_poster = mysql_query("SELECT author FROM posts WHERE id IN ($ids)"); 5) I'm trying to update the points for each post author (basically getting all of the authors for each post in $get_poster) using this mysql_query: $action_lower = mysql_query("UPDATE users SET dp = dp - 0.005 WHERE id IN ($get_poser)");
-
Not really. I need to get the users username first. $ids is the post selected.
-
Here is my code if(isset($_SESSION['admin']) || $authorized || isset($_SESSION['mod'])) { $ids = implode(', ', $_POST['post']); $error = false; foreach($_POST['post'] as $thread) { if(!is_numeric($thread)) { $error = true; break; } } if(!$error) { switch($_POST['action']) { case 'delete': $get_poster = mysql_query("SELECT author FROM posts WHERE id IN ($ids)"); $action_lower = mysql_query("UPDATE users SET dp = dp - 0.005 WHERE id IN ($get_poser)"); if(mysql_query("DELETE FROM {$prefix}posts WHERE id IN ($ids)")) { echo '<p>Post(s) successfully deleted. <a href="index.php">Back to forum</a>.</p>'; } break; default: echo '<p>You have not selected an action. <a href="index.php">Click Here</a> to go to the forum index</p>'; } } else { echo '<p>You have chosen invalid IDs. Please choose new ones <a href="index.php">here</a>.'; } } else { echo '<p>You need to be logged in as an administrator or moderator to do this.</p><p><a href="login.php">Click Here</a> to log in.'; } As you see, I'm trying to get all the authors for each post selected, which is $ids. How would I make it so it updates every users points to be - 0.005? - I'm trying to do that at $action_lower
-
?................................
-
Code works, thanks! And what do you mean by this?