Jump to content

ukweb

Members
  • Posts

    119
  • Joined

  • Last visited

    Never

Everything posted by ukweb

  1. Solved, schoolboy error, path to installer.php was wrong, and I didn't pick it up sooner because wordpress didn't return an error! Thanks for your replies.
  2. Hi This is a strange one, and I'm not sure whats going on here. I've tried googling the answer to no avail. Basically, I'm writing a Wordpress plugin, and here's my setup: install.php has a class called 'two_install' The main plugin file code snippet: // Installation require(plugin_basename('installer.php')); // Initiate installation class $twp_install = new twp_install; This results in this on activation: Fatal error: Class 'twp_install' not found in path-on-server\wp-content\plugins\twitter_parser\twitter_parser.php on line xx Anyone got any ideas? Just a note, there is definitely a class called 'twp_install' in installer.php! Thanks in advance
  3. Hi My job in work at the moment is to write an API for an application, where external sites will be communicating with our server using cURL. They need to validate themselves with their username and password for each and every command. To make this as secure as possible, how would you suggest encrypting the password for transit, I was just going to use md5() but I don't know if this will allow the level of security that would prevent flaws.. Any suggestions welcomed. Ste
  4. Hi all Basically, I have a form which when done will calculate a quote for turf for given areas. Basically each time the user specifies an area it goes into an array, and they can add as many as they want, but the problem seems to be once submitted and it arrives back into the program, it isn't decoding so the multidimensional array is lost. What am I doing wrong here? Full code below, thanks in advance Ste <?php // Framework // Get the sections $sections_array = base64_decode(unserialize($_POST['sections'])); // Build the rest of the array foreach ($sections_array as $section) { $sections[] = base64_decode(unserialize($section)); } // Set the initial unit $units = $_POST['units']; // Do the new add if ($_POST['a'] == 'add_section') { // Add the new measure if ((is_numeric($_POST['width'])) && (is_numeric($_POST['length']))) { $sections[] = array('length' => $_POST['length'], 'width' => $_POST['width']); } } // Build the output foreach ($sections as $section) { $output .= '<strong>'.$section['width'].' wide</strong> x <strong>'.$section['length'].' long</strong><br />'; $sections_array = base64_encode(serialize($section)); } ?> <!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>Untitled Document</title> <style type="text/css"> body,td,th { font-family: Verdana, Geneva, sans-serif; font-size: 11px; } body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } .wrap { text-align: center; height: 350px; width: 410px; padding: 0 10px; } </style> </head> <body> <div class="wrap"> <h2>Turf Calculator</h2> <p>To begin, enter the width and length of the first area of garden you wish to turf. You can keep adding sections to work out the final quantity required.</p> <p><?php echo $output; ?></p> <form id="form1" name="form1" method="post" action=""> <table width="0" border="0" cellspacing="0" cellpadding="2"> <tr> <td>Length:</td> <td><input type="text" name="length" id="length" /></td> </tr> <tr> <td>Width:</td> <td><input type="text" name="width" id="width" /></td> </tr> <?php if ($units == '') { ?> <tr> <td>Units:</td> <td><select name="units" id="units"> <option value="feet">Feet</option> <option value="m" selected="selected">Metres</option> <option value="yards">Yards</option> </select></td> </tr> <?php } ?> </table> <p> <input type="submit" name="add" id="add" value="Add This Section" /> <input name="a" type="hidden" id="a" value="add_section" /> <input name="sections" type="hidden" id="sections" value="<?php echo base64_encode(serialize($sections_array)); ?>" /> <?php if ($units != '') { ?> <input name="units" type="hidden" id="units" value="<?php echo $units; ?>" /> <?php } ?> </p> </form> <p> </p> </div> </body> </html>
  5. Hi all I'm quite a competent PHP coder but where it comes to preg_match I prefer to be ignorant, because I can't get my head around the patterns. Basically, I'm working with a script that someone else has written, and I'm coming across problems because the URL that is being validated sometimes has curly brackets '( )' in it (these are image file names generated by an internal system). I have the pattern, how do I modify this to allow curly brackets? On some occasions, the urls have just the opening or just the closing, so its never the complete set. if someone could give me an indication with this, because I'm clueless! Thanks in advance! Ste pattern: $pattern = '/^(([\w]+?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/';
  6. schoolboy error on my behalf there! it's approaching 4pm on a friday = home time! Apologies, and thanks!
  7. Hi all I'm building a script which reads a XML document, and so far so good... until now! the document uses '-' extensively all the way through it (not something that I would have chosen) so to combat this I've used {}. The part of the document I am working on now, this simply does not work, and I really cannot see why... XML <plot> <name-number>87</name-number> <price>183000</price> <bedrooms>4</bedrooms> <status>available</status> <summary>With three double bedrooms, including one en suite and a further bedroom plus family bathroom to the first floor,&nbsp;separate lounge and&nbsp;dining room with kitchen&nbsp;and utility to the ground floor, the Otter is a modern home with a great deal to offer growing families.</summary> <feature>Separate lounge and dining room</feature> <feature>Kitchen with utility room</feature> <feature>Integral garage</feature> <feature>En suite to master bedroom</feature> <property-type>detached-house</property-type> <media> <caption> </caption> <type>image</type> <filename>1855_Otter-WhitehirstGrange.jpg</filename> <indexno>1</indexno> </media> <media> <caption> </caption> <type>floorplan</type> <filename>1386_Otter-WhitehirstGrange.pdf</filename> <indexno>2</indexno> </media> <media> <caption> </caption> <type>brochure</type> <filename>284_brochure.pdf</filename> <indexno>3</indexno> </media> <style-name>Otter</style-name> </plot> PHP echo $plot->{name-number}; // echoes nothing, should echo 87 echo $plot->price; // echoes 183000 echo $plot->bedrooms // echoes 4 echo $plot->{style-name} // echoes nothing, should echo Otter This is frustrating the hell out of me, and I cannot see why this would work everywhere else in the XML document but not here. Any ideas or help would be received with gratitude!
  8. Will do, looking for the "solved" button!
  9. Muchos appreciation! use the old {}, saved me a lot of headache, thanks again man! :-)
  10. Hi I'm using SimpleXMLElement to work with a supplied XML file, problem is with the way the XML document is formatted. The document uses '-' (minus) in the element names instead of _ so when I go to read the values, nothing is returned: $developer->developer-region; //returns nothing However if I change the sample XML document that I've been supplied to <developer_region></developer_region> and do $developer->developer_region; //returns child elements This is not practical to manually change the document, is there a way to use '-' in the xml document? Thanks in advance Ste
  11. Nice one thanks, after looking at the solution you offered I discovered that the static version can have a link which will launch Google Maps app if installed on the smart phone :-) This is the route we will go down I would have thought, thanks for pointing out the static map api
  12. I've done a few searches and cannot find a definitive answer to my question, although it is a simple one... Q: Can a Google Map be embedded into a web page intended for mobile internet browsing? We're doing a mobile version of our work web site and we need to know if this can be done for location maps. Thanks! Ste W
  13. Hi I'm creating a program that creates an image from an input using imagettftext(). Is there a way I can force a new line if the text exceeds the permitted image width? Thanks in advance Ste
  14. Right, I can't see why this one won't work. I've written this test query and yet again, no results. SELECT * FROM `booking_resource-booking` WHERE date_from > STR_TO_DATE('2010-04-30', '%Y,%m,%d') AND date_from < STR_TO_DATE('2010-12-12', '%Y,%m,%d') What do I have to do? there is a value in the database that meets the criteria, yet NO results. If I could have an indication on where I am going wrong I could probably get the full query working as it should do...
  15. It It doesn't return any rows, no errors, just 0 results...
  16. does anyone have any ideas or pointers? This is really frustrating hell out me!
  17. Hi the data types are: ID (int)* room_id (int) date_from (date) date_to (date) I specified the date as string, my strengths are in PHP and not SQL queries unfortunately! The type of work I do has not given me the opportunity to explore more complex SQL queries I'm afraid, so in terms of MySQL, I'm a novice :-(
  18. Hi I'm making a booking system for a client which checks the availability of a room. For example, there's a table which has the following columns ID | room_id | date_from | date_to | Put in some sample data, ie, (id = 1, room_id = 1, date_from = 2010-06-01, date_to = 2010-06-23) I am writing a query which takes a room_id, a date_from, and a date_to and checks how many rows there are for that date range, and obviously if there are records then the room is not available. Here is the query I tried, but it doesn't work, and I haven't a clue what query to use to make it work SELECT * FROM `booking_resource-booking` WHERE resource_id = 1 AND date_from >= DATE(2010-06-01) AND date_to <= DATE(2010-06-19) ANY IDEAS would be received with gratitude. MySQL version is 5.1.37
  19. The problem I'm having is that the original designer made the admin so it saves the date in the British format and not the american, and thats where I'm having issues (ie, yyyy-mm-dd and not yyyy-dd-mm) I have spent soo much time on this and still getting no-where!
  20. This may be a repost so excuse me if it is, I'm not sure if I submitted the post or not... Basically I've written a program which generates the RSS feed for the work's web site. The database returns an item's post date as 'yyyy-mm-dd' hh:mm:ss'. What I want to do is say, set a variable as just the month in 2 digit numeric form based on a date. I have tried the following to no avail... // Attempt 1 $item_post_month = date('m', $row_rss_news['date']); // This didn't work! // Attempt 2 $item_post_month = date('m', mktime(0, 0, 0, $row_rss_news['date'], 0, )); // Didn't work either! help! Muchos Gratitudos if anyone can help me out on this one! Ste
  21. Hi Yea meant it to be coded the way it is, basically in the function, the $action['message'] is the plain-text email, and the $action['html_message'] is the HTML version, which is returned in the headers. I have a feeling it is something to do with the attached file; when I have the messages generated sent to my mobileme account, it displays the html email and a load of random characters at the end which i presume is the attachment as it changes if I attach a different attachment. needless to say it is winding me up no end!
  22. Set your headers, $headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
  23. just stick an @ infront of any variable without a value :-)
  24. Hi I can't see anything wrong with the code, and I've run out of ideas why the message when delivered is always blank. The attachment works fine though. The code is below, ANY ideas would be welcomed! if ($_POST['a'] == 'send_mail') { // Variables $action['to'] = 'info@sjwright.co.uk'; $action['from'] = $_POST['email']; $action['name'] = $_POST['name']; $action['subject'] = $_POST['subject']; $action['num'] = md5(time()); $action['message'] = $_POST['message']; $action['html_message'] = '<!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>Email Message</title> <style type="text/css"> <!-- #wrapper { width: 550px; margin: 0 auto; } body { font-family: Verdana, Geneva, sans-serif; font-size: 11px; } h1, h2, h3, p { margin: 0px; padding-top: 5px; padding-bottom: 5px; color: #231F20; } h1, h2, h3 { font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; color: #E52546; } --> </style> </head> <body> <div id="wrapper"> <h1>Message Received via the Web Site</h1> <p>Message Received from '.$action['name'].' ('.$action['email'].')</p> <p>Subject: '.$action['subject'].'</p> <h2>'.$action['name'].' Said:</h2> <p>'.$action['message'].'</p> </div> </body> </html>'; if ($_FILES) { // Set Paths and Variables $action['upload_path'] = 'uploads/email_attachments'; $action['upload'] = $_FILES['attachment']; $action['filename'] = basename($action['upload']['name']); $action['fp'] = fopen($action['upload']['tmp_name'], "rb"); $action['file'] = fread($action['fp'], $action['upload']['size']); $action['file'] = chunk_split(base64_encode($action['file'])); } // Headers $action['headers'] = "From: ".$action['name']."<".$action['email'].">\r\n"; $action['headers'] = "Reply-To: ".$action['name']."<".$action['email'].">\r\n"; $action['headers'] .= "MIME-Version: 1.0\r\n"; $action['headers'] .= "Content-Type: multipart/mixed; "; $action['headers'] .= "boundary=".$action['num']."\r\n"; $action['headers'] .= "--".$action['num']."\r\n"; $action['headers'] .= "Message-ID: <".gettimeofday()." TheSystem@".$_SERVER['SERVER_NAME'].">\r\n"; $action['headers'] .= "X-Mailer: PHP v".phpversion()."\r\n"; $action['headers'] .= "Content-Type: text/html; charset=iso-8859-1\r\n"; $action['headers'] .= "Content-Transfer-Encoding: 8bit\r\n"; $action['headers'] .= "".$action['html_message']."\n"; $action['headers'] .= "--".$action['num']."\n"; // Headers for Attachment if ($_FILES) { $action['headers'] .= "Content-Type:".$action['upload']['type']." "; $action['headers'] .= "name=\"".$action['filename']."\"r\n"; $action['headers'] .= "Content-Transfer-Encoding: base64\r\n"; $action['headers'] .= "Content-Disposition: attachment; "; $action['headers'] .= "filename=\"".$action['filename']."\"\r\n\n"; $action['headers'] .= "".$action['file']."\r\n"; $action['headers'] .= "--".$action['num']."--"; } @mail($action['to'], $action['subject'], $action['message'], $action['headers']); fclose($action['fp']); }
  25. hi there. I use SSH to backup my sites which are hosted with Media Temple. i used to have a guide to follow but I misplaced it. Basically I have a 'domains' directory, and a 'backup' directory. What we used to do is create a tar file in 'backup' containing the entire 'domains' directory. A quick google around has failed to give a solution that worked, and I dnt want to do any harm to my domains file Does anyone know the terminal command to do what I am after? thanks Ste.
×
×
  • 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.