Jump to content

king arthur

Members
  • Posts

    335
  • Joined

  • Last visited

    Never

Everything posted by king arthur

  1. Well currently the first thing you're doing on page one is $_SESSION['BusinessName'] ='$BusinessName'; but $BusinessName will not be defined, so you've just assigned an undefined value to the session variable.
  2. Having searched a little on Google it appears there isn't any proper way of doing this. I have seen it suggested that a 302 Temporary Redirect header should be sent first, but since I don't understand enough about what effect that has I think I will just have to send the vars using GET. I didn't want to do that as I didn't want them to appear in the address bar but it'll have to do for now.
  3. I'll try that one and let you know if it works, cheers.
  4. Is there a way to preserve the $_POST vars when doing a header redirect. I want to validate the inputs in a form and if they are valid, redirect to another website sending the same form data all with one click from the user.
  5. Try [code]     $page_name[$i] = $_POST['page_name']['$i']; [/code] ?
  6. I am building a members website. To keep track of what visitors are doing even before they log in, I use a session on every page. The thing I've noticed is that the session ID always gets appended to the URL on the second page any surfer visits. The obvious reason for this is that when the first page starts the session, there is no session cookie yet so it assumes that one wasn't accepted, and switches to passing the session ID by the URL until the next page, then it finds the session cookie. So while it isn't a bug, it's something I'd rather not have appear, but I can't think of a way around it. I don't want to restrict sessions to use only cookies in case I get a member who has cookies blocked. I just wonder if anyone else has ever got round this, or how do other membership type sites do it? I could change to only starting sessions when the user has logged in, which bypasses the problem because the first thing they would hit is the login button rather than a link. But I'd like to see if there's any other way.
  7. I am building a site with a membership system. It uses sessions, with a variable $_SESSION["loggedin"] to indicate if the user is logged in or not, and this is used by the menu code to give access to the free pages if not logged in, and the member pages if logged in. I have it working and have got a few members joining up but noticed from my stats that one or two didn't seem to be able to access the members pages after successfully logging in. The login page does a header redirect as soon as the user has correctly entered their details, and I found that if the browser is not accepting cookies, the session ID is not appended to the URL and therefore the session is lost. This may not be the whole problem but it is a problem. Is there any way of getting PHP to add the session ID to the URL when doing a header redirect, when a cookie cannot be sent? Or should I just redesign my login page to work another way. Also is there any other reason why the session could be getting lost, as it didn't look like these members were actually blocking cookies. I have session_start() at the top of every page.
  8. The disadvantage to having large numbers of arguments is that you'll get them the wrong way round sometimes, or find it difficult to see which values you're passing as which argument. If your function needs a large number of arguments consider creating a class instead and making it a member function of a class from which you can instantiate an object with the arguments as member variables.
  9. [quote author=Wintergreen link=topic=107346.msg430590#msg430590 date=1157726053] So what do I do to get the third value not to appear? [/quote] I just wouldn't bother building the concatenated string if you don't need it for anything else. [code] <?php   $sql = "SELECT post_time FROM posts ORDER BY postid asc";   $query = mysql_query($sql);   $date_holder2 = array();   while ($row = mysql_fetch_assoc($query)) {       $value = strtotime($row['post_time']);       if(date("n", $value) == $current_month) {         $date_holder2[] = date("j", $value);       }   }   $date_holders = array_unique($date_holder2);   $date_counter = count($date_holders) - 1;   echo $date_counter . "<br />";   echo implode(" ", $date_holders); ?> [/code] You may find this has a bearing on your second problem too, if you fix it.
  10. First problem would be due to the fact you are exploding the date_holder string using the "|" which is fine, but the thing is, you are concatenating that onto the end of the string twice (because your while loop executes twice), so when explode() splits it, it splits it into three strings, the last one being an empty one.
  11. You're trying to compare a date string with a timestamp, so of course it doesn't work. It's simpler if you do [code] <?php $created = mysql_result($LoginRS, 0, 'CreateDate') ; if($created < time() - 30 * 24 * 60 * 60) {     print "Expired";     die; } else {     print "Not Expired";     die; } ?> [/code]
  12. Turns out I accidently set the date on my PC to one month ago. Why it affected this forum only, I don't know.
  13. I'm getting a strange thing happening on this forum. When I look at a forum the date at the top right of the page shows as being four days ago. When I read an individual thread however, the date shows correctly. This has the effect that all threads in a forum show as having new posts, and when reading the main forum headings each one shows the latest post as being one from four days ago, not from today. Weird! I did have to re-install XP on a new hard drive a few days ago due to hard drive failure, wonder if that has anything to do with it? EDIT: Well I removed the phpfreaks cookie and nothing changed, so deleted all cookies and the problem is fixed. It just means I now have to log back in to all the other forums I'm on now! Still don't know how it got like that though.
  14. Thanks. margin-left:auto, never would have thought of that one!
  15. Does anyone ever get heartily sick of trying to make CSS work the same across browsers? It's enough to make you scream sometimes. Anyway, here it is: I have four DIVs all relatively positioned one above the other. First DIV is width:100%, height:auto, text-align:left. It contains a paragraph which is 768 pixels wide and has some text in it. Below this is a DIV containing an image. The image is slightly rotated to the left, about 10 degrees. In the DIV above, I have put line breaks to line up the text along the slanted edge of the image. It all works great, it even looks right when sizing the browser window down and everything. Under this I have a DIV which is width:100%, height:auto, text-align:right. It again contains a paragraph 768 pixels wide with some text. Under this is another DIV with another image. This time the image is rotated right about 5 degrees.  Again, I have formatted the text in the DIV above to sit along the diagonal top edge of the image. This all works great in IE. In Firefox the second paragraph, which is supposed to be aligned to the right, is not. It sits at the left side of the screen. The text within the paragraph is right-justified, but the paragraph itself refuses to go to the right of the page. I can't figure out how to get it to go there. I've tried putting text-align:right in the paragraph style, I've tried putting align="right" everywhere, it refuses to budge. Both the DIVS stretch across the screen, I can verify that in the DOM inspector. The paragraph is the right size too, but it is completely in the wrong side of the page!
  16. Sometime around the middle of last month, I installed a script to count the click throughs on one of my sites, so I could monitor which links and banners people were clicking on. Each link now goes to a script called click.php which gets the destination in the query string, and stores it along with time etc. in a database, and then redirects the user to that destination using a header redirect. Starting sometime towards the end of last month, I notice I wasn't getting very many hits from Google. In fact it seems that I now get no hits at all from Google aside from ones where people have actually typed the URL into the search bar. I'm wondering if the two are related? I know Google doesn't like blind redirects, but this script is harmless. If this is the problem, how would I go about fixing it? Can I put something in the header to tell search engines what I am doing with the redirect? Or do I put something in the robots.txt file to tell Google not to follow any links with click.php?blahblahblah in them? I can't believe something like this would piss Google off so much that it stops sending me any hits at all - up to that point I had about 70 or 80 hits during July from Google in its various incarnations - but I can't think of anything else I've done which would cause the problem.
  17. Of course it could always be that classic error, [code] if ($mode = "add_comp_cat") [/code] when you actually meant [code] if ($mode == "add_comp_cat") [/code] or perhaps even [code] if ($_GET["mode"] == "add_comp_cat") [/code]
  18. Not sure if you can use GET and POST methods at the same time?
  19. Best post the code you have now then, also what is the value being passed in and what are the contents of that directory? The only other thing I can think of would be that the while loop is not executing at all therefore the array element $files[$num] is still an empty string.
  20. Try [code] function decodeTime($dateline) { return date("m-d-Y h:i A", $dateline); } [/code]
  21. It's really just a matter of what you do in the loop that echos out the pagenumbers and llinks. If, say, you only want 10 page numbers in the row, then start echoing links to page 1 or the current page minus 5, whichever is the higher, and then continue until you reach either the last page or the current page plus 5, whichever comes first.
  22. Well, it looks as if in your first while loop you are incrementing $num past the end of the array $files[] but then you are using $files[$num] later, which would give an empty string. Also, not sure if this [code] if ($file{0} != '.') [/code] is correct? Did you not mean [code] if ($file[0] != '.') [/code]
  23. In fact depending on your version of MySQL you can use it but you must put backticks around the column name in the query, e.g. `b&bname`=%s
  24. First thing that springs to mind is that '&' may not be a legal character for use in column names.
  25. I doubt anyone is going to feel inclined to wade through all that. How about putting each PHP statement on a separate line for starters?
×
×
  • 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.