Jump to content

JonnoTheDev

Staff Alumni
  • Posts

    3,584
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonnoTheDev

  1. Using socket functions to connect: fsockopen() to issue commands: fwrite() to read response: fgets()
  2. Do you get an error from the unlink() function? Maybe you could use a file_exists() call first $file = '/var/www/html/docs/x.txt'; if(file_exists($file)) { unlink($file); } else { print "file not found: ".$file; }
  3. And filepaths
  4. if ($_SESSION['link'] >0);{ Should be if($_SESSION['link'] > 0) { Remove the ;
  5. Check that $a is of the correct value before running into the function. It must have a value of 0 if that is your result. Are you familiar with HTML? You haven't got a closing FORM tag!
  6. You are calling your function within the scope of the function itself and doubling up on your echo. Check your braces carefully. Should be: <?php function lygu ($a) { if ($a % 2 == 0) { echo "Number can be divided"; } else { echo "Number cannot be divided"; } } $a = $_POST['a']; lygu ($a); ?>
  7. $_post should be $_POST
  8. My idea is as follows Create a database table e.g. queue ======= id (INT) name (VC) status (ENUM 0,1) startTime (DATETIME) Once a user is added to the queue they are redirected to a waiting area. One user will have a status of 1. This is the current active user. Once the user is at the waiting area use AJAX to poll the database every x seconds to see if their user status has changed. An active user will have the buttons displayed for whatever time period. Buttons can be displayed using the DOM. You can query the active time period from the startTime field. When their time has expired their status is set to 0 and the next user is active. You could also store the user activity so if a user is inactive for a period of time their status is reset, etc.. As far as pre-built scripts I have no idea as I have never seen a need for such a mechanism
  9. I would suggest a simple mysql database table to store the users and flag who is active. As far as the switching of users after a time period I would suggest php & AJAX.
  10. No, the cookie is set by the user selecting the template they require (that is how you wanted it, correct?) Cookies are read from the users computer. There is no requirement to pass any vaues from page to page.
  11. I personally would make it more robust that that as * will allow anything through
  12. Another method for you to take into consideration is below if you wish to use another objects internals. Your method of this extends this and extends this and extends this is not always good design and will lead to a headache. Take this example: class foo { public function x() { print "foo prints x"; } } class bar { public function y(foo $foo) { $foo->x(); } } $obj = new bar(); $obj->y(new foo());
  13. Is your php.ini file setup correctly in terms of SMTP entry. Write a small script that just sends an email using mail() just to make sure its not your code on this page. Take an example from: http://uk3.php.net/manual/en/book.mail.php
  14. Where have you found this information from? If you dont want to use PASSWORD() then use md5() in php. Nothing wrong with that.
  15. Your what class is not extending anything. Look at your code: class what {
  16. You have a character in your field that the character set your scripts or database doesn't understand correctly.
  17. Mod Rewrite There is a forum on it within this website.
  18. Do you get any errors? Have you checked that your conditional statements are processing correctly. You have a lot of if statements. Get the script to print to the screen where you expect a condition to pass as to test. Are you on windows or linux? Have you checked the server mail log? Is you mail server running correctly? Can you send an email from the server directly? If not there maybe DNS issues. etc.....
  19. There is no reason for you to do this.
  20. Not simple at all. Think of the validation routines. Lets say you have a scenario where you want 4 checkboxes in the form and at least 2 of them must be checked. How could you validate this dynamically. Also with a select list you may need to display different fields based on the selection i.e country. This maybe a requirement. For the time it takes to add form fields, validation and database table fields I wouldn't bother trying to make it dynamic. What I would do though is create an OO interface for my forms so you can add extra fields easily of any type and specify the type of validation required on the entry.
  21. Store a password however you want. You can use md5, crypt, make up your own algorithm, etc When a user enters their password to login you must run it through the encryption function in your php script and then compare it to the database record.
  22. Already asked that Maq
  23. Change your code to: or die(mysql_error()); And then give us the error
  24. Are your field names correct? organisation_Id = (SELECT organisation_id What is the error?
  25. Your function will not have access to your mysql connection as it is out of the function scope. Do you get an error? You can either use a global variable within the function to your connection or pass in as a parameter $x = mysql_connect(); function example() { global $x; } Im not sure why you would functionalise this procedure unless you are using this insert process from more than script in your website application. Also your function has way too many parameters. You are better passing in the POST array: function example($values) { print $values['name']; } example($_POST);
×
×
  • 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.