Jump to content

milesap

Members
  • Posts

    64
  • Joined

  • Last visited

    Never

Everything posted by milesap

  1. Nothing to do with PHP, unless they are being created by PHP which is unlikely. This is an HTML CSS issue.
  2. name="duration['.$row['Name'].']" if you name an element as an array, then it can hold multiple values. Not going to read over all your code, but I would do a print_r of the $_POST['duration'] variable to see what that returns, and from there ensure that the element is getting properly filled.
  3. happens to me to sometimes, take more breaks or else nothing makes sense lol
  4. Ahaha 600 seconds is 10 mins . . . Just divide 600 by 60 to display it in minutes.
  5. To clarify, the IP address is the user requesting the form, not your hosting servers IP. Here's how it works: 1) User's navigates to your page and is presented with a legitimate form. This form contains the uniqueId found above. 2) When the user submits the form, the uniqueId is verified. The reason this works is because if another website has a form linking (and posting) to your server, they now cannot do so since they lack the ability to generate valid unique ID's. In general you don't need to worry about this, as long as the form data is valid there shouldn't be any concern. However there are times where it is useful. . . I've never needed to though!
  6. You have: name"gender" Change to: name="gender"
  7. Yes there is, simply make a hidden field in your form called 'uniqueId'. Set the value of that field to: MD5(USERS_IP . SALT_STRING) Example MD5(12.34.34.123 . 'XD657349'); Insert that into the hidden field, and on each form submission check to ensure the uniqueId is valid. Since the uniqueId is unique to each I.P, the form cannot be submitted without that unique ID thus rendering POSTs from other places useless.
  8. I would ask a specific question after you've done some research yourself if your having trouble putting it all together rather than posting code and asking someone to write the script for you.
  9. Page requests are 'stateless' meaning that any actions are only performed when the user requests them. The script starts and ends with each page request, and therefore the short answer is no you cannot easily have the server process a file while the user leaves the page. However, there are ways around this and in your case I would suggest setting up a cron job that runs a conversion script for uploaded files. That way the user can leave the page without affecting the conversion process (since the cron job is making the request).
  10. Excellent! So all subsequent methods must be extensions of the last method called, makes a lot of sense when trying to build easy to read, flexible code. Thanks for your help!
  11. I've seen some people code with objects in PHP, but one thing that others do (that I'd like to do) is the ability to call multiple methods at once. For example, in Zend Framework it's possible to write the following: $variable->setMessage('Text')->addColor('blue')->toArray(); (just an example) Notice how you can call several methods at once without having to write $variable next to each method? I've tried to do similar stuff in my code but cannot achieve this effect. Does anyone know how to set this up or point me in the right direction? Thanks!
  12. Quick question, not sure if I'm doing this right. How can I get the value of a forms id element? Would it be $_POST['id']? <form id="test" . . .> </form> Thanks so much!
  13. hahahahahahaha Why don't YOU write YOUR own code
  14. Try: if (empty($_POST)) { header('Location: http://www.example.com'); }
  15. I just thought of this, but why don't you namespace your sessions? $_SESSION['finance']['user_id']; $_SESSION['research']['user_id']; This way your scripts could tell the difference.
  16. Session data is stored on the server, not the person's computer. What is stored on the users computer is a cookie that contains an arbitrary reference number. The server receives the reference number from the users cookie, and then fetches the session data that is associated to that reference number. Thus, a much better way of dealing with this problem is to set a variable in the session which tells the scripts (in the other folders) which folder you originally signed in on. Example: If use A signs into finance, set $_SESSION['signed_id'] = 'finance'. Then check the 'signed_id' before executing the finance script, if it's value is not finance then display an error.
  17. You would need two things: 1) A script which is capable of checking to see which account balance is about to reach zero, and to send an email to that person. (I'm not going to write the code, I'll assume that parts not difficult) 2) Setup a cronjob on the server (ask your administrator if you don't know where that is). Set the cronjob to run the script every, say, 6 hours.
  18. There is no way to do this, a browser only supports one action. On the PHP side, take the form that was submitted via $_POST[] and you can then pass that variable on to another function etc.
  19. It's very hard to understand what you're trying to do, but I'll take a shot in the dark. You should create an array like: $val = array(1 => 'Active', 4 => 'GW'); and so on. You can then use all the PHP functions for arrays to manipulate the data. I.E. echo $val['1']; // returns Active
  20. There is no security risk in doing this, as this is processed server-side. Your scripts would grab the domain name and serve the page accordingly. Remember that all the domains are inherently valid because the DNS records would need to point to your server to load the page in the first place.
  21. Anything is possible on the web! What you're looking at is intermediate level PHP knowlege and therefore I recommend you purchase a book on PHP to get started. To do something like this would involve sessions, a database, and PHP to tie it all together. I would let people post answers to questions, but also let them see what was posted before them. If they like someone else's answer let them give that answer a "thumbs up" or let them append the answer if they don't totally agree with all of it. This way you can see which solution are rated best, but also gives the user full flexibility in their answer.
  22. I would change $result3 to: $result3 = mysql_fetch_assoc(mysql_query($consultsq3)); if (empty($result3)) { echo 'No record found!'; } else { foreach ($result3 as $index => $value) { // something goes here } }
  23. Create yourself a directory named "MP3FILES" out of your root directory (that way users can't access the files directly through their browser but the PHP file can). When someone gives you their email address salt and md5 encrypt the email (Example: http://www.example.com/dl.php?email=ex@ample.com&verify=7DG876SDF897SDF87SFDKSDJHFSDK <- salt'ed & MD5 encrypted email to ensure you sent that link) and send the link to their email using the php mail function. Then use a function like this to serve the file once you confirm their email (and perhaps store their email in MySQL or text file to ensure they can't download again). function send_download($filename) { $file_path = '../MP3FILES/' . $filename; $file_size=@filesize($file_path); header("Content-Type: application/x-zip-compressed"); header("Content-disposition: attachment; filename=$filename"); header("Content-Length: $file_size"); readfile($file_path); exit; }
  24. Hello everyone, I would like to know the best way to approach this problem. I would like my website to check if a user has changed their password within say 4 weeks. If it hasn't been changed, I would like to change the requested controller and action to the change password controller / action. My question therefore is, where should I put this code? In the bootstrap, register a plugin, or another solution? Also, how could I change the controller and action that is displayed to the user if they are required to change their password? Should they be forwarded to the change password controller / action, or can you change the controller / action after dispatch to the change password controller / action? So if a user was on their profile page, but their password is no longer valid I would like to display the change password form instead of their profile. I would prefer the website to check if the password has expired for every page request, and not just during login. I know this is less efficient, however in the future I would like to use this same concept to check for other conditions which may change while the user is logged in. Any help would be much appreciated!
×
×
  • 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.