Jump to content

litebearer

Members
  • Posts

    2,356
  • Joined

  • Last visited

Everything posted by litebearer

  1. pseudo code 1. create database id user name user password path/name of user pic pic description/comment path/name of thumbnail 2. create login/register page for users a. register new user b. exisitng user has option to (1) add pic (2) delete pic (3) add comment (4) edit comment I suggest... 1. each user having own folder for pics/thumbs 2. use sessions so that IF the person viewing a picture IS the original user then edit options are displayed; otherwise, only views are displayed. Lite..
  2. Might look here... [a href=\"http://www.poirrier.be/~jean-etienne/info/clibs/gd-rainbow.php\" target=\"_blank\"]http://www.poirrier.be/~jean-etienne/info/.../gd-rainbow.php[/a] or [a href=\"http://frenchfragfactory.net/ozh/my-projects/images-php-gd-gradient-fill/\" target=\"_blank\"]http://frenchfragfactory.net/ozh/my-projec...-gradient-fill/[/a] or [a href=\"http://www.php-editors.com/contest/1/68-read.html\" target=\"_blank\"]http://www.php-editors.com/contest/1/68-read.html[/a] Lite...
  3. Hmmm, 4 days??? Sounds like a homework assignment... Look here... [a href=\"http://www.phpbuilder.com/snippet/download.php?type=snippet&id=747\" target=\"_blank\"]http://www.phpbuilder.com/snippet/download...=snippet&id=747[/a] and here... [a href=\"http://www.phpbuilder.com/snippet/download.php?type=snippet&id=263\" target=\"_blank\"]http://www.phpbuilder.com/snippet/download...=snippet&id=263[/a] and here (for your description)... [a href=\"http://www.devarticles.com/c/a/PHP/Working-With-Text-Files-in-PHP/\" target=\"_blank\"]http://www.devarticles.com/c/a/PHP/Working...t-Files-in-PHP/[/a] Lite...
  4. Might also consider using sessions
  5. Might take a look at these sites... [a href=\"http://www.ambrosine.com/resource.html\" target=\"_blank\"]http://www.ambrosine.com/resource.html[/a] [a href=\"http://www.download.com/RPG-Toolkit-Development-System/3003-2121_4-6676850.html\" target=\"_blank\"]http://www.download.com/RPG-Toolkit-Develo..._4-6676850.html[/a] [a href=\"http://members.chello.at/theodor.lauppert/games/rpgmaker.htm\" target=\"_blank\"]http://members.chello.at/theodor.lauppert/games/rpgmaker.htm[/a] [a href=\"http://dmoz.org/Games/Video_Games/Game_Design/Development_Tools_and_Software/\" target=\"_blank\"]http://dmoz.org/Games/Video_Games/Game_Des...s_and_Software/[/a] [a href=\"http://www.rpg-dev.net/top50/\" target=\"_blank\"]http://www.rpg-dev.net/top50/[/a] Lite...
  6. As to #3. [a href=\"http://tecfa.unige.ch/guides/mysql/man/manuel_LOCK_TABLES.html#LOCK_TABLES\" target=\"_blank\"]http://tecfa.unige.ch/guides/mysql/man/man...tml#LOCK_TABLES[/a] [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Normally, you don't have to lock tables, as all single UPDATE statements are atomic; no other thread can interfere with any other currently executing SQL statement. There are a few cases when you would like to lock tables anyway: If you are going to run many operations on a bunch of tables, it's much faster to lock the tables you are going to use. The downside is, of course, that no other thread can update a READ-locked table and no other thread can read a WRITE-locked table. MySQL doesn't support a transaction environment, so you must use LOCK TABLES if you want to ensure that no other thread comes between a SELECT and an UPDATE. The example shown below requires LOCK TABLES in order to...[/quote] Lite...
  7. it all depends upon how YOU want your coding to be. ie the simplest method (IMHO) would be to assign each button a unique numeric value. then pass this value to your php script via the post method. Lite...
  8. The answer is right on phpfreaks [a href=\"http://www.phpfreaks.com/phpmanual/page/function.strrchr.html\" target=\"_blank\"]http://www.phpfreaks.com/phpmanual/page/fu...on.strrchr.html[/a] Lite...
  9. Pretty certain you need to accomplish that client-side ie javascript or ajax etc Although, my infamous sledge hammer approach says you could have the add button call a php script that would retain any variable values (sessions are a good way to achieve this) and add another row for input BUT that would necessitate a page 'refresh'. Lite...
  10. yep... [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] If you access a column from tbl_name in an expression, UPDATE uses the current value of the column. For example, the following statement sets the age column to one more than its current value: UPDATE persondata SET age=age+1; [/quote] [a href=\"http://dev.mysql.com/doc/refman/5.0/en/update.html\" target=\"_blank\"]http://dev.mysql.com/doc/refman/5.0/en/update.html[/a] Lite...
  11. You can export from mysql to a csv file. Here is a class that may be of assistance.. [a href=\"http://www.phpclasses.org/browse/package/1197.html\" target=\"_blank\"]http://www.phpclasses.org/browse/package/1197.html[/a] Lite...
  12. I believe you want to use the UPDATE feature ie [code] $result = mysql_query("UPDATE USERS SET click=click+'1' WHERE user = $some_user_id") or die(mysql_error()); [/code] might not be EXACTLY correct but it gives you the general idea - simply look in th ephp/mysql manual for UPDATE LITE...
  13. Not sure but is this kind of what you had in mind? the text file (button,score|button,score| etc etc) (buttonclicks.txt) [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] 01,3|02,25|03,17|04,18 [/quote] the php file [code] <?PHP function add_clicks($file,$what_button) {     $contents = file_get_contents($file);     $new_array=explode("|",$contents);     $i=0;     for($i=0;$i<count($new_array);$i++) {         $done = FALSE;         $temp_array = explode(",",$new_array[$i]);         if($temp_array[0] ==$what_button) {             $score = $temp_array[1];             $temp_array[1] = $score + 1;             $new_array[$i] = implode(",",$temp_array);             $i = count($new_array);             $done = TRUE;         }     }     $contents = implode("|",$new_array);     $fp = f open($file, "w");     $write = f puts($fp, $contents);     f close($fp);     return $done; } ############################# #    this is the name of the text file #    that keeps count of the clicks ############################# $file = "buttonclicks.txt"; ############################### #    replace the value of this variable #    with how you set the value of #    the button clicked ############################### $what_button = 3; ########################################## #    run the function #    if its not sucessful (FALSE) so something #    if its successful (TRUE) do something else ########################################## $done = add_clicks($file,$what_button); if(!$done) {     echo "Too bad"; }else{     echo "Well done!"; } ?> [/code] Note: the forum is still having difficulties with file operation scripts, so remove the spaces after each 'f' in the file operations Hope this helps. Lite...
  14. Hmmm... To use a date as a possible search criteria, you will need to 'expand' the arrays a bit. IF each date is consistent in its format (ie MM/DD/YY) you could insert another pipe "|" to make the date an element of the array. The same holds true for the other search criteria you might want to use. Bottom line is, it would be faster and easier to use a database (mysql etc). Lite...
  15. Might be a sledge hammer approach, but... Your text file [code]05/01/06,14.47:41 subject: Request received from mail@hotmail.com<br>05/01/06,14.47:41 subject: Request received from mail@hotmail.com<br>05/01/06,14.47:41 subject: Information received from mail@hotmail.com<br>[/code] the php file [code] <?PHP $file = "some.txt"; $fp = f open($file, 'r'); $contents = f read($fp, filesize($file)); f close($fp); $needle="subject:"; $delimiter = "|"; $contents = str_replace($needle,$delimiter,$contents); $needle="received from"; $delimiter = "|"; $contents = str_replace($needle,$delimiter,$contents); $new_array = explode("<br>",$contents); $count = count($new_array); if(strlen(trim($new_array[$count-1]))<1) { array_pop($new_array); } $count = count($new_array); $i=0; for($i=0;$i<$count;$i++){   $next_array[$i] = explode("|",$new_array[$i]); ?> <Pre> <?PHP   print_r($next_array[$i]); ?> </pre> <?PHP } ?>[/code] the display [code]Array (     [0] => 05/01/06,14.47:41     [1] =>  Request     [2] =>  mail@hotmail.com ) Array (     [0] => 05/01/06,14.47:41     [1] =>  Request     [2] =>  mail@hotmail.com ) Array (     [0] => 05/01/06,14.47:41     [1] =>  Information     [2] =>  mail@hotmail.com )[/code] Lite...
  16. Ok, here we go, line by line... [code] function truncate_string($details,$max) { [/code] obviously, this first line says "let's make a function named truncate_string; and it will need two pieces of information to do its job. The first is a variable named $details which contains the string/text we want to truncate/shorten. $max is the maximum length of text we want from the string. [code]     if(strlen($details)>$max)     { [/code] This line checks to make sure that the original string is longer than the max length we are looking to create. [code]         $details = substr($details,0,$max); [/code] This line takes a slice off of the original string ($details). the slice starts at the beginning (the 0) and is $max characters long. The original string/text is then replaced with the slice ($details =). [code]        $i = strrpos($details," "); [/code] This line checks to see where the last space is located in our new string. The reason for this is to make sure we didn't cut a word in the middle. [code]         $details = substr($details,0,$i); [/code] This line uses the information from the previous line to actually make the string end with a full word. [code]         $details = $details." ..... ";     } [/code] This line simply adds some periods to the end of our new string to indicate to a reader that there is more text to follow. [code]     return $details; } [/code] This last line of our function simply passes our new string back to our script [code] $text = truncate_string("hello there. This is a long string",19); [/code] This demonstrates how you could use the function in a script. Hope this isn't too muddy. Lite...
  17. Try this in your script [code]<?PHP function truncate_string($details,$max) {     if(strlen($details)>$max)     {         $details = substr($details,0,$max);         $i = strrpos($details," ");         $details = substr($details,0,$i);         $details = $details." ..... ";     }     return $details; } $text = truncate_string("hello there. This is a long string",19); ?> [/code] returns hello there. This .....
  18. Might look here [a href=\"http://www.4wordsystems.com/php_mail_attachment.php\" target=\"_blank\"]http://www.4wordsystems.com/php_mail_attachment.php[/a] or here [a href=\"http://codewalkers.com/seecode/98.html\" target=\"_blank\"]http://codewalkers.com/seecode/98.html[/a] Lite...
  19. function write_beg($filename, $data){ //Imports old data $handle = f open($filename, "r"); $old_content = f read($handle, filesize ($filename)); f close($handle); //Sets up new data $final_content = $data.$old_content; //Writes new data $handle2 = f open($filename, "w"); $finalwrite = f write($handle2, $final_content); f close($handle2); } Lite... (apparently the gorum still has a problem with code using file open functions; therefore in the above, remove any space that immediately follows a 'f'; ie f open etc)
  20. This might be what you want... [a href=\"http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm\" target=\"_blank\"]http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm[/a] And its FREE Lite...
  21. Hmmm, ok. Do you mind showing us your form?
  22. first one must remember the title Guru is like an honorary degree, it doesn't mean I know anything. That said, I am not sure this is the root of your problem; however, if we take this portion of your script... [code] if($ext==='doc' || $ext==='pdf') //check if the file is doc.   {      if(move_uploaded_file($_FILES['paper']['tmp_name'],$dir)) //move the file to papers directory.       {          print("The file as been uploaded");       }       else       {         print("There was a error in uploading please try again..");       }[/code] and remove all the comments, plus do some careful indenting like so... [code]if($ext==='doc' || $ext==='pdf'){     if(move_uploaded_file($_FILES['paper']['tmp_name'],$dir)) {         print("The file as been uploaded");     }else{         print("There was a error in uploading please try again..");     }[/code] It would appear that you are missin gyour final brace, and that may be a part of the problem. Lite...
  23. Might look here... [a href=\"http://www.ezgoal.com/scripts/scripts/f.asp?fid=82584\" target=\"_blank\"]http://www.ezgoal.com/scripts/scripts/f.asp?fid=82584[/a] or here... [a href=\"http://www.absoft-my.com/pondok/sitebackup.php\" target=\"_blank\"]http://www.absoft-my.com/pondok/sitebackup.php[/a]
  24. [code]########################################## # This little function will take a string, truncate it to a specific length, make sure it is not truncated in #  the middle of a word and add three trailing periods. ########################################## Function display_teaser($article,$display_length) {     if(strlen($article)>$display_length) {       $display_portion = substr($article,0,$display_length);     } else {       $display_portion = $article;     }       $true=0;       while ($true < 1) {         if(substr($display_portion, -1) != " ") {             $display_portion = substr($display_portion, 0, -1);         }else{             $true = 1;         }       }     $display_portion = $display_portion . "...";     return $display_portion; }[/code]
  25. How about a php class to acomplish that [a href=\"http://www.phpclasses.org/browse/package/2681.html\" target=\"_blank\"]http://www.phpclasses.org/browse/package/2681.html[/a] [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]With PhpMyBorder you can add round corner borders. The first version of PhpMyBorder generates round corner images (gifs) 'on the fly' and caches them to improve performance. The newest version of PhpMyBorder creates the round border effect by CSS2 (without any images at all). The newest version also support raised and shadowed borders.[/quote] Lite...
×
×
  • 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.