Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently May 18th, 2024, 10:39 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Post Web Data Function
PostPosted: November 14th, 2004, 4:52 am 
Offline

Joined: November 11th, 2004, 3:44 am
Posts: 5
Hi,
I have been using the post web data scripts posted by Robin on the old forum in posting #9403. I have successfully sent data to a Mysql database and retrieved data from the first record of a table in my Mysql database (would like to know how to get the next records also), but I am having trouble with the function that allows you to compare an inputted username... to a username in a database. I am using the information below as posted previously:

Subject Username Date
Re: Databases, Opus Pro and web Robin Garrett 20 Oct 2004 12:25:50

TEXT FROM 9403 SERIES OF ENTRIES IN OLD FORUM
You would need to send the inputted username and password to a PHP file which stores these values to strings, then searches the database for any record where the username is the same as the inputted value. You can then compare the inputted password to that retrieved from the database and echo information back to the publication to communicate whether or not the login was a success.

The following PHP script should give you some idea of how this is achieved:

<?php

$user = $HTTP_POST_VARS['user'];
$pass = $HTTP_POST_VARS['pass'];

$DBhost = "localhost";
$DBuser = "username";
$DBpass = "password";
$DBName = "mydb";

$connect = mysql_connect($DBhost,$DBuser,$DBpass);
$db = mysql_select_db($DBName,$connect);

$query = "SELECT * FROM tablename WHERE username='$user'";
$result = mysql_query($query, $connect);

$resultRow=mysql_fetch_array($result );
$storedpassword=$resultRow[userpassword];
$storeduser = $resultRow[username];

if ($password==$storedpassword) {
echo "&success=1";
} else {
echo "&success=0";
}

?>

If the username and password are correct, a name-value pair of "success" and "1" is transmitted via the echo function. If the username and password do not match, the name "success" and value "0" are transmitted. You would therefore need to use the ''Destination' tab of the existing Post Web Data action to retrieve this name-value pair and store it to a variable. You can then use an If statement to trigger different actions depending on the value of the target variable, such as showing an 'Invalid Login' message or displaying the next page if the login was successful.
END OF TEXT FROM 9403 SERIES OF ENTRIES IN OLD FORUM

I think I understand this up to the point of getting the "success=1" or "success=0" into a variable in my Opus pub. Would it be possible to give a more specific example of this as was done with the prior entries on how to insert or retrieve data? It would be very helpful! Thanks. :roll:


For this message pert6e has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Post Web Data Function
PostPosted: February 18th, 2016, 9:33 am 
Offline

Joined: May 12th, 2015, 2:04 pm
Posts: 47
Opus: Opus 9.5
OS: Win 8
System: Intel Core i7 3.6Ghz
12 years later...did you sort out this problem because I have the same problem.


For this message Matra has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group