Jump to content

pianoman993

Members
  • Posts

    68
  • Joined

  • Last visited

    Never

Everything posted by pianoman993

  1. Hello .htaccess geniuses! I have a small question for you. Would it be possible to: Detect "mysite.com/#/profile" in a url and change it to "mysite.com/profile?" (all within a .htacces file?) If so, what kind of code would I have to use to implement such a task? I'm assuming I need an if statement followed by a 301 redirect, but I'm not sure what that kind of code would look like. Any help would be greatly appreciated!! Thanks in advance! Mark Anderson
  2. Thanks Joel! I'll definitely see what I can do with this
  3. Hey everyone, I'm creating a site designed around users uploading music. How can I implement a system that would effectively record information such as view count so that a user could find the most viewed music of the day, of the week or of all time? Thank you so much in advance to anyone who might be of help! Mark
  4. Ah nice! I like the way you think. I will definitely do that Thanks!
  5. Crap Well, I have 2 Select Boxes, and buttons inbetween that move selected options from one box to the other. After the form is submitted I want to get all the values that were in the box on the right :/
  6. Hello everyone I hope I have a fairly simple question here Lets say I had a <select>..<option>1</option>..<option>2</option>..</select> type up setup. When the user clicks the submit button, is there a way I can read all those options and not just the ones selected? Thank you for reading this! - Mark
  7. Hello there PHP experts! I have a simple question. Basically I have a script that takes user input and processes it through this procedure: strip_tags(trim(htmlentities($_POST['field']))); However, the problem is that I come back with values such as [quote]This is Track 10 of 20 of the album &iexcl;U&amp;I R 1MB! The album will be released April 30th, free for download. Here is a sample from the album &iexcl;ENJOY![/quote] And [quote]¡U&I R 1MB![/quote] Is there any way I can take the user input and disallow HTML but still display quotation marks and funky characters like upside down exclamation marks? Any help would be greatly appreciated!! - Pianoman993
  8. It definitely need to be unserialized. Thank you for your help. My code now works! Thank you!
  9. Hello there PHP experts! I am trying to use a string like this: a:7:{s:10:"country_id";s:3:"226";s:5:"email";s:22:"email@wi.rr.com";s:10:"last_visit";s:19:"2009-02-20 10:22:58";s:7:"created";s:19:"2009-02-20 10:22:58";s:8:"modified";s:19:"0000-00-00 00:00:00";s:3:"URI";s:5:"/home";s:17:"FreakAuth_captcha";s:5:"sqqpi";} And be able to "explode" the data so I can get each value. So for instance I could fetch the country_id value by typing string_array['country_id']. is this possible? Any help is greatly appreciated! Thank you! - Pianoman993
  10. I think that did that trick! And that does everything the regular expression accomplished plus spacing correct?
  11. I figured you'd say that as soon as I posted it. *Edited* Thanks for the speedy response
  12. Hello there PHP experts. I have a small expression that checks to make sure the given string has Only alpha characters, digits, underline or dash characters. However, would it be possible to edit it to allow one space between words? Here is what I've got: '/^([a-z0-9])([a-z0-9_\-])*$/ix' Example "Example String" (the expression allows one space between example and string) An even more adventurous example: "Another Example String" Still allows a space between words If anyone has any ideas please post! Thank you for your time! - Pianoman993
  13. I just created a new topic but have asked the forum mods to delete it. Basically, I would like to pay you if you are able to help me since you have been the one all along helping me! If you would like my offer to pay you, my offer of $10 still stands. * When the message form is submitted and sent to the bb_encoder function, the preg_replace that detects all quote tag dates and converts them automatically will generate a "headers already sent error" and "undefined offset 1 error" if no quote tag with dates is included. (Basically if you just submitted the words "Hello World" in the message textbox, you would get those errors) * When the tags [ quote author=... date=... ] [ / quote ] is actually found and the preg_replace function converts the date to readable format, it converts nicely. However if there are more than one sets of quotes, the date conversion is rendered the same for each occurrence. * How can you reverse this process in the bb_decoder?
  14. It seems that this topic is not very exciting. I'm going to start a new one. In the new one I will give 10 dollars to the first one to fix this problem.
  15. That's strange, for some reason I'm getting a bunch of errors now :/ A PHP Error was encountered Severity: Notice Message: Undefined offset: 1 Line Number: 250 A PHP Error was encountered Severity: Warning Message: Cannot modify header information - headers already sent by Severity: Warning Message: Cannot modify header information - headers already sent by
  16. So in a nutshell, if I used this code: function bb_decode ($str) { preg_match('~\[quote.*?date=(\d+?)\]~is',$str,$timestamp); $date = strtotime("m:d:Y H:i:s", $timestamp[1]); $bbcode = array( "/\<strong>(.*?)<\/strong>/is" => "[b]$1[/b]", "/\<em>(.*?)<\/em>/is" => "[i]$1[/i]", "/\<u>(.*?)<\/u>/is" => "[u]$1[/u]", "/\<s>(.*?)<\/s>/is" => "[s]$1[/s]", "/\<table class=\"bbc_quote_table\"><tr><td class=\"bbc_quote_header\"><\/td><\/tr><tr><td class=\"bbc_quote_body\">/is" => "[quote]$1", "/\<table class=\"bbc_quote_table\"><tr><td class=\"bbc_quote_header\"><span class=\"quote_from\">Quote from<\/span> <span class=\"author\">(.*?)<\/span> on <span class=\"date\">(.*?)<\/span><\/td><\/tr><tr><td class=\"bbc_quote_body\">/is" => "[quote author=$1 date=$date]$3", "/\<\/td><\/tr><\/table>/is" => "[/quote]", "/\<br \/>/is" => "" ); I would be able to convert the date= field to the original time string?
  17. Thank you for the response It worked! Just one last question, how could I convert that back to it's original number? Thanks for being so helpful! - Pianoman993
  18. Sorry about that. Here's my php code function bb_encode ($str) { $str = nl2br(htmlentities($str)); $simple_search = array( '~\[quote author=(.*?) date=(.*?)\]~is', '~\[/quote\]~is', ); $simple_replace = array( '<table class="bbc_quote_table"><tr><td class="bbc_quote_header"><b>Quote from </b>$1</b> on unix_to_human($2)</td></tr><tr><td class="bbc_quote_body">', '</td></tr></table>' ); // Do simple BBCode's $str = preg_replace ($simple_search, $simple_replace, $str); return $str; } And here is what I right [ quote author=UrbanTwitch date=1227397761]Thank you so much!! [ /quote ] Here is what I get
  19. Hello there PHP experts. I have a small question for you. Is it possible to format a date (number) in a preg_replace statement? Here is a snippet of code I am using, you will see the unix_to_human($2) is my stab at a conversion to a real date. Is it possible to do this? If so, could please post an example? Thank you! '<table class="bbc_quote_table"><tr><td class="bbc_quote_header"><b>Quote from </b>$1</b> on unix_to_human($2)</td></tr><tr><td class="bbc_quote_body">', Any help is greatly appreciated - Pianoman993
  20. How then can I detect line breaks without creating <br /> tags?
  21. Hello there PHP experts! I recently posted a similar post about decoding bbcode. In this question I am wondering why I keep getting an extra <br /> tag after every set of [ center ] [ / center ] tags. Here is my code! function bb_encode ($str) { $str = nl2br(htmlentities($str)); $simple_search = array( //added line break '/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[s\](.*?)\[\/s\]/is', '/\[center\](.*?)\[\/center\]/is', '/\[url\=(.*?)\](.*?)\[\/url\]/is', '/\[url\](.*?)\[\/url\]/is', '/\[align\=(left|center|right)\](.*?)\[\/align\]/is', '/\[img\](.*?)\[\/img\]/is', '/\[mail\=(.*?)\](.*?)\[\/mail\]/is', '/\[mail\](.*?)\[\/mail\]/is', '/\[font\=(.*?)\](.*?)\[\/font\]/is', '/\[size\=(.*?)\](.*?)\[\/size\]/is', '/\[color\=(.*?)\](.*?)\[\/color\]/is', //added textarea for code presentation '/\[codearea\](.*?)\[\/codearea\]/is', //added pre class for code presentation '/\[code\](.*?)\[\/code\]/is', //added paragraph '/\[p\](.*?)\[\/p\]/is', ); $simple_replace = array( //added line break '<strong>$1</strong>', '<em>$1</em>', '<u>$1</u>', '<s>$1</s>', '<div style="text-align:center">$1</div>', // added nofollow to prevent spam '<a href="$1" rel="nofollow" title="$2 - $1">$2</a>', '<a href="$1" rel="nofollow" title="$1">$1</a>', '<div style="text-align: $1;">$2</div>', //added alt attribute for validation '<img src="$1" alt="" />', '<a href="mailto:$1">$2</a>', '<a href="mailto:$1">$1</a>', '<span style="font-family: $1;">$2</span>', '<span style="font-size: $1;">$2</span>', '<span style="color: $1;">$2</span>', //added textarea for code presentation '<textarea class="code_container" rows="30" cols="70">$1</textarea>', //added pre class for code presentation '<pre class="code">$1</pre>', //added paragraph '<p>$1</p>', ); // Do simple BBCode's $str = preg_replace ($simple_search, $simple_replace, $str); return $str; } function bb_decode ($str) { $str = ($str); $bbcode = array( "/\<strong>(.*?)<\/strong>/is" => "[b]$1[/b]", "/\<em>(.*?)<\/em>/is" => "[i]$1[/i]", "/\<u>(.*?)<\/u>/is" => "[u]$1[/u]", "/\<s>(.*?)<\/s>/is" => "[s]$1[/s]", "/\<div style=\"text-align:center\">(.*?)<\/div>/is" => " [center]$1[/center] ", "/\<br \/>/is" => "" ); $str = preg_replace(array_keys($bbcode), array_values($bbcode), $str); return $str; } Any help would be greatly appreciated! Thanks! - Pianoman993
  22. I was able to fix the problem. function bb_decode ($str) { $str = ($str); $bbcode = array( "/\<strong>(.*?)<\/strong>/is" => "[b]$1[/b]", "/\<br \/>/is" => "" ); $str = preg_replace(array_keys($bbcode), array_values($bbcode), $str); return $str; }
  23. Hello php experts! I have found the matter of decoding bbcode to be very stumping. I have a simple php encoder that works perfectly, but I can't figure out how to properly decode the information as well. Here is my encoder function bb_encode ($str) { $str = nl2br(htmlentities($str)); $simple_search = array( //added line break '/\[br\]/is', '/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[url\=(.*?)\](.*?)\[\/url\]/is', '/\[url\](.*?)\[\/url\]/is', '/\[align\=(left|center|right)\](.*?)\[\/align\]/is', '/\[img\](.*?)\[\/img\]/is', '/\[mail\=(.*?)\](.*?)\[\/mail\]/is', '/\[mail\](.*?)\[\/mail\]/is', '/\[font\=(.*?)\](.*?)\[\/font\]/is', '/\[size\=(.*?)\](.*?)\[\/size\]/is', '/\[color\=(.*?)\](.*?)\[\/color\]/is', //added textarea for code presentation '/\[codearea\](.*?)\[\/codearea\]/is', //added pre class for code presentation '/\[code\](.*?)\[\/code\]/is', //added paragraph '/\[p\](.*?)\[\/p\]/is', ); $simple_replace = array( //added line break '<br />', '<strong>$1</strong>', '<em>$1</em>', '<u>$1</u>', // added nofollow to prevent spam '<a href="$1" rel="nofollow" title="$2 - $1">$2</a>', '<a href="$1" rel="nofollow" title="$1">$1</a>', '<div style="text-align: $1;">$2</div>', //added alt attribute for validation '<img src="$1" alt="" />', '<a href="mailto:$1">$2</a>', '<a href="mailto:$1">$1</a>', '<span style="font-family: $1;">$2</span>', '<span style="font-size: $1;">$2</span>', '<span style="color: $1;">$2</span>', //added textarea for code presentation '<textarea class="code_container" rows="30" cols="70">$1</textarea>', //added pre class for code presentation '<pre class="code">$1</pre>', //added paragraph '<p>$1</p>', ); // Do simple BBCode's $str = preg_replace ($simple_search, $simple_replace, $str); return $str; } How would I decode the information? Could someone please show me and example ( a simple one would could be finding <strong>...</strong> tags and replacing them with [ b ]...[ /b ] tags ) Any help would be greatly appreciated! Thank you! - Pianoman993
×
×
  • 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.