Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Author Message
izone
Involved
Involved


Joined: Sep 07, 2004
Posts: 354
Location: Sweden

PostPosted: Fri Jun 10, 2005 4:42 am Reply with quote

Hi

I'm using PhpNuke 7,7 and 4Image gallery as stand alone.

I just wonder if there is any way to change in 4Image that the users in Nuke become a member of 4Image too when they register in the site.

How can I change the user_table of 4Image to use Nukes user_table???

Thanks for helping.

Best Regards.
 
View user's profile Send private message
hitwalker
Sells PC To Pay For Divorce


Joined:
Posts: 5661

PostPosted: Fri Jun 10, 2005 3:46 pm Reply with quote

Something like this ?



    Introduction

    These instructions form the basis of a method to integrate the registration processes of PHP-Nuke and 4Images, when 4Images is being used as a PHP-Nuke module.

    Installation

    Install PHP-Nuke as per the installation notes.
    If you are using either Add_Fields, or Approve_Membership, then install this as per the installation notes.
    Install 4Images as a PHP-Nuke Module as per the instructions in the PDF file.
    Install the English language pack for 4Images as per the installation notes.
    Install the modified theme for 4Images, or modify your own theme in a similar manner to this and install it and set as default.
    In Nuke admin.php/modules, set Gallery module to be Members only.

    Database.

    Install the PHP-Nuke database tables in the database of your choice using the nuke.sql file provided and phpMyAdmin.
    If you are using Add_Fields or Approve_Membership, install the tables for this using the appropriate script.
    Install the tables for 4Images into the same database as your PHP-Nuke installation, but give these a different prefix to your PHP-Nuke tables. I left the prefixes for the 4Images tables as the default 4images_.


    Use phpMyAdmin to add the following fields to the nuke_users table

    user_level2 smallint(6) NOT NULL default '2',
    user_allowemails tinyint(1) NOT NULL default '1',
    user_invisible tinyint(1) NOT NULL default '0',
    user_lastaction int(11) NOT NULL default '0',
    user_location varchar(255) NOT NULL default '',
    user_comments smallint(6) unsigned NOT NULL default '0',


    Note that there is a small but important change here from Whirleyes instructions.
    The default for user_level2 is 2.


    Once you have copied any existing membership from the Gallery users table (if these are not also members of your Nuke site).
    You can delete the Gallery users table.
    Check that all of your Nuke members have the default 2 for user_level2.
    Find the Entry for yourself in the nuke_users table and change the value of user_level2 from 2 to 9.
    This will allow you access to the admin pages of 4Images.
    You may change this value to 9 for any of your Nuke members who you wish to have access to 4Images Admin pages.


    Code Changes
    NB in the following notes, full paths are given using the PHP-Nuke root as the starting point. E.g. config.php would refer to the config.php file in your Nuke root and modules/Gallery/config.php would refer to the config.php file in the Gallery folder.
    config.php



Code:


Find:
$user_prefix = "nuke";


After add:
$galprefix = "4images";


Obviously, if your user_prefix is different to nuke the line you are looking for will reflect this, and if you have a different prefix to your Gallery tables, change 4images to the prefix you are using.
modules/Gallery/config.php
Find:
$table_prefix = "4images_";


After add:
$nuke_prefix = "nuke_";


Again, change these to reflect your actual $user_prefix, but note that the nuke_prefix must end with an underscore.
This is because PHP-Nuke and 4Images treat prefixes differently.
Nuke_prefix is the prefix to your PHP-Nuke users table.
modules/Your_Account/index.php


Find the logout () function and replace the complete function with:
function logout() {
    global $prefix, $db, $user, $cookie, $redirect, $galprefix;
    cookiedecode($user);
    $r_uid = $cookie[0];
    $r_username = $cookie[1];
    setcookie("user");
    $db->sql_query("DELETE FROM ".$prefix."_session WHERE uname='$r_username'");
    $db->sql_query("DELETE FROM ".$prefix."_bbsessions WHERE session_user_id='$r_uid'");
   $db->sql_query("DELETE FROM ".$galprefix."_sessions WHERE session_user_id='$r_uid'");
// end custom script     
    $user = "";
    include("header.php");
    OpenTable();
    if ($redirect != "") {
        echo "<META HTTP-EQUIV=\"refresh\" content=\"3;URL=modules.php?name=$redirect\">";
    } else {
        echo "<META HTTP-EQUIV=\"refresh\" content=\"3;URL=index.php\">";
    }
    echo "<center><font class=\"option\"><b>"._YOUARELOGGEDOUT."</b></font></center>";
    CloseTable();
    include("footer.php");
}
modules/Gallery/includes/sessions.php

Find:
user_table_fields = array(
  "user_id" => "user_id",
  "user_level" => "user_level",
  "user_name" => "user_name",
  "user_password" => "user_password",
  "user_email" => "user_email",
  "user_showemail" => "user_showemail",
  "user_allowemails" => "user_allowemails",
  "user_invisible" => "user_invisible",
  "user_joindate" => "user_joindate",
  "user_activationkey" => "user_activationkey",
  "user_lastaction" => "user_lastaction",
  "user_location" => "user_location",
  "user_lastvisit" => "user_lastvisit",
  "user_comments" => "user_comments",
  "user_homepage" => "user_homepage",
  "user_icq" => "user_icq"
);

Replace with:
$user_table_fields = array(
  "user_id" => "user_id",
  "user_level" => "user_level2",
  "user_name" => "username",
  "user_password" => "user_password",
  "user_email" => "user_email",
  "user_showemail" => "user_viewemail",
  "user_allowemails" => "user_allowemails",
  "user_invisible" => "user_invisible",
  "user_joindate" => "user_regdate",
  "user_activationkey" => "user_actkey",
  "user_lastaction" => "user_lastaction",
  "user_location" => "user_location",
  "user_lastvisit" => "user_lastvisit",
  "user_comments" => "user_comments",
  "user_homepage" => "user_website",
  "user_icq" => "user_icq"
);

Find:
$user_password = md5($user_password);
and delete.

Find:
// Get Userinfo
$session_info = $site_sess->return_session_info();
$user_info = $site_sess->return_user_info();

Replace with:
// Get Userinfo

// start custom script
 if (eregi("modules.php", $PHP_SELF)) {
   global $user, $cookie, $prefix, $db, $user_prefix;
   cookiedecode($user);
   $uname = $cookie[1];
   if (isset($uname) && $user_info['user_id'] !== GUEST)
   {
      $sql = "SELECT user_password FROM ".USERS_TABLE." WHERE username='$uname'";
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $dbpass = $row[user_password];
      $site_sess->login($uname, $dbpass, 0);
   }
      $session_info = $site_sess->return_session_info();
      $user_info = $site_sess->return_user_info();
   
}
else
{
      $session_info = $site_sess->return_session_info();
      $user_info = $site_sess->return_user_info();
}
// end custom script.



Note that this part has been substantially changed.

modules/Gallery/includes/constants.php

Find:
define('USERS_TABLE', $table_prefix.'users');

and change to:
define('USERS_TABLE', $nuke_prefix.'users');

 
modules/Gallery/admin/admin_global.php


Find:
$loginpassword = trim($HTTP_POST_VARS['loginpassword']);


After add:
$loginpassword = md5($loginpassword);


modules/Gallery/templates/YourGalleryTemplate/user_logininfo.html
You should substitute YourGalleryTemplate with whatever template you have set as the default theme for 4Images.


Find:
&raquo; <a href="{url_logout}">{lang_logout}</a></td>

and delete.




    Conclusion

    This should now mean that any member logged in as a member of PHP-Nuke will now be logged into 4Images too.
    Admins can log in to 4Images admin pages via Only registered users can see links on this board! Get registered or login! .
    When a member logs out from PHP-Nuke he will also be logged out from 4Images.
 
View user's profile Send private message
izone
PostPosted: Fri Jun 10, 2005 3:54 pm Reply with quote

thanks hitwalker,

I will read it all and give it a try and come back to you with my new problems Cheers
 
izone
PostPosted: Sun Jun 12, 2005 7:00 pm Reply with quote

hitwalker, Thanks to you I have made it works now.

It wasn't easy but it is done now. Thanks again.

But, I have a problem that I hope you or Raven could help me.

When you wanted to download a picture zipped by clicking on zip download, it give you a file by name "module.php" or "module.html"!!!

Where do you think is wrong???

please help!

Best regards
 
hitwalker
PostPosted: Sun Jun 12, 2005 7:38 pm Reply with quote

yes i can remember such thing...
are you using some security on your computer?
its just a wild guess...(turn it off)

other thing is to check the download permissions...
 
izone
PostPosted: Mon Jun 13, 2005 1:51 am Reply with quote

Thanks

Yes I have Ms antispyware and norton antivirus, but, even when I turn them off I have same problem.

Where do mean to check the download permission?

Could you please tell me more?

Regards
 
hitwalker
PostPosted: Mon Jun 13, 2005 4:00 am Reply with quote

well the configuration of 4images comes with download approval.
but its also possible that its path related.
that can be the case...
but i think this is related to the server and how you have set the things....
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

View next topic
View previous topic
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 vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©