HelpSpot Help Desk Software | HelpSpot Blog | HelpSpot Support

BlackBoxPortal.php


#1

Hello,

I’m having a heck of a time getting the BlackBoxPortal.php working. I’ve followed the directions in the manual but haven’t been able to get a ticket list to display.

<?php /* NOTE: THIS FILE MUST BE RENAMED TO BlackBoxPortal.php IN ORDER TO WORK! The black box function allows you to use any authentication scheme you like with the HelpSpot customer portal. Once you enable black box authentication in the admin settings page, the function below will be used to authenticate users rather than HelpSpots built in authentication. This function must return an email account address for a valid username/password or false for a invalid username/password */ // SECURITY: This prevents this script from being called from outside the context of HelpSpot if (!defined('cBASEPATH')) die(""); /* When using Black Box Portal auth, HelpSpot's portal request check login page will ask the user for a username and password. Authenticate these against your internal auth system using LDAP, Password file, Database call, or whatever system your company uses. HelpSpot expects this function to return A VALID EMAIL ADDRESS if the user is valid or FALSE if not. The email is used to then lookup the request belonging to the user. */ function BlackBoxPortal($username, $password){ $dblink = mysql_connect('localhost', 'mysqlUSER', ''); mysql_select_db('helpspot', $dblink); $username = mysql_real_escape_string($username) $password = mysql_real_escape_string($password) $result = mysql_query("SELECT email FROM 'HS_Portal_Auth' WHERE email = '$username' AND password = '$password', $dblink); $num_rows = mysql_num_rows($result); if(mysql_num_rows($result) == 1){ $row = mysql_fetch_assoc($result); //An email must be returned return $row['email'] }else{ return false; header('Locatoin:' . $_SERVER['http_referer']; } } ?>

I have submitted a ticket using the email address and I see it being populated in the DB under HS_Request. On the DB I have created a new table (HS_Portal_Auth) with ID, email, password (plain text for testing). My username and password have been populated in the new table, however, when I go to the HS portal to display a ticket, after logon all I receive is a blank page. What step am I missing do actually display my tickets.

Thank you in advance for any assistance.

-Mike E


#2

HS_Portal_Auth is a table you created correct? Are you sure that query is returning results?


#3

Wow, it’s been a while. We were in the middle of an office move when I posted this and now I’m set to look at this this.

When I paste this SQL Query in SQL WorkBench it returns 1 row…

but I still see a blank page…

SELECT ‘email’ from helpspot.HS_Portal_Auth WHERE email = ‘myemailindb@fqdn.com’;

The action output shows “1 row(s) returned”


#4

it might be easiest to take all the mysql logic and put it in it’s own script so you can just test that. In there run your query and do a print_r(mysql_fetch_assoc($result)) to see what’s actually coming back to the script.