Jump to content

jammesz

Members
  • Posts

    83
  • Joined

  • Last visited

    Never

Everything posted by jammesz

  1. if the iframe source is a server script page that can access a database then all you have to do is store the content from the forum into a table and pass the id of the entry through the url so that the iframe source can then receive the content from the database. You could do the exact same thing but instead of a database use a text file to store the content passing the file path in the url of the iframe. If the content is short and the two options are not possible then perhaps use base64_encode() to encode the content, pass it through the url, then decode it using php or javascript, or ect... Also, im pretty sure that javascript can read/write to files. If this is true then probably a better choice then the one mentioned above. Hope this helps
  2. Try this: $insert = "INSERT INTO comment (comment_name,comment_datetime,comment_text,news_id,comment_ip) VALUES ('".$name."',".now().",'".$text."','".$nid."','".$ip."')";
  3. Use this to get you started: <?php$text="PHP is proud to announce TestFest 2010. TestFest is PHP's annual campaign to increase the overall code coverage of PHP through PHPT tests. During TestFest, PHP User Groups and individuals around the world organize local events where new tests are written and new contributors are introduced to PHP's testing suite.Last year was very successful with 887 tests submitted and a code coverage increase of 2.5%. This year we hope to do better.TestFest's own SVN repository and reporting tools are back online for this year's event. New to TestFest this year are automated test environment build tools as well as screencasts showing those build tools in action.Please visit the TestFest 2010 wiki page for all the details on events being organized in your area, or find out how you can organize your own event.";$limit=200;echo substr($text,0,$limit);echo '<hr>';echo substr($text,$limit);?> of course you'll need to solve the problem of it cutting words in half but that shouldn't be too hard
  4. You could be right with it being a php thing but who knows. I have little experience with the problems that can come when using https but i do know that if you have a script like so: <?phpecho 'Test';?> and try and access it via https:// url and it doesn't work, then its a server issue.
  5. thats a better way of doing it but again you've missed out a ) character. if (in_array($q, $words) { should be: if (in_array($q, $words)) {
  6. Im guessing this is what your talking about: http://faksx.sytes.net/blogs/?page=comment&id=2 I get this error when trying to submit a comment: Incorrect integer value: '' for column 'news_id' at row 1 looking at: $insert = sprintf("INSERT INTO comment (comment_name,comment_datetime,comment_text,news_id,comment_ip) VALUES ('%s',now(),'%s','%s','$ip')",$name,$text,$nid); it looks like your inserting $text into the field news_id which only accepts int values. Where $text is my comment.
  7. There's so many possible causes for this other than php. Have you tested a php script to see if it works in https?? If you cant get any php scripts working in the https protocol than it could possibly be your server configuration or something else.
  8. Syntax error: If ($q == 'the') or ($q == ’wood’) or ($q == ’host’) Should be: if (($q == 'the') or ($q == ’wood’) or ($q == ’host’))
  9. if the forms on the same page as the iframe then you'll need javascript. otherwise you can do it via php after the forms submitted.
  10. Can you please explain further what the problem is?
  11. Another idea you could do is ditch the dropdown box and make custom dhtml dropdown where the subcategories "slide out" to the side when the user hovers over the main parent categoy
  12. Also might like to point out that there's no reason for a mysql connection in index.php as you dont use the database at all on that page. <?php $dbhost = 'localhost'; $dbuser = '*********'; $dbpass = '********'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = '***********'; mysql_select_db($dbname); ?> <form name="form" action="search.php" method="get"> <input type="text" name="q" /> <input type="submit" name="Submit" value="Search" /> </form> should be this: <form name="form" action="search.php" method="get"> <input type="text" name="q" /> <input type="submit" name="Submit" value="Search" /> </form>
  13. Not sure how this is really related to php except maybe wordwrap() function to wrap the comments to a certain width. This seems more like a design problem in regards to how your html layout for the comments are and the css.
  14. maybe something like google search suggestions? where suggestions to what category your looking for pops up as you type. If you want something that a user can browse what categories there are then you'll need a separate page for it or categorize better as 3000 categories is insane. You should maybe categorize the categories so the list of main categories is shortened.
  15. what i really meant was, as you said before, that its probably a syntax error in the command.
  16. In that case, yes, i think its the command and not the function thats not working.
  17. Try this: $final_results=array(); $i=0; while ($file = readdir($dir_handle)) { //Remove file extension $ext = strrchr($file, '.'); if($ext !== false) { $file = substr($file, 0, -strlen($ext)); } if($file == "." || $file == ".." || $file == "index.php" ) continue; //explode file name $changedordernumber = explode("_",$file); //put in new order $changedordernumber = $changedordernumber[1]."_".$changedordernumber[0]."_".$changedordernumber[2]; $changedordernumber=trim($changedordernumber,"_"); $i++; $final_results[$changedordernumber.$i]=array($file,$changedordernumber); } ksort($final_results); foreach($final_results as $FR){ //list options echo "<option name='$FR[0]' value='$FR[0]'>$FR[1]</option>\n"; }
  18. As i haven't used any windows past xp and i dont know which version you have i cant really help. I personally use linux and for me shell_exec needs a bit more info to work. Example: shell_exec("DISPLAY=:0 sudo -u username firefox ".$url); Now i know this will not work for you as your on windows but you should research the function a bit more and try and get some insight into what the function may need/require in order for it to work. On the other hand maybe on windows you don't need to do anything and it's just the command itself thats the problem.
  19. Why not make three database tables that link to each other through one of the tables Example: Table mixes ------------------ mix_id | mix_name | mix_info | etc 2 Song22 random Table genre ------------------ genre_id | genre_name | etc 1 rock 2 pop 3 classical 4 hard rock Table link ------------------ link_mix_id | link_genre_id 2 1 2 4 Example sql // find out what genre's Song22 has $sql="SELECT genre.genre_name FROM genre,link WHERE link.link_mix_id='2' && link.link_genre_id=genre.genre_id"; // output rock hard rock // find out what mixes are under hard rock $sql="SELECT mixes.mix_name FROM mixes,link WHERE link.link_genre_id='4' && link.link_mix_id=mixes.mix_id"; //output Song22
  20. First off, i have made a validation class using array_diff() to check if there are invalid characters submitted by a user. Some extracts: $this->chr_alpha_lower=array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'); $this->chr_alpha_upper=array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'); $this->chr_numeric=array('0','1','2','3','4','5','6','7','8','9'); $this->chr_symbol=array(' ','!','@','#','$','%','&','(',')','[',']','.',',',':',';','\'','"','/','=','\\','-','_','?'); ... // lets say only alpha and numeric characters are allowed $allowed_characters=array(); $allowed_characters=array_merge($allowed_characters,$this->chr_alpha_lower,$this->chr_alpha_upper); $allowed_characters=array_merge($allowed_characters,$this->chr_numeric); $input_split=str_split($this->input); $invalid=array_diff($input_split,$allowed_characters); if(empty($invalid)){ return true; } return false; I have two questions. First, for acsii characters is this method 'full proof' or is there a way for someone to get around this validation script? Second, a new site im developing is going to be built with UTF-8 in mind so people can use the site in their own language. How do i validate UTF-8 user input? I know about mb_strings and sanitizing UTF-8 input using this: preg_match_all('/([\x09\x0a\x0d\x20-\x7e]'. // ASCII characters '|[\xc2-\xdf][\x80-\xbf]'. // 2-byte (except overly longs) '|\xe0[\xa0-\xbf][\x80-\xbf]'. // 3 byte (except overly longs) '|[\xe1-\xec\xee\xef][\x80-\xbf]{2}'. // 3 byte (except overly longs) '|\xed[\x80-\x9f][\x80-\xbf])+/', // 3 byte (except UTF-16 surrogates) $input, $clean_pieces ); $clean_output = join('?', $clean_pieces[0] ); But how do i know what to filter? Example: a field for the user to input first name English: only alpha characters Other language: ????? Help much appreciated.
  21. Yes i know but i was kind of hoping for some 'global window event handler' code that will automatically focus on the text box, without having to add code to every function called to do the same job.
  22. How can i make my text box have focus all the time while allowing the user to do other actions in the meantime? This is for a game im developing which includes a chat window where the text box is located in.
  23. The error message says that $location is empty or doesnt contain a filename and only a directory. So your problem has something todo with that.
  24. You should edit <form action="<?=$_SERVER['PHP_SELF']?>" method="POST"> to <form action="Whatever.php" method="POST"> Where Whatever.php is the current php page the dropdown boxes are in.
×
×
  • 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.