Jump to content

StirCrazy

Members
  • Posts

    75
  • Joined

  • Last visited

    Never

Everything posted by StirCrazy

  1. Hi folk, Need some of that 'ol phpfreaks magic I'm trying to contruct a page (as a whole) from lots of sub template files. Some of these sub template files call other sub template files (a bit like you would use 'include' to call a php file). I'm currently using this function, but it only constucts the page up to the first sub level template (it doesn't get templates within templates). function contructpage($template) { global $subdir; $templateincludes = getStrsBetween('{template:','}', $template); if (isset($templateincludes)) { foreach ($templateincludes as $value => $tplfile) { if(!($includedtemplate = @file_get_contents($subdir['templates'] . '/' . $tplfile))) { error('no_sub_tpl', $tplfile); } $template = eregi_replace('{template:' . $tplfile. '}', strval($includedtemplate), $template); } } return $template; } $template = file_get_contents('main_template.tpl') $whole_template = contructpage($template); Can anyone help making a function that keeps going until the whole page is made? EG: index.tpl:- file1.tpl:- subfile1.tpl:-
  2. you my friend are a genius! Thank you very much for the help (sorry for the delay in replying, was feeding the baby).
  3. thanks badbad Kinda got it working using below, but is a very dirty way of coding. There must be a patten that matches it. $message = (str_replace('[url]http://www.' . $domain, '', $message)); $message = (str_replace('[url=http://www.' . $domain, '', $message)); $message = (str_replace('[url="http://www.' . $domain, '', $message));[/code] I'll give your way a go and see what happens.
  4. Hey all Having a little problem with pattern matching (because I'm crap at it LOL). I need to remove a variable URL from page text. Problem is the URL is wedged between bbcode. The domain variable:- $removedomain = "domain.com"; Needs to cater for:- with or without http / https :// with or without www. EG: $pagetext = (preg_replace($pattern, '', $pagetext)); Can anyone help me with the correct pattern to remove the right domain? Thanks, S.C>
  5. Hi there, I've used stripos to find the position of part a word. How would I find the full word? EXAMPLE: $string = "this is message text text text text text text text text text text text"; the full word at character position 10 is "message". How word I put that full word ("message") in a variable (for use later)? Thanks in advance.
  6. Thanks for the ultra fast reply mgallforever
  7. I know this is really simple but have brain freeze. How do you include a page but include error.php (or any error file) if the file doesn't happen to exist.... for example include($page . '.php') //if page doesn't exist then... include ('error.php')
  8. Hi folks, Wonder if someone can give me a hand If I had a variable like this:- and an array like this:- How would I find out how many times each word in the array features in $contents ? The preferable return would be an array like this:- Any help would be great Thanks in advance
  9. You genius Works on your version, just have to addapt it now. Thank you utexas_pjm
  10. Hi folks, I'm trying to sensor some text variables (but in a specific way). Looks like this:- $text = "text text text BOB1 text text text"; $replacetext = "*****"; $var1 = array("BOB","JACK","BILLY","HARVEY","JOHN"); $var2 = array("1","2","3","4","5"); If $text has "BOB" anywhere in the variable then check if it has a number from $var2 joined to it. If it has the replace "BOB1" with $replacetext. Any ideas how to do this? Will love you forever if you can help. S.C>
  11. I've just recently upgraded to PHP Version 5.2.3 from 4.4.7 and noticed a problem with one of my GD images. It should use verdana.ttf for the text using the code below imagettftext($image, $fontSize, 0, $margin, 73, $black, $font, $tickerText); But for some reason the text is messed up... and ideas why? S.C>
  12. thanks fenway. can you tell what variables are sent?... say if I selected 1st January 2007 -> 2nd January 2007 (ie. how is the date formatted when parsed in the form). Thanks for your help. S.C>
  13. I'm trying to figure out how this __doPostBack function works in relation to the date form below. I'm trying to get a commission report for another site and want to find out what variables it posts and in what format. Can anyone help? Sample below. Oh and just a side note (that should be in the PHP forum but you may know) Is it possible to post variables using PHP CURL to an .aspx page? Regards, S.C>
  14. I'm trying to get unix time based on data inputted into a drop down menu: example code below:- <select id="dateselector" value="day" class="datedropdown"> <option onChange="updateDate();" value="01" name="inDay" >1</option> <option onChange="updateDate();" value="02" name="inDay" >2</option> <option onChange="updateDate();" value="03" name="inDay" >3</option> <option onChange="updateDate();" value="04" name="inDay" >4</option> ... <select id="dateselector" value="month" class="datedropdown"> <option onChange="updateDate();" value="01" name="inMon" >January</option> <option onChange="updateDate();" value="02" name="inMon" >February</option> <option onChange="updateDate();" value="03" name="inMon" >March</option> ... <select id="dateselector" value="year" class="datedropdown"> <option onChange="updateDate();" value="06" name="inYear" >2006</option> <option onChange="updateDate();" value="07" name="inYear" >2007</option> ... I have no idea how to get the updateDate() function to output unix time into 'var timestamp' as i have very little experience with .js I'm guessing it looks a little like:- function updateDate() { var timestamp = new Date(Date.UTC(document.getElementsByName("inYear").value, (stripLeadingZeroes(document.getElementsByName("inMon").value)-1), stripLeadingZeroes(document.getElementsByName("inDay").value), 0, 0, 0)); timestamp=timestamp.getTime()/1000.0; updateText(); } (updateText(); then updates a text area) Any help to with the correct syntax would be great. Thanks in advance S.C>
  15. Does anyone have a PHP generated dropdown date selector that automatically selects todays date on page load that i can pinch? Love ya loads if you do. Regards, S.C>
  16. Hi folks, I'm trying login into a website and store a webpage (that contains a sales report) in a variable. So far I can login using:- But the reports page isn't the first page of the website. So I need to login, goto the reports page, submit the form details and capture the results in a variable. What I need is to login in using:- This is the page with the reports FORM:- post these details:- to this page ...and store the results in $page_contents Does that make any sense? I hope someone can help S.C>
  17. perfect.. just what i needed  :D Thanks for your help S.C>
  18. How would I go about printing the html of a webpage hosted on another server? E.G:- [code]$url_to_output = "http://www.domain.com/page123.php"; <!-- some function to output html rather than run it --> echo $page_html;[/code] Regards, S.C>
  19. Hi there, Our website has a very strict spam policy and are in the process of stopping our members from putting links on certain websites. How would I got about:- [quote]if referred from ebay.com or ebay.co.uk or othersite.com { warning_function(); exit; }[/quote] Any help would be appreciated. S.C>
  20. Cheers arianhojat, looks right but get an error. Fatal error: Cannot instantiate non-existent class: domdocument in /xml-import.php on line 3 ($xml = new DOMDocument;) I'm I right in guessing this is a problem with my PHP version? S.C>
  21. This is probably the wrong place to post this but I'm hoping someone who knows PHP here also knows ASP/IIS Is there a way of doing this:- [code]Dim xmlrequest Set xmlrequest = Server.CreateObject("MSXML2.ServerXMLHTTP") xmlrequest.open "GET", strQuery, False xmlrequest.setRequestHeader "Content-type", "text/xml" xmlrequest.send xml.loadxml(xmlrequest.responseText) xsl.load(Server.MapPath(".") & "\results.xsl")[/code] ...in PHP? Regards, S.C>
  22. Can anyone work out what is wrong with this code? This is my my_query function:- [code]<?php $link = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) or die ("Could not connect to database. Try later<BR>"); @mysql_select_db(DB_NAME, $link); function my_query($sql) {   global $link;   $result = @mysql_query($sql, $link);   if ($result) return $result;   if (DEBUG_MODE) { error_report(10); };   return false; }   ?> [/code] $_REQUEST['credit'] has a list for order numbers from a textarea:- [code]<?php $arr_orders = explode("\n",$_REQUEST['credit']); $where_clause = "WHERE trackingid IN ('".implode("','",$arr_orders)."')"; $r = my_query("select user_id,site,offer,points,timedate,trackingid,status from offer_clicks " . "$where_clause");   ?>   <h1>Preview Accounts</h1><br>    <table border="1" cellspacing="0" cellpadding="2">   <tr>   <th bgcolor="#dddddd">Site</th>    <th bgcolor="#dddddd">User ID</th>   <th bgcolor="#dddddd">Username</th>    <th bgcolor="#dddddd">Offer</th>   <th bgcolor="#dddddd">Credit</th>   <th bgcolor="#dddddd">Date / Time</th>   <th bgcolor="#dddddd">Tracking ID</th>    <th bgcolor="#dddddd">Status</th>   <th bgcolor="#dddddd">Credit</th>   <th bgcolor="#dddddd">Pending</th>   <th bgcolor="#dddddd">Reject</th>      </tr>   <?php     while (list($user_id,$site,$offer,$points,$timedate,$trackingid,$status) = mysql_fetch_array($r)) {   $sql = my_query("select username from central_users where id='$user_id'"); list($username) = mysql_fetch_row($sql); $sql = my_query("select site_name from site_options where site_prefix='$site'"); list($site_name) = mysql_fetch_row($sql);    if ('0' == $status) {      $status = "Clicked"  ;   }      if ('1' == $status) {      $status = "Credited"  ;   }    if ('2' == $status) {      $status = "Pending"  ;   }      if ('3' == $status) {      $status = "Rejected"  ;   }      if ($points < 100) { $points = $points ." Credit";      } if ($points > 99) { $points = "Full Credit"; }   ?>   <tr>   <td width="75" align="center"><?php echo $site_name; ?></td>      <td width="75" align="center"><?php echo $user_id; ?></td>   <td width="125" align="center"><?php echo $username; ?></td>   <td width="125" align="center"><?php echo $offer; ?></td>   <td width="100" align="center"><?php echo $points; ?></td>    <td width="110" align="center"><?php echo date("d-m-Y H:i",$timedate); ?></td>   <td width="110" align="center"><?php echo $trackingid; ?></td>    <td width="75" align="center"><?php echo $status; ?></td>   <td width="75" align="center"><INPUT TYPE=RADIO NAME="<?=$trackingid?>" VALUE="<?=$trackingid?>" CHECKED></td>   <td width="75" align="center"><INPUT TYPE=RADIO NAME="<?=$trackingid?>" VALUE="<?=$trackingid?>"></td>   <td width="75" align="center"><INPUT TYPE=RADIO NAME="<?=$trackingid?>" VALUE="<?=$trackingid?>"></td>    </tr>   <?php     }   ?>   </table>      <?php    return(0); }   ?>[/code] Problem is it only displays the last order... any ideas? S.C>
  23. Still baffled: If I put in three order numbers and echo the $where_clause [quote]WHERE order IN ('166254052 ','166094039 ','165904030') [/quote] but only pulls up order 165904030 S.C>
×
×
  • 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.