Jump to content

webmaster1

Members
  • Posts

    607
  • Joined

  • Last visited

    Never

Posts posted by webmaster1

  1. Thanks Zagga. I don't want each user to have their own page. I need group a to be redirected to page a and group b to be redirected to page b. Group a and b cannot access each others pages.

     

    I'm going to add a third column to my username/password table to assign values for the variable to be used in redirect url e.g. $direct-to = "page-a.php" header("location:/$direct-to")

     

     

     

  2. I have a log-in form that starts a session by checking the input against a database:

     

    // Mysql_num_row is counting table row.
    $count=mysql_num_rows($result);
    
    if($count==1){
    $_SESSION['username'] = $username;
    $_SESSION['password'] = $password;
    header("location:success.php");
    }

     

    If the inputs match the user is redirected to success.php which checks for the session as follows:

     

    <?php
    // Begin session. Function must remain at top.
    session_start();
    
    // If the session is not registered.
    if(!session_is_registered(username)){
    
    // Redirects when the url of this page is directly accessed without a registered session.
    header("location:fail.php");
    
    }
    ?>

     

    [Q1] Let's say I have two users who are each redirected to a different success page. How do I prevent them from accessing each others success pages? Here's what I'm trying to achieve in simpler terms:

     

    SESSION A allows USER A to access SUCCESS PAGE A but not PAGE B

     

    SESSION B allows USER B to access SUCCESS PAGE B but not PAGE A

     

    How do I distinguish between sessions?

     

    [Q1] If users listed in my username/password mysql table are each to be redirected to an individual url, should I just save this as a third column in my username/password table (or is it bad practice to use this table for anything other than checking the username and password?)

     

  3. I don't understand that question. What exactly is there to deal with?

     

    My bad, let me paraphrase. I read through a tutorial that used if, if else for isset though I use post myself. I was just wondering if one approach is agreebly superior to the other or if it really depends on what's to be achieved.

     

    What does it mean for code to be "relative to [something]"?

     

    I'm thinking in terms of server/web root paths. Then again, I could should will just go and find out.

     

    If all their existing code is written using ASP and their developers are specialized in ASP, why would they want to spend massive amounts of resources on switching to another language?

     

    For no other reason other than the fact that I'm not familiar with ASP  :P. This prompts another question:

     

    :confused: Does the left/right paradigm exist between PHP and ASP? i.e. are their fanboys who hate their counterparts a la Mac vs PC? I already understand that hybrids exist.

     

    :confused: Briefly, in what way is PHP better than ASP and vice versa?

     

    Of course it can. Look up RFI (Remote File Inclusion) for instance. Any general-purpose programming language can be used for "unethical hacking".

     

    Heh, heh. A Russian apparently exploited this guys website using RFI. I'm laughing because of how he immediately decided to ban all of Russia from his site.

    http://forums.digitalpoint.com/showthread.php?t=1743122

     

     

  4. Though I understand the concerns about accessibility and unnecessary repetition, I still assert that many a novice - moderate PHP practitioners wouldn't have the audacity or shamelessness to start a thread in it's own right to simply ask what the difference between <?php and <? is. An archived FAQ style repository could be periodically updated with the crème of the select quickfire Q&A thread if the aforementioned concerns are all that, erm, concerning (damn my apathetic lexicon).

     

    Rather than musing about how and if such a facility should exist, we should instead reflect on the fact that the questions simply may not be asked in lieu of the said facilitation. Hence, the maxim, the only stupid questions, are the questions that aren't asked.

     

    The waffling is contagious. Onwards with the Q&A!

     

    :confused: What's your preferred approach in terms of dealing with multiple independent forms on the one page? i.e. post or an if statement.

     

    :confused: Who does md5 and hash string comparisons protect more? The end-user or the administrator?

     

    :confused: Is the code of an included file relative to where it's included in or from?

     

    :confused: Let's say you work in a company whose internal applications are predominately ASP based. What three points would you rattle off to entice them to PHP?

     

    :confused: Can PHP be used for unethical hacking to any great effect? Everything I've read seems to be about Linux and packet sniffing.

  5. By chance, the following works:

     

    $querymin = "SELECT MIN(datetime) FROM table where something='$something'"; 
    $resultmin = mysql_query($querymin) or die(mysql_error());
    
    while($rowmin = mysql_fetch_array($resultmin)){
    $min= $rowmin['MIN(datetime)'];
    
    $min = strtotime($min);
    print date('Y-m-d \a\t H:i', $min)."\n";
    

     

    The strtotime() function through me off a little. A multitude of the examples I encountered used the current time for calculation which I had assumed wouldn't be interchangeable with a variable.

  6. I'm outputting the minimum datetime as follows:

     

    $querymin = "SELECT MIN(datetime) FROM table where something='$something'"; //query
    $resultmin = mysql_query($querymin) or die(mysql_error()); //execute
    while($rowmin = mysql_fetch_array($resultmin)){ //loop
    $min= $rowmin['MIN(datetime)']; //as variable
    //echo $min; 
    $min= date("m/d/y g:i (A)", $min); //format date
    echo $min;

     

    2010-04-18 00:00:53, as stored in my database should be formatted like 18/04/10 00:00 (AM) except it formats as: 01/01/70 1:33 (AM) Notice it's about 4 decades out.  :confused:

     

    I've wasted a fair amount of time trouble-shooting this though I keep on bouncing back and forth between unix timestamps and the strftime() function.

     

    Can someone please assist? Why is my formatting messing up my 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.