Jump to content

JonnoTheDev

Staff Alumni
  • Posts

    3,584
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonnoTheDev

  1. Post the code for both parts login1.php & hoa.php
  2. mail("user@example.com, anotheruser@example.com", ........ Always check the php manual for usage of functions http://uk.php.net/manual/en/function.mail.php
  3. if($_POST['submit']) { $filename = $_POST['filename']; $temp_code = stripslashes($_POST['template']); $fa = fopen( $filename, "w" ) or die("Error opening $filename"); fwrite($fa, $temp_code); fclose( $fa ); } Also look at this line if($_POST = 'submit') { Change to if($_POST['submit']) {
  4. Then don't!. What is the problem, you are not making it very clear.
  5. Never! Not if you want to rank your website on search engines. You are looking for a mod rewrite that will rewrite: http://www.xyz.com/index.php?page=contact to http://www.xyz.com/contact Check the mod rewrite boards. This is simple.
  6. Then simply dont use the function htmlentites() or htmlspecialchars()
  7. You need to build up the sql based on the form fields entered. So you start of with the basic sql (also escape any user input prior to running a query): $word = mysql_real_escape_string($_REQUEST['word']); $sql = "SELECT * FROM image_bank WHERE tags LIKE '%".$word%."'"; Then check the additional fields and add to the query if(strlen($_REQUEST['field2'])) { $field2 = mysql_real_escape_string($_REQUEST['field2']); $sql .= " AND tags LIKE '%".$field2%."'"; } Then run the query mysql_query($sql);
  8. Your probably creating an infinate loop here. Also your methodology is wrong. If you want to return a player number that hasn't already been used then your function should do the following 1. Take in both arrays 2. Remove all players from the players array that are in the used players array 3. Obtain a random player from the players array You will never get a used player as there will be none to select from. Also use array_rand() to return a random array key: // give me 1 player at random $player = array_rand($players_array, 1); return $players_array[$player];
  9. NO You are checking the post array here: if(isset($_POST)){ and then checking again in the function: if(isset($_POST)){ The $_POST array is outside the scope of the function so will always return nothing. By using a switch / case you are assuming that the form fields names will always be username, etc. You could end up with a huge set of cases to cater for the forms in your website and you also have no way of checking if your form field names are in the switch / case. You are better validating the fields simply using: // check for an empty field if(!strlen(trim($_POST['name']))) { $error = true; } or write a function i.e. check a username is between 5 and 10 characters function checkUsername($name) { $username = trim($name); if(strlen($username) < 5 || strlen($username) > 10) { return false; } return true; } if(!checkUsername($_POST['username'])) { $errors = true; }
  10. if(!is_array($val)) { print "not array"; } else { print "is array"; }
  11. The extended / parent class are of the same object. When extending a class you must use the keyword 'extends' class a class b extends a When instantiating b I have all of the properties / methods of class a available to me as b is an extension of a. Read some tutorials on extending classes
  12. A class needs to be extended in order for the subclass to access its properties / methods as long as the properties / methods access levels allow it (public, private, protected) class a { public $x; } class b extends a { public function setVal($y) { $this->x = $y; } } $obj = new b(); $obj->setVal(123); print $obj->x;
  13. Post on the CSS forums, this topic is not associated with php
  14. No you can do what you want with it as long as its in the terms of the licence from the supplier. i.e. thay may want you to keep certain text in the footer like 'powered by wordpress' or something. You just can't sell it on.
  15. If you find a code library that can do what you are after then let us know. Another suggestion is to strip an open source ecommerce store open, it may contain multi currency functionality. Other than that you're on your own.
  16. At this part of the file: $settings['siteDir'] = ''; You need to put the path to the website files between the single quotes from the root of the computer. i.e. on windows the root is c:\ linux is / Example: the path to my documents is c:\my-documents Now I dont work on windows so I dont know if you can use c:\ but im pretty sure you can use / for the root so: $settings['siteDir'] = '/webspace/wwwroot/'; I'll let you finish it off
  17. There is a php api for ffmpeg rather than using the CLI http://ffmpeg-php.sourceforge.net/ To see errors if you are using ffmpeg as a CLI operation I guess you would have to store the output from the command line
  18. It could be another part of your code at fault. i.e. you are setting the cookie value from the $_POST array. This may be empty without you realising it. To test cookies create a test file i.e. test.php Put the following code in the file and upload it to your webserver setcookie("user", "joe bloggs", time()+3600); print $_COOKIE['user']; Open the page in the browser and refresh it. What do you see?
  19. Its easy to find all countries currency codes and symbols. Took me 2 seconds on Google. Like I said store them in a currency database table. If you have found a PEAR package to get you exchange rates then great. I would store them in the table along with the currency code and symbol. Write a script to get the exchange rate updated i.e. once per day. http://www.xe.com/symbols.php I would prefer to implement my own system but if you want guides then search Google. Heres one I found: http://www.talkphp.com/general/1422-creating-simple-currency-converter-automatic-symbols.html
  20. No php function available. You need a database table of all currencies, iso codes, symbols, and current exchange rates you wish to use. Pull this information out to use in your drop lists. Exchange rates change all the time so you will need to write an update script that can get the data from an external source, that is unless you want to manually add the rates in.
  21. Are you referring to the file upload part? You mean if a user attempts to upload a file of an unsupported format? ffmpeg doesn't do error handling as it is a command line application. You need to make sure that you do not use it with garbage files. Your file upload should only accept certain file types i.e .mov, .mpeg, etc
  22. What a long winded method. Why not use javascripts own confirmation alert and then if a user clicks ok delete the record on the same page i.e. Heres your javascript function function decision(message, url){ if(confirm(message)) location.href = url; } Heres the link to delete a record. When a user clicks ok at the prompt it will run index.php?action=delete&id=117 (117 is the database id) <a href='#' onclick="decision('Are you sure you want to delete?','index.php?action=delete&id=117')">delete</a> On your index.php or whatever the file is put the code to delete a record: if($_GET['action'] == 'delete') { // code to delete - database id in $_GET['id'] }
  23. Not familiar with your classes but could esily be done with DOMDocument(); Examples: http://uk3.php.net/manual/en/class.domdocument.php
  24. There is nothing really on this site that jumps out and says I would use these guys to do my website. You have little call to action. Browsing through web design agency websites this is the look that I would go after. http://www.netdreams.co.uk/index.html Nice portfollio, blog, list of product offerings, easy navigation
  25. failed to open stream: No such file or directory in d:\webspace\bradleystokejudoclub.co.uk\wwwroot\includes\DbConnector.php on line 6 Your include paths are wrong! Add the web directory to that array: i.e $settings['siteDir'] = '/myfile/mywebsite.com/docs/'; Whatever the path is to the document root of the website
×
×
  • 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.