Jump to content

Brian W

Members
  • Posts

    867
  • Joined

  • Last visited

Posts posted by Brian W

  1. if you want every single person viewing the site to all go to the maintenance version of the site, you'll need to use a database or a file, like Mchl said. I don't know much about the file writing thing, but I can tell you that if you have a database already, using it would be you best option. Or, Mchl or someone can inform us of some file writing tactics. I don't know why though you'd want every one on the same version of the page like that. Odd.

  2. it creates a session variable based on what your button posts. Really, your button isn't posting any value, you need a hidden field with the value of either true or false. Initially I create a session

    <?php session_start(); ?>

    Then I tell it to create a session variable out of the value they posted using the button.

    <?php $_SESSION['Maint'] = $_POST['hiddenfield'] ?>

    Then I check to see if they have already clicked the button once so I use "isset()" and then I see if it is true because that is what the value would be if the button has only been clicked once (right?)

    <?php if(isset($_SESSION['Maint']) && $_SESSION['Maint'] == "true") { ?> 

    after you do that, you just simply need a form with a hidden field with the value "false" and a button to submit. have the form action as something like "?", there are a number of ways for the form to post to self... and of course method="POST".

     

    <?php } else { ?>

    this makes it so that the above form only shows if they have already clicked it once. Below that is what you'll need for the button for them to click the first time and then again if they turn it to false again. you know, people don't make up there minds. lol

    so just copy your first form stuff and change the hidden field value to "true"... close this all up with

    <?php } ?>

     

    Ask Mchl said, if you want it for every one who is that the site at that time to suddenly have maintnence on, then you'll need a file or a db. You could also do this with the Get function and completely leave out the session thing. I just like it cuz it doesn't show the user how you coded it.

  3. button posts right?

    <?php session_start(); ?>
    <?php $_SESSION['Maint'] = $_POST['hiddenfield'] ?>
    <?php if(isset($_SESSION['Maint']) && $_SESSION['Maint'] == "true") { ?> //your button code and hiddenfield with value "false"
    <?php } else { ?> //the same button and hidden field but with value "true" <?php } ?>

  4. Does the query error tell you anything? like does it have a excerpt from the syntax or the SQL? Can't think of whether it will or not, but worth asking.

    Any way, try

    $query = "SELECT UserID FROM Users WHERE UserName='".$u."' AND Password='".SHA($p)."'";

    LOL, or what the other guy beat me too. I didn't know you could SHA with SQL... let me know who's works. (if either)

    That might actually do the trick... but i'm not that great at the whole sql thing yet.

  5. 	
    $row = mysql_fetch_array ($result, MYSQL_NUM);
    
    if ($row)) { // A record was pulled from the database.
    
    //Start the session for this user.
    
    session_start();
    $_SESSION['UserID']  = $row[0];
    $_SESSION['UserName'] = $row[1];
    }

    I think your problem is within these lines... but I cant put my finger on it.

    Trouble shoot please./ disable your redirect for a moment and echo $u, $p, $row[0], and $row[1]

    if they are all working properly, than I'll keep looking into your code, other wise maybe we can rework the syntax to get what you want.

  6. Sorry, i'm making a game board that has 40 x 40 cells. Each cell was going to have a string (such as 2 across and 1 down would have $x3y1)

    Players would add entries into the database with a picture's source from a list I have (20x20px pics) and x and y positioning choices. I then have a repeat field that takes the info from the database and converts it into the image script in the right place.

     

    $x3y1 = "<img src=\"$row_pos['src']\" > \\ or something like that.

     

    I changed over to a repeating background of chess board like squares to create my board (less script, better refresh time) and set it up to have absolute positioning instead. (tid bit from it: absolute; left; ".10+(20*$row_pos['X'])."...(*20 because each square is 20pixels and + 10 because the screen margins 10 from the top and left.))

  7. The variables are from a data base. I'm trying to populate certain cell (out of a 50x50 cell table). If $row_pos['left'] = "4" and $row_pos['top'] = "3", and $row_pos['word'] = "HI"

    I want it to come out as $cell4x3 = "HI"

    in my table in the cell 4 over and 3 down, there is

    echo $cell4x3

  8. I hop I don't sound too stupid, but look at the basic real quick. I think you cant have your script like this...

    $EmailBody =   "Name: $name\n 
    			Email: $email\n
    			Phone: $phone\n
    			Message: $message\n";

    its got to be like

    $EmailBody =   "Name: ".$name."\n 
    			Email: ".$email"\n
    			Phone: ".$phone."\n
    			Message: ".$message."\n";

    Just like using echo/print..."".$."".$.""

    If I'm wrong, thats great, it'll save me time in the future.

  9. From what I read, sniffers aren't easy to use... they kinda have to sit there and wait for someone to sign in or something (don't quote me on that). If you have data that is so sensitive as to worry about intruders, you probably will be willing to spend the extra $$$ or so on SLL. If you just got a message board or something with some email addresses, names, maybe even a b-day here and there, don't worry.

  10. I sadly am not using PHP >= 5.0... some version < is supplied by my server (this will be changing soon). Do to this, I can't seem to use the time zone settings. The time zone is simply 1 hour ahead, is there any way i can get "g" to be -1 hour?

    date("F j, Y - g:ia")

    If it doesn't work out to be pretty simple, I'll just hold off till I get my new testing server rolling.

    Thanks

  11. I am just developing a text based game for the learning experience during my free time. But I gave up on that piece of math and just created a table with all the number input>>outputs. made things so much more simple. This was only an option because they can't use a number higher than 100.

×
×
  • 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.