Jump to content

dc2007

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Everything posted by dc2007

  1. try insert the content example $content = get_url("http://url-to-content"); preg_match("~<span style="color: red;">Your Price</span>:$(.+?)<br>~s", $content, $match); $price = preg_replace("$","",$match[1]); $price = ltrim(rtrim($price)); echo $price; function get_page($url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $content = curl_exec($ch); return $content; }
  2. hi i have looked around that site i cant see any example with LIBXML_PARSEHUGE in it but also it states Only available in Libxml >= 2.7.0 (as of PHP >= 5.3.2 and PHP >= 5.2.12) im running PHP 5.3.13 and 5.4.4 can you please give me an example of how to implement it into the original code.. thanks
  3. i put simplexml_load_string($filecontent,'LIBXML_PARSEHUGE'); and get error Warning: simplexml_load_string() expects parameter 2 to be a class name derived from SimpleXMLElement, 'LIBXML_PARSEHUGE'
  4. you very welcome that would be fine love.
  5. really need help with this Urgent if possible...thanks
  6. try this mate <script type="text/javascript"> function get() { $.post('search_tsr.php', { search_term: $("#Name").val() }, function(output) { $('#search_results').html(output).show(); }); } $("#SceneName").live("keypress", function(e) { $("#form").submit(); $.post('search_tsr.php', { search_term: $("#Name").val() }, function(output) { $('#search_results').html(output).show(); }); }); </script> <form name="form"> <img src="gfx/search_magnifyer.jpg" width="18" height="18" border="0" align="absmiddle"> <input name="name" id="Name" type="text" value="" /><input type="button" onClick="get()" value="Go"> </form> <div id="search_results"></div>
  7. yes mate as long as the $_POST['imgurl is the full path to the file if not then you must put unlink("/path/to/files/".$imgurl);
  8. Good lol nice to meet a girl whos interested in php coding lol whats your site will take a look and if you need anymore help im around. p.s i think you need to edit your first post to change status to solved.. David.
  9. if you are a female i will lol glad i could help.
  10. try this mate <script type="text/javascript"> function get() { $.post('search_tsr.php', { search_term: $("#Name").val() }, function(output) { $('#search_results').html(output).show(); }); } $("#SceneName").live("keypress", function(e) { if (event.keyCode == 13) { $("#form").submit(); $.post('search_tsr.php', { search_term: form.name.value }, function(output) { $('#search_results').html(output).show(); }); } }); </script> <form name="form"> <img src="gfx/search_magnifyer.jpg" width="18" height="18" border="0" align="absmiddle"> <input name="name" id="Name" type="text" value="" /><input type="button" onClick="get()" value="Go"> </form>
  11. looking at the script its not querying the database to find the file name add under unlink(); add echo $file; what does it return
  12. try replacing downloads with you whole path to the file unlink("/path/to/file/downloads/".$file);
  13. change unlink("./downloads/".$file); to unlink("../downloads/".$file);
  14. is the downloads folder in the same folder as the php file is so replace the code with: <?php $host = "localhost"; $user = "myusername"; $pass = "mypassword"; $database = "mydatabasename"; $conn = mysql_connect($host, $user, $pass) or die( mysql_error() ); mysql_select_db($database) or die( mysql_error() ); $table = mysql_real_escape_string( $_GET["table"] ); $id = mysql_real_escape_string( $_GET["id"] ); $message = mysql_real_escape_string( $_GET["message"] ); $redirect = mysql_real_escape_string( $_GET['redirect'] ); $file = mysql_real_escape_string( $_GET['file'] ); unlink("./downloads/".$file); $sql="DELETE FROM $table WHERE id='$id'"; $result = mysql_query( $sql ) or die( mysql_error() ); if($result) { header("Location: ../successful.php?message=$message&redirect=$redirect"); }else{ echo"there was a problem!"; } mysql_close($conn); ?>
  15. what does $file return ? and whats the path do the downloads folder ?
  16. here <?php $host = "localhost"; $user = "myusername"; $pass = "mypassword"; $database = "mydatabasename"; $conn = mysql_connect($host, $user, $pass) or die( mysql_error() ); mysql_select_db($database) or die( mysql_error() ); $table = mysql_real_escape_string( $_GET["table"] ); $id = mysql_real_escape_string( $_GET["id"] ); $message = mysql_real_escape_string( $_GET["message"] ); $redirect = mysql_real_escape_string( $_GET['redirect'] ); $file = mysql_real_escape_string( $_GET['file'] ); unset("path/to/download/folder/".$file); $sql="DELETE FROM $table WHERE id='$id'"; $result = mysql_query( $sql ) or die( mysql_error() ); if($result) { header("Location: ../successful.php?message=$message&redirect=$redirect"); }else{ echo"there was a problem!"; } mysql_close($conn); ?>
  17. can you explain please or give me an example with the code i added thank you as i dont know what to do with that never used libxml.
  18. your a legend mate sorted AND FROM_UNIXTIME(down.time) > NOW() - INTERVAL 24 HOUR thank you. maybe you could have a look at my other issue http://forums.phpfreaks.com/index.php?topic=361603.0 thanks again..
  19. time int(10) UNSIGNED No
  20. no mate still not working
  21. thanks for that mate but it was the wrong code lol here the proper one for the download file $grabs= $db->query_first(" SELECT COUNT(*) AS `grab` FROM " . TABLE_PREFIX . "downloaded AS down WHERE down.userid = '" . $vbulletin->userinfo['userid'] . "' AND down.time > NOW() - INTERVAL 24 HOUR "); $vbulletin->db->free_result($grabs); $totgrabs = $grabs['grab']; if($totgrabs >= $permissions['ugpindexperday']) { standard_error("You have reached you daily download limit of 10"); } and for the display of how many the member had downed $perd = $vbulletin->db->query_first(" SELECT COUNT(*) AS `perday` FROM " . TABLE_PREFIX . "downloaded AS down WHERE down.userid = '" . $vbulletin->userinfo['userid'] . "' AND down.time >= NOW() - INTERVAL 24 HOUR "); $vbulletin->db->free_result($perd); $downed = $perd['perday']; but its displaying 0
  22. Hi i have a php mysql query where it see how many attachments users have downloaded per day but i need it to reset at each users midnight but at the moment its no its just removing one each time its 24 hour after. if($row['postdate'] <= (time()-$permissions['ugpindexretention']*24*60*60) AND ($vbulletin->userinfo['userid'] != $row['owner']) AND (!in_array($vbulletin->userinfo['usergroupid'], array(6)))) { standard_error("Sorry you can only download 10 attachments per 24 hours."); }
  23. Hi i have a little bit of php code and its uses simple xml to parse file uploads but it seems to work fine with <?xml version="1.0" encoding="UTF-8"?> when its parsed tidly 0but errors out on <?xml version="1.0" encoding="iso-8859-1" ?> the code is function pieceslisting($where, $id) { $filecontent = file_get_contents($where); $xml = simplexml_load_string($filecontent) or die ("Unable to load XML file!"); $nzbpiece = 0; foreach($xml->{"file"} as $nfile) { $nsubject = (string) trim($nfile['subject']); $ndate = 0 + trim($nfile['date']); $nposter = (string) trim($nfile['poster']); $nposter = sqlesc($nposter); // To find num of segments in subject: $nsubjsegs = 0 + subj_seg($nsubject); // To find out if Par or not $npar = sqlesc(stristr($nsubject, "par2")?0:1); $nsfv = sqlesc(stristr($nsubject, "sfv")?0:1); $nnfo = sqlesc(stristr($nsubject, "nfo")?0:1); $navi= sqlesc(stristr($nsubject, "avi")?0:1); //$nr = sqlesc(stristr($nsubject, 'r')?0:1000); $nrar = sqlesc(stristr($nsubject, "rar")?0:1); $nsubject = sqlesc($nsubject); $groups = array(); foreach($nfile->groups->group as $group) { $groups[] = (string) trim($group); } $ngroups = sqlesc(serialize($groups)); $nsegcount = 0; $nsize = 0; foreach($nfile->segments->segment as $segment) { $nbytes = 0 + trim($segment['bytes']); $nsize += $nbytes; $nsegcount++; } $query = mysql_query("UPDATE " . TABLE_PREFIX . "nzbpiecelist SET piece_poster = $nposter, piece_date = $ndate, piece_subject = $nsubject, piece_groups = $ngroups, piece_size = $nsize, piece_segments = $nsegcount, piece_subjseg = $nsubjsegs, piece_par = $npar, piece_sfv = $nsfv, piece_nfo = $nnfo, piece_avi = $navi, piece_rar = $nrar WHERE nzb = $id AND nzb_piece = $nzbpiece"); $nzbpiece++; } unset ($filecontent, $nzbpiece, $xml, $nposter, $ndate, $nsubject, $ngroups, $nsize, $nsegcount, $nsubjsegs, $npar, $nsfv, $nnfo, $navi, $nrar); } i upload a file and it come up with erros like this but i have memory_limit = 500M and im running php5.4.4 and also tried on 5.3.13. can any one help thanks.
×
×
  • 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.