View Single Post
  #8  
Old 01-19-2006, 11:25 AM
 
HawkCode HawkCode is offline
 

Advanced Member
  
Join Date: Jan 2006
Posts: 30
 

Default

Alright I need help.

Firest Here is my import script:

Code:
function execute () { //Only included file really needed would be "include/func.php", but the following is done because func.php can't be just simply included include $xcart_dir."include/func.php"; @include_once "top.inc.php"; //include_once $xcart_dir."/config.php"; //include $xcart_dir.DIR_CUSTOMER."/referer.php"; // this seens to not be needed //Database details $sql_hostname = 'localhost'; $sql_user = 'user; $sql_password = 'password'; $mambo_database_name = 'dbname'; $mambodb = mysql_connect($sql_hostname, $sql_user, $sql_password) or die ('Connection not possible : ' . mysql_error()); echo" ----------------------------------- "; echo" Connected to the database in" ; echo" ------------------------------------ "; print(" $sql_hostname"); mysql_select_db($mambo_database_name, $mambodb) or die ('Can not find database ' .$mambo_database_name . ': ' . mysql_error()); import_passwords(); } function import_passwords () { $path_to_csv = 'impxcart.csv'; $csv_delimiter = ","; echo "<table border=\"1\" width=\"500\">\n"; $count = 0; echo "About to open:".$path_to_csv; $handle = fopen ($path_to_csv,"r"); $Cnt = 0; $CharsToRemove = array(" ", "-", "'", "."); while (($data = fgetcsv ($handle, 1000, $csv_delimiter)) !== FALSE) { $login = mysql_escape_string($data[0]); str_replace($CharsToRemove, "", $login); $usertype = $data[1]; $Membership = mysql_escape_string($data[2]); $Password = addslashes(text_crypt($data[3])); $b_address = mysql_escape_string($data[4]); $b_city = mysql_escape_string($data[5]); $b_state = mysql_escape_string($data[6]); $b_zipcode = mysql_escape_string($data[7]); $Title = mysql_escape_string($data[8]); $FirstName = mysql_escape_string($data[9]); $LastName = mysql_escape_string($data[10]); $company = mysql_escape_string($data[11]); $s_address = mysql_escape_string($data[12]); $s_city = mysql_escape_string($data[13]); $s_state = mysql_escape_string($data[14]); $s_zipcode = mysql_escape_string($data[15]); $EMail = mysql_escape_string($data[16]); $Phone = mysql_escape_string($data[17]); $Fax = mysql_escape_string($data[18]); $count++; mysql_query("INSERT INTO xcart_customers(login, usertype, Membership, Password, b_address, b_city, b_state, b_zipcode, Title, FirstName, LastName, company, s_address, s_city, s_state, s_zipcode, EMail, Phone, Fax) VALUES('$login', '$usertype', '$Membership', '$Password', '$b_address', '$b_city', '$b_state', '$b_zipcode', '$Title', '$FirstName', '$LastName', '$company', '$s_address', '$s_city', '$s_state', '$s_zipcode', '$EMail', '$Phone', '$Fax')") or die(" Error doing insert:".mysql_error()); echo "<tr><td>$login</td><td>$data[0]</td><td>$LastName</td><td>$FirstName</td></tr>\n"; } echo "</table>\n"; echo "<h3>finished</h3>"; //this is more usefull than it looks fclose($handle); mysql_close($mambodb); }

I inserted this in user_modify.php right after the

Code:
require "./auth.php"; require $xcart_dir."/include/security.php"; define('USER_MODIFY', 1);

I uploaded my csv to same admin directory

then created a file to call the execute called RunImport.php

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <?php include 'user_modify.php'; execute(); ?> </body> </html>

Now when I load RunImport.php I get this error from xcart:

Warning: Smarty error: unable to read resource: "partner/main/register.tpl" in /var/www/aspe.org/htdocs/xcart/Smarty-2.6.9/Smarty.class.php on line 1088

This is displayed on the Admin screen.

I did put it all in 1 file and it ran fine, however it didn't put the correct password in, same problem you originally had.

Any help would be appreciated.

TIA[/code]
__________________
xCart Version 4.0.17

Richard S Albrecht
Reply With Quote