Jump to content

Search the Community

Showing results for tags 'expression'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. I am coding a series of preg_replace expressions to try and strip unnecessary html/css code from text that was originally created using FCKEditor and is being copied programatically into CKEditor. All works well until I try to do a search/replace on a string that ends with a ">". No matter what I try this does not work, it either appears to do nothing or it errors and my resulting text is empty. In this case, if a table definition does not have a width defined, I want to add a width of 100%. The old/new strings and replace expression (str_replace in this case) are below. $oldstring = 'cellspacing="0">'; $newstring = 'cellspacing="0" width="100%">'; $textstring = str_replace($oldstring, $newstring, $textstring); It seems that the problem is related to the ">". If I take this out, it works ok. However I want to be sure that "cellspacing" is the last tag for a table definition (the tags were added automatically by FCKEditor and are always in the same order). Thanks for any help. I have been tearing my hair out for hours over this.
  2. hi there everyone! i currently have, in my php document (which generates various xml depending on post and querystring request values) - the following function: function getdbconfig($file = "") { if ($_GLOBALS["ssl_enabled"] == 1 && ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) || $_GLOBALS["ssl_enabled"] == 0) { $pattern = '/^\$conn = mysql_connect\("([a-zA-Z._0-9\-]+)", "([a-zA-Z_0-9]+)", "([a-zA-Z_0-9]+)"\);$'. '|^mysql_select_db\("([a-zA-Z_0-9]+)", \$conn\);$'. '|^date_default_timezone_set\([\'"]([A-Za-z0-9\/+\-]+)[\'"]\);$'. '|^\$GLOBALS\["dtmstyle"\] = "([^"]+)";$'. '|^\$GLOBALS\["dtlast"\] = ([0|1]);$'. '|^\$GLOBALS\["prod_prodmode"\] = ([0|1]);$'. '|^\$GLOBALS\["prod_prodmail"\] = "([^@]+@[^"]+)";$'. '|^\$GLOBALS\["curl"\] = ([0|1]);$'. '|^\$GLOBALS\["conn_timeout"\] = ([0-9]+);$'. '|^\$GLOBALS\["post_timeout"\] = ([0-9]+);$'. '|^\$GLOBALS\["ssl_enabled"\] = ([0|1]);$/m'; $connstr = file_get_contents($file, FILE_USE_INCLUDE_PATH); echo "<sql>".$connstr."</sql>\n"; $arr = array(); if (preg_match_all($pattern,$connstr,$arr,PREG_PATTERN_ORDER)) { echo "<sql>".print_r($arr,true)."</sql>\n"; array_push($GLOBALS["sql"],print_r($arr,true)); echo " <conn dbsrvr=\"".$arr[1][6]."\" dbname=\"".$arr[4][7]."\" user=\"".$arr[2][6]."\" pass=\"".$arr[3][6]."\" php_tz=\"".$arr[5][10]."\" php_dtf=\"".$arr[6][8]."\" php_dta=\"".$arr[7][9]."\" pt_on=\"".$arr[8][0]."\" pt_mail=\"".$arr[9][1]."\" curl=\"".$arr[10][2]."\" cto=\"".$arr[11][3]."\" pto=\"".$arr[12][4]."\" ssl=\"".$arr[13][5]."\" />\n"; } } else { $redirect = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; header("Location: $redirect"); } } however - there is something wrong somewhere in the outer if statements, as i get nothing printed! the global variables should post the following, according to the currently parsed file contents: <?xml version="1.0" encoding="utf-8"?> <root> <conn dbsrvr="localhost" dbname="*****" user="*****" pass="*****" php_tz="Africa/Johannesburg" php_dtf="Y/m/d H:i:s" php_dta="0" pt_on="0" pt_mail="greywacke@outlook.com" curl="1" cto="15" pto="30" ssl="0" /> <sql></sql> </root> please note - private information such as database names, usernames and passwords were replaced with ***** can anyone help me out please, in resolving this issue? (to get the regular expression values printed!) any comments, questions and/or suggestions are welcome! sincerely, Pierre du Toit.
×
×
  • 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.