Adding a PHP Function?

Discussion in 'Tips/Tricks/Mods' started by mccyberix, Mar 11, 2009.

  1. mccyberix

    mccyberix New Member

    I try to customize ISPConfig 2.x to be able to insert Records to a MySQL DB on a remote Server which serves as an Antivirus/Antispam Mailgateway. I hope someone can put me in the right Direction. I’m running 2 Servers one as the Primary Mailserver without ISPConfig (Frontend Server). The second Server is equipped with ISPConfig.

    The Frontend Server is running Postfix, Spamassassin and Greylisting in Virtual User/Domain Mode, the Server receive the Mails scan them for Viruses and Spam and forwards only the clean ones to the Backendserver

    The Backend Server is running ISPConfig 2 and is the Mainpoint for adding/editing of the Domains and Useraccounts.

    The Problem is when I add a new Domain/User (using ISPConfig) on the Backend Server I have to edit manually the DB on the Frontend server which stores the Virtual Domain/User Data otherwise the Mails will be rejected since the Frontend Server is the first MX Record.

    My Idea is to adopt the ISPConfig Functions with a little PHP Script which will connect to the MySQL DB on the Frontend Server and adds the required Records to the DB. I have already figured out how to use the Form Designer of ISPConfig to create the needed Form. But I can’t figure out how to hook up my PHP Script to the Form I have created in ISPConfig Formdesigner. I thought I can add my Script with the include() function to the File which will be called after submitting the Form but I’m only able to connect to the db_ispconfig DB and even if I create a new Table in it I get the Error that the Table not exists. Maybe can someone give me some hints how to solve this problem or just put me in the right Direction…

    THX in advance
  2. id10t

    id10t Member

    I'd write a script for the front end machine that will add the proper records. Then edit the ispconfig code to simply call that script via one of the php file handling functions and http(s) w/ either get or post args to provide the data to the script on the front end machine. If it will be crossing the internet, then use https or some sort of secret key/hash value like the md5 of the username appended a known to both scripts secret phrase.

Share This Page