PHP Scripts Development » PHP Classes Support Forum » Access_user Class Support forum

two start pages for different access levels

(22 posts)

Great offers not only for geeks!


  1. Haii olaf,
    thanks all for your classs.
    i am beginer in php programming.
    i am using your class, but i dont know how to redirect access user class.
    example : if user level = 10 go to admin.php but if user level =1 go to member.php and member can update his account to. not to deny_access.php.
    one question more, i am using smtp server for mail how i can setting it. how i can configurate if i using Mail.php(pear). cause my internet service provider cannot support it with mail() function.

    thanks a lot for your answer and time.
    best regard andree.

    Posted 7 months ago #
  2. Hi,

    create a page for your admin level (based on the example page) and use this code:

    $admin = new Access_user;
    
    $admin->access_page($_SERVER['PHP_SELF'], "", DEFAULT_ADMIN_LEVEL); 
    
    if ($admin->get_access_level() < DEFAULT_ADMIN_LEVEL) {
        header("Location: ".START_PAGE);
        exit;
    }

    this should do the job

    Posted 7 months ago #
  3. thanks Olaf, i will try it now.
    i have one question more,
    how we can check if the user has/already login or not?
    example : if user want to download some files, he must login first.
    how i can check it..? :)

    Thanks a lot for your time.
    best regard,
    andree.

    Posted 6 months ago #
  4. check the file "example.php", the function

    $page_protect->access_page();

    will check if the login is valid, if not the visitor is redirected to the login page.

    Posted 6 months ago #
  5. there is another way using a session:

    if (isset($_SESSION['logged_in'])) echo 'welcome!';

    Posted 6 months ago #
  6. Yes its works!
    thanks a lot.

    I still confuse using PHPMailer,
    which configurate i must change in PHPMailer folder.
    for your access_class, i change it in db_config right,
    am i need to change anything else?
    it seem can't send email.
    so I try using PEAR and it works well, how do u think olaf, its save for security?
    i cut it in acces_user_class.php bellow send_mail() function.

    include("Mail.php");
    /* mail setup recipients, subject etc */
    $recipients = "andree@whatzup-online.com";
    $headers["From"] = $_POST['from'];
    $headers["To"] = "andree@whatzup-online.com";
    $headers["Subject"] = $_POST['subject'];
    $mailmsg = $_POST['message'];
    /* SMTP server name, port, user/passwd */
    $smtpinfo["host"] = "mail.telkom.net.id";
    $smtpinfo["port"] = "25";
    $smtpinfo["auth"] = true;
    $smtpinfo["username"] = "whatzup@yahoo.net.id";
    $smtpinfo["password"] = "xtr3m";
    /* Create the mail object using the Mail::factory method */
    $mail_object =& Mail::factory("smtp", $smtpinfo);
    /* Ok send mail */
    $mailsent = $mail_object->send($recipients, $headers, $mailmsg);

    for all the time being, thanks.
    andree

    Posted 6 months ago #
  7. Andree,

    you need to check that your mail script safe against mail header injections.

    what I don't understand, is it possible to use phpmailer on your server or not?

    you know about the last update where it's possible to use phpmailer as mail script?

    Posted 6 months ago #
  8. okey,
    how if my server cannot allow to using phpmailer?

    i just change in this script right:
    define("USE_PHP_MAILER", false); // true = use phpmailer
    define("PHP_MAILER_SMTP", true); // true send by SMTP, false = senmail

    sory, if i can explain it better co'z my poor english.
    where is the last update i can find.?

    Thanks.

    Posted 6 months ago #
  9. Hi,

    with the pear script the mail is send via SMTP, the same way how it's possible with phpmailer.

    Just download the latest AU class version and check the instructions here:

    Posted 6 months ago #
  10. okey olaf,
    i already update the latest au class.
    so i don't need configuration for PHPMailer,
    i just extract them into classes folder, isn't it?

    best regards, andree.

    Posted 6 months ago #

RSS feed for this topic

Reply »

You must log in to post.