Jump to content

Zugzwangle

Members
  • Posts

    56
  • Joined

  • Last visited

Everything posted by Zugzwangle

  1. May I say a big thank you to all who posted.. and thanks to RussellReal too - it worked!! (even though you called me sarcastic)
  2. Oh, I didn't mean to be sarcastic at all!! I was being genuine.. I'll explain. Users 'html' input, is saved to a SQL database, and then recalled. I presumed that if the user saved <?php // content // ?> and it was recalled by php, it would execute - so that is wrong yes?
  3. I want to allow javascript oh!!! Any other ideas?
  4. Hi. I have made profile pages available for users.. How do I turn off <?php ?> for those pages? I would like javascript enabled however. All suggestions are welcome!! Thanks
  5. Hi, I have a website and I want to use 'RewriteRule' to redirect. The "htaccess" file, will be located in the /profile/ folder.. for example http://www.mySite.net/profile/newLoc I want to find the word after "profile/", so in the example above, I want it to find "newLoc", then it needs to redirect to http://www.mySite.net/profile.php?profile=newLoc When at http://www.mySite.net/profile.php?profile=newLoc for example, I want it to show only http://www.mySite.net/profile/newLoc I have found a match for the whole website address: http\:/\/\www\.mySite\.net\/profile\/+(\w+) However I only need to capture the word after "profile/".. How do I ammend my code to search for that? And when the user's arrive at http://www.mySite.net/profile.php?profile=newLoc, I want it to display only http://www.mySite.net/profile/newLoc Any help would be glady appreciated.
  6. Awesome... I was trying to think up some kind of redirect from one page-to-another thing...!!! Thank you.
  7. Hi.. I would like to allow users to create profile pages on my website. So for example... If I wanted to create a profile page called "Zugzwangle"... it would be stored at "www.website.com/Zugzwangle"... in the same such way that MySpace stores profiles. How does this work? I'm at a loss for where to start with this one.. Any hints, or suggestions for where to start looking would be greatly appreciated!! Thanks
  8. ok I worked it out... : $splitTextData = preg_split("/\{([^\}]*)\}/", $textData); preg_match_all('/\{([^\}]*)\}/', $textData, $matches); foreach ($matches[0] as $matVal) { //echo $matVal; $matVal2 = preg_replace('/\[/', '', $matVal); $matVal3 = preg_replace('/\]/', '', $matVal2); $matVal4 = preg_replace('/\%/', '', $matVal3); $matVal5 = preg_replace('/emt/', '', $matVal4); //$matVal5 = preg_replace('/[a-zA-]/', '', $matVal4); $matchArr[] = $matVal5; } //echo print_r($matchArr, true).'<br>'; foreach ($splitTextData as $tdKey => $tdVal) { $comboVal[] = $tdVal.$matchArr[$tdKey]; } //echo print_r($comboVal, true); $textData2 = join(" ", $comboVal);
  9. Oh right.. I didnt know of the function preg_match_all() !!! Ok so, now I have the matches: preg_match_all('/\{([^\}]*)\}/', $textData, $matches); //Outputs: //Array ( [0] => //Array ( [0] => {[%emt 0:00:10]} //[1] => {[%emt 0:00:04]} //[2] => {[%emt 0:02:15]} //[3] => {[%emt 0: 00:14]} //)) So first stage done.. I can now access the elements of $matches.. Now I have to use preg_replace/str_replace to update them.. I'm not sure which yet!
  10. Hi... I have a string (called $textData) with the following format: 1. e4 {[%emt 0:00:10]} c5 {[%emt 0:00:04]} 2. c3 {[%emt 0:02:15]} etc I need to replace the square brackets/special chars within that string with " "... so my first thought was to use preg_match to find the matches.. then preg_replace/str_replace to update them. To find the patterns, I think this is correct: preg_match('/\{([^\}]*)\}/', $textData, $matches); echo print_r($matches, true); // returns Array ( [0] => {[%emt 0:00:10]} [1] => [%emt 0:00:10] ) // returns nothing else I expected the preg_match to search through the whole of $textData. Then I could replace the square brackets/special chars with a spaces. Thank you for your time!!
  11. Zugzwangle

    between

    Simple question.. what is the regex for 'between'? For example, I want to search between { and } and match and delete any special characters between them. (in php)
  12. im very new to regex - does: $aVal2 = str_replace('/\{\[/', "{", $aVal); $aVal3 = str_replace('/\]\}/', "}", $aVal2); find and replace "{[" and "]}" with { and } please help if you can!!
  13. Thats a useful bit of code!!!: ini_set ("display_errors", "1"); error_reporting(E_ALL); I'll use that in future cases or error... However no error has been thrown up!! Grrr.. I'm at a loss..
  14. What is the error in this code? It's such a simple bit of code, but doesnt work... So make me look stupid by pointing out my coding error!!! Good luck!! $dbName = $_GET['dbIdent']; $dirArr = scandir(("uploadedPGN/gameDatabases/"), 0); foreach ($dirArr as $key => $value) { if (is_null($value) || $value=="." || $value==".." || $value=="...") { unset($dirArr[$key]); } } ///// works all the way to here \\\\\ echo '<form method="POST"><select name="process"><OPTION>Select Database: </OPTION>'; foreach($dirArr as $val2) { echo '<OPTION value="processPGN_NONANCL_DB.php?dbIdent='.$val2.'">'.$val2.'</OPTION>'; } echo '</select><input type="submit"></form>'; ////// so why is the little bit of code above causing me such a nightmare? grrr \\\\\
  15. Thank you for explaining it - you are very kind
  16. hi, what would the regular expression be to search for "[+anyword+1 space"... im trying to get to grips with it all!!
  17. yes.. ive tried again and again to do this, but im not sure how to go about it..
  18. hello. i have the following array called $newParts which cycles through game data: [0] => Control 90m + 5s, rated <--start of game 1 [1] => Site Room 1 [2] => Date 2010.08.03 [3] => Round ? [4] => WhiteIs D r A G ó N [5] => BlackIs Spike_and_Butch [6] => Result 0-1 <--end of game 1 [7] => Control 90m + 5s, rated <--start of game 2 [8] => Site Room 1 [9] => Date 2010.08.03 [10] => Round ? [11] => WhiteIs Öschi [12] => BlackIs Shreki [13] => Result 1/2-1/2 <--end of game 2 ---> continues with next game data... The games all start with "Control " and end with "Result " Firstly, I would like to split the array into seperate game arrays. How would I go about doing this? Secondly, I would like to use the first word, of the values in the new arrays, as the Key. So the arrays would become: [site] => Room 1 [Date] => 2010.08.03 [Round] => ? [WhiteIs] => D r A G ó N [blackIs] => Spike_and_Butch [Result] => 0-1 Any help would be greatly appreciated. Thanks
  19. I have tried the below: $uniqueArr = array_diff($thisArray, array_unique($thisArray)); echo print_r($uniqueArr, true); // returns "Array ( )" I have tried to echo print_r, on the $uniqueArr, but it simply returns "Array ( )". There are definitely duplicates within $thisArray. What am I doing wrong?
  20. how would you write a function to find values from an array that are NOT unique? 'array_unique' finds unique items...
  21. Oh, thanks for your code btw.. also this is solved... I used the itrim() function.. foreach ($parts as $value) { $new_key = explode(' ', $value); $new_value = explode(' ', $value, 2); $new_array[ltrim($new_key[0])]= $new_value[1]; }
  22. That kind of works. It results in: Array ( [Event] => Rated game, 90m + 5s [ Site] => Room 1 [ Date] => 2010.07.05 [ Round] => ? ... However there is a 'space' before Site for example. I need to manipulate the data. echo $new_array[' Site']; // outputs nothing.. How do I go about removing the white space if this is necessary?
  23. Hi. I have an array named $parts: [0] => Event Rated game, 90m + 5s [1] => Site Room 1 [2] => Date 2010.07.05... and I simply want to use the first word of the array 'Value', as the 'Key'. so the new array would look like this: [Event] => Rated game, 90m + 5s [site] => Room 1 [Date] => 2010.07.05... Please help if you can.
×
×
  • 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.