Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. You want to look into Pagination. A decent tutorial can be found here.
  2. $wordchunks = explode(" ", $message); $where = "(searchedfield LIKE '%" . implode("%' OR searchedfield LIKE '%", $wordchunks) . "%')"; Should generate a where clause that searches for each word in that array.
  3. Not hard at all to do. You can set the background of Windows XP to be a webpage just set it to the local server's IP on the network. But why is this posted here, you should have posted it in the freelance section, as you are not wanting to code it you are looking for someone else to do it (from what I can tell).
  4. Your cron is setup to execute just the page, it is going to read it in and attempt to execute it as a shell commands. You either have to send it to the PHP CLI: http://www.devarticles.com/c/a/PHP/PHP-CLI-and-Cron/1/ Or open a browser instance to that page. I would suggest the CLI method from the link I posted above. EDIT: Modified the URL to the correct "Part"
  5. You are better off making a third table - city_hotels and using that. New table structure: CITY - city_id, city_name, city_desc HOTEL - hotel_id, hotel_name, hotel_desc CITY_HOTEL - ch_id, city_id, hotel_id Then the query would be something like: SELECT c.city_id, c.city_name, h.hotel_name FROM city c JOIN city_hotel ch ON c.city_id = ch.city_id JOIN hotel h ON h.hotel_id = ch.hotel_id ORDER BY c.city_name, h.hotel_name; The reason you were only getting one hotel from your original query was because you were only selecting one in the WHERE clause. A simple modification to that WHERE clause and it will pull all cities / hotels. You are also adding the hotel table twice. Here is a correct version of your code, incase you do not care about 3NF form: (the below query is untested) SELECT c.city_id, c.city_name, h.hotel_name FROM city c, hotel h WHERE h.hotel_id IN(c.hotel_1, c.hotel_2, c.hotel_3) ORDER BY c.city_name, h.hotel_name; Hope that helps you out.
  6. Post the CRON line you have. As that code above looks fine, chances are your PHP CLI syntax is incorrect.
  7. Just an FYI, if the C++ software does anything with user information I would look into a better way, as it would be really easy to setup a spoofed site using a local server that just echos true / false using the HOSTS file to point it to your own. So if all you are doing is displaying stats, that is fine. But just know that anyone can be validated for any user with that script / logic if they know how.
  8. Using Google keywords php combo box mysql would have yielded a tutorial: http://www.internaldrive.com/2009/03/31/populating-a-combo-box-in-php-dynamically-from-mysql/
  9. Please do not post Exam questions here.
  10. $question20[$i] = $q20Split; Once again you forgot the $ before the i.
  11. $q20Split = array_slice(explode("D", $q20), $i, 1); You forgot the $ before i.
  12. I know google will not like that. But if you want to be indexed and SEO friendly why not add another keyword to be searched? In all honesty, there is no benefit to using a special character for the GET data. There are only cons, so you might as well fix it.
  13. It is legal, well it seems to work with FireFox. As for using them I would suggest against it as most web searches will look down on it. If you do not care about that I would test it in Opera / IE 7-8 / Safari and make sure it does not cause them any dismay. But why use them? Readable names are much more preferred in my opinion. EDIT: If you are going to define them as a different variable, why not just use that variable name?
  14. Well you have a something to think about. In order to make a request for a hashed password or for the salt you want to encrypt that data and you also want a validation key sent with it. As anyone with a network monitor can see what is being sent across the network and to where which could potentially be used to grab all the users salts and using that to hack accounts. The method of encryption will need to be able to be used on both sides and have to have the valid key passed etc. How to do that I am not sure, but I am sure you can find a common encryption method between C++ and PHP where they both can validate a public key being sent. I have never attempted to do this, but you have to be cautious as if you do not take the methods to secure it can be used to hack accounts on your site.
  15. Not sure, but you will either have to make a remote webpage call or, if the application is local to the server make a call to php to run the script using PHP CLI. If you want to do the remote webpage call (cause you want this to work on a system other than your server), you will probably have to take this question to either our "Other Languages" forum here or to a C++ forum. But before you do that, try google first and see how to contact a remote site.
  16. First up, the password is not encrypted as if it was you could decrypt it It is hashed. Second, I am not sure what your question is, but I am sure if your C++ application talks to the MySQL database you can find a C++ version of MD5 and use that with the salt from the DB to figure out if the password entered into the C++ application is valid or not. Another alternative is create a simple PHP script that uses vbulletin's hashing system and send the password entered into C++ into that php script, run it and get back a hashed version of the password and use that for validation. Hopefully that answers your question. C++ MD5 Resource: http://stackoverflow.com/questions/1892242/calculate-md5-in-c
  17. Right, but it really does not bother me. I tend to only use the Quick-Reply form
  18. SELECT asset_num FROM table_one WHERE asset_num NOT IN(SELECT asset_num FROM table_two) Should get you the desired results.
  19. Date is a reserved word in MySQL. You can find a list of them here. You can either change it (preferred) or use back ticks around that column name to get it to work. Also you should implement error checking like so: $schedule=mysql_query("select * from schedule where date>'2009-09-01' and division='1' and ((team1='$team1' and team2='team2') or (team1='$team2' and team2='$team1'))") or trigger_error("Query Failed: " . mysql_error()); As it would have told you the error.
  20. To get the bar to be on whatever form element you want, it is .focus(); using javascript on a form element. It will set the focus to that item. Hope that helps.
  21. I've always enjoyed Java. Good luck with it!
  22. You want to look into AJAX.
  23. Well looking at the code I wrote I think this might be better suited for you: $sql = "SELECT found FROM locations_members WHERE leader = some_condition"; $query = mysql_query($sql) or trigger_error("Query Failed " . mysql_error()); if (mysql_num_rows($query) > 0) { $locations = array(); while ($row = mysql_fetch_assoc($query)) { $locations[] = $row['found']; } while (in_array($new_location, $locations)) { $new_location = "some random location"; } } // insert the $new_location variable to the DB here I was just bored and saw that the above would probably suit your needs better. EDIT: The one thing you will have to watch out for is if they have discovered everything then this will be an infinite loop, so yea.
  24. You can fetch the results of multiple rows via: $sql = "SELECT found FROM locations_members WHERE leader = some_condition"; $query = mysql_query($sql) or trigger_error("Query Failed " . mysql_error()); $found = false; while ($row = mysql_fetch_assoc($query)) { if ($row['found'] == $new_location) { echo 'Location already found.'; $found = true; break; } } if (!$found) { // insert into memberlocations }else { // do something that you want to do } That is what you are looking for I believe.
  25. Ok, why are you using SYSTEM for a username? That is just weird, in my opinion. To solve the issue you have to select the database you want to use by using mysql_select_db or else it will not know where to pull the data from. You will want to call this right after the mysql_connect statement.
×
×
  • 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.