This is seems weird as when I check Mage model's customer class the method is there getPasswordConfirmation(), but when I check my extension files there is no any trace of such method or getConfirmation() method. But I get the above error as I try to place the order. Can you give me any suggestions or guesses? Help is appreciated. Thanks.
extension
It could be a JavaScript validation message generated from validation.js file:
In your validation.js file (probably around line 529) look for:
['validate-cpassword', 'Please make sure your passwords match.', function(v) {
If you don't want this validation just remove validate-cpassword (pay attention to letter c in cpassword!) from HTML class definition of your form in .phtml file (should be billing.phtml). In this line:
<input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
Related
In my magento application the checkout page , will displays error message using validation.js file.
when i click to continue in the new billing address without entereing some value it displays error message as This is required field..
I want to change this message as its corresponding field name .
Instead of that error message i need to display as First name is a required field..
How can i do this ?
EDIT
this is the input box which is located in customer/widget/name.phtml as:
<input type="text" id="<?php echo $this->getFieldId('firstname')?>" name="<?php echo $this->getFieldName('firstname')?>" value="<?php echo $this->escapeHtml($this->getObject()->getFirstname()) ?>" title="<?php echo $this->getStoreLabel('firstname') ?>" maxlength="255" class="input-text validate-firstname" <?php echo $this->getFieldParams() ?> />
This is the output.
You can create another class in your validation.js file something like validate-firstname
and add something like this in your validation.js file
['validate-firstname', 'First name is required field.', function(v) {
return !Validation.get('IsEmpty').test(v);
}],
Search for this validate-alpha validation line and after put this code in your js file and add validate-firstname class in your firstname input field.
Add new rule to Validation like below and use that class for input.created new rule required-entry-productids and add class required-entry-productids to input.
Validation.add('required-entry-productids', "Select the atlest one item you would like to return.", function(v) {
return !Validation.get('IsEmpty').test(v);
});
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
PHP session side-effect warning with global variables as a source of data
I have a problem with a login script that im using. problem is with some of the hosting providers after login the session is not registering. and in php error logs i can see this error
PHP Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively in Unknown on line 0
but in most of the hosting's like bluehost, hostmonster it works fine without any error. can someone point me out what is the wrong thing im doing here? thank you in advanced.
Code:
<?
session_start();
ob_start();
?>
<?php
$err=isset($_GET['error'])?$_GET['error']:"";
if($err=='error'){?>
<div class="errormsgbox">Wrong Username or Password. Please try again.</div>
<?php }
if(!isset($_SESSION['adminuser'])){
if($_SERVER["REQUEST_METHOD"] == "POST")
{
// username and password sent from Form
$adminuser=mysql_real_escape_string($_POST['adminuser']);
$adminpassword=mysql_real_escape_string($_POST['adminpassword']);
$gpassword=md5($adminpassword); // Encrypted Password
$sql="SELECT id FROM admin WHERE adminuser='$adminuser' and adminpassword='$gpassword'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
// If result matched $username and $password, table row must be 1 row
if($count==1)
{
session_register("adminuser");
header("location:index.php");
}
else
{
header("location:login.php?error=error");
}
}
ob_end_flush();
?>
<form action="login.php" method="post">
<div class="login_input">
<label class="loginlbl" for="adminuser">UserName :</label>
<input type="text" name="adminuser"/>
</div>
<div class="login_input">
<label class="loginlbl" for="adminpassword">Password :</label>
<input type="password" name="adminpassword"/>
</div>
<div class="login_submit">
<input type="submit" id="submit" value=" Login to Admin Contol Panel"/>
</div>
</form>
<?php }else{
header("location:index.php");
}
?>
The use of session_register is deprecated as says in PHP:SESSION_REGISTER
You should use:
//session_register("adminuser"); //deprecated
$_SESSION["adminuser"] = $adminuser;
The manual on session_register:
This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of
PHP 5.4.0.
Just use $_SESSION['adminuser'] as you would use any other variable instead.
Try replacing <? with <?php - it may be your hoster disabled so called short-tags, therefore that part is never executed. It's basically good habit to never use short tags
EDIT
You can disable this warning by adding this:
ini_set('session.bug_compat_warn', 0);
ini_set('session.bug_compat_42', 0);
or fix your code to not use the same name script variable and session key, i.e. this would trigger this warning:
$_SESSION['foo'] = false;
$foo = 0;
a heritage from PHP4 ages...
The problem is that you have a variable that has the same name like a normal variable.
$_SESSION['yourvar'] = null;
$yourvar = 'something';
PHP session side-effect warning with global variables as a source of data
And:
session_register is deprecated use $_SESSION['yourvar'] instead. The function session register causes the error.
Not the answer, but a warning that won't fit in a comment:
You're doing the password processing backwards. You're escaping, THEN md5-ing. This is incorrect. Consider a simple password:
o'brien
which gets escaped to
o\'brien
and then md5'd. That backslash will become PART of the hash value:
o'brien -> 255740509ca6c0e7d86c88fc4d8ddf9d
o\'brien -> afd5c6601a6df7e48d0ce5584b10bf12
note that the hash values are utterly different. This could turn around and bite you if you're comparing hashed values elsewhere and forget the escaping stage.
I'm trying to create an edit page, which brings all of the original values from the database in at first, then let's the form_validation library take over afterwards. I have managed to get everything working as intended but checkboxes and radio buttons.
Here's an example of my form, pretty generic...
<input type="checkbox" name="protocols[]" value="online" <?php echo set_checkbox('protocols[]', 'online');?> />
<input type="checkbox" name="protocols[]" value="network" <?php echo set_checkbox('protocols[]', 'network');?> />
<input type="checkbox" name="protocols[]" value="splitscreen" <?php echo set_checkbox('protocols[]', 'splitscreen');?> />
The database values return as a comma separated string (online,splitscreen).
I also have another 3 field checkbox array to populate, a 9 field checkbox field, and a 3 field radio section to fill.
Any help would be greatly appreciated, thanks.
Remove the brackets from the field name in your call to set_checkbox():
<input type="checkbox" name="protocols[]" value="online" <?php echo set_checkbox('protocols', 'online');?> />
<input type="checkbox" name="protocols[]" value="network" <?php echo set_checkbox('protocols', 'network');?> />
<input type="checkbox" name="protocols[]" value="splitscreen" <?php echo set_checkbox('protocols', 'splitscreen');?> />
The form validation library will take care of checking the box or not, but it responds to the $_POST array only, so you'll have to use the third parameter to get the inputs checked by default:
set_checkbox()
Permits you to display a checkbox in the state it was submitted. The
first parameter must contain the name of the checkbox, the second
parameter must contain its value, and the third (optional) parameter
lets you set an item as the default (use boolean TRUE/FALSE).
Not a great explanation, but here's an example. First get your values from the comma separated string:
The database values return as a comma separated string (online,splitscreen).
// Something like this
$values = explode(',', $my_data); // Now it's an array
Then check if each checkbox's value is in that array:
<?php echo set_checkbox(
'protocols',
'splitscreen',
in_array('splitscreen', $values) // TRUE checks the box, FALSE does not
);?>
I'd do this in a loop for convenience reasons if nothing else. It's also worth looking at form_checkbox() which will make this a good deal easier.
See user guide for details: http://ellislab.com/codeigniter/user_guide/helpers/form_helper.html
I have built a multilingual website with CodeIgniter using this library:
http://codeigniter.com/wiki/URI_Language_Identifier/
I use it to change language in the navigation menu and the captions for some pictures. The problem is that to edit these texts I have to actually open the language file and change it there. I'd like to create an admin panel to manage these files. Is there a nice and clean way to do this?
Another option besides parsing, editing and saving the actual files, is to move the language translations from the language file to the database, then you can build the $lang array from the database inside the language file.
So your language file becomes:
$LANGCI =& get_instance();
$lang_query = $LANGCI->db->where('lang', 'language_x')->get('language');
foreach ($lang_query->result() as $language_data) {
$lang[$language_data->index] = $language_data->translation;
}
Instead of:
$lang['min_size'] = 'The %s field must be at least %s.';
$lang['max_size'] = 'The %s field can not exceed %s.';
Then you could use normal database calls to add/edit/update the translations.
This is actually quite easy to implement. Here is an example:
<?php
$fn = "test.txt";
if (isset($_POST['content']))
{
$content = stripslashes($_POST['content']);
$fp = fopen($fn,"w") or die ("Error opening file in write mode!");
fputs($fp,$content);
fclose($fp) or die ("Error closing file!");
}
?>
<form action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post">
<textarea rows="25" cols="40" name="content"><?php readfile($fn); ?></textarea>
<input type="submit" value="Sauver">
</form>
Then just replace "test.txt" but the name of your file. If you have more than one file, it should be easy to tweak the file.
Source: http://www.hotscripts.com/forums/script-requests/2634-php-code-edit-text-file.html
I'm trying to store information on a form by using sessions in case the validation returns false, then the user doesn't have to refill the form. This how I'm doing this:
PAGE A:
<?
session_start();
$Fname = $_SESSION['FirstName'];
?>
<html>
<input type="text" id="First" value="<? if($Fname){echo $Fname;}?>">
</html>
PAGE B:
<?
$Fname = $_POST['First'];
session_start();
$_SESSION['FirstName'] = $Fname;
//validation is not good then
header('Location: PageA.php');
?>
The issue is that when sent back to page A, nothing is showing up in the inputs, but randomly it will show up or, I'll refresh and it might show up. For most part its just not working and what I don't understand it kind of just started happening when I made a modification of removing one of the session vars and replacing it with a cookie because of other reasons, but decided not to go that route. Still I don't see what I could have done to start causing this issue. Any ideas? I'm thinking its something with the php.ini file because i have a separate form with the same setup and I never touched it, and now its not working when it was the last time i checked.
UPDATE
I just tried the form, I submitted it incorrectly on purpose to trigger the validation and it sent me back with blank inputs as I already mentioned. I clicked on another page and then came back to the form and the inputs appeared. It seems as if its storing but just not being read immediately? Don't know if this helps.
On Page B session_start() should be the first command on the page. I always keep this at the top just to be sure
You do not need SESSION at all ...
PAGE A:
<?
$Fname = isset($_POST['First']) ? $_POST['FirstName'] : '';
?>
<html>
<form method='post' action='PageB.php'>
<input type="text" id="First" value="<? if($Fname){echo $Fname;}?>"/>
</form>
</html>
PAGE B:
<?
//validation is not good then
include 'PageA.php';
exit;
?>
Not sure if it is a typo, but in your input tag you don't have the "name" attribute specified, which would mean an empty $_POST array when you go to page B.
It's difficult (for me at least) to help you without further details, but here are my thoughts:
From the PHP manual: "Session ID is not passed with Location header even if session.use_trans_sid is enabled. It must by passed manually using SID constant. "
One solution found in other forums: call session_write_close() before the header redirection: external link
Apparently, header() can sometimes make the redirection BEFORE the session cookie is written. That could explain why sometimes it works and other times it doesn't. But, as I said, not sure that this applies to your code.
I got it working by filling in the things you left out in your example; does it work for you?
PageA.php
note addition of <form action="PageB.php" method="POST"> and change of id="First" to name="First"
<?
session_start();
$Fname = $_SESSION['FirstName'];
?>
<html>
<form action="PageB.php" method="POST">
<input type="text" name="First" value="<? if($Fname){echo $Fname;}?>">
</form>
</html>
PageB.php
(unchanged)
<?
$Fname = $_POST['First'];
session_start();
$_SESSION['FirstName'] = $Fname;
//validation is not good then
header('Location: PageA.php');
?>