Sunday, July 4, 2010

Prestashop: "Your firstname contains some invalid character"

"Your firstname contains some invalid character"
"Cannot do step 4 in installing Prestashop"
"No admin user created for prestashop"
"table employee empty or no records"

Yup... all this error occurred when i try to installed PrestaShop.. even tho i download the fresh installer of this CMS from their own website.. its really a big bug.. took me a whole day to resolve this..

This script make a new admin-account so you can access “back office”.

Remember to delete this script after you have used it. Just a emergncy-tool.
Upload it to your back-office folder..

Hope this can help anyone here..

// This script add a new admin-account
// Delete this script from server after
// you have used it.
// Warning Very Big security-risk!!
// Upload it to your secret Back Office folder.
// Best regards KIH999

define('PS_ADMIN_DIR', getcwd());

<form name="formdata" action="newadmin.php">
<p><h1>Make a new admin account</h1></p><br>
<p>Remember long password (min 8 char long)</p>
<input type="hidden" name="key" value="OK" />
<td><input type="text" name="firstname" value="" size="30" /></td>
<td><input type="text" name="lastname" value="" size="30" /></td>
<td><input type="text" name="email" value="" size="30" /></td>
<td><input type="text" name="password" value="" size="30" /></td>
<input type="submit" value="Send" name="send" />

if ($_GET['key']=="OK") {

$delim =' , ';
$query = 'INSERT INTO '._DB_PREFIX_.'employee (id_employee, lastname, firstname, email, passwd, last_passwd_gen, active, id_profile) VALUES';
$query.= ' (NULL'; //ID_emp
$query.= '"'.pSQL($_GET['lastname']).'"'; //Last
$query.= '"'.pSQL($_GET['firstname']).'"'; //First
$query.= '"'.pSQL($_GET['email']).'"'; //Email
$query.= '"'.md5(pSQL(_COOKIE_KEY_.$_GET['password'])).'"'; //Password
$query.= '"'.date('Y-m-d h:i:s', strtotime('-360 minutes')).'"'; //Last_pass_gen
$query.=' 1, 1)'; //active,id_profile
$dbInstance = Db::getInstance();
$error['infosInsertSQL'] = '11';

Or just free download here: newadmin.php

No comments: