1. kwoodford's Avatar
    I have service that I want users to subscribe to and I want to authenticate the user so not just anyone can access the website.

    Want this all to be server side. This is not an Application running on BB.

    At first I thought I could read the BB Pin via Java (or something) but thats a no-go. Then I thought I could place a cookie on BB from my website when someone subscribes but having problem saving and retrieving cookie.

    I could force user to log on EACH time with User & Password but thats a pain for the user.

    Any suggestions? I'll take whatever I can get.

    Thanks in advance.
    05-22-09 07:48 PM
  2. morrow95's Avatar
    Why not do an extremely small BB app - it would act as a launcher to your website, but only if they entered in their username/pass and it was stored on the BB. Think AOL IM, ICQ, MSN, etc how you save your login info... if its saved then it goes straight to the site and authenticates the login information. If not, it prompts to enter your username/pass then luanches the site and passes the info.
    05-22-09 09:39 PM
  3. kwoodford's Avatar
    Why not do an extremely small BB app - it would act as a launcher to your website, but only if they entered in their username/pass and it was stored on the BB. Think AOL IM, ICQ, MSN, etc how you save your login info... if its saved then it goes straight to the site and authenticates the login information. If not, it prompts to enter your username/pass then luanches the site and passes the info.
    Thanks for your feedback and ideas. I've thought about building the app but was hoping to not get into the app design and only handle it from the website side. I'm a programmer by trade and done a lot of embedded stuff but didn't want to learn everything for the BB. But maybe I will and make some other apps as well. Who knows.

    Thanks again.

    If anyone else has any ideas for handling on the server side, I'd appreciate any suggestions.
    05-23-09 04:41 PM
  4. ydaraishy's Avatar
    I could force user to log on EACH time with User & Password but thats a pain for the user.
    There are such things called cookies...
    05-24-09 03:38 AM
  5. kwoodford's Avatar
    There are such things called cookies...
    Thanks for the info. Not sure if you read my entire post but thats what I was trying to do but not having much success. Have you done it and if so can you provide me some code or pointme in the right direction.

    Any help would be greatly appreciated.

    Thanks again.
    05-25-09 12:10 AM
  6. cslave's Avatar
    Thanks for the info. Not sure if you read my entire post but thats what I was trying to do but not having much success. Have you done it and if so can you provide me some code or pointme in the right direction.

    Any help would be greatly appreciated.

    Thanks again.
    Why isn't this working? What's wrong?

    And how are you trying to save and recover the cookies? PHP? It should work...since cookies work easily for every other website I visit on my BB I would say theres a tiny problem with your website coding (IIRC).
    05-27-09 07:02 PM
  7. kwoodford's Avatar
    Why isn't this working? What's wrong?

    And how are you trying to save and recover the cookies? PHP? It should work...since cookies work easily for every other website I visit on my BB I would say theres a tiny problem with your website coding (IIRC).
    cslave,
    I can get cookies to work fine with Opera Mini but for some reason I can't set them using the Blackberry browser. I can't count on users having Opera. I set the cookie (same code on server for both browsers) yet when I go into cache on BB browser, it says 0 cookies. Obviously at that point I can't read them either. Go into Opera, go to same page and cookies get set, and cookies are read back without a problem.

    Any suggestions?

    This is my code. Can't get any simpler...

    set Cookie
    <?php
    $value = 'Test';
    setcookie("TestCookie", $value, time()+240);
    ?>

    ReadCookie
    <?php
    // Print an individual cookie
    echo $_COOKIE["TestCookie"];
    // Another way to debug/test is to view all cookies
    print_r($_COOKIE);
    ?>

    Works with multiple cookies in Opera. Expiration set for 4 minutes but tested immediately. Tested in Blackberry, Firefox, & Internet Explorer mode.

    Thanks
    05-28-09 01:30 PM
  8. cslave's Avatar
    i dont see why that wouldn't work....

    Instead of the setcookie() function try something like this. I know its arbitrary and I can't pull up my old code right now (its at work..) to see if this is what I used but give it a shot.
    Code:
    $_COOKIE['TestCookie'] = $value;
    and to retrieve it just do a regular echo like you had in your example
    Code:
    echo $_COOKIE['TestCookie'];
    05-28-09 05:59 PM
  9. kwoodford's Avatar
    i dont see why that wouldn't work....

    Instead of the setcookie() function try something like this. I know its arbitrary and I can't pull up my old code right now (its at work..) to see if this is what I used but give it a shot.
    Code:
    $_COOKIE['TestCookie'] = $value;
    and to retrieve it just do a regular echo like you had in your example
    Code:
    echo $_COOKIE['TestCookie'];
    I thought I had already tried that but in trying again, I don't get that to work in Opera or BB browser. Tried from desktop and it didn't work either. Not sure if its because there is no expiration time but without it the cookie should be good through the end of the session.

    If you check your code at work, can you let me know what you find. Otherwise, maybe I hava a setting wrong on BB but I don't think so. Seeing as how it worked in Opera, I know I have working code.

    Thanks.
    05-29-09 11:59 AM
  10. cslave's Avatar
    I thought I had already tried that but in trying again, I don't get that to work in Opera or BB browser. Tried from desktop and it didn't work either. Not sure if its because there is no expiration time but without it the cookie should be good through the end of the session.

    If you check your code at work, can you let me know what you find. Otherwise, maybe I hava a setting wrong on BB but I don't think so. Seeing as how it worked in Opera, I know I have working code.

    Thanks.
    Well I used my code in conjunction with a $_SESSION cookie (which also means I had to use session_start(); ). I also cleared the $_COOKIE at the end after I closed the session, so theres no way to check if it was persistent or not.

    I only get back to work on Wednesday, so until then I won't be able to check.

    Btw, check out http://dreamincode.net. Its a great, huge community of helpful programmers who can most likely figure this out faster than I can.
    05-29-09 12:43 PM
  11. kwoodford's Avatar
    Thanks for the info. I registered at Programming and Web Development Help | DreamInCode.net and I'll see what I can find. If you think of anything, let me know

    Thanks.
    05-29-09 03:33 PM
  12. cslave's Avatar
    Thanks for the info. I registered at Programming and Web Development Help | DreamInCode.net and I'll see what I can find. If you think of anything, let me know

    Thanks.
    Sure thing, sorry I couldn't be of more help. Im sure the people at DIC will come up with something though. Good luck!
    05-29-09 09:48 PM
LINK TO POST COPIED TO CLIPBOARD