Jump to content

vin_akleh

Members
  • Posts

    36
  • Joined

  • Last visited

Everything posted by vin_akleh

  1. how can i do this? select * From table_name Where date = currentmonth when date is a double and i insert it like so date = date("U") so i want to select the month of date("U") for the current month
  2. i can match this pattern /<a href="\/How_I_Met_Your_Mother\/season-1\/episode-1\/search\?page=\d+".+\d+<\/a>/i but my priblem is that this pattern selects line by line into an array what i need it to do is that it selects every match in 1 single line and puts it in a array with different index. $html=<div class="pagination"><span class="disabled prev_page">« Previous</span> <span class="current">1</span> <a href="/How_I_Met_Your_Mother/season-1/episode-1/search?page=2" rel="next">2</a> <a href="/How_I_Met_Your_Mother/season-1/episode-1/search?page=3">3</a> <a href="/How_I_Met_Your_Mother/season-1/episode-1/search?page=4">4</a> <a href="/How_I_Met_Your_Mother/season-1/episode-1/search?page=2" class="next_page" rel="next">Next »</a></div> //*this is all in one line not multiple lines* //if this was in multiple lines i wouldn't have this problem preg_match_all('/<a href="\/How_I_Met_Your_Mother\/season-1\/episode-1\/search\?page=.*/', $html, $pages); preg_match_all('#<a.+href="/How_I_Met_Your_Mother/season-\d+/episode-\d+/search\?page=\d+.+?">[^<]+</a>#', $html, $pages); for ($i=0;$i<sizeof($pages[0]);$i++) { echo $pages[0][$i]; echo $pages[0][0]; echo $pages[0][1]; //////////////////////////////////////////this would give undefined index } any suggestions would be appreciated.
  3. sorry about the mistake i made above here is what i need: hi, i would like for this regexp preg_match_all('/<a href="\/How_I_Met_Your_Mother\/season-.+[^next]/', $html, $link, PREG_PATTERN_ORDER); to grab only somthing like this: <a href="/How_I_Met_Your_Mother/season-1/episode-1/links/5215143" data-track-action="ClickNonFeaturedLSRPLink" rel="nofollow">videobb.com</a> not this: <a href="/How_I_Met_Your_Mother/season-1/episode-1/search?page=2" rel="next">2</a> or this: <a href="/How_I_Met_Your_Mother/season-1/episode-1/search?page=2" class="next_page" rel="next">Next »</a> or this: <a href="/How_I_Met_Your_Mother/season-1/episode-1/search" class="dofollow">search</a> or this: <a href="/How_I_Met_Your_Mother/season-1/episode-1" class="donotfollow sr-blue">Season 1 Episode 1</a> but it is grabing them all! can you give me some pointers thanks
  4. hi, i would like for this regexp preg_match_all('/<a href="\/How_I_Met_Your_Mother\/season-.+[^next]/', $html, $link, PREG_PATTERN_ORDER); to grab only somthing like this: <a rel="nofollow" data-track-action="ClickNonFeaturedLSRPLink" href="/How_I_Met_Your_Mother/season-1/episode-1/links/5215143">videobb.com</a> not this: <a rel="next" href="/How_I_Met_Your_Mother/season-1/episode-1/search?page=2">2</a> or this: <a rel="next" class="next_page" href="/How_I_Met_Your_Mother/season-1/episode-1/search?page=2">Next »</a> or this: <a class="dofollow" href="/How_I_Met_Your_Mother/season-1/episode-1/search">search</a> or this: <a class="donotfollow sr-blue" href="/How_I_Met_Your_Mother/season-1/episode-1">Season 1 Episode 1</a> but it is grabing them all! can you give me some pointers thanks
  5. ****************disregard the last post please*********************** should this work?? $title[1]='faster'; $html_poster_link = file_get_contents('http://www.rottentomatoes.com/search/full_search.php?search=Faster'); if (preg_match('/<a href="\/m\/'.$title[1].'-2\/.*?/i', $html_poster_link, $poster_link)) if i am looking for if yes then why it is not working for me??
  6. should this work?? $title[1]='Faster'; $html_poster_link = file_get_contents('http://www.rottentomatoes.com/search/full_search.php?search=Faster'); if (preg_match('/<a href="\/m\/'.$title[1].'-2010\/.*?/i', $html_poster_link, $poster_link)) if i am looking for if yes then why it is not working for me??
  7. this script saves the image from a url to the folder were this script is saved, how can i make this code save images into specific folder such as "/image/poster_image/" <?php $img[]='http://images.rottentomatoescdn.com/images/redesign/poster_default.gif'; foreach($img as $i){ echo $i; save_image($i); // if(getimagesize(basename($i))){ // echo '<h3 style="color: green;">Image ' . basename($i) . ' Downloaded OK</h3>'; // }else{ // echo '<h3 style="color: red;">Image ' . basename($i) . ' Download Failed</h3>'; // } } //Alternative Image Saving Using cURL seeing as allow_url_fopen is disabled - bummer function save_image($img,$fullpath='basename'){ if($fullpath=='basename'){ $fullpath = basename($img); } $ch = curl_init ($img); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); $rawdata=curl_exec($ch); curl_close ($ch); if(file_exists($fullpath)){ unlink($fullpath); } $fp = fopen($fullpath,'x'); fwrite($fp, $rawdata); fclose($fp); } ?>
  8. sorry guys but i didn't realize that preg_match was case sensitive
  9. $html_poster_link = file_get_contents('http://www.rottentomatoes.com/m/hop_2011/');
  10. i do want to pair them but if this realy work then this should work but it doesnt if (preg_match('/<a href="\/m\/'.$title[1].'_2011\/.*/', $html_poster_link, $poster_link)) { ECHO"YES"; } !!!
  11. how can i make this work?? i have this variable $title[1] and wanna insert it in the preg_march like so this doesnt work how can i make it work??
  12. this is a code that gets the link of the video from a website of one page <?php $html = file_get_contents('http://test.com/movie.php?id=7333'); if (preg_match('/<param name="movie".*/', $html, $matches)) { echo "1- Match was found <br />"; echo $matches[0]; } ?> i would like to make it search such contents from the whole website test.com not just test.com/movie.php?id=7333 any idea how to do that???
  13. i have a banner that changes image every couple of seconds that retrieve the images from a static images like so: old code: var image1=new Image() image1.src="uploads/firstcar.gif" var image2=new Image() image2.src="uploads/secondcar.gif" var image3=new Image() image3.src="uploads/thirdcar.gif" var image4=new Image() image3.src="uploads/cat.gif" <div class="banner"> <p class="banner_image"> <a href="http://www.w3.org/"> <img src="banner/123.jpg" name="slide" width="290px"> <script> <!-- //variable that will increment through the images var step=1 function slideit(){ //if browser does not support the image object, exit. if (!document.images) return document.images.slide.src=eval("image"+step+".src") if (step<3) step++ else step=1 //call function "slideit()" every 2.5 seconds setTimeout("slideit()",2500) } slideit() //--> </script> </p> <p class="banner"> <a href="http://www.w3.org/">banner</a> </p> </div> know i want it to retrieve the images from database like so New modifications: <?php $count_im=1; $req=mysql_query("select * from banner"); while ($res=mysql_fetch_array($req)){ ?> var image<?php echo $count_im; ?> =new Image() image<?php echo $count_im; ?>.src="<?php echo $res["banner"]; ?>" <?php $count_im++; }?> but the problem is that it know freezes on the last image, it doesn't loop!! any ideas how to fix it
  14. if this was in variable $x and i want it to become any one can help
  15. i need a solution for my code, i dont want to keep on changing my code every time i start one
  16. i tried this code and it worked fine but when i try to apply it on my site i am having some problems !!! <?php /* Place code to connect to your DB here. */ include('connection.php'); // include your code to connect to DB. $tbl_name="mawdoatseyaseya"; //your table name // How many adjacent pages should be shown on each side? $adjacents = 3; /* First get total number of rows in data table. If you have a WHERE clause in your query, make sure you mirror it here. */ $query = "SELECT COUNT(*) as num FROM $tbl_name"; $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages[num]; /* Setup vars for query. */ $targetpage = "index.php?page=mawdoatseyaseya&"; //your file name (the name of this file) $limit = 15; //how many items to show per page $page_num = $_GET['page_num']; if($page_num) $start = ($page_num - 1) * $limit; //first item to display on this page else $start = 0; //if no page var is given, set start to 0 /* Get data. */ $sql = "SELECT * FROM $tbl_name LIMIT $start, $limit"; $result = mysql_query($sql); /* Setup page vars for display. */ if ($page_num == 0) $page_num = 1; //if no page var is given, default to 1. $prev = $page_num - 1; //previous page is page - 1 $next = $page_num + 1; //next page is page + 1 $lastpage = ceil($total_pages/$limit); //lastpage is = total pages / items per page, rounded up. $lpm1 = $lastpage - 1; //last page minus 1 /* Now we apply our rules and draw the pagination object. We're actually saving the code to a variable in case we want to draw it more than once. */ $pagination = ""; if($lastpage > 1) { $pagination .= "<div class=\"pagination\">"; //previous button if ($page_num > 1) $pagination.= "<a href=\"$targetpage?page_num=$prev\">« السابق</a>"; else $pagination.= "<span class=\"disabled\">« السابق</span>"; //pages if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up { for ($counter = 1; $counter <= $lastpage; $counter++) { if ($counter == $page_num) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?page_num=$counter\">$counter</a>"; } } elseif($lastpage > 5 + ($adjacents * 2)) //enough pages to hide some { //close to beginning; only hide later pages if($page_num < 1 + ($adjacents * 2)) { for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) { if ($counter == $page_num) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?page_num=$counter\">$counter</a>"; } $pagination.= "..."; $pagination.= "<a href=\"$targetpage?page_num=$lpm1\">$lpm1</a>"; $pagination.= "<a href=\"$targetpage?page_num=$lastpage\">$lastpage</a>"; } //in middle; hide some front and some back elseif($lastpage - ($adjacents * 2) > $page_num && $page_num > ($adjacents * 2)) { $pagination.= "<a href=\"$targetpage?page_num=1\">1</a>"; $pagination.= "<a href=\"$targetpage?page_num=2\">2</a>"; $pagination.= "..."; for ($counter = $page_num - $adjacents; $counter <= $page_num + $adjacents; $counter++) { if ($counter == $page_num) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?page_num=$counter\">$counter</a>"; } $pagination.= "..."; $pagination.= "<a href=\"$targetpage?page_num=$lpm1\">$lpm1</a>"; $pagination.= "<a href=\"$targetpage?page_num=$lastpage\">$lastpage</a>"; } //close to end; only hide early pages else { $pagination.= "<a href=\"$targetpage?page_num=1\">1</a>"; $pagination.= "<a href=\"$targetpage?page_num=2\">2</a>"; $pagination.= "..."; for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++) { if ($counter == $page_num) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?page_num=$counter\">$counter</a>"; } } } //next button if ($page_num < $counter - 1) $pagination.= "<a href=\"$targetpage?page_num=$next\">التالي »</a>"; else $pagination.= "<span class=\"disabled\">التالي »</span>"; $pagination.= "</div>\n"; } ?> <?php echo '<br><table class="sample" style="width:95%;"><tbody><tr><th style="width:70%;">العنوان</th><th style="width:20%;">التاريخ</th></tr>'; while($row = mysql_fetch_array($result)) { echo '<tr><td>'; echo '<a href="'.$row["mawdoatseyaseya"].'"style="font-size:130%;color:blue">'.$row["mawdoatseyaseya_title"].' &nbsp(<label style="font-size:10px;">'.(round(filesize($row["mawdoatseyaseya"])/(1024*1024),2)).'م.ب</label>)</a>'; echo '</td><td>'; echo date("d-m-Y",$row[date]); echo '</td></tr>'; } echo '</tbody></table><br><span class="center2">'; echo $pagination; echo '</span>'; ?> <?php=$pagination?> only the first page shows up, when i try to go to the next page it changes the pag_num from 1 to 2 but the displayed data is the same from the pag_num=1 i think the problem is here $targetpage = "index.php?page=mawdoatseyaseya&"; //your file name (the name of this file) but i cant figure it out
  17. <?php $pg=$_GET["pg"]-1; if ($pg<0)$pg=0; $pg=$pg*15; $maxurl=mysql_query("select * from mawdoatadabia order by id desc limit ".$pg.",15"); echo '<span class="forms">'; echo '<br><table class="sample" style="width:95%;"><tbody><tr><th style="width:70%;">العنوان</th><th style="width:20%;">التاريخ</th></tr>'; while ($result=mysql_fetch_array($maxurl)) { echo '<tr><td>'; echo '<a href="'.'index.php?page=new_adabia&'."maktoba_id=".''.$result["id"].'" style="font-size:130%;color:blue">'.$result["mawdoatadabia_title"].'</a>'; echo '</td><td>'; echo date("d-m-Y",$result[date]); echo '</td></tr>'; }//end while echo '</tbody></table>'; $count=mysql_fetch_array(mysql_query("select count(*) from mawdoatadabia")); $max_page=ceil($count['0']/15); if($max_page<1){ $max_page=1;} $page_counter=''; for($i=1;$i<=$max_page;$i++) { if ($i==$pg){ $page_counter.='<a href="'."index.php?page=mawdoatadabia".'&pg='.$i.'" style="padding:7px;background-color:#f1f1f1;"><b>'.$i.'</b></a>'; }else{ $page_counter.='<a href="'."index.php?page=mawdoatadabia".'&pg='.$i.'" style="padding:7px;">'.$i.'</a>'; } } echo '<br><span class="pad">...'.$page_counter.'...</span><br>'; echo'</span> <br>'; ?> why this part of my code doesn't ever work if ($i==$pg){ $page_counter.='<a href="'."index.php?page=mawdoatadabia".'&pg='.$i.'" style="padding:7px;background-color:#f1f1f1;"><b>'.$i.'</b></a>'; i want to mark the current page that is being viewed??!! need help please
  18. can any one tell me what is the correct reg-ex and how to do it to remove both <!--[if !supportLineBreakNewLine]--> and <!--[endif]--> thanks
  19. i know how to design if you dont understand what im saying why the reply the site is editable by the client he will inserting and adding data it to the database using WYSIWYG and will be viewed to other users as an html site the site owner is the one who is inserting from a document
  20. I WANT ALL THE COLORS AND THE DESIGN 2
  21. in that case it will become in black and whight not collored and will change the design of the text
  22. i am doing a site for a client but im having some problems with IE but not with other browsers. this is the site: saadizeidan/com replace the / with . i use wysiwyg to insert into database IE shows it with somthing like this and and the page after that get messed up but with other browsers every thing is very good any ideas how to fix it this is whats in the database feild that im selecting:
  23. i did modify php.ini restarted my PC didn't work!! any other suggestions?
  24. i am using WAMPSERVER. this is the output of "print_r($_FILES);": what is the "[error] => 1"??!
×
×
  • 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.