Jump to content

cstegner

Members
  • Posts

    39
  • Joined

  • Last visited

    Never

Everything posted by cstegner

  1. Solved! Once I woke up a little I realized that I was making things much too difficult. I ended up going this route. // add media into blog post public function add_media() { $blog_one = explode('[:', $this->blog); if(count($blog_one) > 1) { for($i=0; $i <= count($blog_one); $i++) { $blog_two = explode(':]', $blog_one[$i]); if(count($blog_two) > 1) { $blog_three = explode('|', $blog_two[0]); $media_type = str_replace(' ', '', $blog_three[0]); $media_url = str_replace(' ', '', $blog_three[1]); switch ($media_type) { case "quicktime": $blog_two[0] = ' <object CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="320" height="256" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab"> <param name="src" value="/uploads/' . $media_url . '"> <param name="qtsrc" value="/uploads/' . $media_url . '"> <param name="autoplay" value="true"> <param name="loop" value="false"> <param name="controller" value="true"> <embed src="/uploads/' . $media_url . '" qtsrc="/uploads/' . $media_url . '" width="320" height="256" autoplay="true" loop="false" controller="true" pluginspage="http://www.apple.com/quicktime/"></embed> </object>'; break; case "windows_video": $blog_two[0] = 'embed code'; break; case "flash": $blog_two[0] = 'embed code'; break; } $blog_one[$i] = join($blog_two); } } $this->blog = join($blog_one); } } this owrks perfect for [: quicktime | whatever.mov :] however many times its inserted between whatever text, etc.
  2. I am working to make a script that will replace a bbcode type tag with the correct embed html for the media type. Here it will make more sense if I just show you. here is the sample string: The idea of all of the possibilities that iValueRich.com will bring the community just blows my mind. I hope everyone is ready for it! [quicktime "991cc705c6e8be7b074aeca3fe0f52e1.mov"] [quicktime "991cc705c6e8be7b074aeca3fe0f52e1.mov"] I was thinking that I could use preg_replace, however two problems I am having a tough time getting it to work at all in my object and even if I do I could use some help with the expression. Here is what I was kind of thinking // add media into blog post public function add_media() { $patterns[0] = 'expression for [quicktime "whatever"]'; $patterns[1] = 'expression for [windows_video "whatever"]'; $patterns[2] = 'expression for [flash "whatever"]'; $replacements[0] = 'proper embed code'; $replacements[1] = 'proper embed code'; $replacements[2] = 'proper embed code'; $this->blog = preg_replace($patterns, $replacements, $this->blog); } I have all of the embed code. Another problem how would I pass the "whatever" to the embed code? Please any help, or otherways to accomplish this, anything.
  3. Jesirose and Barand, Don't mean to bring up a solved topic, but your explanation still left me feeling pretty...confused. If you think you could clear it up any better in my mind, I would greatly appreciate it. Thanks again.
  4. Barand, Thank you so much, you were a life saver. I read your reasoning behind how this works however am still a bit confused. Don't get me wrong I plugged it in and it works however if you could break down the how a bit more for me I would greatly appreciate it. Just when I feel like I am really starting to get good at this language I feel like a newb all over again. I don't understand how you are calling the function with the quotes around it, or where it is getting $a or $b from. Thanks, again.
  5. I have a procedure that makes an array of a users contacts from one table. For each contact that it finds it sets an object array with all of the information from the members class. Like so... public function set_contacts($member_id) { $sql = ' SELECT * FROM network WHERE member_id = ' . (int)$member_id .' AND contact="Yes"'; if ($rows = $this->Db->get_rows($sql)) { $Member = new Member(); foreach($rows as $row) { $this->contact_list[] = new Member($row['network_member_id']); } } } Pretty simple, but Now I am trying to figure out how to put these contacts into alphabetical order by the $Member->name. Any ideas on how I could accomplish this?
  6. For some reason it wont pass the image variables into the function correctly. The first if statement in the function keeps stopping it. Please let me know what I need to do. Thanks [code]function mkThumb($image, $project, $newname, $forcedwidth, $forcedheight){     $maxwidth = 10000;     $maxheight = 100000;     $max_filesize = 500000;     $max_filesize_kb = ($max_filesize / 1024);     $uploads = 'photos/' . $project . '/'; $types_array = array('image/gif','image/pjpeg','image/x-png','image/jpeg'); if($_FILES[$image]['name'] == ""){     echo "Please select a file to upload!";     exit; } if(!in_array($_FILES[$image]['type'], $types_array)){     echo "That file type is not allowed!";     exit; } if($_FILES[$image]['size'] > $max_filesize){     echo "Your file is too large. <br />Files may be up to ".$max_filesize_kb."kb";     exit; }     $imagesize = getimagesize($_FILES[$image]['tmp_name']);     $imagewidth = $imagesize[0];     $imageheight = $imagesize[1]; if($imagewidth > $maxwidth || $imageheight > $maxheight){     echo "Your file is too large. (".$imagewidth." x ".$imageheight.")<br>The maximum is <b>".$maxwidth." x ".$maxheight."</b> pixels.";     exit; } $ext = explode(".",$_FILES[$image]['name']); $imagename = $newname . '.' . 'jpg'; $thname = $newname . "st" . "." . "jpg"; move_uploaded_file($_FILES[$image]['tmp_name'], $uploads.'/'.$imagename) or die ("Couldn't upload ".$_FILES[$image]['name']."\n"); // Make thumbnail $sourcefile = $uploads . $thname; $forcedwidth = "175"; $forcedheight = "175"; $destfile = 'thumbs/' . $project . '/' . $imagename;     $fw = $forcedwidth;     $fh = $forcedheight;     $is = getimagesize( $sourcefile );     if( $is[0] >= $is[1] )     {         $orientation = 0;     }     else     {         $orientation = 1;         $fw = $forcedheight;         $fh = $forcedwidth;     }     if ( $is[0] > $fw || $is[1] > $fh )     {         if( ( $is[0] - $fw ) >= ( $is[1] - $fh ) )         {             $iw = $fw;             $ih = ( $fw / $is[0] ) * $is[1];         }         else         {             $ih = $fh;             $iw = ( $ih / $is[1] ) * $is[0];         }         $t = 1;     }     else     {         $iw = $is[0];         $ih = $is[1];         $t = 2;     }     if ( $t == 1 )     {         $img_src = imagecreatefromjpeg( $sourcefile );         $img_dst = imagecreatetruecolor( $iw, $ih );         imagecopyresampled( $img_dst, $img_src, 0, 0, 0, 0, $iw, $ih, $is[0], $is[1] );         if( !imagejpeg( $img_dst, $destfile, 90 ) )         {             exit( );         }     }     else if ( $t == 2 )     {         copy( $sourcefile, $destfile );     } } // End of mkThumb function if(isset($_POST['addProject'])){     //add to database   mysql_query("INSERT INTO 'select' ('project','title', 'description') VALUE ('$title', '$description')");   //create and place images and thumbs     if($_FILES['image1'] != ""){     mkThumb($image1, $project, '1', '50', '50');     echo "<span style='color: yellow'>Added 1</span>";   }    if($_FILES['image2'] != ""){     mkThumb($image2, $project, '2', '50', '50');     echo "<span style='color: yellow'>Added 2</span>";   }    if($_FILES['image3'] != ""){     mkThumb($image3, $project, '3', '50', '50');     echo "<span style='color: yellow'>Added 3</span>";   }    if($_FILES['image4'] != ""){     mkThumb($image4, $project, '4', '50', '50');     echo "<span style='color: yellow'>Added 4</span>";   }    if($_FILES['image5'] != ""){     mkThumb($image5, $project, '5', '50', '50');     echo "<span style='color: yellow'>Added 5</span>";   }    if($_FILES['image6'] != ""){     mkThumb($image6, $project, '6', '50', '50');     echo "<span style='color: yellow'>Added 6</span>";   }    if($_FILES['image7'] != ""){     mkThumb($image7, $project, '7', '50', '50');     echo "<span style='color: yellow'>Added 7</span>";   }    if($_FILES['image8'] != ""){     mkThumb($image8, $project, '8', '50', '50');     echo "<span style='color: yellow'>Added 8</span>";   }   echo "<span style='color: yellow'>Added</span>"; }[/code]
  7. Thank Fyorl! Ok, so I have adding tags and viewing them down. This is how I am adding them. [code] if(isset($_POST['add_tags'])){   $string = $_POST['tags'];   $ex = explode(',', $string);   foreach($ex as $tag){     $tag = trim($tag);     $tag = strtolower($tag);     $sql = mysql_query("SELECT COUNT(*) FROM tags WHERE tag_name='$tag'");     if(mysql_result($sql, 0) < 1){       mysql_query("INSERT INTO tags SET tag='$tag'");     }     $q_tag_id = "SELECT * FROM tags WHERE tag='$tag'";     $r_tag_id = mysql_query($q_tag_id);     $a_tag_id = mysql_fetch_array($r_tag_id);     $tag_id = $a_tag_id['id'];     mysql_query("INSERT INTO tag_map SET tag_id='$tag_id', map_to='$message_id', user_id='$user_id', type='message'");   } } [/code] And then I am having the tags that pertain to the message displayed in the messages page. And I am having them link to a tag search of sorts, that is basically functional, just needs some cleanup. Here is that code. [code]<? $q_get_tags = "SELECT * FROM tag_map WHERE tag_id='$tag_id'"; $r_get_tags = mysql_query($q_get_tags); $nr_get_tags = mysql_num_rows($r_get_tags); if($nr_get_tags >= 1){   echo "<div class=\"body_text\" style=\"border-bottom: 1px dashed silver; padding: 5px; margin-left: 15px\">";   while($a_get_tags = mysql_fetch_array($r_get_tags)){     $map_to = $a_get_tags['map_to'];     $item_type = $a_get_tags['type'];     if($item_type == "message"){       $q_info = "SELECT * FROM messages WHERE id='$map_to'";       $r_info = mysql_query($q_info);       $a_info = mysql_fetch_array($r_info);       $title = $a_info['subject'];       $message = $a_info['message'];       echo "<a href=\"/userpage/messages/view_message.php?id=".$map_to."\">".$title."</a>         <div style=\"font-size: 0.8em; margin-left: 15px\">".$message."</span>";     }   }   echo "</div><br />"; } ?>[/code] Now this is only for if a tag link gets clicked from another page. A different full search engine will need to be made later. So I was wondering if you of you masterminds, could take a look at the above code and clean it up and simplify it any. So it isn't...bulky.
  8. You're the best you just saved me two hours of digging out all of the functions and coding them ;) I will keep this thread updaed as I encounter and hopefully solve problems. Chris
  9. Thanks for the quick reply. I relize thay my question above was rather generalized, so I went and read as much as I could find on the net. And came to a conclusion much like yours. Here is the plan, so far--stay tuned as I will still need help ;) I have one table for say their messages, we'll call it "messages" that has the normal columns... id, to_user, from_user, title, subject...whatever. Then I have another table called "tag map" which would have the following columns... id, message_id, tag_id and user_id. Then have a final table for the tag itself called "tags", which would have id and tag for columns. So I have most of that figured out, so maybe an easier question now. So say they enter three tags in the text field. Soccer, World Cup, BRAZIL How can I seperate these, make them all lowercase and ditch all the spaces and commas so that I can have each one make it's own entry in the tags table? Wow, hope some others learn from this too. haha
  10. I want to setup a system for letting my members tag their messages and so fourth. But I am really not sure where to start this endeavor. I have gotten most of the basics of php and mysql down and am good at understanding concepts, but I need a point in the right direction on this. I am a little confused as to how I could handle this. So I want my users to be able to tag messages and friends of theirs, and I want other people to be able to see the tags that are given to the friends and also to be able to use the tags to search for content with the same tags and to be able to search content that would be referenced by tags. So any help would be greatly appreciated.
  11. I am trying to give the users on my page the ability to make their own folders for storing messages. Now in each messages row I added a column called "box", so that if my users drag their message to the certain folder then it will just update the box column with whiever folder they want it in. That way it is easy for displaying the messages of each folder, by just using a "index.php?box=$box_result" and then a "WHERE box='$box'". So that is easy. The part I am wondering about is them adding new folders. I could make a table that is just three columns "id", "user_id", "folder". But I have a ton of members and the amount just keeps growing and I am worried that this might get too many entries over time. Is there a better way? should I not worry? How many rows can mysql handle before getting bogged down? thanks for any help. If youhave a completly different better way of doing this let me know. Chris
  12. Crayon violet, you seem to always get the honors of making me feel like an idiot ;) Thanks.
  13. I need a query that will in essence be saying NOT IN ('$id_array') how do I do that?
  14. YES!! it worked and thank you. It sucks when you spend like 2 hours on what you expected to take 3-5 min :P
  15. A super simple insert query that I have used at least 2 million times, wont work. let me know if you can see why. [code] if(isset($_POST['send_message'])){   $q_send_message = mysql_query("INSERT INTO messages (to, from, subject, message, date) values ('$id', '$user_id', '$subject', '$message', '$today')");   echo "     <div id=\"middle\">         <br /><br />         <div class=\"body_header\">Send Message</div>         <p class=\"body_text\" />         <b>Your message has been sent!</b><br /><br />         Return to <a href=\"/userpage/index.php\">User Page</a>.     </div>   ";   include($_SERVER['DOCUMENT_ROOT'].'/inc/home_bottom.php');   exit(); } [/code] the table name is definitley messages. I also tried setting all the values directly in the query rather then variables, to see if they were the problem. It would still not work. I have also tested all the variables they all work. Every thing in the if runs correctly other then the insert query. thanks for the help.
  16. Hi, once a week I want to update a certain column in every one of my members database rows. Now I was wondering if there was a certain query you could feed mysql to do this rather then using a while statement to go through every row. For the odvious reason that if ther were one day 5 million users, well you get the idea. You guys are always a huge help, and I am starting to try and help out those who I can. -Chris
  17. Wild thank you very much. I am at work now so I can't even view the demo through there firewall, but this looks like it might be perfect for my application. Questions before I even see the demo haha. I was reading thier wiki and this seems like such an easy script to implement. Basically you put there code instead of a text area input. Wow how smart. now here is my question. How does the person on the other side that recieevs the message view it. How do you pull the text back into the FCKeditor? Would you just stick the variable that is holding the saved text right into the default text line of there code? thansk for any help. This looks liek it will be PERFECT!!!
  18. strip_tags() will take out all the html tags from your string.
  19. I have a new site idea I am working on and 90% of the site is going to be messaging. So I want this feature to be as nice and simple as possible however very powerful. So here is my question, is it possible to script something with PHP for messaging that when they type text they could highlight the text click the bold button and the text appears bold, etc? Like a WYSIWYG editor for website messages? If so where are some good resources (I have searched), if not what is the next best thing and where are some resources. Thanks as always -Chris
  20. Hey Michael, I just wanted to say thank you a million! Everything is now working perfect! SOLVED!!!! -Chris
  21. You are the best man, where do I send the beer to?? As for destroying the images, I want to keep the original image along with the new thumbnail. Does the image destroy delete the actual orignal image or just the memory space used for it? -Chris
  22. Michael I know you thought you had gotten rid of me, but not yet...sorry :( Here it is... what I have no idea... Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 3072 bytes) in /home/httpd/vhosts/bigornot.com/httpdocs/make_th.php on line 57 -Chris
  23. ohhhhhh, ok I see what you are saying now. It was almost too easy, I was trying to think too hard about it. Ok just keep re running the script and everytime it will pass right by the ones I already did and start on new ones. So simple, your awesome, I'll try it out tonight and I don't see any reason why it woun'dt work. thanks. -chris
×
×
  • 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.