Please change the file permissions to 777 for the following files and folders:
includes/connect.php
sitemap.xml
admin/uploads/

'); } if ($_GET['error'] == 1) { $theError = "

ERROR: please complete the fields with a *

"; } // ------------------------------------------------ do the following if Step 2 if ($_GET['step'] == 'Step2') { if ($_GET['error'] == 2) { $theError = "

ERROR: please complete the fields with a *

"; // open database require_once('includes/connect.php'); mysql_select_db($database, $databaseConnect); } // check to see if step 1 required details have been completed if ($_GET['error'] != 2) { if (empty($_POST['Host']) || empty($_POST['Username']) || empty($_POST['Password']) || empty($_POST['Name']) || empty($_POST['adminUser']) || empty($_POST['adminPass']) || empty($_POST['adminEmail']) || empty($_POST['adminWebTitle']) || empty($_POST['adminWebURL'])) { header("Location: install.php?error=1"); } } if (!isset($_GET['error'])) { // get login details from Step 1 $hostname = $_POST['Host']; $database = $_POST['Name']; $username = $_POST['Username']; $password = $_POST['Password']; $databaseConnect = mysql_connect($hostname, $username, $password) or trigger_error(mysql_error(),E_USER_ERROR); // connect to database mysql_select_db($database, $databaseConnect); // drop config table if it already exists $sql = "DROP TABLE IF EXISTS affiliSt_config"; mysql_query($sql, $databaseConnect) or die(mysql_error()); // create config table $sql = "CREATE TABLE affiliSt_config ( name VARCHAR(150) NOT NULL, value TEXT, comment VARCHAR(150), title VARCHAR(150), PRIMARY KEY (name) )"; mysql_query($sql, $databaseConnect) or die(mysql_error()); // drop categories table if it already exists $sql = "DROP TABLE IF EXISTS affiliSt_categories"; mysql_query($sql, $databaseConnect) or die(mysql_error()); // create categories table $sql = "CREATE TABLE affiliSt_categories ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(255), parent INT(10) default 0, subCategories INT(10) default 0, keywords TEXT, priceFrom DECIMAL(10,2) default 0.00, priceLimit DECIMAL(10,2) default 0.00, searchType SMALLINT(1) default 0, bindParent SMALLINT(1) default 0, PRIMARY KEY (id) )"; mysql_query($sql, $databaseConnect) or die(mysql_error()); // drop link categories table if it already exists $sql = "DROP TABLE IF EXISTS affiliSt_linkcategories"; mysql_query($sql, $databaseConnect) or die(mysql_error()); // create link categories table $sql = "CREATE TABLE affiliSt_linkcategories ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(255), parent INT(10) default 0, counter INT(10) default 0, subCategories INT(10) default 0, PRIMARY KEY (id) )"; mysql_query($sql, $databaseConnect) or die(mysql_error()); // drop links table if it already exists $sql = "DROP TABLE IF EXISTS affiliSt_links"; mysql_query($sql, $databaseConnect) or die(mysql_error()); // create links table $sql = "CREATE TABLE affiliSt_links ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(255), email VARCHAR(255), url VARCHAR(255), title TEXT, description TEXT, category INT(10) default 0, reciprocal VARCHAR(255), confirmed SMALLINT(1) default 0, approved SMALLINT(1) default 0, nocheck SMALLINT(1) default 0, added INT(10) default 0, nextcheck INT(10) default 0, PRIMARY KEY (id) )"; mysql_query($sql, $databaseConnect) or die(mysql_error()); // drop news table if it already exists $sql = "DROP TABLE IF EXISTS affiliSt_news"; mysql_query($sql, $databaseConnect) or die(mysql_error()); // create news table $sql = "CREATE TABLE affiliSt_news ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(255), timestamp INT(10) default 0, content TEXT, PRIMARY KEY (id) )"; mysql_query($sql, $databaseConnect) or die(mysql_error()); // drop pages table if it already exists $sql = "DROP TABLE IF EXISTS affiliSt_pages"; mysql_query($sql, $databaseConnect) or die(mysql_error()); // create pages table $sql = "CREATE TABLE affiliSt_pages ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(255), parent INT(10) default 0, subCategories INT(10) default 0, content TEXT, PRIMARY KEY (id) )"; mysql_query($sql, $databaseConnect) or die(mysql_error()); // drop tag cloud table if it already exists $sql = "DROP TABLE IF EXISTS affiliSt_cloud"; mysql_query($sql, $databaseConnect) or die(mysql_error()); // create tag cloud table $sql = "CREATE TABLE affiliSt_cloud ( searchPhraseID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, searchPhrase TEXT, searchPhraseCount INT(10) default 0, approve SMALLINT(1) default 0, PRIMARY KEY (searchPhraseID) )"; mysql_query($sql, $databaseConnect) or die(mysql_error()); // drop products table if it already exists $sql = "DROP TABLE IF EXISTS affiliSt_products1"; mysql_query($sql, $databaseConnect) or die(mysql_error()); // create products table $sql = "CREATE TABLE affiliSt_products1 ( prodID INT(10) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT, merchant VARCHAR(150), merchantProdID VARCHAR(255), prodCategory VARCHAR(255), prodName VARCHAR(255), prodBrand VARCHAR(255), prodDescription TEXT, prodPromoText TEXT, prodLink TEXT, prodImageURL TEXT, prodPrice DECIMAL(10,2), prodCurrency VARCHAR(20), prodPopularity INT(10) NOT NULL default 0, prodDB INT(10) NOT NULL default 0, PRIMARY KEY (prodID) )"; mysql_query($sql, $databaseConnect) or die(mysql_error()); if (dirname($_SERVER['PHP_SELF']) == '/') { $theHostDir = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']); } else { $theHostDir = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/"; } // page 1 welcome $insert = array ( array ( 'id' => 1, 'name' => 'Welcome', 'parent' => 0, 'subCategories' => 0, 'content' => 'You can add some text and images here using the wysiwyg editor in admin') ); // insert values into pages table foreach ($insert as $row) { $sql = "INSERT INTO affiliSt_pages ( id, name, parent, subCategories, content ) values ( '{$row['id']}', '{$row['name']}', '{$row['parent']}', '{$row['subCategories']}', '{$row['content']}' )"; mysql_query($sql, $databaseConnect) or die(mysql_error()); } // sample news item $timeNow = mktime(0, 0, 0, date("m"), date("d"), date("Y")); $insert = array ( array ( 'id' => 1, 'name' => 'Sample News Title', 'timestamp' => $timeNow, 'content' => 'Sample news description') ); // insert values into news table foreach ($insert as $row) { $sql = "INSERT INTO affiliSt_news ( id, name, timestamp, content ) values ( '{$row['id']}', '{$row['name']}', '{$row['timestamp']}', '{$row['content']}' )"; mysql_query($sql, $databaseConnect) or die(mysql_error()); } // create array for values posted from Step 1 $insert = array ( array ( 'name' => 'adUsername', 'value' => $_POST['adminUser'], 'comment' => 'Your admin username', 'title' => 'Admin Username'), array ( 'name' => 'adPassword', 'value' => $_POST['adminPass'], 'comment' => 'Your admin password', 'title' => 'Admin Password'), array ( 'name' => 'adEmail', 'value' => $_POST['adminEmail'], 'comment' => 'Your admin email address', 'title' => 'Admin Email'), array ( 'name' => 'adWebTitle', 'value' => $_POST['adminWebTitle'], 'comment' => 'Your website title', 'title' => 'Website Title'), array ( 'name' => 'adWebStrap', 'value' => 'An AffiliStore Website', 'comment' => 'Your website strapline', 'title' => 'Website Strapline'), array ( 'name' => 'adWebURL', 'value' => $_POST['adminWebURL'], 'comment' => 'Your website address', 'title' => 'Website Address'), array ( 'name' => 'adSkinURL', 'value' => 'default', 'comment' => 'Your chosen website skin', 'title' => 'Website Skin') , array ( 'name' => 'dbHost', 'value' => $_POST['Host'], 'comment' => 'Your database host', 'title' => 'Database Host'), array ( 'name' => 'dbUsername', 'value' => $_POST['Username'], 'comment' => 'Your database username', 'title' => 'Database Username'), array ( 'name' => 'dbPassword', 'value' => $_POST['Password'], 'comment' => 'Your database password', 'title' => 'Database Password'), array ( 'name' => 'dbName', 'value' => $_POST['Name'], 'comment' => 'Your database name', 'title' => 'Database Name') , array ( 'name' => 'installDir', 'value' => $theHostDir, 'comment' => 'Directory of installation', 'title' => 'Installation Directory') , array ( 'name' => 'adLinkDescription', 'value' => 'Your Website Description', 'comment' => 'Your website description', 'title' => 'Website Description'), array ( 'name' => 'adLinkTitle', 'value' => 'Your website title', 'comment' => 'Your website title', 'title' => 'Website Title'), array ( 'name' => 'adLinkURL', 'value' => 'http://www.yourwebsite.com/', 'comment' => 'Your backlink URL', 'title' => 'Website Address') , array ( 'name' => 'emailNewLink', 'value' => 'You have received a new link submission.', 'comment' => 'New link added', 'title' => 'New Link'), array ( 'name' => 'emailSig', 'value' => 'Regards Admin', 'comment' => 'Email signature', 'title' => 'Email Signature'), array ( 'name' => 'emailThanks', 'value' => 'We have received your submission and will review your link asap.', 'comment' => 'Thank you for submitting link', 'title' => 'Thank You Email'), array ( 'name' => 'emailApprove', 'value' => 'Your link has been approved!', 'comment' => 'Approved link email', 'title' => 'Approved Link'), array ( 'name' => 'emailNoRecip', 'value' => 'We are unable to find a reciprocal link, your link has been approved here:', 'comment' => 'No reciprocal link found', 'title' => 'No Reciprocal') , array ( 'name' => 'navOptions', 'value' => '1::1:1:1::1::1:99999:1:1:', 'comment' => 'Turn on or off navigation panels', 'title' => 'Navigation Options'), array ( 'name' => 'prodPerPage', 'value' => '9:30:3:4:9:9', 'comment' => 'How many products to display on home and other pages', 'title' => 'Products Per Page'), array ( 'name' => 'prodListings', 'value' => '::::::1', 'comment' => 'Items to display on the product listings', 'title' => 'Product Listings Options'), array ( 'name' => 'prodSingle', 'value' => ':1::::1:1', 'comment' => 'Items to display on the single product listing', 'title' => 'Single Product Listings Options') ); // insert values posted from Step 1 into config table foreach ($insert as $row) { $sql = "INSERT INTO affiliSt_config ( name, value, comment, title ) values ( '{$row['name']}', '{$row['value']}', '{$row['comment']}', '{$row['title']}' )"; mysql_query($sql, $databaseConnect) or die(mysql_error()); } // write values posted to connect.php include file $file = fopen("includes/connect.php", "w"); $cData =''; fwrite($file, $cData); fclose($file); } // ------------------------------------------------ end Step 2 begin Step 3 } else if ($_GET['step'] == 'Step3') { // check to see if step 1 required details have been completed if (isset($_POST['URLfeed'])) { if (empty($_POST['URLfeed'])) { header("Location: install.php?step=Step2&error=2"); } } // can now include the connect.php as detail have been added in step 2 require_once('includes/connect.php'); // connect to database mysql_select_db($database, $databaseConnect); //---------- uploaded feed file if (isset($_POST['theupload'])) { // move file to folder on server $feedSource = $_FILES['feedUpload']['tmp_name']; $feedTarget = "admin/uploads/".$_FILES['feedUpload']['name']; // check if file already exists if (file_exists($feedTarget)) { echo "$feedTarget already exists, please rename the file you are trying to upload."; exit; } move_uploaded_file($feedSource, $feedTarget) or die ("couldn't copy"); if ($_POST['upload_csvType'] == 'tab') { $fd_csvType = "\t"; } else { $fd_csvType = $_POST['upload_csvType']; } // set row variable and open file $handle = fopen($feedTarget, "r"); $row = 1; // while loop with fgetcsv sorts the csv into the data array while (($data = fgetcsv($handle, 3000, $fd_csvType)) !== FALSE) { // display only the first row if ($row == 1) { $num = count($data); $data_names = array(); for ($c=0; $c < $num; $c++) { $data_names[$c] = $data[$c]; } } $row++; } //---------- url feed file } else if (isset($_POST['theurl'])) { if ($_POST['typeFeed'] == 'tab') { $typeFeed = "\t"; } else { $typeFeed = $_POST['typeFeed']; } // set row variable and open file $handle = fopen($_POST['URLfeed'], "r"); $row = 1; // while loop with fgetcsv sorts the csv into the data array while (($data = fgetcsv($handle, 3000, $typeFeed)) !== FALSE) { // display only the first row if ($row == 1) { $num = count($data); $data_names = array(); for ($c=0; $c < $num; $c++) { $data_names[$c] = $data[$c]; } } $row++; } } // ------------------------------------------------ end Step 3 } else if ($_GET['step'] == 'CompleteInstallation') { // open database require_once('includes/connect.php'); mysql_select_db($database, $databaseConnect); // set row variable and open file $row = intval($_POST['firstRow']); if (isset($_POST['feedPath'])) { $handle = fopen($_POST['feedPath'], "r"); } else { $handle = fopen($_POST['URLfeed'], "r"); } if ($_POST['typeFeed'] == 'tab') { $typeFeed = "\t"; } else { $typeFeed = $_POST['typeFeed']; } // empty the table $empty = "TRUNCATE TABLE affiliSt_products1"; mysql_query($empty); // while loop with fgetcsv sorts the csv into the data array while (($data = fgetcsv($handle, 3000, $typeFeed)) !== FALSE) { $resulta = $_POST['merchantData']; $resultb = $data[intval($_POST['merchantProdIDData'])]; $resultc = $data[intval($_POST['prodCategoryData'])]; $resultd = $data[intval($_POST['prodNameData'])]; $resulte = $data[intval($_POST['prodBrandData'])]; $resultf = $data[intval($_POST['prodDescriptionData'])]; $resultg = $data[intval($_POST['prodPromoTextData'])]; $resulth = $data[intval($_POST['prodLinkData'])]; $resulti = $data[intval($_POST['prodImageURLData'])]; $resultj = $data[intval($_POST['prodPriceData'])]; $resultk = $_POST['prodCurrencyData']; $resultl = 1; if ($_POST['UrlPrefix'] == 'before'){ $resulth = $_POST['UrlPrefixText'].$resulth; } else if ($_POST['UrlPrefix'] == 'after') { $resulth = $resulth.$_POST['UrlPrefixText']; } // remove characters that may interfear with navigation or display include("includes/fixlist.inc.php"); $resultc = str_replace($andAmps, "and", $resultc); $resulte = str_replace($andAmps, "and", $resulte); $resultc = str_replace('\'', "", $resultc); $resulte = str_replace('\'', "", $resulte); $resultc = str_replace($allCharacters, " ", $resultc); $resulte = str_replace($allCharacters, " ", $resulte); $resultj = str_replace($currencyCharacters, " ", $resultj); // miss out headers row if ($row != 1) { // insert all the data into the database table $sql = "INSERT INTO affiliSt_products1 ( merchant, merchantProdID, prodCategory, prodName, prodBrand, prodDescription, prodPromoText, prodLink, prodImageURL, prodPrice, prodCurrency, prodDB ) VALUES ( '$resulta', '$resultb', '$resultc', '$resultd', '$resulte', '$resultf', '$resultg', '$resulth', '$resulti', '$resultj', '$resultk', '$resultl' )"; mysql_query($sql); } $row++; } // check if csvType exists and delete $result=mysql_query("SELECT * FROM affiliSt_config WHERE name='csvType1'", $databaseConnect) or die(mysql_error()); $test=mysql_fetch_assoc($result); if ($test['value']) { $sql= "DELETE FROM affiliSt_config WHERE name='csvURL1' or name='csvType1' or name='feedMemory1' or name='totalDBs'" ; mysql_query($sql, $databaseConnect) or die(mysql_error()); } if (isset($_POST['feedPath'])) { $handle = $_POST['feedPath']; $whichFeed = 'Upload Feed'; } else { $handle = $_POST['URLfeed']; $whichFeed = 'URL Feed'; } // create selection memory for admin refresh $insert = array ( array ( 'name' => 'feedMemory1', 'value' => $_POST['merchantData'].'-:-'.intval($_POST['merchantProdIDData']).'-:-'.intval($_POST['prodCategoryData']).'-:-'.intval($_POST['prodNameData']).'-:-'.intval($_POST['prodBrandData']).'-:-'.intval($_POST['prodDescriptionData']).'-:-'.intval($_POST['prodPromoTextData']).'-:-'.intval($_POST['prodLinkData']).'-:-'.intval($_POST['prodImageURLData']).'-:-'.intval($_POST['prodPriceData']).'-:-'.$_POST['prodCurrencyData'].'-:-'.$_POST['firstRow'].'-:-'.$_POST['UrlPrefix'].'-:-'.$_POST['UrlPrefixText'], 'comment' => 'Remembers which feed columns have been put into AffiliStore columns', 'title' => 'Feed Memory'), array ( 'name' => 'csvURL1', 'value' => str_replace("admin/", "", $handle), 'comment' => 'The link to your product feed', 'title' => $whichFeed), array ( 'name' => 'csvType1', 'value' => $_POST['typeFeed'], 'comment' => 'The format of the product field eg. comma seperated, tab etc.', 'title' => 'Product Feed Type'), array ( 'name' => 'totalDBs', 'value' => 1, 'comment' => 'The Total Product Databases', 'title' => 'Total Prod DBs') ); // insert values posted from Step 1 into config table foreach ($insert as $row) { $sql = "INSERT INTO affiliSt_config ( name, value, comment, title ) values ( '{$row['name']}', '{$row['value']}', '{$row['comment']}', '{$row['title']}' )"; mysql_query($sql, $databaseConnect) or die(mysql_error()); } // email details $asmail_email = mysql_query("SELECT * FROM affiliSt_config WHERE name = 'adEmail'"); $asmailEmail = mysql_fetch_assoc($asmail_email); $asmail_user = mysql_query("SELECT * FROM affiliSt_config WHERE name = 'adUsername'"); $asmailUser = mysql_fetch_assoc($asmail_user); $asmail_pass = mysql_query("SELECT * FROM affiliSt_config WHERE name = 'adPassword'"); $asmailPass = mysql_fetch_assoc($asmail_pass); $email = $asmailEmail['value']; $user = $asmailUser['value']; $pass = $asmailPass['value']; $emailaddress = $email; $subject = "Your AffiliStore Have Been Created"; $emailfrom = $email; $message .= "Here are your AffiliStore admin sign-in details: \n Username: $user \n Password: $pass \n Email: $email \n"; $runtime = (date("d M Y H:i")); $message .= "Time of the message: $runtime (server time zone)\n\n"; mail($emailaddress, $subject, $message, "From: '$emailfrom'"); } ?> Install AffiliStore - <?php // title swap if (!isset($_GET['step'])) { echo 'Step 1'; } else if ($_GET['step'] == 'Step2') { echo 'Step 2'; } else if ($_GET['step'] == 'Step3') { echo 'Step 3'; } else if ($_GET['step'] == 'CompleteInstallation') { echo 'Installation Complete'; } ?>

Welcome to AffiliStore Installation

'.$theError.''; } ?>
Install AffiliStore - Step 1 of 3

Enter your MySQL database details:

Create your personal details for your AffiliStore admin panel:

* Must be completed

Continue to
Install AffiliStore - Step 2 of 3
Or
Please change the file permissions to 777 for the following folder: admin/uploads/

This will allow AffiliStore to upload product feeds from you computer.

'); } else { ?>

(this may take a few seconds depending on the file size of the product feed)

'."\n"; echo "
Install AffiliStore - Step 3 of 3\n"; echo "

Please match the product feed columns with the AffiliStore database columns:

\n"; echo "\n"; echo "\n"; // show the data output on the php page //Get names of columns in table $field_names = array(); $res = mysql_query("SHOW COLUMNS FROM affiliSt_products1"); for($i=0; $i < mysql_num_rows($res); $i++){ array_push($field_names, mysql_result($res, $i)); } $totalCols = count($field_names); for ($ab=1; $ab < $totalCols-3; $ab++) { if ($field_names[$ab] == 'merchant') { $ascolname = 'Merchant Name'; } else if ($field_names[$ab] == 'merchantProdID') { $ascolname = 'Merchant Product ID'; } else if ($field_names[$ab] == 'prodCategory') { $ascolname = 'Product Category'; } else if ($field_names[$ab] == 'prodName') { $ascolname = 'Product Name'; } else if ($field_names[$ab] == 'prodBrand') { $ascolname = 'Product Brand'; } else if ($field_names[$ab] == 'prodDescription') { $ascolname = 'Product Description'; } else if ($field_names[$ab] == 'prodPromoText') { $ascolname = 'Promotional Text'; } else if ($field_names[$ab] == 'prodLink') { $ascolname = 'Affiliate Product Link'; } else if ($field_names[$ab] == 'prodImageURL') { $ascolname = 'Product Image URL'; } else if ($field_names[$ab] == 'prodPrice') { $ascolname = 'Product Price'; } if ($ab == 1) { echo ''; } else { echo ''; } echo ''."\n"; } echo ''; echo ''; echo '
Sample first row of data from product feed AffiliStore MySQL product table comumns
'; echo ''; echo '

Please note: you must try and match as many columns as possible for the website to be built correctly.


(this may take a few seconds depending on the file size of the product feed)'; if (!isset($_POST['theupload'])) { echo ''; echo ''; } else { echo ''; echo ''; } echo '
'; ?>
Install AffiliStore - Installation Complete

Congratulations

Please delete install.php and change the file permissions to 644 for the following file: includes/connect.php

You have now installed AffiliStore. Now view your website or visit the admin panel.

Ps. good luck with your affiliate sales!