-
Posts
3,584 -
Joined
-
Last visited
-
Days Won
3
Everything posted by JonnoTheDev
-
Using socket functions to connect: fsockopen() to issue commands: fwrite() to read response: fgets()
-
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; }
-
if ($_SESSION['link'] >0);{ Should be if($_SESSION['link'] > 0) { Remove the ;
-
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!
-
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); ?>
-
$_post should be $_POST
-
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
-
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.
-
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.
-
dynamic file names with php or otherwise?
JonnoTheDev replied to matstars's topic in PHP Coding Help
I personally would make it more robust that that as * will allow anything through -
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());
-
posted in html put im sure its a PHP thing MY FORM WONT WORK
JonnoTheDev replied to evaneo's topic in PHP Coding Help
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 -
Storing passwords - converting to a better way
JonnoTheDev replied to IndynewToPhp's topic in MySQL Help
Where have you found this information from? If you dont want to use PASSWORD() then use md5() in php. Nothing wrong with that. -
Your what class is not extending anything. Look at your code: class what {
-
HTMLentities Issue -- Dealing with Andpersands
JonnoTheDev replied to shanejeffery86's topic in PHP Coding Help
You have a character in your field that the character set your scripts or database doesn't understand correctly. -
dynamic file names with php or otherwise?
JonnoTheDev replied to matstars's topic in PHP Coding Help
Mod Rewrite There is a forum on it within this website. -
posted in html put im sure its a PHP thing MY FORM WONT WORK
JonnoTheDev replied to evaneo's topic in PHP Coding Help
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..... -
There is no reason for you to do this.
-
Dynamic Form Fields - customizing your dbase from the website?
JonnoTheDev replied to Siggles's topic in MySQL Help
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. -
Storing passwords - converting to a better way
JonnoTheDev replied to IndynewToPhp's topic in MySQL Help
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. -
Already asked that Maq
-
Change your code to: or die(mysql_error()); And then give us the error
-
Are your field names correct? organisation_Id = (SELECT organisation_id What is the error?
-
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);