Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. The browser sends the "HTTP_USER_AGENT" data, PHP uses that data to look up more info, and as the server relies on the client sending that data, it can be spoofed, So everything refers on $_SERVER['HTTP_USER_AGENT'], the browscap.ini is just extending info (a lookup from the reference if you will)
  2. Strange! go start -> Run and type C:\wamp\bin\apache\Apache2.2.11\bin\php.ini see if it loads up
  3. if you have a link without the domain at the start it will append to the current domain, so for example <a href="/login.php">login</a> will go to the login.php of the current domain (here would be http://www.phpfreaks.com/login.php, on google.com it would be google.com/login.php etc etc this might work (may need some tweaking) <?php $url = "http://southcoast.craigslist.org"; $html = file_get_contents("$url/muc/"); preg_match_all('/<a href="([^"]+)">([^<]+)<\/a><font size="-1">([^"]+)<\/font>/s', $html,$posts,PREG_SET_ORDER); //echo "<pre>";print_r($posts); foreach ($posts as $post) { //print $post[0]; //HTML $post[2] = str_ireplace($url,"",$post[2]); //remove domain echo "<a href=\"$url/{$post[1]}\">{$post[2]}<\/a><font size=\"-1\">{$post[3]}<\/font>"; print "<BR />\n"; } ?>
  4. create a script <?php phpinfo(); ?> open that in the browser and look for Loaded Configuration File on the right of that it will give you the full path to the php.ini file used
  5. Well it was an example for the order of the array!, format the text however you wish, hence the comments stating whats what, or just use the HTML line (i commented it out for ease of use)
  6. works for me [sCRIPT] http://madtechiesupport.com/freaks/downloadpdf.php [PDF] http://madtechiesupport.com/freaks/test.pdf <?php $file = "test.pdf"; $newfilelocation = "test.pdf"; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); header ("Content-Type: application/pdf" ); header("Content-Disposition: attachment; filename=\"".$file."\";"); header("Content-Transfer-Encoding:­ binary"); $filesize = filesize($newfilelocation); header("Content-Length: ".$filesize); readfile($newfilelocation); exit; ?>
  7. This is normally a network problem, or php.ini setting (ie max post size set to low).
  8. try changing else if(isset($_POST['save'])) to else if(isset($_POST['update']))
  9. So what does happen ? try this <?php header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); header("Content-Type: application/pdf" ); header("Content-Disposition: attachment; filename=\"".$file."\";"); header("Content-Transfer-Encoding:­ binary"); $filesize = filesize(newfilelocation); header("Content-Length: ".$filesize); readfile($newfilelocation); exit; ?>
  10. Cool If this is solved please click the topic solved button (Bottom left) (this saves other members wasting time reading posts that have already been solved) you can unsolved it by clicking the button again (it gets toggled to unsolved)
  11. That's because your new here, At PHPFreaks if you don't get a quick response then you probably asked the wrong question Oh and on that note welcome EDIT: oh an my example don't split words
  12. So what happens In IE (version unknown) and what was you expecting to happen ? do both have acrobat installed or another PDF handler ?
  13. Their are many ways to split the string, most will create an array then you just concatenate them back together, but we need to know how you wish the split it up, for example to split it in half you could do this <?php $str = "This is the title split"; $words = str_word_count($str, 1); $first_half = ceil(count($words)/2); echo "<span >"; for($n=0;$n<$first_half;$n++) echo $words[$n]." "; echo "</span>"; for($n=$first_half;$n<count($words);$n++) echo $words[$n]." "; ?> or using word wrap <?php $str = "This is the title split"; $str = str_replace("\n","",$str); //remove linespace $text = explode("\n",wordwrap($str, 20, "\n")); //word wrap at 20 char & put in array foreach($text as $newtext){ echo "<span>$newtext</span>\n"; } ?>
  14. You probably want the Set Order for example <?php $html = file_get_contents("http://southcoast.craigslist.org/muc/"); preg_match_all('/<a href="([^"]+)">([^<]+)<\/a><font size="-1">([^"]+)<\/font>/s', $html,$posts,PREG_SET_ORDER); //echo "<pre>";print_r($posts); foreach ($posts as $post) { //print $post[0]; //HTML print $post[1]; //Link print $post[2]; //Description print $post[3]; //Short Text print "<BR />\n"; } ?>
  15. oops that should be $sel = "SELECTED";
  16. Oh and your need to have an onchange update <select name="img01"> to <select name="img01" onchange="chkFrm(this)"> should do it!
  17. Sorry i have been as busy as hell today, and I'm off out now, but try this update foreach ($found as $filename) { echo "<option value='$filename'>$filename</option>\n"; } to $selectedImage = ""; //default image foreach ($found as $filename) { if(!empty($_POST['img01']) && $_POST['img01'] == $filename){ $sel = "SELECTED":""; $selectedImage = $filename; } echo "<option value='$filename' $sel>$filename</option>\n"; } } and <tr> <td><img src="<?php echo $row_chosen_pItem['img02']; ?>" width="250" height="250"></td> <td><?php echo $row_chosen_pItem['img02']; ?> </td> </tr> to <tr> <td><img src="uploaded/<?php echo $selectedImage; ?>" width="250" height="250"></td> <td><?php echo $selectedImage; ?> </td> </tr>
  18. I remember on my Amstrad 464 Plus, I sat up all night writing code from the back of the book, (i didn't even know how to save it) and ran it, and got an error on line 10, that was something like this 10: 'This is a Game I wrote 10: `This is a Game but couldn't workout the problem, so I cried myself to sleep.
  19. program Life; begin writeln('Wake Up'); writeln('Remember's using Pascal'); writeln('Feels old'); writeln('goes to bed'); end.
  20. $row_chosen_pItem['img01'] and $row_chosen_pItem['longDesc'] don't seam to be set, can you post the code that builds the imagefile list include('populateDropDownList.php'); include('buildFileList5.php');
  21. SimpleXML is PHP 5 but xml_parse will work just as well
  22. I only had the choice of VB3 and pascal.. So i choose VB, but out of VB and Java, its got to be Java, The question is really do you want to create a quick visual utility, or learn to code at a higher standard? VB is very easy/quick to learn. Java takes a little more time but you can learn a style that will help you program better and can be applied to other languages as well.
  23. I believe the problem is more to do with the https, however the solution is almost the same try this <?php //querying the quick base to get xml response to particular report error_reporting(E_ALL); echo "<pre>"; $request = "https://www.quickbase.com/db/bexiahv4m?act=API_DoQuery&ticket=5_bgstwfekp_byrjk4_b_djxbedds8y689c6beqiurhnr54_b737vy85rv2ge_&apptoken=d75hx9nbmacp3jc7si8ezcdb9wgi&qid=7"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $request); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //REQUIRED for HTTPS curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $xml = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); //list($version,$status_code,$msg) = explode(' ',$http_response_header[0], 3); $status_code = $info['http_code']; //replacing previous line // Check the HTTP Status code switch($status_code) { case 200: // Success break; case 503: die('Your call to quickbase failed and returned an HTTP status of 503. That means: Service unavailable. An internal problem prevented us from returning data to you.'); break; case 403: die('Your call to quickbase failed and returned an HTTP status of 403. That means: Forbidden. You do not have permission to access this resource, or are over your rate limit.'); break; case 400: // You may want to fall through here and read the specific XML error die('Your call to quickbase failed and returned an HTTP status of 400. That means: Bad request. The parameters passed to the service did not match as expected. The exact error is returned in the XML response.'); break; default: die('Your call to quickbase returned an unexpected HTTP status of:'.$status_code); } $career=htmlspecialchars($xml, ENT_QUOTES); echo $career;
  24. OKAY, salathe has posted a nice example and i have a bad one.. but i don't care i spent the time typing it i am god dame going to posts it Okay lets look at a bad example, I wish to match L (2 or more O's) and K So it fines LOOK, LOOOK, LOOOOK etc etc etc LO+O+K Now while that may look fine, when we break it down we can see the problem On the work LOOOK, this part of the code LO+ finds LOOO, now the next part of the code O+ Needs a O but the first part was greedy and took them all!.. SO I backtrack (go back one character at a time from the last greedy expression) now with this simple example that's just a O but I need to hold all this backtrack data in memory, so theirs a limit (you can change this limit in the php.ini) HERE is another example String (note the VOL near the middle) LOLOLOLOLOLOLOLOLOLVOLOLOLOLOLOLOLOLOLO regex [LOV]*VOL This will match the whole string then backtrack until it gets to the middle so about 20 backtrack steps Now this RegEx [LOV]*?VOL does the reverse it gets the first L or O or V then checks for the string VOL, then repeats until it matches VOL then stops matching Greedy vs non-greedy(lazy) So with .*21 in this string 0123456789101112131415161718192021222324252627282930 will match 0123456789101112131415161718192021 about 52 steps this .*?21 will only match this 01234567891011121 about 30 steps Humm.. hope that helps! PS nice example salathe
  25. As i was unable to re-create the problem (No having the correct RegEx) i said its "probably" as that's the most obvious problem with that RegEx,
×
×
  • 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.