Jump to content

JonnoTheDev

Staff Alumni
  • Posts

    3,584
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonnoTheDev

  1. Then your pages will get indexed without a navigation or your navigation may get indexed itself. Frames are about 10 years out of date and should be avoided at all costs for live websites.
  2. I need a quick solution to extract duplicates into a temporary table for review. The duplicates are to be found where the longitude and latitude values are identical (not just one column). The placenames that differ but have the same long & lat will need their geo data checked so I do not want to delete just yet. Structure: cities ====== cityId regionId title longitude latitude i.e. 1, 1, citya, 10.1, 45.2 2, 4, cityb, 10.1, 45.2
  3. The only way to know what the most popular searches are is to have data that you can query on. It is up to you how you store the data.
  4. Your missing persons is a good idea. You will have to do quite a bit of research into getting the data you need.
  5. Have you use a proper 301 redirect on the domain? Does your server have php > 4.3 to obtain headers? Should work fine if all of the above are true. $_SERVER['HTTP_REFERER'];
  6. Yes it is a bit vague, however if you are recording searchterms then you should record a count against the term i.e. searchterms ========= id (INT) term (VC 255) searchcount (INT) Everytime a search is performed check if the term exists in the table, if so update the count, else insert a new term. Then you can easily run a query to get your top searches i.e. SELECT term FROM searchterms ORDER BY searchcount DESC LIMIT 10
  7. Could you make it using an object oriented approach so the core programming can be extended by any developer without having to modify any of your underlying code? Also how about adding multiple templates that can be installed, or adding API functionality so that affiliate users can request product data and make sales from their own website using an affiliate ID. This data is recorded and used to payout commission. You could setup XML-RPC server or use REST calls. I'm sure the documentation that you will need to produce with the application is going to take some time, i.e UML, system flow, etc
  8. Why not something like e-commerce engine with CMS and fully automated server install. Do something like loadable modules that can be installed or removed such as special offers, multi-currency, delivery rates, worldwide tax zones, payment options, etc.
  9. There are many types of API calls you can make dependent on what the remote server is setup to accept i.e SOAP calls, XML-RPC & REST. REST are the most basic types of call and is really what you should implement for something so simple as you describe. The client code will make a call over HTTP GET to a script on your server. The response is XML. The client reads XML and processes i.e I would use CURL but heres a dirty example <?php // client api call $xml = file_get_contents("http://domain.com/api/getversion.php"); $obj = simplexml_load_string($xml); ?> getversion.php <?php // server receive call // get latest version from db $result = mysql_query("blah...."); $row = mysql_fetch_assoc($result); // display $output = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'; $output .= '<response>'; $output .= '<item>'; $output .= '<version>'.$row['version'].'</version>'; $output .= '</item>'; $output .= '</response>'; // display xml header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: '.gmdate('D, d M Y H:i:s').'GMT'); header('Cache-Control: no-cache, must-revalidate'); header('Pragma: no-cache'); header('Content-Type: text/xml'); print $output; exit(); ?>
  10. Sorry, its not apache, it is mysql encoding. fixed.
  11. Charset problem on apache 2. I have migrated a site from one server to another however characters are not displayed correctly through the browser any more (encoding is UTF-. What am I missing. It worked correctly on original server.
  12. SELECT * FROM table WHERE FROM_UNIXTIME(timestamp) >= DATE_SUB(NOW(),INTERVAL 1 DAY) AND userId='x';
  13. Yes, normally but that wouldn't work if the back button is clicked as stated in the post. This forum uses ajax to save the data in a form so the page is not reloaded, that is why the data persists. A cookie is a dumb idea! You don't store form data in cookies to maintain persistence. If I was logging into my online bank account would it be wise to store my account details in a cookie?
  14. I think this forum will use ajax to make the post rather than a standard form submission.
  15. print the array at the end of the loop to check that the correct data exists <?php $weapon_array = array(); foreach($xml->attack as $attack){ $name = (string)$attack->name; $bonus = (int)$attack->basebonus; $weapon_array[$name] = $bonus; } print_r($weapon_array); exit(); ?> Looks fine to me Array ( [Eastwind Katana] => 2 [Robin Bow] => 2 [blue Ice Staff] => 2 [Aldonian Spatha] => 4 [Cobalt Bow] => 4 [Fire Staff] => 4 [Hitzman Claymore] => 6 [Fire Bow] => 6 [Plaz Staff] => 6 [big Club] => 1 )
  16. You have not contained the value of the text element within quotes correctly. This is the case with all of your form elements. Validate your HTML: <?php echo "<tr><td>Yrityksen nimi:</td><td><INPUT TYPE='text' NAME='Yritys' VALUE='".$a['yhteyshenkilonimi']."'></td>"; ?> Cleaner html should use double quotes for html attributes i.e <?php echo "<tr><td>Yrityksen nimi:</td><td><INPUT TYPE=\"text\" NAME=\"Yritys\" VALUE=\"".$a['yhteyshenkilonimi']."\"></td>"; ?>
  17. Open a handle to the directory and loop through the files to display. If the directory contains sub-directories you require a recursive function. Checkout the examples on php.net http://uk3.php.net/opendir
  18. This is beacuse $bonus is an object. Cast it to an integer when adding to the array: <?php foreach($xml->attack as $attack){ $name = (string)$attack->name; $bonus = (int)$attack->basebonus; $weapon_array[$name] = $bonus; } ?>
  19. You are thinking very horizontally. OOP is not about using a class or classes for bits of functionality. you have seen objects used to connect to databases, etc. This is not OOP, they are just basically wrappers for bits of code that perform general functions and this is why you are not seeing the benefits. OOP is where objects interact with each other in an application. Classes model real life objects. i.e Teacher, Pupil, Classroom A teacher belongs in a classroom, a pupil is allocated many teachers, a pupil has many classrooms, etc. This is OOP interaction. You really need to study from a book. Good example: http://www.phparch.com/books/isbn/0973589825 Also look at a framework like zend. maybe look at how the mvc pattern works to see OOP in action.
  20. By the sound of things the projects you work on suit a procedural approach. This is fine and usually the easiest and quickest approach to take. However, if you ever get to work on or design much larger systems that require major additions / modifications over time then you will see in the long run that an OOP approach is by far the most suited. At a first look at OOP concepts it is hard to picture how they benefit over your usual procedural take, however once you become accustomed to it you will not want to revert back to your current methods. Think of an application like Facebook written in PHP. To add to the functionality or modify part of the system you don't think that they would be scouring through hundreds of script files to modify includes or add functions, the core components of the system will be extended using an OOP approach so none of the main source code is affected.
  21. Yes $row does not exist, should be $user12 = $data['username']; However you could have performed this in 1 query without have to use (num users +1) queries. No loops needed. Replace value field names with correct names: mysql_query("INSERT INTO messages (field1,field2,field3,field4,field5,field6) SELECT NULL, 'Virtual-soccer', username FROM users, '".$sub12."', '".$mess12."', 0");
  22. A complete explanation provided by regexbuddy (get this program, it is golddust). You can see there are errors in the pattern. ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})^ Assert position at the start of the string «^» Match a single character present in the list below «[_a-z0-9-]+» Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+» The character "_" «_» A character in the range between "a" and "z" «a-z» A character in the range between "0" and "9" «0-9» The character "-" «-» Match the regular expression below and capture its match into backreference number 1 «(\.[_a-z0-9-]+)*» Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*» Note: You repeated the backreference itself. The backreference will capture only the last iteration. Put the backreference inside a group and repeat that group to capture all iterations. «*» Match the character "." literally «\.» Match a single character present in the list below «[_a-z0-9-]+» Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+» The character "_" «_» A character in the range between "a" and "z" «a-z» A character in the range between "0" and "9" «0-9» The character "-" «-» Match the character "@" literally «@» Match a single character present in the list below «[a-z0-9-]+» Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+» A character in the range between "a" and "z" «a-z» A character in the range between "0" and "9" «0-9» The character "-" «-» Match the regular expression below and capture its match into backreference number 2 «(\.[a-z0-9-]+)*» Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*» Note: You repeated the backreference itself. The backreference will capture only the last iteration. Put the backreference inside a group and repeat that group to capture all iterations. «*» Match the character "." literally «\.» Match a single character present in the list below «[a-z0-9-]+» Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+» A character in the range between "a" and "z" «a-z» A character in the range between "0" and "9" «0-9» The character "-" «-» Match the regular expression below and capture its match into backreference number 3 «(\.[a-z]{2,3})» Match the character "." literally «\.» Match a single character in the range between "a" and "z" «[a-z]{2,3}» Between 2 and 3 times, as many times as possible, giving back as needed (greedy) «{2,3}» Assert position at the start of the string «^»
  23. Am I reading the Da Vinci Code here! My god, you need to get out more!
  24. Use Google man! http://blog.wiki-tom.com/2009/04/24/fixing-ssl-for-xampp-installs/
  25. You must have saved the file with a unicode signature (BOM) in your text editor. Do not save your files with any unicode normalisation.
×
×
  • 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.