Jump to content

DamienRoche

Members
  • Posts

    282
  • Joined

  • Last visited

    Never

Everything posted by DamienRoche

  1. " This board exists to help and assist in learning, not to solve the problems for you. Many people have come away from this board frustrated because they want us to do it for them and they don't want to learn. Don't be that person " HA! that is honestly joke, yeh? Id on't expect anyone to do anything for me. Jesus I'm doing this TO LEARN. It's not like I'm doing work for someone and have come here because the boneheads here will do it for me! In fact, while were on this. I don't know how you can jump on me for that. There was a guy the other day who submitted 1000 lines of code and got over 20 replies with people helping...surely that wasn't for educative purposes...? Oh, and from the same page: The manual probably doesn't stress this enough: ** This has nothing to do with lifetime of a session ** Whatever you set this setting to, it won't change how long sessions live on your server. This only changes HTTP cache expiration time (Expires: and Cache-Control: max-age headers), which advise browser for how long it can keep pages cached in user's cache without having to reload them from the server. Thanks for the input guys. As I've said I just want to set a session to expire. I used ini_set and that doesn't work...yet it should. As stated above, I've even echoed the settings and it says 10. I ahve also tried 1 yet it doesn't expire after 1 minute. Maybe there is a min setting. I'm sorry to be so confrontational. It's just I don't appreciate being tarnished with the same brush as so many others that obviously come here just looking for people to do their work for them. No hard feelings. I like this board. I like this community. I'll try what PFM advised above, sounds like that's the best way to go.
  2. That code works fine but I'm trying to make a session expire on a time, not user input. Thanks any way!- I can certainly use that elsewhere.
  3. Here is what I have tried: <?php ini_set('session.gc_maxlifetime', 10); session_start(); echo "session should expire in ".ini_get("session.gc_maxlifetime"); ///code goes on. The output is session should expire in 10 But the session doesn't expire in 10(seconds, I'm assuming.) Any advice?
  4. You can't detect that behavior with php because it's client side. I think your best bet would be a timeout... EDIT: saying that, I heard the session is supposed to expire when the browser is closed. Maybe check your php.ini settings or use ini_set. The javascript way, when the client hits x or alt +f4 you could have it redirect to a php script on your server that simply has: <?php session_destroy(); ?> It's hard to control though because javascript can be disabled. Hope that helps.
  5. This is exactly why I don't get anywhere. I have checked the link below about session cache expire. Yet I have also been advised to use ini_set('session.gc_maxlifetime', #number); So which is better? considering the ini sets the value just for that script, does one not make the other obsolete? I wish I had the time to read the entire documentation about every question I have about php. But all I can do is search Google,and the documentation, and if I can't get my head around it, come here. I thought that was why this board exists? Thanks for the input any way!
  6. I'm thinking maybe this is what you're looking for: if (something blah something){ $error = $error +1;} if (something blah something){ $error = $error +1;} if (something blah something){ $error = $error +1;} Then, I'm guessing you want to count the errors and echo how many? echo "$error"; Your issue is that, like you said, the ifs are at the bottom. Well, they can't be at the bottom. They have to be right after the form input. Like so: $varfromform = $_POST['inputfromform']; $error = 0; if($varfromform ==""){$error = $error +1;} if($error > 0){"ERRORS!"; [b]return;[/b]} That's it. If there are errors, no more of the script will work. It's so much tricky as badly implemented. Why must the ifs be right at the bottom? Best Regards, Damien.
  7. It's impossible. So you want to return the value of a variable that is set in an if statement BEFORE the if statement runs? Do you see how this is impossible? The echo has to come after the if statement...after the variable has been set. Best, Damien.
  8. I have created a session. Yet I can turn off my comp!!- come back, and the session is still there?? I'm still logged in. How do I set a timer on a session? I know they have a default value but mine obviously isn't working. Can I just set a timer for a *SPECIFIC* session? Many thanks. Damien.
  9. You have to use a post function. so put that input into the variable: $firstname = $_POST['firstname']; Of course, the form will have to have have method="post" and action="relevantfile.php" Hope that helps.
  10. That last one hasn't worked. I need something relative not absolute. That seems to only work on the exact string (1)damien_full.txt That regexp is seriously above my head. How can I alter it to make this work. If I can use a substr(); it would be great but that seems to only work with numbering the pos in a string. Can I not number the pos based on special characters? namely, the ) and _ in the given string. Any one else got any other ideas? Thanks any way!
  11. Just checked that out..it is of some use and now I am one step closer. so now I have used glob and it has found the name. Let's say the name is (1)damien_full.txt How do I put that file name into a string and then pull out everything between (1) and _full and put it in a variable. So, in essence, how do I get 'damien' from that file name into a variable? Any ideas? Thanks as well! that glob function is incredible!
  12. Here's what I want to do: open a file in a directory which has a certain pattern in it's name..then, after opening the file, put the file name into a variable. /// FILE ON SERVER = (1)damien.txt $ptn = "(1)" $lines = file("$ptn___I AM STUCK HERE___.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); /// output is sorted. So, I need to open any file (there will only be one) with that pattern in, maybe by using somekind of wild card..but after opening the file, I need to know what the rest of the name was. I know, I said there would only be one...but that's what I need. Any one got any ideas on how I can tackle this? Thanks.
  13. What you could do is put the minutes into a variable like so: $minutes1 = date("i"); $minutes2 = date("i"); //this would be the date now. Then compare. $difference = $minutes2 - $minutes1; It might not be the complete solution but I'm sure you could find a way to finish it off. I hope that helps.
  14. Can anyone give an example of how they use a custom framework they build themselves? do you mean like a collection of different functions and classes etc. that you put in files and include in scripts? Care to share any? lol ..or at least an example of where you use one? Thanks.
  15. The only thing I use, so far, is a framework for creating forms. So I put in the form fields and it produces the html, the php, the mysql schema and php mysql as well as the fetch..blah blah. It saves a lot of time, and it's good practice
  16. I'll start you on your way. use this: $loop = 1; $limit = 20; ///you have to find a way to make this how many lines there are. while($loop <= $limit){ echo "<textarea cols='80' rows='25' name='filebody' id='filebody' wrap='soft'>$loop: hey this is a test lol</textarea>" $loop = $loop +1; } This will produce 20 lines of "hey, this is a test" all numbered, 1 to 20. Now you gotta figure out how to make it dynamic. A valid point made before is that, those numbers in the page you shown us are not within a text area. They are within a td, or a div/li etc. Hope that helps.
  17. And did you read (or try) the suggestion I made about using the file() function? Yes, well, you are my hero right now I was writing that really long reply at I just thought it'd be a waste to chuck it so submitted it any way. The file(); function worked a treat! Thanks for your time!
  18. My long lines are being displayed none stop in the page. like so: I am a paragraph without a paragraph tab that is why I just can stop. ha that period doesn't stop me, I'm so clever, I just can stop. I am a paragraph without a paragraph tab that is why I just can stop. ha that period doesn't stop me, I'm so clever, I just can stop. I am a paragraph without a paragraph tab that is why I just can stop. ha that period doesn't stop me, I'm so clever, I just can stop. I am a paragraph without a paragraph tab that is why I just can stop. ha that period doesn't stop me, I'm so clever, I just can stop. I am a paragraph without a paragraph tab that is why I just can stop. ha that period doesn't stop me, I'm so clever, I just can stop. I am a paragraph without a paragraph tab that is why I just can stop. ha that period doesn't stop me, I'm so clever, I just can stop. When really, it should break up a little. In the text file I just have really long lines for each paragraph. I need to replace the start of each line with <-p-> and the end with </-p-> but I'm having trouble locating the beginning and the end of each line. Thanks for the interest!
  19. Don't shout! were not slaves, here to do your bidding!!! I think you just lost any help you were gonna get. Well done I'll say this much. You have to use a loop. While (there are lines){ add $loopnum inside a text box; } That's all you're getting. Good luck!!
  20. Can I use a php string function to detect carriage returns and the start of new lines. Like th pre tags do. Basically, I have a text file with some really long lines. WHat I want to do is put a <-p-> at the start of each line and a </-p-> at the end. I already know how to use fopen etc. so it's just the string function I need to learn. Has anyone got any ideas how I can do this? Thanks.
  21. I don't know what you just did but that worked!! Thank you so much!!
  22. THIS IS DRIVING ME NUTS. All I want to do is get the current date using javascript, but if javascript is disabled, get the date of the server using php...all seamlessly on the same page. JAVASCRIPT: function checkjavatime(){ var phptime ="<?php echo "$todayserver"; ?>"; var javatime ="<?php echo "$todayjava"; ?>"; if(phptime=="" && javatime==""){document.timeform.submit();}else{return false;} } HTML: <body onload="checkjavatime();"> <form name="timeform" method="post" action="index.php"> <input type="hidden" name="datecheck" value="19" /> </form> </body> AND THE PHP: $todayjava = $_POST['datecheck']; if($todayjava!=""){ echo "today from form:$todayjava"; } if($todayjava==""){ $todayserver = date("j"); echo "today from server:$todayserver"; } Obviously, because the php is parsed before the javascript the php if statement does not work, because how can the javascript variable be there? So all this does is check if first check if the form has submitted the date, when it hasn't it returns the variable and thent he javascript checks and sees that that variable is there so it doesn't submit the form. Any pointers?
  23. Can I pass a javascript variable to a php variable on the same page? I know I'll probably have to use a nifty redirect..but how do I go about it. So I have: javascript! var = "my new var"; PHP! phpvar = "var"; ///obviously this won't work, just to illustrate what I'm looking for. It needs tobe very seamless without using GET from the browser address bar. Any input is greatly appreciated. Thanks.
  24. Thanks for the replies guys. I didn't think it'd be so hard to get the local time for the user. Can I not find out the timezone for the user? then use date_timezone_set(); The reason for all of this is because I'm writing a "...of the day" script and need a reliable date.
×
×
  • 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.