Jump to content

Jakez

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Jakez's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Found a solution, although I'm sure there's a regex that could do this in one line $string = ",8,1,2,3,4,5,6,7,8,9,89,87,83,8"; $patterns = array(); $patterns[0] = '/(,8,)/'; $patterns[1] = '/(,$/'; $replacements = array(); $replacements[1] = ','; $replacements[0] = ''; echo preg_replace($patterns, $replacements, $string);
  2. Ah I forgot to give that example, yeah that's was one of the solutions I thought of, but if the ID is at the beginning or end then it's not going to work: $string="1,2,3,4,5,6,7,8"; I seem to run into this type of string replace problem quite often, surely there's got to be some PHP function I don't know about that deals with exactly this.
  3. I'm trying to find the simplest (no big function) solution to this, probably could do some kind of regex, but I'm a regex noob. Ok let's say I have a string of ID's like: $string="1,2,3,4,5,6,7,8,9,89,87,83"; Then I want to remove ID 8. So I do this: $string=str_replace(",8","",$string); Simple enough right? BUT it's going to remove the ,8 from ID's 89 and 87 also! And if it's at the beginning or end of the string I think that could pose another problem as well..
  4. http://www.codeeclipse.com You would need to somehow make the application actually need (require) this file. Encryption and the like is not normally the best approach to licensing, it also now means your application can only run on servers where the encryption engine you have chosen to use is supported. Yeah I know, which is why I did my best to find an encryption method that doesn't require any special engines installed. It's not the best encryption obviously, but will ward off at least most of the people. I'm just not sure how to make the script require this encrypted file(s) to run without them being able to remove the includes and checks in the non-encrypted files. Maybe put one important function inside the encrypted file and they won't know which one it is without going through everything? But if they just remove the include it would easily tell them which function(s) is missing.
  5. How do I sell a PHP script on a per domain license basis? I've found a utility that will encrypt a file for me, I just want to encrypt one file that is required for the script to run so that they can still do some editing to the other parts of the script if they want. Question is, how do I include the one encrypted file which checks their domain for validation without the person deleting the include?
  6. I think I just learned something while searching Google. Do I just use $GLOBALS[path] and $GLOBALS[etc] inside the function?
  7. Ok let's say I am loading settings from MySQL into varibles like so: $result=mysql_query("SELECT * FROM table WHERE id='1' LIMIT 1"); while($row=mysql_fetch_array($result)) { $path=$row['path']; $etc=$row['etc']; } Then I have a function: function func_name() { global $path, $etc; print $path.$etc; } Is there a way to "pre" global these variables so that I can use them in all my functions without having to global them inside each function? I have a lot of variables loaded in the settings and I'd rather not have to global them in every function.
  8. OK I have a search form on my page, I want to search the database for each word someone types in, for example instead of matching the exact phrase "song lyrics" I want it to search for fields containing "song" AND/OR "lyrics". I tried this query below but no luck: SELECT * FROM table WHERE field LIKE 'song' OR field LIKE 'lyrics' OR other_field LIKE 'song' OR other_field LIKE 'lyrics' What am I doing wrong?
  9. Ok so I have something like: Array ( [http://www.url.com/audio/60723620cc4eaa73/] => decripsdf sf asdf sdf [http://www.url.com/audio/6072363275d23388/] => description asf asdf asd ) And afterwards I need to be able to print out something using both the URL's and the text they hold, like: <a href=http://www.url.com/audio/60723620cc4eaa73/>decripsdf sf asdf sdf</a> <a href=http://www.url.com/audio/6072363275d23388/>description asf asdf asd</a> Problem is, I don't know how to do this because arrays confuse the hell out of 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.