Here is my code:
public function is_base_domain($url)
{
// set base domain
$base = $this->CI->core->config['base_url']; // http://www.mysite.com/
// match
if(preg_match('/$base/i', $url)){ return TRUE; }else{ return FALSE; }
}
thats sort of what im looking for although the code you gave me does not work. Basicly if a user is on my site (www.mysite.com) and they try to shorten my sites domain (www.mysite.com) instead of an external site then it will return false. The script will work similar to tinyurl
Hi,
I am making a small URL service for my website and want to check if the user is trying to shorten my sites domain name so i can stop this from happening. I am thinking I would need to use PHP's preg_match function but dont quite know how to check for the above.
Any help would be great on this.
Thanks
Hi,
I have built a captcha system that saves the captcha to a temp folder with the file name captcha_CURRENT_TIME_STAMP where CURRENT_TIME_STAMP is the unix time.
I want to delete images older than 5mins old by reading the time stamp on the file name. My question is this:
How can i loop through the image folder and read the time stamps on the file name and delete all images older than 5mins?
Thanks
Hi,
I have a site where users can choose languages they speak and they have the option to add more. They are selected from drop down boxes and have a level select box next to each. I am using jquery's clone function to do the job and all works fine apart from the fact that it clones the selected fields of the one above too..
My question is this: is there any way to remove the selected attribute from the cloned field?
My code is this:
$(document).ready(function() {
$("#lang_add").click(function() {
$("#lang_fields > p:first-child").clone(true).appendTo("#lang_fields");
return false;
});
$("#lang_fields #lang_remove").click(function() {
$(this).parent().remove();
});
$("#lang_remove").click(function() {
$(this).parent().remove();
});
});
yes it is... except i wanted the results as:
{"LANG1":["German","Beginner"],"LANG2":["Polish","Advanced"]}
I changed it as i thought it might get more complicated if not
that gives me:
{"lang":["german","polish","english","blaaaa"],"level":["2","4","1","3"]}
and i need:
{"german":"2","polish":"4", "english":"1","blaaaa":"3"}
well at the moment with 4 of each field selected i get:
Array
(
[lang] => Array
(
[0] => german
[1] => polish
[2] => english
[3] => blaaaa
)
[level] => Array
(
[0] => 2
[1] => 4
[2] => 1
[3] => 3
)
)
Sorry i should have said that i am already using this function but cant get the result i need. My code is this:
if(isset($_POST))
{
foreach($_POST as $key => $val)
{
echo json_encode(array($key => array($val['lang'], $val['level'])));
}
}
but it does not output the required:
{"LANG1":["German","Beginner"],"LANG2":["Polish","Advanced"]}
Hi,
I have two select boxes on my site like this:
Language - Level
and the user can keep adding more sets of select boxes. I need the data posted to be JSON encoded like this:
{"LANG1":["German","Beginner"],"LANG2":["Polish","Advanced"]} etc
How can i make this happen?
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.