Need help to resolve problem in general.php
#1
Posted 13 January 2012 - 08:12 PM
To work in new PHP 5.3 former code "ereg" needs to be changed to "preg-match".
Changed 2 of the three lines:
Here is the code:
if ($type == 'mixed') {
if (preg_match('^[a-z0-9]$', $char)) $rand_value .= $char;
} elseif ($type == 'chars') {
if (preg_match('^[a-z]$', $char)) $rand_value .= $char;
} elseif ($type == 'digits') {
if (eregi('^[0-9]$', $char)) $rand_value .= $char;
}
}
But when I change the 3rd one which is "eregi" with the extra "i" to "preg_match" which is suppose to be changed the same change as "ereg"
I get this error:
Warning: preg_match() [function.preg-match]: No ending delimiter '^' found in /includes/functions/general.php on line 1043
Appreciate any help to resolve this.
#2
Posted 13 January 2012 - 08:41 PM
If you want to see the mods I have installed, then see my profile.
#3
Posted 13 January 2012 - 08:43 PM
eregi becomes preg_match
If you want to see the mods I have installed, then see my profile.
#4
Posted 13 January 2012 - 08:49 PM
if (preg_match('/^[a-z0-9]$/i', $char)) $rand_value .= $char;
If you want to see the mods I have installed, then see my profile.
#5
Posted 13 January 2012 - 08:56 PM
if (preg_match('/^[a-z0-9]$/i', $char)) $rand_value .= $char;
} elseif ($type == 'chars') {
if (preg_match('/^[a-z]$/i', $char)) $rand_value .= $char;
} elseif ($type == 'digits') {
if (preg_match('/^[0-9]$/', $char)) $rand_value .= $char;
If you want to see the mods I have installed, then see my profile.
#6
Posted 13 January 2012 - 09:14 PM
Try the link below. It should help you out.
Click Me
Edited by bktrain, 13 January 2012 - 09:16 PM.
I have a problem for your solution
I reject your reality and substitute my own
My mind not only wanders, it sometimes leaves completely
The problem with the gene pool is that there is no lifeguard
Everyone’s entitled to my opinion
Links
Security
SSL Help
Basics for design
Basics for design V2.3+
How Do I ...?
#7
Posted 13 January 2012 - 09:55 PM
Mort-lemur, on 13 January 2012 - 08:56 PM, said:
if (preg_match('/^[a-z0-9]$/i', $char)) $rand_value .= $char;
} elseif ($type == 'chars') {
if (preg_match('/^[a-z]$/i', $char)) $rand_value .= $char;
} elseif ($type == 'digits') {
if (preg_match('/^[0-9]$/', $char)) $rand_value .= $char;
Thank youi so much Heather! That did it!
#8
Posted 13 January 2012 - 10:05 PM
If you want to see the mods I have installed, then see my profile.
#9
Posted 13 January 2012 - 10:07 PM
The error I get is: Warning: preg_replace() [function.preg-replace]: No ending delimiter '+' found in /includes/functions/general.php on line 61
Here is the code: $string = preg_replace(' +', ' ', trim($string));
I tried put a / in and around the ' +' but nothing worked so far.
#10
Posted 13 January 2012 - 10:12 PM
ecgbyme, on 13 January 2012 - 10:07 PM, said:
The error I get is: Warning: preg_replace() [function.preg-replace]: No ending delimiter '+' found in /includes/functions/general.php on line 61
Here is the code: $string = preg_replace(' +', ' ', trim($string));
I tried put a / in and around the ' +' but nothing worked so far.
Try
$string = preg_replace(' /+/', ' ', trim($string));
If you want to see the mods I have installed, then see my profile.
#11
Posted 13 January 2012 - 10:19 PM
If you want to see the mods I have installed, then see my profile.
#12
Posted 13 January 2012 - 10:20 PM
Mort-lemur, on 13 January 2012 - 10:12 PM, said:
$string = preg_replace(' /+/', ' ', trim($string));
Now the error changed still the same line: Warning: preg_replace() [function.preg-replace]: Compilation failed: nothing to repeat at offset 0 in /includes/functions/general.php on line 61
In the dark as to waht that may mean.
#13
Posted 13 January 2012 - 10:22 PM
function tep_sanitize_string($string) {
$string = preg_replace(' /+/', ' ', trim($string));
return preg_replace("/[<>]/", '_', $string);
}
#14
Posted 13 January 2012 - 10:24 PM
http://forums.oscommerce.com/topic/382628-osc-22rc2a-php-52-php-53-crisis/
A lot of what you are asking is covered
If you want to see the mods I have installed, then see my profile.
#15
Posted 13 January 2012 - 10:45 PM
I already downloaded and install the drop in update PHPs.
I have 2 stores and the one I did the drop in updates, I cannot load anything into the shopping cart at all, nothing appears, it remains empty.
I have no idea if these updates are the cause but the other store is getting close to processing. Items appear in the cart. So far the checkout does not
recognize me a s a customer. I'v went through and read your posts a page or 2 back.
I still have this error: as in my last post: Warning: preg_replace() [function.preg-replace]: Compilation failed: nothing to repeat at offset 0 in /includes/functions/general.php on line 61
Appreciate any help
#16 ONLINE
Posted 13 January 2012 - 10:55 PM
If you replaced entire files, any changes already made will be lost and things will stop working.
Restore the files and just change the lines that need to be replaced.
HTH
G
Virus Threat Scanner
My Contributions
Basic install answers.
Click here for Contributions / Add Ons.
UK your site.
Site Move.
Basic design info.
For links mentioned in old answers that are no longer here follow this link Useful Threads.
If this post was useful, click the Like This button over there ======>>>>>.
#17
Posted 13 January 2012 - 11:00 PM
Use the Read Me section of the contribution and do the changes line by line
If you want to see the mods I have installed, then see my profile.
#18
Posted 13 January 2012 - 11:26 PM
Now I'm unable to add anything to the cart just as in the other store.
Any ideas as what to do would be appreciated!
#19 ONLINE
Posted 13 January 2012 - 11:48 PM
geoffreywalton, on 13 January 2012 - 10:55 PM, said:
If you replaced entire files, any changes already made will be lost and things will stop working.
Restore the files and just change the lines that need to be replaced.
Restore the files to the state before you dropped in the files, ifthat makes sense
G
Virus Threat Scanner
My Contributions
Basic install answers.
Click here for Contributions / Add Ons.
UK your site.
Site Move.
Basic design info.
For links mentioned in old answers that are no longer here follow this link Useful Threads.
If this post was useful, click the Like This button over there ======>>>>>.
#20
Posted 14 January 2012 - 12:28 AM
geoffreywalton, on 13 January 2012 - 11:48 PM, said:
G
Hi Geoffery
I never dropped the files into the 2nd store as a precaution to see what would happen. The cart was working until I changed the one line:
Warning: preg_replace() [function.preg-replace]: Compilation failed: nothing to repeat at offset 0 in /includes/functions/general.php on line 61
I only changed 1 line copied out of the update general.php file and lost my cart ability to put products in it.
Could admin files have anything to do with it as I don't think I've edited any of those yet.









