Jump to content

s_bastian

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

s_bastian's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. what you need to look at is $_SERVER['HTTP_REFERER'] this var states where connection comes from. You can put a filter that if referer is not internal or null the link is sent back. Or you can compile an array with a list of sites you want to "cut off", and then filter what can pass and what cannot. You will then use the META REFRESH to redirect the page where you need, or an include() to load a warning page. Pay attention with a "total" filter, it will also block links coming from search engines result pages...
  2. ok, after I was confirmed by PM that there is no direct, single function way to do what I need, I solved the thing by myself, developing the paranoid fist idea I had (working with the exploded array with array search and replace) into this piece of code, maybe a little clumsy but effective... [code]// var setup $hist="a loto of text"; // this is the main text I need to parse to get my infos $inserie=0; // determinates if we have to consider the lines or not $in_string=" SERIE -"; // the word/flag in $hist from where what I'm interested in begins $out_string="^-"; // the word/flag in $hist from where what I'm interested in ends $serie=""; // a string the rebuild the "original" text portion $new_serie=""; // the ouptut string // the job // I explode the main text in an array line by line $work_serie=explode("\n", $hist); // print_r($work_serie); //debug // I use these debug lines to undesrtand where I get stuck foreach ($work_serie as $row_serie) {   $row_serie=trim($row_serie); //cleanin up of data    // determinates the array chunk where "recording" ends. It precedes the line that starts the recording because in my case, also starting line would match stop, causing no recording at all    if (preg_match("/$out_string/", $row_serie) ) {      $inserie=0;    }    // determinates the array chunk where "recording" begins.    if (strpos($row_serie, $in_string)) {      $inserie=1;    }    // the recording of data    if ($inserie==1) {        $serie .="$row_serie\r\n"; // This is the cleaned up data, rebuilt to it's original form        $new_serie.="<b>$row_serie</b><br>"; // This is the worked out data. Final version will do some more str_replace and also some mysql querys      } } // echo $new_serie; //debug // gets the final ouput $hist=str_replace($serie, $new_serie, $hist); [/code] My knowledge stops here, if someone knows how to improve it, any advice is welcome (and feel free to use it if you need.. ;)
  3. Do you need to block certain users (eg: web spiders) or the fact that someones links to your pages? referrers work on this latter case, but if you need to block spiders the best option is to work out a robots.txt for you site...
  4. Hi! I have a very long string, (say a description of a game divided in tech data, description etc), and I would like to be able to do some str_replace() operation on only one part of it. Example [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]- TECHNICAL DATA - (some text here) - SERIES - 1. [!--coloro:red--][span style=\"color:red\"][!--/coloro--]Dynasty Wars[!--colorc--][/span][!--/colorc--] (1989) 2. [!--coloro:red--][span style=\"color:red\"][!--/coloro--]Warriors of Fate[!--colorc--][/span][!--/colorc--] (1992) - STAFF - (other text here) [/quote] I want to change the red strings with a link. This means I need to trim out od the text the "SERIES" chapter and work on that. And this is my problem: HOW can I do this? is there any kind of regular espression function that puts the matched text into a string? something like [code]$mytext=get_that_string($the_long_string, "/^- SERIES (.*.) - STAFF -/"); [/code] retunrning a $mytext stating [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]- SERIES - 1. Dynasty Wars (1989) 2. Warriors of Fate (1992) - STAFF -[/quote] (no problem in replacing the names with the links, I can dig that... ;) I was planning to do this by splitting the string on ^-, and working then on the array that would result from this, but isn't there any faster way? Searched the function list, but all string check functions I found states if the needle is in the haystack, but do not return the needle.... Many thanks for any reply!
  5. Thanks for answer, at least I know I can start working on that. Any suggestion on where to start from? Many thansk again!
  6. Hi everybody. I admit I'm n00b on this kind of operations, and I hope I'm on the right place. I run a MAME (the arcade emulator) related site, with searchable database etc. Now I wanted to make a php based MAME frontend that could be downloaded by users, run the mame.exe with a passthru or an exec command (the one that will fit better) etc., to be run locally and dialogue with the online mysql based database to exchange infos. The structure is already done, it works fine, but it only has a "small problem": The size. The frontend by itself is a small bunch of php pages, but if I want to distribute it "to the masses" it would mean to download and install the whole php-apache-mysql thing, plus the setting it up (and this may not be easy for unexperienced users...) What I wanted to know is (some advices, just to know if it is possible, before i become crazy to discover after a sleepless research week that it cannot be done....): is it possible to compile a minimal php environement, with a very small php.exe and (all the rest).exe including only the instructions I need, so to reduce the size of the compiled distributable binary to the max? Any advice is welcome. 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.