Jump to content

TripleDES

Members
  • Posts

    64
  • Joined

  • Last visited

Everything posted by TripleDES

  1. Ahh...I needed this: '\\0' Can you explain the significance of \\0, \\1, etc..??
  2. Still doesn't work: $myarray = "i am [[happy]] today"; $pattern = "/\[\[.+?\]\]*/ie"; foreach ($myarray as $val) { $val = preg_replace($pattern, "strtoupper('\\1')", $val); print $val . "\n"; }
  3. Bumping this thread. I have a similar scenario. See this string: $subject = "i am [[happy]] today"; I'd like to only change happy to uppercase. $pattern = "/\[\[.+?\]\]*/"; preg_replace($pattern, strtoupper(??whatdoidohere??), $val);
  4. Got it. Thanks for your help and Neil's on this. I appreciate it!!
  5. eval() does work, but I'd like to know why akitchin recommended against it.
  6. I tried that too, but no workie. By the way, why do you recommend against using eval()? $begin = 'i_ar[\'NEW:'; $end = '\'][0]'; echo $$newline; PHP Notice: Undefined variable Seems that will only work if I define $i_ar['NEW:THIS'][0]; beforehand.
  7. [line] => [[THIS]] [newline] => $i_ar['NEW:THIS'][0] Running this gets me an undefined variable error: echo $$newline; But running this gets me the value I'm looking for: echo $i_ar['NEW:THIS'][0];
  8. I tried it that way, but I get this. PHP Notice: Undefined variable
  9. I didn't want to overcomplicate the question, but here it goes. I'm trying to pull values from a string (eventually will be a file) that contains delimiters within [[]]. The index from an array I'm pulling is exactly the name of [[]]. So in this case, [[THIS]] can be called with $i_ar['NEW:THIS][0] and return a value. I'm replacing [[ with $i_ar['NEW: and ]] with ][0]. So instead of displaying the string, I want the value of the array called. Hope this clarifies it a bit and thanks for the help!! $template = 'Replace [[THIS]] and [[THISTOO]]'; $parser = xml_parser_create (); $ipinfo = implode ("", file("xml.txt")); xml_parse_into_struct($parser, $ipinfo, $d_ar, $i_ar); preg_match_all('/\[\[.+?\]\]/', $template, $matches); $begin = '$i_ar['NEW:'; $end = '\'][0]'; foreach ($matches[0] as $line) { $newline = str_replace('[[', '', $line); $newline = str_replace(']]', '', $newline); echo "$begin$newline$end"; }
  10. Thanks for the quick reply. Okay, here's more information: $begin = '$c['NEW:'; $end = '\'][0]'; $newline = str_replace('[[', '', $line); $newline = str_replace(']]', '', $newline); echo "$begin$newline$end"; Gives me: $c['NEW:Array'][0] Instead of the value
  11. How do I go about calling a variable that is stored as a string? For example, I have a variable called: $a = '$newvariable'; Now when I call upon $a, I'd like the value in $newvariable to be called instead of being interpreted as a string. Any ideas?
  12. Thanks. I've tried the hidden input and the session to no avail. Still does this: 20080709.100331 and then: 20080709.100335 Very odd. Maybe too many moving parts. Here's what I have so far. The sflow function calls cURL to a web site. if (!isset($_SESSION['tstamp'])) { session_start(); $_SESSION['tstamp'] = date('Ymd.His'); } $ordnum = $_POST['ordernumber']; $serialnum = $_POST['serialnumber']; if (isset($ordnum)) { $flowname = "SRP"; $fresult = sflow($flowname); } Then I have a AJAX reading the file: var fileName = myWan + '\-' + myDate; function status() { var myAjax = new Ajax.PeriodicalUpdater('status', 'readfile.php?fname=' + fileName, {method: 'get', frequency: 5.0, decay: 1}); }
  13. I'm using the following as part of a unique ID: $timestamp = date('Ymd.His'); However, I'm noticing the timestamp is getting set twice. First when the page loads and second when the is submitted. What can I do to only use the timestamp generated at page load?
  14. But the value I want for the variable is the value of the input. Would this still work?
  15. Hopefully, this is a simple question. How do I go about setting a variable (PHP/Javascript) so when a user clicks out of a text field, it's immediately assigned? Thanks!
  16. Oh...I just bumped a thread for this very same question. I guess I'll need to look into sessions.
  17. Resurrecting this thread. Is there any way to pass variables to another page using POST instead of GET?
  18. Question on how to go about this. I've created a PHP function that writes to a file which is then printed on the page using AJAX. I'd like to run this function twice with an AJAX update after each. However, both functions must complete before the AJAX portion is able to print to the page. Is there a way around this? myFunction(); Print contents with AJAX myFunction(); Print again.... Just more information: I'm using prototype.js for AJAX which looks something like this: var myAjax = new Ajax.PeriodicalUpdater('status', 'readfile.php {method: 'get', frequency: 3.0, decay: 1}); And it's called by: <div align="center" id="status"></div>
  19. Simple example: <script> var test = "<?php echo date.php;?>"; function myDate() { var myAjax = new Ajax.PeriodicalUpdater('date', test, {method: 'get', frequency: 2.0, decay: 1}); } </script>
  20. Thanks, but I still can't get it to work: { var myAjax = new Ajax.PeriodicalUpdater('date', <?=$date?>, {method: 'post', frequency: 5.0, decay: 1}); }
  21. If I store a variable in $date= $_POST['date']; How do I go about using it in a javascript? { var myAjax = new Ajax.PeriodicalUpdater('date', 'rand.php', {method: 'post', frequency: 5.0, decay: 1}); }
  22. Can this be done without a trim? Or do you always need to trim when you want to match items in between delimiters? ie. I have this: <highlight>text</highlight> And I only want to display text Would I need to trim off <highlight> Or can this be done through regex?
  23. Thanks, but storing file information in a db is a little more complicated than I want to make it.
  24. I have a backup script for a particular file that is constantly updated. However, I only want the backup to be executed if the file size changes. What's a good way for me to check the 159302 Jan 23 00:10 file.20080123.tgz 159893 Jan 25 13:16 file.20080124.tgz 159377 Jan 25 14:31 file.20080125.tgz 1. Check the last file by date. 2. Check file size 3. Create new backup if file size != previous file. Any opinions on this matter? I currently have it checking today's date and yesterday's date. There's a flaw with this method since if a backup wasn't created because of a previous size match, then a backup will always occur every other day even if the file size doesn't change. ie. Feb 01 100k file.200800201.tgz Feb 02 - 100k - same size no change Feb 03 100k file.200800203.tgz - This is because yesterday file size = 0, thus new file is created.
  25. RTFM!! curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
×
×
  • 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.