Adult Script Pro Community Forums

The forum is here for legacy reasons. No new posts will be created. User registration is disabled! If you have any questions, please email us or check https://www.adultscriptpro.com for more details!

You are not logged in.

#1 2010-10-17 17:08:16

Coscast
Member
From: Germany
Registered: 2010-10-03
Posts: 546

Need some help with an integration

I try to integrate http://www.flashcoms.com/products/commu … /overview/

I downloaded a trial Version of this Script and i have RED5 up and running.

My install is here:

http://media.mypornow.com/chat7/chat.htm

This Scipt has some Loginhandlers to authenticate the user and let him login.

The integration is described here: http://www.flashcoms.com/docs/7_0/chat7/#login_handlers

So i tried to modify one handler to use the ASP database:


<?php
#
# Copyright © 2004-2010 Chat software by [url=http://www.flashcoms.com]www.flashcoms.com[/url]
#
# This is the demo handler. Replace it with your custom logic.
#

$login = $_REQUEST['login'];
$password = $_REQUEST['password'];

//Connect to users database
$db = mysql_connect('localhost','dbuser','dbpass') or die(mysql_error());
mysql_select_db('databasename',$db) or die(mysql_error());

//Init request parameters
$userName = (isset($_REQUEST["login"])) ? urldecode($_REQUEST["login"]) : "";
$password = (isset($_REQUEST["password"])) ? urldecode($_REQUEST["password"]) : "";
$uid = (isset($_REQUEST["uid"])) ? urldecode($_REQUEST["uid"]) : "";
#$login    = md5($login);
#$password = md5($password);
//Check if user filled login and password in the login screen (Chat authorization)
if($login != "" && $password != "")
{
#  $sql = "SELECT * FROM user WHERE username='".$login."' AND password='".$password."'"; //////// This works not, because the passwd is endcrpyted :(
#  $sql = "SELECT * FROM user WHERE username='".$login."'"; /// This works but no password check :(
}
//session/cookie base authorization (Auto login)
else if ($_SESSION['user_id']!="")
{
  $sql = "SELECT * FROM user WHERE id='".$_SESSION["user_id"]."'";
}
// Non session/cookie based autologin authorization
else if ($uid!="")
{
  $sql = "SELECT * FROM user WHERE id='".$_GET['user_id']."'";
}
else
{
  echo '<login result="FAIL" error="error_authentication_failed1"/>';
  exit;
}

//Select user data
$result = mysql_query($sql,$db);
$count=mysql_num_rows($result);
if($count==1)
#if(mysql_num_rows($result)==1)
{
  //User found. get user info
  $usersInfo = mysql_fetch_array($result);
  $answer .= '<login result="OK">';
  $answer .= '<userData>';
  $answer .= '<id>'.$usersInfo['user_id'].'</id>';
  $answer .= '<name><![CDATA['.$userName.']]></userName>';
  $answer .= '<photo>'.$usersInfo['user_id'].'</id>';
  $answer .= '<gender>'.$usersInfo['gender'].'</gender>'; //male, female or couple
  $answer .= '</userData>';
  $answer .= '</login>';
  echo $answer;
  exit;
}
else
{
  //User not found OR authorization failed
  echo '<login result="FAIL" error="error_authentication_failed"/>';
  exit;
}
?>

Basically it works if i comment out the Password Check, but thats very bad.
The Problem is, that i can't encrypt the entered password to match with the Password in the ASP database.

Maybe someone wants to help me.

BTW: The XML Output is not yet completed, some work there too. But i can do that by myself.

Thank you.

Last edited by Coscast (2010-10-17 17:14:47)


sgt-halfsize-banner.jpg

Offline

#2 2010-10-18 07:07:13

symtab
Administrator
Registered: 2010-08-23
Posts: 7,501
Website

Re: Need some help with an integration

Check the modules/user/components/login.php file. ASPro does not use md5 to encrypt passwords, it uses blowfish when available and DES if blowfish is not available. You can change this from a library configuration file and it can use md5/sha, however this is only useful if you decide to upgrade from other scripts.


Adult Scripts: Adult Script Pro - Adult Search Script
Adult Advertising/Traffic: Plug Rush - EXOClick - PopAds

Offline

#3 2010-10-19 21:13:36

Coscast
Member
From: Germany
Registered: 2010-10-03
Posts: 546

Re: Need some help with an integration

Got that working.

if somebody needs that:

<?php
header('Content-type: text/xml');
define('_VALID', true);
require '/path/to/your/bootstrap.php';
$username = $_REQUEST['login'];
$password = $_REQUEST['password'];                  
                  if ($username == '' OR $password == '') {
              echo '<login result="FAIL" error="error_authentication_failed"/>';
              exit;
                  }
                  #$username    = md5($username);
                  $db = VF::factory('database');
                  $db->query("SELECT user_id, group_id, username, password, email, name, gender, birth_date,
                                     country, city, zip, avatar, login_date, verified, status
                              FROM #__user
                              WHERE username = '".$db->escape($username)."'
                              LIMIT 1");
                  if ($db->affected_rows()) {
                      $user     = $db->fetch_assoc();
                    $passed = FALSE;
                      }
                      if (VHash::check($password, $user['password'])) {
                          $passed = TRUE;
                      } 
                                            
                      if ($passed === TRUE) {
                    
                              
  $profileurl = 'http://www.mypornow.com/users/'.$user['username'];
  $photo      = 'http://www.mypornow.com/media/users/'.$user['user_id'].'.'.$user['avatar'];
  $thumbnail  = 'http://www.mypornow.com/media/users/'.$user['user_id'].'.'.$user['avatar'];
  $answer .= '<login result="OK">';
  $answer .= '<userData>';
  $answer .= '<id>'.$user['user_id'].'</id>';
  $answer .= '<name><![CDATA['.$username.']]></name>';
  $answer .= '<gender>'.$user['gender'].'</gender>';
  $answer .= '<location>'.$user['country'].'</location>'; //male, female or couple
  $answer .= '<age>'.$user['birth_date'].'</age>';
  $answer .= '<photo><![CDATA['.$photo.']]></photo>';
  $answer .= '<thumbnail><![CDATA['.$thumbnail.']]></thumbnail>';
  $answer .= '<details>no details</details>';
  $answer .= '<level>0</level>';
  $answer .= '<profileUrl><![CDATA['.$profileurl.']]></profileUrl>';
  $answer .= '</userData>';
  $answer .= '<friends></friends>';
  $answer .= '<blocks></blocks>';
  $answer .= '</login>';
  echo $answer;
    }

Replace all instances of mypornow.com with your domain smile

Last edited by Coscast (2010-10-19 21:14:17)


sgt-halfsize-banner.jpg

Offline

Board footer

Powered by FluxBB