[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Redirect a login script

Posted on 2012-03-17
6
Medium Priority
?
241 Views
Last Modified: 2012-03-23
Hi,
I try to modify a script produced by Dreamweaver to make each user login to his/hers own page. I have a MySQL database called login with username, password and URL (to the page the individual user will land after login) - but I cannot make it work. So, what is wrong with this code?

mysql_select_db($database_Liquid_FSteer, $Liquid_FSteer);
$query_Recordset1 = "SELECT username, password, URL FROM login";
$GLOBALS['MM_UserGroup'] = $loginStrGroup;
$MM_redirectLoginSuccess = mysql_result($LoginRS,0,'URL');
$Recordset1 = mysql_query($query_Recordset1, $Liquid_FSteer) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

When I try to run it, I get the following error message:
Warning: mysql_result() expects parameter 1 to be resource, null given in /home/fsteer/public_html/index.php on line 37
0
Comment
Question by:ToreJohn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 37734338
I don't know what you're expecting with

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

but mysql_result() is supposed to get the results of a mysql_query() and you haven't run one yet in your code above.

http://us3.php.net/manual/en/function.mysql-result.php
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 37734597
Sorry to have to tell you this, but I think you're starting your PHP learning in the wrong place.  Dreamweaver contains some of the worst PHP code ever written, and trying to learn from it,  use it, or modify it for specialized applications is a fools errand.  Instead, buy this little book and give yourself a few weeks to work through the examples.  It is very readable and comes with its own code library.  And it covers many of the kinds of things that you will be interested in.  It will not make you a pro, but it will help you get a good foundation in how PHP and MySQL work together.
http://www.sitepoint.com/books/phpmysql4/

The general design of a PHP client authentication system (login) is given in this article.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_2391-PHP-login-logout-and-easy-access-control.html

HTH, ~Ray
0
 

Author Comment

by:ToreJohn
ID: 37734916
I am not trying to learn PHP and I am happy with Dreamweaver. In this case I want to add  a field to the login username and password called URL = so that I could redirect each user to its own page. I want to use Dreamweaver's login script and add the URL field to each record. I found this Micromedia article explaing how to do it:

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

But I did not make it work. Can anyone give me the solution?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 37735079
At the very least, that line Must come After you have run the query, not before.  When you run it before, there is nothing for it to get.  And '$LoginRS' is supposed to be the results pointer from a query.  I don't see a query that is setting that value.  This link shows how it is supposed to work:

http://us3.php.net/manual/en/function.mysql-result.php
0
 

Accepted Solution

by:
ToreJohn earned 0 total points
ID: 37735204
So it was that simple. Thanks a lot.
0
 

Author Closing Comment

by:ToreJohn
ID: 37756265
I do not know .php and I do not want to learn it, hence the reason for using Dreamweaver. I therefore did not understand your answer first time.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question