Jump to content

doddsey_65

Members
  • Posts

    902
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by doddsey_65

  1. You need to include \'s echo "Title:<br>"; echo "<input type=\"text\" name=\"title\" value=\"{$row['Title']}\" />";
  2. onclick="return confirm(\'You are being redirected to \\1. Proceed?\') That is a javascript alert box with confirm/cancel properties
  3. thats what i am after and i did try it but the popup just echos \\1 it doesnt print the actual url
  4. What I mean is $YOUR_VARIABLE_INSIDE_HERE needs to be the url they are clicking. The href. Eg/ $replace='<a href="\\1" onclick="return confirm(\'You are being redirected to '.$YOUR_VARIABLE_INSIDE_HERE.'\'));">link</a>';
  5. thanks for the info. But how would i add the url into a variable so i could call it in the popup box?
  6. yes
  7. Im having trouble deleting the selected checkboxes in my form. I have tried several options out there but none seem to work. here is the code i have which generates the checkboxes. i am alos using jquery to select all. <form name="checkboxes" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> This is within the while loop: echo "<input value=\"{$messages_info->message_id}\" style=\"float:left;\" type=\"checkbox\" name=\"checkbox\" />"; <a href="<?php echo $site_root; ?>/user_center.php?user=<?php echo $_GET['user']; ?>&do=messages&action=del_marked"> Delete Marked</a> </span> Anyone have any ideas? Thanks
  8. basically what i am trying to do is replace the <a href="whatever.com"> with <a href="whatever.com" onclick = "if (! confirm("Continue?")) return false;"> so that when the user clicks the url in a message the box pops up first then redirects them to the url if they click confirm. However i am getting the following error: Warning: preg_replace() [function.preg-replace]: Compilation failed: reference to non-existent subpattern at offset 11 here is the code i used. $message_content = $content_info['message_content']; $pattern='<a href="\\1">'; $replace='<a href="\\1" onclick = "if (! confirm("Continue?")) return false;">'; $message_content = preg_replace($pattern, $replace, $message_content); echo $message_content; Anyone know where i went wrong?
  9. thanks twitch. I did in the end use jquery. I did find some scripts that did it for me but jquery was the better choice. I do have an offtopic question regarding your code though. at the beginning you add: $detail=$_POST["id"]; $detail = mysql_real_escape_string($detail); but i would use: $detail = mysql_real_escape_string($_POST["id"]); is there any difference? I dont think there would be but you never know. Also where you use: $query = "SELECT * FROM your_table WHERE id = '$detail'"; $qry_result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($qry_result)){ i would use: $query = mysql_query("SELECT * FROM your_table WHERE id = '$detail'") or die(mysql_error()); while($row = mysql_fetch_array($query )){ Like i said just interested to know if there is any difference. Thanks
  10. i am making a private messaging system like hotmails where the message list appears on the left. Then when you click on one of them the box on the right loads the email. The problem is i dont really know how to go about it. Anyone have any pointers?
  11. thanks for the reply, i didnt know i could join the same table twice. Ill try it now.
  12. Okay so I have 2 forums, which each have 1 topic and atleast 1 post within those topics lets call them forum 1 and forum 2 where the number is the id in the database under forum_id they are in a parent with a parent id of 1 so the database layout is forum_id - forum_parent_id 1 1 2 1 but i want to add a child board/subforum to forum_id 1. So i added two more columns forum_type f for forum or c for child board forum_connection the forum id this child is in(if its a child) but how would i get forum child with a forum_connection of 1 to appear under the forum with an id of one? here is my query: $query = $db->query("SELECT f.forum_id, f.forum_name, f.forum_description, f.forum_topics, f.forum_posts, f.forum_type, forum_connection, f.forum_last_poster, f.forum_last_post_time, f.forum_last_post, p.parent_id, p.parent_name, m.user_id, m.user_username, m.user_group, t.thread_topic_id, t.topic_name FROM forum_parents as p JOIN forum_forums as f ON f.parent_id = p.parent_id LEFT JOIN forum_members as m ON f.forum_last_poster = m.user_username LEFT JOIN forum_topics as t ON t.topic_name = f.forum_last_post WHERE f.forum_type = 'f' ORDER BY p.parent_id, f.forum_id ASC") or trigger_error("SQL", E_USER_ERROR); hopefully someone will understand this lol
  13. thanks it works perfectly now there isnt a time format to display without leading 0's so i used your code.
  14. PDO::PARAM_STR ); that bracket shouldnt be there im thinking, but without a look at the full code i cant be sure
  15. thanks for the advice, i got it working before i read your post anti-moronic but a slight issue. when the post was made less than 30 minutes ago it shows how many minutes ago it was made. but it has a leading 0 eg 05 minutes ago. how would i replace that 0 or remove it? my code: $last_post = strtotime($topic_info->topic_last_post_time); $today = strtotime('NOW'); $last_post_gap = $today - $last_post; $last_post_gap = date('i',($last_post_gap)); $min = strtotime('- 1 MINUTE'); $normal = strtotime('- 30 MINUTES'); if ($last_post <= $normal) { echo '<p class="last_post_date">'.date('F j, Y g:i a', strtotime($topic_info->topic_last_post_time)); } elseif ($last_post >= $min) { echo '<p class="last_post_date">Less Than 1 Minute Ago'; } else { echo "<p class=\"last_post_date\">{$last_post_gap} minutes ago"; }
  16. why not is test0.php use: <html> <head> </head> <body> <?php include ('test.php'); ?> <img src="$image; ?>"/> </body> </html>
  17. im no expert but from the looks of your code you are assuming that i will know the page number. But thats my problem because when its inserted into the database i wont know which page number it is on to redirect to. I could use several if statements but surely theres a better way.
  18. anyone?
  19. I am using a header redirect after a user makes a post which goes to their post. example they made a post which has an id of 236, then the url redirect would be index.php?forum=1&topic=1&post=236#p236 i have the <a name> set up on each post and it works fine until the post is on a different page. the url should be: index.php?forum=1&topic=1&page=2&post=236#p236 but how would i be able to tell the header redirect which page to go to. I was thinking if statements like: if ($number_of_results >=10) { $page = 2; } but that would involve alot of if statements with no way of knowing how many pages the topic could have. Is there an easier way?
  20. that sounds a bit complicated. Any tips? Here is the code for the textarea and preview box: <textarea class="test" id="reply" name="test" style="height:350px;width:785px;"></textarea> <script type="text/javascript"> $("textarea").keyup(function () { var value = $(this).val(); $("#preview").text(value); }).keyup(); </script> <p id="preview"> Your Preview will appear here </p> And here is some of the bbcode parser: class bbParser{ public function __construct(){} public function getHtml($str){ $bb[] = "#\[b\](.*?)\[/b\]#si"; $html[] = "<b>\\1</b>"; $bb[] = "#\[i\](.*?)\[/i\]#si"; $html[] = "<i>\\1</i>"; $bb[] = "#\[u\](.*?)\[/u\]#si"; $html[] = "<u>\\1</u>"; $str = preg_replace ($bb, $html, $str); return $str; } } you can see it here: http://thevault.cz.cc/new_post.php?forum=1&topic=65 You will need to login with username:public and password:public then click Post reply at the bottom left.
  21. server side
  22. basically when a user enters something into textarea the content of the text area is added to the <p> as you type. but when you click a bbcode button(lets say Bold) the content of the text area will be [bold]the word[/bold]. But then the preview box will also look the same because its generated using jquerys .val(). <script type="text/javascript"> $("textarea").keyup(function () { var value = $(this).val(); $("#preview").text(value); }).keyup(); </script> so how would i be able to format $("#preview").text(value); with my bbparser?
  23. i have some code which displays text area contents in a preview box using jquery. but this is for a forum which means the text area will contain something like word. This will just print the . I know i can replace that with str_replace but that means the contents of the textarea need to be in a variable. so how do i add it into a variable? <script type="text/javascript"> $("textarea").keyup(function () { var value = $(this).val(); $("#preview").text(value); }).keyup(); </script> <p id="preview"> Your Preview will appear here </p>
  24. Im trying to find the time between the last database entry and the current time and then echo it so it says something like '2 minutes ago'. I tried doing: $last_post_gap = strtotime('NOW') - strtotime($topic_info->topic_last_post_time); $last_post_gap = date('i', strtotime($last_post_gap)); $last_post = date('F j, Y', strtotime($topic_info->topic_last_post_time)); if ($last_post <= '- 1 DAY') { $last_post = 'Yesterday at '.date("g:i a", strtotime($topic_info->topic_last_post_time)); } if ($last_post <= '- 1 MINUTE') { $last_post = 'Less Than 1 Minute Ago'; } else { $last_post = $last_post_gap.' Minutes Ago'; } but that just displays 0 minutes ago regardless of the time. Is there anything im missing?
  25. I have the following query which selects all the info i need for the current page and displays it. $topic_info_query = $db->query("SELECT f.forum_id, f.forum_name, m.user_id, m.user_username, m.user_group, t.thread_topic_id, t.topic_name, t.topic_poster, t.topic_time_posted, t.topic_views, t.topic_replies, t.topic_last_poster, t.topic_last_post_time, t.topic_locked, t.topic_sticky, t.topic_edited FROM ".DB_PREFIX."topics as t LEFT JOIN ".DB_PREFIX."members as m ON t.topic_poster = m.user_username LEFT JOIN ".DB_PREFIX."forums as f ON t.forum_id = f.forum_id WHERE t.forum_id = '$forum_id' ORDER BY t.topic_last_post_time DESC") or trigger_error("SQL", E_USER_ERROR); $topic_num_rows = mysql_num_rows($topic_info_query); while ($topic_info = mysql_fetch_object($topic_info_query)) you can see the code working here: http://thevault.cz.cc/index.php?forum=4 However the last post section doesnt work. This is because the LEFT JOIN which joins the members table is on the topic_starter. but i cant add another join for the topic_last_poster cos they would go to the same thing user_username which wouldnt work. so how do i retain the join for the topic_starter while somehow getting the last_poster to work? I was under the assumption that i may have to create a new db table with seperate user information in but im not sure.
×
×
  • 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.