Jump to content

Deanznet

Members
  • Posts

    220
  • Joined

  • Last visited

Everything posted by Deanznet

  1. www.sharedimage.net More Features to come.... Search, Multi upload,comments, Image Editor etc... What else would you want to see in a image upload site
  2. Let me tell you a little story here Alright their was this guy right.. Working a job up on a tower.. it was dangerous 2 people fell to their deaths but he was getting paid $30 an hour so he didn't care. Anyways Saturday came around and he went to a party, Anyway he and this girl meet.. I mean she was Hot, he was enjoying her company and im sure she was enjoying his.. anyways after some time they decide to get a hotel.. he ask her to see her license to make sure she 18.. and she shows him and he shows her.. anyway they stated to go an the girl ask to get some beer.. but he was only 18 but the girl said dont worry about it the lady who works at the gas station knows me and she gives it to me all the time.. So they got the beer and went to the hotel.. spend the night did what they did.. the next day he was arrested.. got out on bail.. Asked the laywer what kind of trouble he was in Said he was in for rape. The girl was only 14 with a fake id.. He could get life in jail times 2... Just a little story i wanted to share.. not sure if its related
  3. I was working on this in another topic.. but it got kinda big with all my other problems.. and i solved most in the old thread.. So anyways heres the problem.. When a user gose to this page.. it displays all the images in the database.. But the images are all across the page.. The image url is located in basename.. also some images dont have any urls in the basename so how can i make it show just the ones with stuff in the basename. I want about 4 columns with 4 in a row and if it goes past that it makes a new page. Any idea how this can be done? this is the code we tried fixing in the old thread, but still displays in a straight line <? ob_start();//output buffering include("include/common.php"); function washdata($input) { if(preg_match('/^[0-9a-zA-z]*$/', $input) == 1) { return true; } else { return false; } } if(washdata($_POST['keyword_query']) == true) { $keyword_query = mysql_real_escape_string($_POST['keyword_query']);//we need to sanitize ANY and ALL user input, to prevent sql injection and yada-yada $query = @mysql_query("SELECT id,basename,keywords FROM images WHERE keywords LIKE '%$keyword_query%' ") or die(mysql_error()); if(!mysql_num_rows($query)){//0 = false, 1 or more = true die("I'm sorry, no results were found for $keyword_query."); } //if it gets to here, that means there were some matches... echo "<table><tr>"; $rowcounter = 0; while($row = mysql_fetch_array($query)){ $basename = $row['basename']; list($filename,$extension) = explode(".",$basename);//something.ext to something & ext $keywords = $row['keywords'];//you can do fancy stuff with this one, explode into arrays, etc... if (!$rowcounter%3){echo "<tr>";}//if 1 or 2, nothing happens, if 0, it echos <tr> if ($basename) { echo "<td><P><img src='$basename' width='100' height'100' alt='$keywords' /><br>Keywords: $keywords<br><br>"; } echo "</td>"; $rowcounter++; if (!$rowcounter%3){echo "</tr>";}//if 1 or 2, nothing happens, if 0, it echos </tr> } echo "</table>"; mysql_free_result($query);//clear off memory of all data from this query, just in case it returns a lot of results and takes up memory on the sever, helps w/ server load } else { echo "Only letters and numbers please."; } ?>
  4. Hey Their! i used.. http://gr0w.com/articles/code/php_5_star_rating_system_using_hreview/index.php For a rating system. Now i have a dynamic php page... such as mysite.com/index.php?page=viewimage&image_id=s9ds anyways When i use that script.. It posts echo '<form method="post" action="'.$_SERVER["PHP_SELF"].'">'; So when i hit submit it post to just the image.php if you understand me correctly..
  5. Looks like everything works! Thanks again for all your effort!
  6. Well i got the image to display using this code i fixed <? include("include/common.php"); if($_GET['page'] == "viewimage" && !empty($_GET['image_id'])) $image_id = mysql_real_escape_string($_GET['image_id']); $query = @mysql_query("SELECT id,keywords,basename FROM images where id = '$image_id' LIMIT 1"); if(!mysql_num_rows($query)){//0 = false, 1 or more = true die("I'm sorry, no results were found for $keyword_query."); } $row = @mysql_fetch_array($query); echo "<img src=".$row['basename']." alt=".$row['filename']."><br>"; echo "<b>Viewing image: ".$row['pkey']."</b>"; ?> didn't use $row = @mysql_fetch_array(mysql_query($query)); it that a problem? But keywords and filename still wont show
  7. I added an @ infront so i think that fixed the error message but still wont pull the information from that database.. <? include("include/common.php"); if($_GET['page'] == "viewimage" && !empty($_GET['image_id']))//dose that make it do image_id= the image $image_id = mysql_real_escape_string($_GET['image_id']);//make it sanitized for database input $query = "SELECT filename,id,pkey,basename,keywords FROM images where id = '$image_id' LIMIT 1"; if(!@mysql_num_rows(mysql_query($query))){ die("I'm sorry, we cannot find the image in the database.");//selects the filename,pkey,basename from images colume } $row = @mysql_fetch_array($query); echo "<img src=".$row['basename']." alt=".$row['filename']."><br>";//displays the images echo "<b>Viewing image: ".$row['pkey']."</b>"; ?> I dont see why not.. It dose not display the filename or pkey or basename on the page.. Just has Broken image than under that is Viewing image:
  8. Alright! now it reads the url.. But i keep getting Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in and it shows a broken image when you go to the page.. so i dont think its pulling the information from the database.
  9. Fixed the error i was getting befor if($_GET['page'] == "viewimage" && !empty($_GET['image_id'])) Added the extra ) at the end seemed to fix it.. But now i get a new error.. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in line 9.. and that is if(!mysql_num_rows($query)){//this returned 0, so die Also if i go to http://www.mysite.net/image.php?page=viewimage&image_id=aec448645c The aec448645c should be in the pkey table so it should find it but it says I'm sorry, we cannot find the image in the database.
  10. Heyy thanks again.. I keep getting Parse error: parse error, unexpected '{' on line 5.. Not sure why if($_GET['page'] == "viewimage" && !empty($_GET['image_id']){//dose....
  11. Okay... The image_id is also letters to... 24sdfh1d21n looks like that sometimes. When i use that code it dosent display any images.. or any information.. just ... Show something else here, we're not looking at a specific image... Also if you put a made up id in it still works... basicly all i want it do to.. is grab the id from the url so if some puts 7dasnf7as it searches image column and the filename table.. if it finds the exact match it will echo out the image on the page witch is located in the basename table and than after that some room for my other stuff
  12. Hey did you get my pms? Also can you explain these part do. if(is_numeric($_GET['image_id']) && $_GET['page'] == "viewimage"){//dose that make it do image_id= the image $image_id = mysql_real_escape_string($_GET['image_id']);//make it sanitized for database input $query = "SELECT filename,pkey,basename FROM images where image_id = '$image_id' LIMIT 1"; if(!mysql_num_rows($query)){//this returned 0, so die die("I'm sorry, we cannot find the image in the database."); -- selects the filename,pkey,basename from images colume } $row = mysql_fetch_array($query); echo "<img src=".$row['basename']." alt=".$row['filename']."><br>"; - displays them? echo "<b>Viewing image: ".$row['pkey']."</b>";
  13. Bare with me let me know if i did this right... <? ob_start();//output buffering include("include/common.php"); if(is_numeric($_GET['image_id']) && $_GET['page'] == "viewimage"){//display the image $image_id = mysql_real_escape_string($_GET['image_id']);//make it sanitized for database input $query = "select pkey from images where image_id = '$image_id' LIMIT 1"; if(!mysql_num_rows($query)){//this returned 0, so die die("I'm sorry, we cannot find the image in the database."); } $row = mysql_fetch_array($query); echo $row['stuff']; echo $row['otherstuff']; } else {//they do not want to view an image, so just show them something else //stuff here } ?> If i use the code like that is just a blank white page.. no image their. and if i put in a wrong pkey it shows Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in line 11 witch is if(!mysql_num_rows($query)){//this returned 0, so die and than the I'm sorry, we cannot find the image in the database So you know... The Image colum is has the following in it.. id filename ipaddress date status pkey user keywords basename if you follow me.. the filename stores it like this 921fsf2.jpg and the pkey is just the name 921fsf2 basename is the imge url such as http://www.mysite.net/uploads/d405282029 and it displays the image.
  14. Hey doubled check and i got it kinda to work... im going to pm you the links to the site so you can see for your self...
  15. <? ob_start();//output buffering include("include/common.php"); $keyword_query = mysql_real_escape_string($_POST['keyword_query']);//we need to sanitize ANY and ALL user input, to prevent sql injection and yada-yada $query = @mysql_query("SELECT id,basename,keywords FROM images WHERE keywords LIKE '%$keyword_query%' ") or die(mysql_error()); if(!mysql_num_rows($query)){//0 = false, 1 or more = true die("I'm sorry, no results were found for $keyword_query."); } //if it gets to here, that means there were some matches... echo "<table><tr>"; $rowcounter = 0; while($row = mysql_fetch_array($query)){ $basename = $row['basename']; list($filename,$extension) = explode(".",$basename);//something.ext to something & ext $keywords = $row['keywords'];//you can do fancy stuff with this one, explode into arrays, etc... if (!$rowcounter%3){echo "<tr>";}//if 1 or 2, nothing happens, if 0, it echos <tr> if ($basename) { echo "<td><img src='$basename' witdh='100' hight'100' alt='$keywords' /><br>Keywords: $keywords<br><br>"; } $rater_id=$row['id']; $rater_item_name=ucfirst($filename);//capitalize filename for rating include("rater.php"); echo "</td>"; $rowcounter++; if (!$rowcounter%3){echo "</tr>";}//if 1 or 2, nothing happens, if 0, it echos </tr> } echo "</table>"; mysql_free_result($query);//clear off memory of all data from this query, just in case it returns a lot of results and takes up memory on the sever, helps w/ server load ?> Fixed it myself! Wow I love this forum.. i learned so much just from all this.. Is their any tutorial for Having it create dynamic pages.. so when it echos it makes it so you can click the link and go to a page that displays the image that was clicked... if you understand me correctly.
  16. That dosent work.. It now dosent display any images even if you search for them. Just says cannot find images
  17. Their might be some Xss code in the keywords that was just for testing
  18. Wow sorry about all this i know its alot.. But if you can tell me how to make it so they can click the image and it goes to a page.. that displays the image they click on with description and other stuff that i pull from the database
  19. Oh wait hold on.. I got the search form named search.html and than the php code witch is at search2.php if i search using the html form it goes and and its in neat columns but when i go to search2.php directly it displays all images with keywords witch is good but looks all messed up like how i described it on the top.
  20. Hey ratings work but the display of the image are messed up... It looks like this |----------------------| | - - - | | - - - | | - - - | | - - - | | - - - | |----------------------| - represents a image and rate and keyword.. The first row looks good but than thier a big gap in the middle and the second and thrid row are all meesed up ..
  21. Hey also on my html form where i search for the images... I can use Xss in it... Any idea how to fix it?
  22. Sure.. it's a single file called rater.php <? // User settings $rater_ip_voting_restriction = true; // restrict ip address voting (true or false) $rater_ip_vote_qty=1; // how many times an ip address can vote $rater_already_rated_msg="You have already rated this item. You were allowed ".$rater_ip_vote_qty." vote(s)."; $rater_not_selected_msg="You have not selected a rating value."; $rater_thankyou_msg="Thankyou for voting."; $rater_generic_text="this item"; // generic item text $rater_end_of_line_char="n"; // may want to change for different operating systems if(!isset($rater_id)) $rater_id=1; if(!isset($rater_item_name)) $rater_item_name=$rater_generic_text; // DO NOT MODIFY BELOW THIS LINE $rater_filename='item_'.$rater_id.".rating"; $rater_rating=0; $rater_stars=""; $rater_stars_txt=""; $rater_rating=0; $rater_votes=0; $rater_msg=""; // Rating action if(isset($_REQUEST["rate".$rater_id])){ if(isset($_REQUEST["rating_".$rater_id])){ while(list($key,$val)=each($_REQUEST["rating_".$rater_id])){ $rater_rating=$val; } $rater_ip = getenv("REMOTE_ADDR"); $rater_file=fopen($rater_filename,"a+"); $rater_str=""; $rater_str = rtrim(fread($rater_file, 1024*,$rater_end_of_line_char); if($rater_str!=""){ if($rater_ip_voting_restriction){ $rater_data=explode($rater_end_of_line_char,$rater_str); $rater_ip_vote_count=0; foreach($rater_data as $d){ $rater_tmp=explode("|",$d); $rater_oldip=str_replace($rater_end_of_line_char,"",$rater_tmp[1]); if($rater_ip==$rater_oldip){ $rater_ip_vote_count++; } } if($rater_ip_vote_count > ($rater_ip_vote_qty - 1)){ $rater_msg=$rater_already_rated_msg; }else{ fwrite($rater_file,$rater_rating."|".$rater_ip.$rater_end_of_line_char); $rater_msg=$rater_thankyou_msg; } }else{ fwrite($rater_file,$rater_rating."|".$rater_ip.$rater_end_of_line_char); $rater_msg=$rater_thankyou_msg; } }else{ fwrite($rater_file,$rater_rating."|".$rater_ip.$rater_end_of_line_char); $rater_msg=$rater_thankyou_msg; } fclose($rater_file); }else{ $rater_msg=$rater_not_selected_msg; } } // Get current rating if(is_file($rater_filename)){ $rater_file=fopen($rater_filename,"r"); $rater_str=""; $rater_str = fread($rater_file, 1024*; if($rater_str!=""){ $rater_data=explode($rater_end_of_line_char,$rater_str); $rater_votes=count($rater_data)-1; $rater_sum=0; foreach($rater_data as $d){ $d=explode("|",$d); $rater_sum+=$d[0]; } $rater_rating=number_format(($rater_sum/$rater_votes), 2, '.', ''); } fclose($rater_file); }else{ $rater_file=fopen($rater_filename,"w"); fclose($rater_file); } // Assign star image if ($rater_rating <= 0 ){$rater_stars = "./img/00star.gif";$rater_stars_txt="Not Rated";} if ($rater_rating >= 0.5){$rater_stars = "./img/05star.gif";$rater_stars_txt="0.5";} if ($rater_rating >= 1 ){$rater_stars = "./img/1star.gif";$rater_stars_txt="1";} if ($rater_rating >= 1.5){$rater_stars = "./img/15star.gif";$rater_stars_txt="1.5";} if ($rater_rating >= 2 ){$rater_stars = "./img/2star.gif";$rater_stars_txt="2";} if ($rater_rating >= 2.5){$rater_stars = "./img/25star.gif";$rater_stars_txt="2.5";} if ($rater_rating >= 3 ){$rater_stars = "./img/3star.gif";$rater_stars_txt="3";} if ($rater_rating >= 3.5){$rater_stars = "./img/35star.gif";$rater_stars_txt="3.5";} if ($rater_rating >= 4 ){$rater_stars = "./img/4star.gif";$rater_stars_txt="4";} if ($rater_rating >= 4.5){$rater_stars = "./img/45star.gif";$rater_stars_txt="4.5";} if ($rater_rating >= 5 ){$rater_stars = "./img/5star.gif";$rater_stars_txt="5";} // Output echo '<div class="hreview">'; echo '<form method="post" action="'.$_SERVER["PHP_SELF"].'">'; echo '<h3 class="item">Rate <span class="fn">'.$rater_item_name.'</span></h3>'; echo '<div>'; echo '<span class="rating"><img src="'.$rater_stars.'?x='.uniqid((double)microtime()*1000000,1).'" alt="'.$rater_stars_txt.' stars" /> Ave. rating: '.$rater_stars_txt.'</span> from <span class="reviewcount"> '.$rater_votes.' votes</span>.'; echo '</div>'; echo '<div>'; echo '<label for="rate5_'.$rater_id.'"><input type="radio" value="5" name="rating_'.$rater_id.'[]" id="rate5_'.$rater_id.'" />Excellent</label>'; echo '<label for="rate4_'.$rater_id.'"><input type="radio" value="4" name="rating_'.$rater_id.'[]" id="rate4_'.$rater_id.'" />Very Good</label>'; echo '<label for="rate3_'.$rater_id.'"><input type="radio" value="3" name="rating_'.$rater_id.'[]" id="rate3_'.$rater_id.'" />Good</label>'; echo '<label for="rate2_'.$rater_id.'"><input type="radio" value="2" name="rating_'.$rater_id.'[]" id="rate2_'.$rater_id.'" />Fair</label>'; echo '<label for="rate1_'.$rater_id.'"><input type="radio" value="1" name="rating_'.$rater_id.'[]" id="rate1_'.$rater_id.'" />Poor</label>'; echo '<input type="hidden" name="rs_id" value="'.$rater_id.'" />'; echo '<input type="submit" name="rate'.$rater_id.'" value="Rate" />'; echo '</div>'; if($rater_msg!="") echo "<div>".$rater_msg."</div>"; echo '</form>'; echo '</div>'; ?> Than you put <? $rater_id=1; $rater_item_name='Item 1'; include("rater.php"); ?> It makes a file called rater_1.rank that stores the ranking. and you can change the rater number.. so you can use more the one ranker. so i thought all i have to do is pull the id from the image column.
  23. Alright! that worked! Now one last question lol! I followed a Tutorial for a rating system.. Now it uses ids to keep track of what has what rating... <? $rater_id=1; $rater_item_name='Item 1'; include("rater.php"); ?> Now the image table has id and a file name field.. so how can i call it so it gose on the raiting system.. If you understand the rows in the images are called id and filename <? $rater_id=$id; $rater_item_name='$filename; include("rater.php"); ?>
  24. Hey that worked I have one more question back about the image search code.. When you go the the page it will display all of the images, and thats okay But some images dont have basenames and keywords so you have a whole bunch of images that are blank and have the broken image display on them... Is their a way to only display images with that the basename is not null or something similar if you understand me.
×
×
  • 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.