[allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => SpeedRacer21 webforumsuser@macromedia.com [ip] => "SpeedRacer21" [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> User Login to Redirect using PHP - Macromedia Dreamweaver

User Login to Redirect using PHP - Macromedia Dreamweaver

I've read many posts about redirecting a user by specifying the directin url in the database, but have had very little luck. I'm using Dreamweaver's user authentication login extensions, and telling the "if successful login, go to page:" to point to the redirect field in the database by clicking browse..data sources...redirect(recordset value). This seems to work only for the first user in the database, ie. any other user is verified, but still directed to the first users redirect page. I have included the code to view(nothing fancy). Please be detailed in explaination, being I'm not that handy with coding and ...

  1. #1

    Default User Login to Redirect using PHP

    I've read many posts about redirecting a user by specifying the directin url in the database, but have had very little luck. I'm using Dreamweaver's user authentication login extensions, and telling the "if successful login, go to page:" to point to the redirect field in the database by clicking browse..data sources...redirect(recordset value). This seems to work only for the first user in the database, ie. any other user is verified, but still directed to the first users redirect page. I have included the code to view(nothing fancy). Please be detailed in explaination, being I'm not that handy with coding and general "do this and do that" talk.

    Thank you to anyone who might be able to help me.


    <?php require_once('Connections/PasswordDB.php'); ?>
    <?php

    mysql_select_db($database_PasswordDB, $PasswordDB);

    $query_Recordset1 = "SELECT * FROM Trial";
    $Recordset1 = mysql_query($query_Recordset1, $PasswordDB) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?>

    <?php

    // *** Validate request to log in to this site.

    session_start();

    $loginFormAction = $HTTP_SERVER_VARS['PHP_SELF'];

    if (isset($accesscheck)) {$GLOBALS['PrevUrl'] = $accesscheck;
    session_register('PrevUrl');}

    if (isset($HTTP_POST_VARS['textfield'])) {$loginUsername=$HTTP_POST_VARS['textfield'];
    $password=$HTTP_POST_VARS['textfield2'];

    $MM_fldUserAuthorization = "";
    $MM_redirectLoginSuccess = $row_Recordset1['redirect'];
    $MM_redirectLoginFailed = "/index.html";
    $MM_redirecttoReferrer = false;

    mysql_select_db($database_PasswordDB, $PasswordDB);

    $LoginRS__query=sprintf("SELECT username, password FROM Trial WHERE username='%s' AND password='%s'", get_magic_quotes_gpc()
    ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password
    : addslashes($password));

    $LoginRS = mysql_query($LoginRS__query, $PasswordDB) or die(mysql_error());

    $loginFoundUser = mysql_num_rows($LoginRS);

    if ($loginFoundUser) { $loginStrGroup = "";

    //declare two session variables and assign them

    $GLOBALS['MM_Username'] = $loginUsername;
    $GLOBALS['MM_UserGroup'] = $loginStrGroup;

    //register the session variables

    session_register("MM_Username");
    session_register("MM_UserGroup");
    if (isset($HTTP_SESSION_VARS['PrevUrl']) && false) { $MM_redirectLoginSuccess = $HTTP_SESSION_VARS['PrevUrl'];
    } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } ?>



    <html>
    <head>
    <title>Untitled Doent</title>
    <meta http-equiv="Content-Type" content="text/html; cht=iso-8859-1">
    </head>

    <body>
    <table width="585" border="0" cellpadding="0" cellspacing="0">

    <!--DWLayoutTable-->
    <tr>
    <td width="585" height="178" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
    </tr>
    <tr>
    <td height="261" valign="top"><form ACTION="<?php echo $loginFormAction; ?>" name="form1" method="POST">

    <p>
    <input type="text" name="textfield">
    </p>
    <p>
    <input type="text" name="textfield2">
    </p>
    <p>
    <input type="submit" name="Submit" value="Submit">
    </p>
    </form></td>
    </tr>
    </table>
    </body>
    </html>
    <?php
    mysql_free_result($Recordset1);
    ?>



    SpeedRacer21 webforumsuser@macromedia.com Guest

  2. #2

    Default Re: User Login to Redirect using PHP

    Hi SoeedRacer21,

    Try doing this:

    Go back to the original code inserted by the login server behavior. You
    don't need to create another recordset to get the page that you should
    redirect to. That information can be pulled from the recordset that checks
    the username/password. Add 'redirect' to the list of fields being retrieved
    "username,password,redirect".

    add this code below "$GLOBALS['MM_UserGroup'] = $loginStrGroup;"

    $MM_redirectLoginSuccess = mysql_result($LoginRS,0,'redirect');

    Hope this helps
    Jaybee Reyes
    Macromedia Technical Support


    JREYES-MMTS Guest

  3. #3

    Default Re: User Login to Redirect using PHP

    Thank you so much for your help. This worked perfectly! Do I need to add a behavior to the individual user pages to keep unautherized people from viewing this page by directly typing it in to the title bar?

    I am very grateful to you. You don't know how much headache this has caused me. Thank you.


    SpeedRacer21 webforumsuser@macromedia.com Guest

  4. #4

    Default Re: User Login to Redirect using PHP

    Hi SpeedRacer21,

    Glad that worked for you. As for the page restrictions, I would recommend
    adding that. But from what you are describing, this is not something that
    can be handled by the restrict access behavior. The only way I can see this
    working with the behavior is if you use user level permissions. You will
    have to create a user level for each user. A bit tedious but it should work.

    Regards,
    Jaybee


    JREYES-MMTS Guest

Similar Threads

  1. Question redirect on login
    By Kirkman in forum Brainstorming Area
    Replies: 0
    Last Post: June 27th, 08:47 PM
  2. Login Redirect
    By James Jiao in forum PHP Development
    Replies: 7
    Last Post: September 25th, 08:12 AM
  3. redirect to guest if first redirect is doesnt work for a user
    By istalcup@hotmail.com in forum Coldfusion - Advanced Techniques
    Replies: 0
    Last Post: March 17th, 03:27 PM
  4. Cookie not set after login and redirect
    By Faassen, B. in forum ASP.NET Security
    Replies: 0
    Last Post: August 3rd, 02:35 PM
  5. Login User and Redirect to a specific page - help required
    By Alex Billerey in forum Macromedia Dreamweaver
    Replies: 1
    Last Post: July 22nd, 12:18 AM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139