Jump to content

doddsey_65

Members
  • Posts

    902
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by doddsey_65

  1. in pseudocode: <table> <tr> <td>$user_avatar</td> <td><p>$user_name</p><p>$user_reg_date</p></td> </tr> </table>
  2. i tried the array but dont know how to go about the foreach loop
  3. when i echo it displays all of the results. but i wanted it in a variable because it needs to be called later. Also all of the results display on the same line if i echo them and i need them in individual table tds
  4. $likes = explode(", ", $p_name_info['post_likes']); post_likes is a db table with content like user1, user2, user3 there is no case sensitive issue but to be safe i added strtolower on the array and database field but still only shows one result
  5. i did that but it only echoes one username: $user_query = mysqli_query($link, "SELECT user_username, user_avatar, user_regdate FROM ".TBL_PREFIX."members ") or die(mysqli_error($link)); while($user_info = mysqli_fetch_array($user_query, MYSQLI_ASSOC)) { if (in_array($user_info['user_username'], $likes)) { $user_name .= profile_link("", $user_info['user_username'], ""); $user_avatar .= "<img src=\"./avatars/{$user_info['user_avatar']}\" alt=\"avatar\" />"; $user_reg_date .= asf_date($user_info['user_regdate'], 1); } }
  6. I am trying to pull the username for everyone who appears within an array. How would i go about this? something like this maybe? SELECT * FROM users WHERE username (in_array($users))
  7. if only i could think before posting lol. Thanks for the addon info ken. Works perfect.
  8. thanks for the help. I cant get it to work though. It shows an error on allowed extensions. here is the code now: $ext = strtolower(pathinfo($_FILES['Filedata']['name'], PATHINFO_EXTENSION)); $f_types = explode(',',$f_types_info['file_types']); if (!in_array($ext, $f_types)) { $error = "File Type (.$ext) Not Allowed<br />Only $f_types[1] are allowed"; } but when i load something with ext .jpg it shows an error even though .jpg is in the array list: content of db table: .jpg, .jpeg, .png, .gif
  9. i am trying to get the allowed file types from the database into a switch statement but with no luck so far. They types are in the database like: jpg, png, gif. All seperated with a comma and all in one db column. I am then splitting them at the comma and inserting them into $file_list. In the switch statement i want it to be like: switch($ext) { case "jpg": case "png": case "gif": break; } how can i make this possible? here is my code so far: $ext = strtolower(pathinfo($_FILES['Filedata']['name'], PATHINFO_EXTENSION)); $f_types = $f_types_info['file_types']; $f_types = preg_split("|\,|", $f_types); $types = count($f_types); $file_list = ""; for($i=0; $i<$types; $i++) { $file_list .= $f_types[$i]; } switch ($ext) { case $file_list: break; default: $error = "File Type Not Allowed"; break; }
  10. i know how to get the actual filename into the session i just used "example" as an example. but either way it doesnt write the session.
  11. i have an upload form and a posting form on the same page. when you upload a file it is uploaded to the server. what i am then trying to do is add the name of the file to $_SESSION['attachment'] so i can use it later. When the user posts their form i want the session to be inserted into the database but the session always comes up empty. this is what happens when they upload their file Setting the session and moving the file: session_start(); $_SESSION['attachment'] = "EXAMPLE"; move_uploaded_file($_FILES['Filedata']['tmp_name'], "../attachments/" . time() . $_FILES['Filedata']['name']); and then when they submit their form(textarea) it uploads the contents to the database and the contents of the session aswell. Why is this session always empty?
  12. i am using mod_rewrite for seo friendly urls. Take this page for example http://www.thevault.cz.cc/new_post/thread/forum_and_site_news/welcome_to_asf that page calls a js file located in: root/modules/parser.php the problem i am having is calling that file using javascript. when i use relative paths ./modules/parser.php it doesnt work. but even using absolute paths doesnt work. it adds the full url onto the existing one so it becomes: http://www.thevault.cz.cc/new_post/thread/forum_and_site_news/welcome_to_asf/http://www.thevault.cz.cc/modules/parser.php is there a way to do this properly? to get the absolute path in the js file i am using: document.location.protocol + "//" + document.root.hostname + "/modules/parser.php"
  13. sorry i forgot to update this. I solved it by adding: document.location = "./login_redirect.php" then in login_redirect.php i would redirect to the correct page based on sessions.
  14. i have tried using the <code> html tage but this doesnt work either. I am able to see exactly what it looks like in a post because of the jquery preview box on the same page which updates when the text in the textarea is changed. <script type="text/javascript"> $(document).ready(function(){ $("#message").bbcode({tag_bold:true,tag_italic:true,tag_underline:true,tag_link:true,tag_image:true,button_image:true, tag_code:true}); process(); }); var bbcode=""; function process() { if (bbcode != $("#message").val()) { bbcode = $("#message").val(); $.get('./bbParser.php', { bbcode: bbcode }, function(txt){ $("#preview").html(txt); }) } setTimeout("process()", 10); } </script> with everything in the preview box being printed as html with: $("#preview").html(txt); could this be the problem? This is what i am doing: [code = php]<a href="">This isnt a link</a>[ / code]
  15. i am wanting to add a code tag to my bbcode list. Anything within this tag will be printed as is(like the html code). I have tried using htmlspecialchars() but it isnt printing the code. Here is the parser section for the tag: $patern = "#\[code = ([^\]]*)\]([^\[]*)\[/code\]#i"; $replace = "<table class=\"code\"> <tr> <th>\\1</th> </tr> <tr> <td>".htmlspecialchars('\\2')."</td> </tr> </table>"; $str=preg_replace($patern, $replace, $str); Any ideas?
  16. the problem i have is that this is for my login system. the login page is login.php which sets variables and pulls the content from login_page.html. when they click login the posted data is posted via a javascript file called login_functions.js, which is using jquery to stay on current page without having to reload. this login_functions.js passes the posted data to login_process which check the info posted, then sends a response back to login_functions.js. if the response is good then login_functions.js redirects. i want it to redirect to the cookie which has been set(they are redirected to the page they were going to before having to login). so what about turning the page into login_functions.php and having: <script type="text/javascript"> to enclose the js and then: document.location = <?php echo $_COOKIE['fwd_page']; ?>; for the redirect.
  17. can i add php variables into a js file? i have tried this: document.location = <?php echo $_SESSION['fwd_page']; ?>; but it doesnt work.
  18. this rule doesnt work as such. it loads the page but not any css. RewriteRule ^f/([a-zA-Z0-9_-]+)/t/([a-zA-Z0-9_-]+)/?$ view_posts.php?fid=$1&tid=$2 anything i did wrong?
  19. i have a rule that rewrites view_topics.php?fid=forum_name into /forum_name. how would i go about rewriting this: view_topics.php?fid=1&tid=2 to: /forum_name/topic_name/ this is the rule i have for the top one. RewriteRule ^([a-zA-Z0-9_-]+)$ view_topics.php?fid=$1 RewriteRule ^([a-zA-Z0-9_-]+)/$ view_topics.php?fid=$1
  20. since i started this topic ASF has undergone a ton of changes. You can see the new changes here: http://thevault.cz.cc I have started from scratch so these are the only pages that work: the main index page the topic viewing page i also have the register page and login pages done but they arent formatted properly. thanks
  21. ok so i am using relative timestamps on my forum. if a post was created less than 1 hour ago then it will display something like 32 minutes ago. If it was posted more than 1 hour ago it will display "posted today at 10:00pm", or if it was older than 1 day then it will display the absolute time stamp. My question is how do i get them to update automatically like facebook does? i would like to use jquery for this but after searching i cant make heads or tales of any of it. so to sumarise i would like the timestamps to update without having to refresh the page. Thanks
  22. no my $crumbs array is array( "index.php" => "Board Index", "./view_category.php?cid={$crumb_info['cat_id']}" => $crumb_info['cat_name'], "./view_topics.php?fid=$forum_id" => $crumb_info['forum_name']); the values are taken from the database as are part of the keys. also adding the implode like that to the variable using the .= operator just repeats the same thing.
  23. when i remove the implode function it works fine and they are links. whats wrong with the implode function then?
  24. I have a foreach loop which shows the breadcrumb display. But it's stopped working. For some reason the links are no longer links. They are just echoed on screen with no <a> tags. setting up array: $crumb_query = mysqli_query($link, "SELECT f.forum_id, f.forum_cat_id, f.forum_name, c.cat_id, c.cat_name FROM ".TBL_PREFIX."forums as f LEFT JOIN ".TBL_PREFIX."categories as c ON c.cat_id = f.forum_cat_id WHERE f.forum_id = '$forum_id' ") or die(mysqli_error($link)); $crumb_info = mysqli_fetch_array($crumb_query, MYSQLI_ASSOC); $crumbs = array("index.php" => "Board Index", "./view_category.php?cid={$crumb_info['cat_id']}" => $crumb_info['cat_name'], "./view_topics.php?fid=$forum_id" => $crumb_info['forum_name']); echo build_crumbs($crumbs); the function: function build_crumbs($crumbs) { foreach($crumbs as $key => $value) { $crumb_display = "<a href=\"{$key}\">{$value}</a>"; $crumb_display = implode(" - ", $crumbs); } return $crumb_display; } can anyone see where im going wrong?
  25. it has to be something to do with the require_once as i am getting it everywhere now. index.php requires header.php which requires config.php config.php has the variables for connection.(host, user, pass etc) header.php sets up the connection and connects and index.php runs a query but i am getting: Notice: Undefined variable: link everywhere i run a query. config.php: $config['database']['database'] = 'database'; $config['database']['hostname'] = 'localhost'; $config['database']['username'] = 'user'; $config['database']['password'] = 'password'; header.php require_once("config/config.php"); $link = mysqli_connect($config['database']['hostname'], $config['database']['username'], $config['database']['password'], $config['database']['database']); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } index.php: require_once("includes/header.php"); $query = mysqli_query($link, "SELECT f.forum_id, f.forum_name, f.forum_description, f.forum_topics, f.forum_posts, f.forum_last_poster, f.forum_last_post_time, f.forum_last_post, f.forum_cat_name, f.forum_cat_id, f.forum_image, c.cat_id, c.cat_name, m.user_id, m.user_username, m.user_group, m.user_date_format, m.user_description_display, t.topic_id, t.topic_name FROM ".TBL_PREFIX."categories as c JOIN ".TBL_PREFIX."forums as f ON f.forum_cat_id = c.cat_id LEFT JOIN ".TBL_PREFIX."members as m ON f.forum_last_poster = m.user_username LEFT JOIN ".TBL_PREFIX."topics as t ON t.topic_name = f.forum_last_post ORDER BY c.cat_id, f.forum_id ASC") or trigger_error("SQL", E_USER_ERROR); // Loop through records to process data $catData = array('cat_id' => false); while ($forum_info = mysqli_fetch_object($query)) this query fails for no apparent reason!
×
×
  • 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.