[PHP/MySQL] simple questions

Discussion in 'Web Design & Coding' started by macromp, Apr 24, 2006.

  1. macromp

    macromp the retarded one

    Messages:
    426
    Location:
    UK
    i'm completely new to php, but have to use it for a uni project. i've got a few questions about the site i'm making for my dad's business using dreamweaver. the site is www.domesticelectrical.net, and as you can see when it first loads up there's nothing in the content frame, i want the "information" page to load up there at the very start but dont know how to do that.

    and i'm also trying to get a login script working, i've been using what i think is a pretty good tutorial here but i'm having a problem with the initial loading of the page. if you click the login button you will see what i mean.

    Warning: session_start(): Cannot send session cookie - headers already sent... etc

    i read another post on the forum with someone having the same kind of problem, but couldnt figure out what i needed to change (dont like programming, find it hard to grasp) i did add thefollowing bit of php as suggested in an earlier thread but it didnt seem to work.

    Code:
    <?php
    ob_start( 'ob_gzhandler' );
    ?>
    i was thinking that it's trying to check the login before the session was started...but i'm not sure.
    any help on the matter would be great. i'm using code from the tutorial website, but if you need to see any other code jsut ask what you need and i will post it here.
     
  2. Khayman

    Khayman I'm sorry Hal... Political User Folding Team

    Messages:
    5,518
    Location:
    England
    make sure that code is right at the top of ANY other code, not just the middle frame code.

    for the default page in the middle set the src property to the information page <iframe src ="whatever.php/html" ..... etc
     
    macromp likes this.
  3. macromp

    macromp the retarded one

    Messages:
    426
    Location:
    UK
    ok that was stupidly easy, the only thing above it was the link to the css file. thank you for that.

    one more thing, the "username" and "password" arent fully 'using' the css file. the text color has changed but the size hasnt. can that be changed somehow?
     
  4. Khayman

    Khayman I'm sorry Hal... Political User Folding Team

    Messages:
    5,518
    Location:
    England
    add
    Code:
    td {
    font-family: Verdana;
        font-size: 12px;
    }
    to the css file
     
  5. macromp

    macromp the retarded one

    Messages:
    426
    Location:
    UK
    thank you again. no doubt i'll be back later when something else doesnt work.
     
  6. macromp

    macromp the retarded one

    Messages:
    426
    Location:
    UK
    well that didnt take long did it. i have a problem with the database now, i've been into phpmyadmin and entered a username and password into the table, but when i enter those same values into the login boxes and click login, it says that i'm using the wrong password...which i'm not. i'm not getting any errors anywhere, so i dont know where to start trying to debug it...
     
  7. Khayman

    Khayman I'm sorry Hal... Political User Folding Team

    Messages:
    5,518
    Location:
    England
    Do you get the message 'Incorrect password, please try again.'? if so then you cannot enter the password and username dirctly into mysql because the script you are using is looking for an encrypted password, and as such it won't work if you just type it in plain text into the database, you have to use their register.php page (or modified obviously).

    if you got a different error (somthing like Access denied for user: 'userName' (Using password: passWord) ) then check you enrered the correct mysql username and password in db_connect.php page
     
  8. macromp

    macromp the retarded one

    Messages:
    426
    Location:
    UK
    yeah it's the 'Incorrect password, please try again.' so i've got to modify it to stop looking for an encrypted password...oh dear. thanks

    edit: figured it out, just removed the line with the "md5" bit, whatever that means.
     
    Last edited: Apr 25, 2006
  9. Khayman

    Khayman I'm sorry Hal... Political User Folding Team

    Messages:
    5,518
    Location:
    England
    md5 is the encryption function and algorithm
     
  10. macromp

    macromp the retarded one

    Messages:
    426
    Location:
    UK
    hi, i'm back again, i've got all my file uploads and login working fine, there's just one simple thing i'd like it to do. i want a text box on a page and when someone enters text in and submits it it's displayed on a different page, kind of like a news post...but uber simple. the php version of response.write (asp)...i have no idea what it is but would like to know. anyone?

    thanks for all your help khayman btw, much appreciated.
     
    Last edited: Apr 27, 2006
  11. Khayman

    Khayman I'm sorry Hal... Political User Folding Team

    Messages:
    5,518
    Location:
    England
    ok, you need a form on the page, normal html form with a text box and submit
    Code:
    [B] <form action="whatname.php" method="post">
          <input type="text" name="Fname"><br>
          <input type="submit" value="submit">
    </form>[/B]

    the action attribute tells it where its going
    then on that page you could have something like
    PHP:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title> New Document </title>
    </head>

    <body>
    <?
          $firstname
    $_POST["Fname"];
          echo 
    "Welcome $firstname to our web page";
    ?>
    </body>
    </html>
    I hope thats kind of what you were looking for
     
  12. macromp

    macromp the retarded one

    Messages:
    426
    Location:
    UK
    yeah that's the kind of thing i'm wanting, i've got a page with "edit post" and "view post", "edit post" contains the form with the input that you gave me, and "view post" shows what is posted, after clicking the submit button it takes me straight to the "show schedule page", then if i go back to the page with "view post" there is nothing there, i need to save what is posted onto that "view post" page, so next time i come to that page whatever i posted last will be there. if you understand that.
     
  13. Mainframeguy

    Mainframeguy Debiant by way of Ubuntu Folding Team

    Messages:
    3,763
    Location:
    London, UK
    Correct me if I am wrong, but there is a note of caution here (with POST variables)maybe? Because I remember employing exactly the same technique and finding some folks advising against it (maybe on security grounds? or Maybe a compatibility potential issue?) Just thought I'd chip in, hope useful...
     
  14. macromp

    macromp the retarded one

    Messages:
    426
    Location:
    UK
    security isnt an issue, it's just being used today in my presentation until i can find a proper replacement. i just need a simple way of posting a note, and being able to view it. i've got everything i need for the project but i decided to try and add this at the last minute, and perhaps i shouldn't have. presentation in 1 hour :p
     
  15. j79zlr

    j79zlr Glaanies script monkey Political User

    Messages:
    2,725
    Location:
    Chicago
    Always include a generic font, you should always have serif or sans-serif in a font declaration:

    Code:
    td {
    font-family: Verdana, sans-serif;
        font-size: 12px;
    }
    As far as security, you have the variable in double quotes, which is what you want. The difference between POST and GET are the way the variables are sent. Read here -> http://www.faqs.org/docs/gazette/superglobals.html