SitePoint Sponsor

User Tag List

Results 1 to 11 of 11

Hybrid View

  1. #1
    SitePoint Evangelist
    Join Date
    Dec 2000
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Controling Access Using PHP & MySQL

    Hi all,

    I used Kevin Yank's article, Managing Users with PHP Sessions and MySQL to make a script that controls access to a certain area of my site.

    However, I always get the following error message:
    Parse error: parse error in /home/corby/justforwebmasters-www/authors/new.php on line 142
    I have posted the code for the different scripts at: http://www.justforwebmasters.com/script.html . I have a feeling that I'm missing a closing parenthesis mark, but I don't know where to put it.

    Any ideas?

    Thanks,
    Corbb
    Corbb O'Connor
    Looking for quality website design or database programming?
    Contact me for more information and a FREE quote!

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you post all that code into a .phps file, just copy the code into that file and name it wit ha .phps extension, that way we can see your color-highlighted code. Its sort of hard to read in the textareas, also you may want to convert your scripts to a {} structure instead of using colons for your if clauses. It will be easier to debug that way.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Evangelist
    Join Date
    Dec 2000
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Freddy,

    That won't work because my server parses all files for PHP.

    It's in a .zip file now. http://www.justforwebmasters.com/authorscripts.zip

    -Corbb
    Corbb O'Connor
    Looking for quality website design or database programming?
    Contact me for more information and a FREE quote!

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did you convert the if else clauses to brackets style instead of colon style?
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  5. #5
    SitePoint Evangelist
    Join Date
    Dec 2000
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    freddy,

    I used most of the code Kev used in his article.

    What do you mean by, "convert the if else clauses to brackets style instead of colon style"?

    I'm not too advanced at PHP.

    Thanks for your help,
    Corbb
    Corbb O'Connor
    Looking for quality website design or database programming?
    Contact me for more information and a FREE quote!

  6. #6
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I mean is you have thing like
    PHP Code:
    if():
    else(): 
    That is only going to make you more confused, the reason you have a parse error on line 142 of new.php is because you are missing the

    endif;

    From the bottom of the file to close the else: clause, this is why Isaid to change it to a style like
    PHP Code:
    if {

    }
    else {


    as I think it will help you miss those missing endif; that you are gonna need usinga colon style.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  7. #7
    SitePoint Evangelist
    Join Date
    Dec 2000
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Freddy,

    Thanks for your help.

    The script displays now, except it just reloads the form and doesn't add the entries to the database.

    The .zip file has been updated.
    Corbb O'Connor
    Looking for quality website design or database programming?
    Contact me for more information and a FREE quote!

  8. #8
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess you aren't gonna change those control structures . The first reason its not working is you are checking for the existence of $submitok on line 6, $submitok never exists even when the form is submitted since your submit button has no name

    PHP Code:
    <input type="submit" value="Add"
    needs to have a name

    PHP Code:
    <input type="submit" name="submitok" value="Add"
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  9. #9
    SitePoint Evangelist
    Join Date
    Dec 2000
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Freddy,

    Thank your help. It works now!

    -A very happy Corbb
    Corbb O'Connor
    Looking for quality website design or database programming?
    Contact me for more information and a FREE quote!

  10. #10
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Would you at least humor me and promise me that you are gonna change those colons to brackets?
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  11. #11
    SitePoint Evangelist
    Join Date
    Dec 2000
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If I come accross another script, I'll change 'em before coming to you

    Thanks again for your help,
    Corbb
    Corbb O'Connor
    Looking for quality website design or database programming?
    Contact me for more information and a FREE quote!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •