How do I resolve link problems mask PHP /"////"//"/" - php

I have a website, using tiny_mce backoffice.
My website works well on my server, but I have to change the host server and suddenly I see this problem:
For example:
If I want to save text with links, for wikipedia.org for example... And I save on backoffice (with open new window propertie _target)
-Then in website interface, I click on wikipedia text link
and and instead of opening a new window, I have somethinfg like this :
mysite.com//"//"////"http://wikipedia.org/"////"//"/"
Is that normal?
Last server never happen that
And in this new server he creates somethink like a mask
anyone knows how to resolve that?
thanks
best regards

You should use stripslashes();
http://php.net/manual/en/function.stripslashes.php
EXAMPLE
<textarea class="tiny_mce"><?php echo stripslashes(); ?></textarea>

Related

url does not work on server but does on localhost

I got a problem with my page loader, I have a "buttons" function that I have placed in my pagebanner controller (pagebanner.php). It looks like this:
<?php
if(isset($buttons)){
foreach($buttons as $button) {
echo "<a href='$button[1]' class='w3-btn w3-dark-gray w3-margin-
left'>$button[0]</a>";
}
}
?>
When I am making a new file, I require the pagebanner.php So i can make buttons in the new file, Like this:
$buttons = Array(
['Inplannen', '/?page=onderhoudInplannen&kid='.$_GET['kid']
.'&id='.$row['id']],
['Afboeken', '/?page=onderhoudAfboeken&kid='.$_GET['kid']
.'&id='.$row['id']],
);
But the problem is, that it doesn't lead me to that particular page, but I leads my to my default page where I go when the program doesn't recognize the page name. In my url bar it will show me the good url with the good id's but it just doesn't go to the page.
The first link doesn't work, it is on my server:
Link: 192.168.1.9:8000/?page=onderhoudAfboeken&kid=18&id=217
But the second link does work and it is on my localhost:
Link: http://localhost:8000/?page=onderhoudAfboeken&kid=18&id=217
I want the link to work on my server. How can i solve this?
Thanks,
Check if your server isn't a Linux machine, if it is a Linux machine you have to make all your URL's lowercase. Otherwise your Linux server won't find them.

Typo3 getTypoLink_URL creates wrong link after language change

I hope I can manage to explain this problem...
I have an T3-extension that handles shared content.
In this shared content, we have links (page-ids) that are defined and converted into something like /en/clients/contact, using
$cObj = t3lib_div::makeInstance('tslib_cObj');
$href = $cObj->getTypoLink_URL($linkValue); // $linkValue is an integer (e.g. 153)
This works fine - until I change the language on the page. Then, the last used URL kinda «sticks» and the language indicator isn't present in the URL anymore.
Means:
call the german page -> works
change to english -> works
change back to german -> the english link is presented.
So the above link turns out like clients/contact (the leading slash is gone as well).
Oddly enough, I have a local installation of the same page where the problem doesn't occur. It's just on the page that's online.
I tried to find differences in the configuration, but there aren't any.
The only difference I could find so far is, that I use Typo3 v4.5.35 for the local installation and v4.7.17 for the online installation.
Any ideas???
This was very odd... but, I found a solution.
Instead of using $cObj->getTypoLink_URL($linkValue); I'm using this:
$configurations['additionalParams'] = "&L=".(int)t3lib_div::_GP('L');
$configurations['returnLast'] = 'url'; // get it as URL
$configurations['parameter'] = $linkValue;
$href = $cObject->typolink(NULL, $configurations);
It seems that when I created the $cObj, the L-Parameter got lost somewhere, somewhen. By adding it manually, the Link works as expected.

php read webpage after all processing are done

I dont know how to explain my need, and neither which key words to use to find a solution on google, so i'll give an url to be more clear:
check an IP (click on: Check your current IP address)
I'ld like, by using this website for example, getting somes informations after all the processus are terminated.
I tried with "file_get_contents" and with "cURL functions" but i did not find a way to do it, i always get the original source code.
Any idea ?
EDIT:
<body onLoad="setTimeout('get_my_blacklist()', 60000)">
...
...
<?php
echo '<iframe id="my_iframe" src="http://multirbl.valli.org/lookup/'.$ip.'.html">';
?>
...
...
<script>
function get_my_blacklist()
{
//function to get the content after somes secondes.
}
</script>
Here is the new code i tried thank to #Ludovic for is iframe idea.
Still working on it, i'll tell you if its working or not to solve my issue.
Edit2: Whatever how i try, i didnt find a way to get the containt of my frame window.. And even if i'ld succeed, i dont know how i can update my database if do it with JQuery/Javascript
First the page should have been construct by server script like PHP, at this step you have all IP requested then the page is modified by JQuery script who seems to query each IP.
The second step is an asynchronous script so you can't know when the page is effectively finished to construct.

Changing a link to a redirect page php

How do i change a url in a string example :
This is a link http://google.com.au
To something like this
This a warning page link http://google.com.au
EDIT:
What i'm trying to do is take a description entered by the end user, They might enter links in the description, i want to change all the links to make them GOTO a warning page, the warning page is ./warn.php?site=link
The string might look like this
This is a awesome description Google and this another link Google images
Ok here's what i tried:
$descc = mysql_real_escape_string($_POST['description']);
$descc = preg_replace('"\b(http://\S+)"', '$1', $descc);
Check this, although im not sure if you are really refering to this, just let me know the case then ---
$mylink = "http://google.com.au";
This a warning page link http://google.com.au
EDIT version 1.0
Even it is on description box data you can fetch it via jquery or php like
$mylink = $_GET['desc_name_data'];
Please be more specific with the problem :)
EDIT Version 1.1
Check this and let me know then --
echo preg_replace('(<a href="http://\S+)', '<a href="./warn.php?site='.'google.com.au'.'">google.com.au', $descc);
I'm not sure I understand your question, but urlencode may help.
http://google.com.au
If this isn't it, then please be a bit more specific with what you're trying to achieve and what you have tried.
EDIT:
Ok, you could try a HTML parser to extract the href from the link, then rewrite appropriately. This is likely to be more reliable that a regex.
You should still add urlencode if you're passing a url as a querystring.
You could have a look at preg_replace().

php POST can't handle <img src="http://

I'm creating a form where the user should be able to enter any text (used to change articles on the site), Html, JavaScript or literally anything is allowed to type in and post, and so far everything worked. But today I suddenly got this strange error.
When I try to save text with Html to a MySQL database like this:
google
nothing goes wrong, but when I try it like this:
<img src="http://www.google.com/" />
The page does not load (forbidden error) and the database does not contain any of the text is should contain (the Html).
Instead the page shows the following error:
Forbidden
You do not have permission to access this document.
The same problem occurs when I try to post the following data:
src="http:
Why do I get a forbidden error when the post contains that specific piece of text, whats going on here?
Code I'm using:
if($_SERVER['REQUEST_METHOD']=="POST" && !empty($_POST['save'])){
$text = mysql_real_escape_string($_POST['textarea']);
$title = mysql_real_escape_string($_POST['title']);
$query = "INSERT INTO articles (text, title) VALUES ('".$text."','".$title."')";
When I remove the MySQL query I still get the error so it has nothing to do with the database. PHP safe mode is on, could that make a difference?
How can this be fixed?
Edit: Tried the complete application on my xampp server and it did not show the error, but on my hosting server I use the script in a password protected map. could that be the problem? Anyway I'm going to contact my hosting company.
It sounds a bit like mod_security, switched on and in its most aggressive mode, and it thinks you're trying to hack the site. The reason I say it only sounds a bit like that is because no-one should normally configure it to check POST data because that causes far too many false positives. But check the error log(s) as it will probably be listed there if it's that. If so you'll need to turn it off in the hosting settings or nag your host to do it.
Also try a bare minimum script: <?php var_dump($GLOBALS); ?> to see if the data reaches PHP at all.
try:
if($_POST && !empty($_POST['save'])){
$text = mysql_real_escape_string(htmlentities($_POST['textarea']));
$title = mysql_real_escape_string(htmlentities($_POST['title']));
Send this into your db
<a href=www.google.com>Google</a>
or
When called from db
echo "http://".$row_TabelName['RowName'];
It should solve your issue.
if you wish to use the following
base64encode() and insert ,after read base64decode()

Categories