Page 1 of 1

functions.php

Posted: Tue Dec 30, 2014 11:53 am
by Lowepepsi2004
Iv just recently updated my forum on my site to 3.1.2 from 3.0.1.The forum seems to be fine and I can login and out of, but its the members page with a login script seems to be the issue because it used the function.php within the forum, and it seemed the update of functions.php has stop my login script from working. I used the forums usernames and password to access a members area on the site by creating a script see below. is they a line I need to add or remove to make this work again?????

Code: Select all

<?php

//ob
ob_start();

//session
session_start();

if (isset($_SESSION['username']))
{
header("Location: main.php");
exit();
}

//connect
$error = 'Could Not Connect To The Database';
mysql_connect('SITE.mysql','DATABASE NAME','DATABASE PASSWORD') or die ($error);
mysql_select_db('DATABASE NAME') or die ($error);	

//include functions.php phpbb script
require 'forum/includes/functions.php';

if ($_POST{'login'})
{
//get form data
$username = addslashes(strip_tags(strtolower($_POST['username'])));
$password = addslashes(strip_tags($_POST['password']));

if (!$username||!$password)
	echo "Please Enter A Username And Password<p />";
else
{
//find username
$find = mysql_query("SELECT * FROM phpbb_users WHERE username_clean='$username'");
if  (mysql_num_rows($find)==0)
	echo "Username Not Found<p />";
else
 {
 while ($find_row = mysql_fetch_assoc($find))
 {
// grab passsord hash for user
$password_hash = $find_row['user_password'];
  }
  
  $check = phpbb_check_hash($password, $password_hash);
  if ($check==FALSE)
	echo "Incorrect Password";
  else if ($check==TRUE)
  {
   $_SESSION['username']=$username;
   header('Location: main.php');
   exit();
  }
  
  
 }
}



}

Re: functions.php

Posted: Sat Jan 03, 2015 10:49 am
by M.Gaetan89
The function phpbb_check_hash() is in forum/includes/functions_compatibility.php now.
If you posted your full script, you don't need to include forum/includes/functions.php anymore.

Re: functions.php

Posted: Sat Jan 03, 2015 3:06 pm
by Lowepepsi2004
//include functions_compatibility.php phpbb script
require 'forum/includes/functions_compatibility.php'; still doesn't work :-( see www.eastriding4x4club.co.uk/members.php

Re: functions.php

Posted: Sat Jan 03, 2015 7:06 pm
by M.Gaetan89
I just noticed that if ($_POST{'login'}) should be if ($_POST['login']).
Do you have any error showing up?

Re: functions.php

Posted: Sat Jan 03, 2015 7:22 pm
by Lowepepsi2004
I get no errors, see http://www.eastriding4x4club.co.uk/members.php just a blank screen were the login field should be, iv been playing all day with different ideas. The php script did work before I updated the forum to the most recent and updated the php on the web sever to 5.6. I have edited the script to include both comments but still wont work.

Code: Select all

<?php

//ob
ob_start();

//session
session_start();
?>
<?php
if (isset($_SESSION['username']))
{
header("Location: main.php");
exit();
}

//connect
$error = 'Could Not Connect To The Database';
mysql_connect('**********************','********************','*************************') or die ($error);
mysql_select_db('***************') or die ($error);   

//include functions.php phpbb script
require 'forum/includes/functions_compatibility.php';

if ($_POST['login'])
{
//get form data
$username = addslashes(strip_tags(strtolower($_POST['username'])));
$password = addslashes(strip_tags($_POST['password']));

if (!$username||!$password)
   echo "Please Enter A Username And Password<p />";
else
{
//find username
$find = mysql_query("SELECT * FROM phpbb_users WHERE username_clean='$username'");
if  (mysql_num_rows($find)==0)
   echo "Username Not Found<p />";
else
 {
 while ($find_row = mysql_fetch_assoc($find))
 {
// grab passsord hash for user
$password_hash = $find_row['user_password'];
  }
  
  $check = phpbb_check_hash($password, $password_hash);
  if ($check==FALSE)
   echo "Incorrect Password";
  else if ($check==TRUE)
  {
   $_SESSION['username']=$username;
   header('Location: main.php');
   exit();
  }
  
  
 }
}



}
?>

Re: functions.php

Posted: Sat Jan 03, 2015 11:17 pm
by Lowepepsi2004
iv giving up, iv restored the old forum 3.0.12 and the database and the site is running fine. If you want me to upload any files and try for yourselfs let me know. Thanks for all your help and one day we will crack it.

Re: functions.php

Posted: Thu Feb 19, 2015 7:02 am
by millzee
i'm doing the same, functions_compatibility.php just doesn't work. Maybe one day in the future it will be sorted but for the amount of hassle and time i've wasted trying to diagnose errors caused for something that already works isn't really worth it.

maybe 3.0.12 to 3.1.12 will be the way forward for me.

Re: functions.php

Posted: Thu Feb 19, 2015 7:03 am
by Paul
You will need to tell what won't work. Did you include all required files? You can't just include functions_compatibility.php

Re: functions.php

Posted: Mon May 04, 2015 9:38 pm
by Lowepepsi2004
What other links do I need to include??