PHP - Moved: Change Text String After ?? Seconds
This topic has been moved to JavaScript Help.
http://www.phpfreaks.com/forums/index.php?topic=342245.0 Similar Tutorials
Hi, echo '<div style="float:right;width:60%;color:#666666">'. TeamSpeak3_Helper_Convert::version($ts3->virtualserver_uptime) .'</div>'; Edited June 24, 2020 by Lux05 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=327134.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=357414.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=343671.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=352669.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=326004.0 below is the script.i use it for to edit a single .html file. but now i want to edit multiple .html file by this script. so i think i have to change dynimacaly (may be a dropdown form) this line $url = "p".$page.".html"; and this line. can any body help? Code: [Select] <?php function br2nl($str) { return preg_replace('=<br */?>=i', "", $str); } $action=$_POST['action']; $textarea=$_POST['textarea']; if($_GET['p']){ $page=$_GET['p']; } // Assume your text pages are called, p1.db or p2.db, etc. $url = "p".$page.".html"; if (file_exists($url)) { // do nothing } else { $url = "p0.html"; } // where to go back to after the edit ... $return="edit.php?p=$edit"; // Get page $data = implode("", file($url)); if($action=="save"){ $newtext=stripslashes($textarea); $newtext = str_replace("<?", "", $newtext); $newtext = str_replace("?>", "", $newtext); $newtext = nl2br($newtext); //echo "page: $url<br><br>\n"; //echo $newtext; $fh = fopen($url, 'w') or die("can't open file"); fwrite($fh, $newtext); fclose($fh); header ("location:edit.php?p=$page"); } else{ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>abeer cms</title> <script type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script> <script type="text/javascript"> tinyMCE.init({ // General options mode : "textareas", theme : "advanced", plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager", // Theme options theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true, // Example content CSS (should be your site CSS) content_css : "css/example.css", // Drop lists for link/image/media/template dialogs template_external_list_url : "js/template_list.js", external_link_list_url : "js/link_list.js", external_image_list_url : "js/image_list.js", media_external_list_url : "js/media_list.js", // Replace values for the template plugin template_replace_values : { username : "Some User", staffid : "991234" } }); </script> <style> body,html{ margin:0px auto; width:700px; text-align:center; } #content{ margin:0px auto; width:700px; } #middle h1 { color: transparent; font-family:georgia; font-size:12pt; margin:0; color: #dF9100; padding:10px 0px 15px 0px; text-align:left; } </style> </head> <body> <div id='content'> <? $ta=br2nl($data); echo" <a href='$return'><-- Return to Page</a><br /><br /> Make Changes and click \"Save Changes\" at the very bottom ...<br /> <form action='edit.php' method='post'> <input type='hidden' name='action' value='save'> <input type='hidden' name='p' value='$page'> <input type='hidden' name='n' value='$n'> <textarea name='textarea' rows='25' cols='80'>$ta</textarea> <br /> <input type='submit' name='submit' value='Save Changes'> </form> <div id='middle' style='width:680px; text-align:left; padding-left:20px; border:1px solid #ccc;'> </div> </div> </body> </html> "; } ?> Hello!
I'm hoping this makes sense.
Basically I have this code:
What it does
1) Looks at the XML
2) Looks for the PIN number in the URL, then finds it in the XML
3) Returns values for the PIN number (which is a profile) allowing me to do echo statements like name, tools, description, etc.
<?php if (!empty($_GET['pin'])) { $feedURL = 'http://www.inveroak.co.uk/readerimages/livepanel/91255.xml'; $showOpsWithNoPics = false; try { $xml = simplexml_load_file($feedURL . '?' . time()); $readers = $xml->xpath('/ReaderDetails/Reader[Pin="' . $_GET['pin'] . '"]'); foreach ($readers as $reader) { if ($reader->Picture == 'None' && $showOpsWithNoPics == false) { $picture = ''; } elseif ($reader->Picture == 'None' && $showOpsWithNoPics == true) { $picture = 'images/defaultpic.jpg'; } else { $picture = $reader->Picture; } if ($picture != '') { $name = $reader->Name; $pin = $reader->Pin; $status = $reader->Status; $description = $reader->Description; $arr_skills = ''; $arr_subjects = ''; foreach ($reader->Categories->Category as $Category) { foreach ($Category->Skill as $Skill) { switch ($Category['name']) { case 'Skills': $arr_skills .= "<li>$Skill</li>"; break; case 'Subjects': $arr_subjects .= "<li>$Skill</li>"; break; } } } $arr_shift = ''; $hourWidth = 20; $PreviousDate = ""; foreach ($reader->Rota->Shift as $Shift) { $Date = $Shift['Date']; $Day = date("l", strtotime($Date)); $Start = $Shift['Start']; $Stop = $Shift['Stop']; if($Stop == '23:59:59' || $Stop == '00:00:00' ){$Stop = '24:00:00';} $Left = date("H",strtotime($Date.' '.$Start)) * $hourWidth; $Width = (round(abs(strtotime($Date.' '.$Stop) - strtotime($Date.' '.$Start)) / 60,2)/60)*$hourWidth; $compare = strcmp ($PreviousDate, $Date); if ($compare != 0) { if ($PreviousDate != '') { //this is not the first loop so close off the previous dayrow and hours divs $arr_shift.= '</div></div>'; } //create a new day row $arr_shift .= '<div class="dayrow">'; $arr_shift .= '<div class="day">'.$Day.'</div>'; $arr_shift .= '<div class="hours">'; } //add the shift object $arr_shift .= '<div class="shift" title="'. substr($Start,0,5).'-'.substr($Stop,0,5) .'" style="left:'.$Left.'px; width:'.$Width.'px; opacity: 1;"></div>'; //set previouse date to the current shift's date so that we can check if we need to create a new day row next loop $PreviousDate = $Date; } //now we have finshed looping the shifts, either close the last div or display a message to show //we have no schedule for the op if ($Date != "") { $arr_shift.= '</div></div>'; } else { $arr_shift.= 'We are sorry but they have not scheduled their hours this week. Email for further details.'; } } } } catch (Exception $e) { echo 'cannot display operator profile'; } } ?>What I am want to achieve 1) Looks at the XML 2) Looks for a set PIN number in the CODE, then finds it in the XML 3) Returns values for the PIN number (which is a profile). Hi all, first time here as I am a bit stuck. I am by no means a programmer and I was hoping that someone out there may have a simple solution to my problem?... So here goes" I have a voucher/offers site up-and-running. The site content is generated from an external feed. I want to create other sites and I want to track what sales/clicks have come from where. An example of the feed: (http://www.awin1.com/awclick.php?mid=251&id=28971&clickref=[URL_REFERENCE]&p=http://www.247electrical.co.uk) As you will see, I have [URL_REFERENCE] in each link. I want to automatically change that part of the string in the database. Does anyone have any thoughts? This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=321050.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=330820.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=351099.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=319445.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=358198.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=320682.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=354362.0 This topic has been moved quickly to PHP Regex because I need to go to work instead of lurking phpfreaks. http://www.phpfreaks.com/forums/index.php?topic=359460.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=321479.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=345200.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=322578.0 |