I recently installed Grocery CRUD to manage my site. The site is written in php and using mariadb to store the content.
I have also activated the CKeditor.
Everything works well and i can write an article and "upload" this to my DB.
In the articles i often want to link to another sites, this should be straight forward, but its not.
When the article is displayed on my website, the URL format is wrong, relative??
Example:
Inputs https://www.test.com
Expect to see https://www.test.com as a clickable link.
This is the result now when looking at the code: https://www.test.com
When hoovering over the link i see https://www.my_domain.com/"https://www.test.com/
I am used to correct this in some situations by adding https://, but this doesnt work in this case.
Im not sure where the error/mistake can be found.
Is it the DB that needs some adjustment, is it the CRUD software and particularly the CKeditor that generates this?
Maybe some PHP issue somewhere?
I need some advice/help on this please.
Does anyone have an idea on how to fix this?
Too many quotes:
https://www.test.com
The pair of \" is an escaped quotes, as if it is inside some other pair of ". The plain pair of " are ok, too. HTML needs either pair, not both. MariaDB does not care, it is just a string.
MariaDB will not cause that to happen. However, the code that does the INSERT may be screwed up. Let's see that code in Grocery.
Related
I just transferred a website from their previous host to hosting with me. Obviously, I had to change some of the links that pointed to the images to make them display correctly. Unfortunately, it's a huge mess. There were some links described in the mysql database, but i got into MySQL and replaced all of those with the correct link. Originally, it linked to
http://localhost/...
I now need it to link to
http://[subdomain].[website].net/
I've gone through every line of code i could find with fgrep in linux and i can't find where it's inserting localhost. Any ideas where localhost could be stored, if not in the database (as far as i can tell) and not in the physical code? I'm assuming it's a PHP variable somewhere. I'm not sure which, but i already made sure that
<?php echo get_template_directory_uri(); ?>
was set to the correct uri. Any help would be greatly appreciated. thank you.
EDIT
I tried to replace the database information correctly from a clean copy of the database. I used the serialize php script and it didn't work. the images are still not showing up and they're still routing back to
http://localhost
I'm not sure what to do about it. Any more suggestions?
1) Check page source and see exactly where the image URLs point to. Some missing image links may be hardcoded to point to the theme folder or other locations.
2) Did you also move /wp-content/uploads?
3) Dumping the database and doing a find/replace with a text editor will break URLs that are in serialized data. You have to use a tool to correctly deserialize/re-serialize data. See interconnectit.com WordPress Serialized PHP Search Replace Tool
If you're sure that you replaced every occurrence of localhost in the database, then the most likely next culprit is the browser cache, so I recommend you to delete the cache of your browser just to be sure, as this depends on your browser search for the appropriate method, but, for example, on Internet Explorer open the Developer Tools (F12) and go to Cache->Erase cache for this domain.
Ok, so my company has a client that has an interface for posting content - standard MySQL database, PHP-based, etc.
Anyway, they've continually had an intern or someone, post content to this interface straight from an MS Word doc - the interface is coded poorly, and takes this input as is, with no formatting.
My company has now been contracted out to fix this particular problem, as it is continually breaking their site, and my company has repeatedly had to manually go into the database, and delete the offending values.
Is there a quick and easy way to do this, or am I going to have to just do a replace operation on each offending character?
I see htmlentities() may be a partial solution - but as far as I know, that won't remove everything.
What's a good solution to this problem? Is there anything out there to make this easier?
We're also considering writing a content validator as well, probably just server-side (though maybe client-side, if my week is going slowly enough/I finish the rest of this quickly enough).
It depends on how many clients (or potential clients) you are supporting and how much time you have to invest. Options
Write your own function to strip out the metadata
Teach your clients to remove it themselves such as paste in notepad first,
or supply a knowledge base article to explain how to do it in the software. Perhaps a "Help" section or icon they can click on.
htttp://support.microsoft.com/default.aspx?scid=kb;en-us;223396
Use a WYSIWYG editor such as TinyMCE which has built in functionality to remove it
But like I said in the comments, unless you are using your own function, prepare for clients to continue to paste directly and wonder why there is a problem.
I have a PHP site, on an Apache 2.2 server, with MySQL.
It has its own virtual host at:
www.mybusinesssite1.localhost
I've got some basic content extracted from MySQL in the PHP; no issues so far with that.
What I am trying to do is to get URLs like this with query strings:
http://www.chevrolet.com.pk/index.php?option=com_content&task=view&id=48
Notice how that has option=com_content, task, view etc. - and that's what I'm trying to emulate on my development/sandbox site.
I've forgotten how to do query strings, because I've been busy learning .htaccess and PHP template coding, what would I need to do to achieve this effect?
I've had a look online but am not quite sure how to do this, or the best way to progress on this without breaking my site; since my site is going to be moved from localhost to a live server, I don't want it to be broken on launch.
As Daniel mentioned, all the URL query strings are in the $_GET super global array. Just issue this to see the structure:
print_r($_GET);
If you have url text strings that you want to parse as if they were real URLs, use parse_str();
I'm having a problem with my autocomplete. It works on another one of my pages, but on this one, it doesn't work. It's returning the correct number of entries, but they are all "blank" (or at least black so I can't see it), and selecting one does not put it into the text field either.
I'm using this: http://papermashup.com/jquery-php-ajax-autosuggest/
My page right now looks like
Any suggestions?
Thanks!
I'd post my code, but it's pretty much exactly what's on the site linked above, with some variables changed, and embedded into a PHP. Let me know if you want to see it (I don't want to paste it here and make the page huge and fugly).
Oh and this is taking it from a column in a MySQL database.
I think this link is quite useful to understand the technique. After you got the AJAX technique, you may simply change your php files which can run sql queries etc. You may show the results in that way with a simple div, very trivial css implementation would be enough. I think the hardest part is solved here:
http://www.w3schools.com/ajax/ajax_aspphp.asp
maybe your problem lies within encoding, jquery needs utf8 in the default settings, but without any code, I can only speculate...
try utf8_encode($output) instead of only returning the output...
also maybe your ajax request awaits a specific datastructure (json/xml/ etc)
I have a security issue on one of my websites and I am quite unsure how to prevent this, as I never had a similar problem. I have a php driven webpage, and over night someone somehow managed to paste
<iframe src="http://<webaddress>.com/" width="1" height="1" frameborder="0"></iframe>
right after the body tag into the php (!) file.
What would make something like that possible? And how do I prevent this?
Thanks for any help!
Maenny
Many times this is the result of your FTP credentials being stolen. Change them, remove the malicious code, and try to always connect to your server over a secure connection. This is a common attack in joomla, wordpress and other popular CMSs; and it's usual to have many files (all your index.php files for example) attacked.
We've been seeing many plugins, extensions, etc. being used as the point of entry to a website.
Hackers are constantly trying to hide their "wares" so they may not infect all of your index files, just a few to try and "fly under the radar".
As far as removing that line, it's probably not going to look like what you see in the "view source" of your browser. It's going to be obfuscated (coded).
Without knowing your website or what you're running on there, ie., WordPress, Joomla, etc. it's difficult to tell you where to look for the obfuscated code, however, you might look in header.php files or whatever file is generating the code for your body tag. You might see script tags right after the body tag and you may have to scroll all the way to the end of the line with the body tag in order to see the malscript. Hackers like to do add lots of extra spaces to try and hide their malscript.
Then you'll have to see what files have been added to your site. Or, if you have a good backup, you might want to delete all the files on your site and restore them from backup. That might be the only way to find any backdoors. Backdoors are files hackers use to upload some of their other infected files. They can be PHP or Perl.
Last, you'll have to determine how it happened. Do you have access to your access logs? If so, scan them. Look for strings that don't look right. Sometimes you might search the logs for the string, "base64_decode" as hackers like to use that at times to upload their malicious code.
Keep all software: WordPress, Joomla, Drupal, Zen Cart, osCommerce, etc. updated at all times. Also keep any add-ons, etc. updated as well.