
doa24uk
Members-
Posts
102 -
Joined
-
Last visited
Never
Everything posted by doa24uk
-
Awesome guys! @roopurt - that did the trick once I stopped being an idiot & actually looked at the code you'd provided @Wolfrage - thank you for all your help, pity roopurt pipped you to the prize but we (by that I mean you) would have got there soon enough! This is part of a larger script I'm designing & I would like to credit both of you, where would you like the links pointing for the credits??
-
Sorry to be a pain but this isn't working again..... Your exact code - <?php $url = 'http://site.com'; // Split link to just get domain name function parse_url_domain ($url) { $parsed = parse_url($url); $hostname = $parsed['host']; return $hostname; } $raw_url = parse_url_domain($url); $url=array_reverse(explode('.',$raw_url),TRUE); $domain_only=$url[1].$url[0]; echo $domain_only; exit(); ?> Gives the following results $url values first followed by outputted results http://site.com --> comsite http://www.site.com --> sitewww http://www2.site.com --> siteww2 ------------- So I removed the $url[0] to give the following code, but this is still erroring (although it's closer) <?php $url = 'http://www2.site.com'; // Split link to just get domain name function parse_url_domain ($url) { $parsed = parse_url($url); $hostname = $parsed['host']; return $hostname; } $raw_url = parse_url_domain($url); $url=array_reverse(explode('.',$raw_url),TRUE); $domain_only=$url[1]; echo $domain_only; exit(); ?> The above code gives the following results http://site.com --> com http://www.site.com --> site http://www2.site.com --> site ---- So to my mind what we need strip the .com or .net (I will only be using TLDs with one . - so no .co.uk for example) then parse the URL..... I'm one step away, help please!
-
This just outputs - Array
-
I'm not entirely sure how to integrate that with my initial script ...
-
Hi guys, Here's my code. It stips the URL down to site.com rather than having http://www.site.com $linkurl = "http://site.com"; // Split link to just get domain name function parse_url_domain ($url) { $parsed = parse_url($url); $hostname = $parsed['host']; return $hostname; } $raw_url = parse_url($linkurl); $domain_only =str_replace ('www.','', $raw_url); echo $domain_only['host']; exit(); The problem is I'm using this to strip URLs that have various structures & need to strip them ALL down to sitename.tld eg. http://www4.site2.com http://site3.com http://www15.site4.com Is there a way to tell the script to knock off everything in these cases so we're left with site2.com site3.com site4.com ????????? :facewall:
-
Hi guys, Here's what I've got so far .... $message = "<a rel="nofollow" href="http://www.mysite.com/?d=9FDS32S" target="_blank">http://www.mysite.com/?d=9FDS32S</a>"; $messageimp = explode (">", $message,1); for($i = 0; $i < count($messageimp); $i++){ echo $messageimp[$i]; } All I want to do is chop $message down so the all I've left with is http://www.mysite.com/?d=9FDS32S Is this possible given that there are double quotes in the original variable??
-
^bump^
-
Sorry, I should have mentioned that a.php in your example & Page B will be an offsite page therefore this won't work
-
Hi guys, I'm wondering if someone could advise or point me in the direction of a good tutorial for the following. Let's say I have two pages. A & B Page A contains a link to Page B I want to check for certain text contained on Page B (it will always be in the same place. So, if Page B says <div id=mydiv>Positive Negative</div> Then I can code something in php (this bit I can do) to update Page A with the text Unfortunately, Page B Result was NEGATIVE Otherwise it will post something on Page A saying Great, Page B Result was POSITIVE --- Thanks in advance!
-
[SOLVED] Get extension code -> file has two extensions ???
doa24uk replied to doa24uk's topic in PHP Coding Help
Brilliant, that's working now. Many thanks! -
We'll need the php code too.........
-
[SOLVED] Get extension code -> file has two extensions ???
doa24uk replied to doa24uk's topic in PHP Coding Help
This is nearly working but unfortunately it's breaking the rest of the script because I'm not sure what variables to change further on in the script.... Here's the full script //This function separates the extension from the rest of the file name and returns it function findexts ($filename) { $filename = strtolower($filename) ; $exts = split("[/\\.]", $filename) ; $n = count($exts)-2; $exts = $exts[$n]; $n2 = count($exts)-1; $exts2 = $exts[$n2]; return $exts.$exts2; } //This applies the function to our file $ext = findexts ($_FILES['uploaded']['name']) ; //This line assigns a random number to a variable. You could also use a timestamp here if you prefer. $ran = rand () ; //This takes the random number (or timestamp) you generated and adds a . on the end, so it is ready of the file extension to be appended. $ran2 = $ran."."; //This assigns the subdirectory you want to save into... make sure it exists! $target = "directory/"; //This combines the directory, the random file name, and the extension $target = $target . $ran2.$ext; if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "Congratulations - File upload Successful!<br><br><h2>File Links</h2>http://mysite.com/directory/directory2/".$ran2.$ext."some text after the link<br>"; } else { echo "Oops! There was a problem uploading your file, please try again."; } -
[SOLVED] Get extension code -> file has two extensions ???
doa24uk posted a topic in PHP Coding Help
Hi guys, I am currently using this code to split the extension from a file, this is working fine. However my file has 2 extensions & I want to return them both eg. filename.ext1.ext2 The code currently spits out .ext2 And I need it to spit out .ext1.ext2 //This function separates the extension from the rest of the file name and returns it function findexts ($filename) { $filename = strtolower($filename) ; $exts = split("[/\\.]", $filename) ; $n = count($exts)-1; $exts = $exts[$n]; return $exts; If it matters, both extensions will always be the same length (and same length as each other... eg. -> .mp3.txt Thanks in advance for the help! -
Hi guys, Ok here's the script. if(in_array($forumid, $fid_array)) { $tests = array($forumid,); foreach($tests as $t) { if(preg_match('#\[(hide|HIDE)\].*?\[/\1\]#', $t)) { // DO NOTHING } else { header ("Location: $url"); echo "Hide tags aren't there, run error procedure<br>"; return; } } } This works fine, the problem i've got is when the statement ISN'T true I want the script to go back to the referring page & echo some text to tell teh user what to do. The problem is that the above script simply keeps seeing the result as false & endlessly redirects back to itself. It doesn't stop after the first redirect to give the user a chance to rectify the problem. Am I going about this the wrong way??
-
[SOLVED] check for certain text in a text area
doa24uk replied to doa24uk's topic in PHP Coding Help
Ok, I now have the following two php if loops. Just need to combine em Original Array <?php $fid_array[0] = "13"; $fid_array[1] = "14"; $fid_array[2] = "15"; $fid_array[3] = "20"; $fid_array[4] = "26"; $fid_array[6] = "27"; $fid_array[7] = "28"; $fid_array[8] = "29"; $fid_array[9] = "30"; $fid_array[10] = "31"; $fid_array[11] = "32"; fid_array[12] = "33"; $fid_array[13] = "34"; $fid_array[14] = "35"; $fid_array[15] = "36"; $fid_array[16] = "37"; $fid_array[17] = "38"; $fid_array[18] = "39"; $fid_array[19] = "40"; $fid_array[20] = "41"; $fid_array[21] = "42"; $fid_array[22] = "43"; $fid_array[23] = "44"; $fid_array[24] = "45"; $fid_array[25] = "46"; $fid_array[26] = "47"; if(in_array($forumid, $fid_array)) { // TEST REGEX FOR HIDE TAGS } else{ // DO NOTHING } ?> And combined code <?php $fid_array[0] = "13"; // ALL OTHER $fid_arrays if(in_array($forumid, $fid_array)) { $tests = array( '... [hide] and [/hide] ...', 'as well as [HIDE] and [/HIDE] xyz', 'and [hide] and [hide] abc', 'or [hide] and [/HIDE] ...',); foreach($tests as $t) { if(preg_match('#\[(hide|HIDE)\].*?\[/\1\]#', $t)) { // [HIDE] AND [/HIDE] (OR ANY CAPS PERMUTATION OF THESE) ARE PRESENT // DO NOTHING AND EXECUTE SCRIPT AS NORMAL } else { // TAGS AREN'T PRESENT. EXECUTE ERROR CODE. } } } else{ // DO NOTHING } ?> Is this correct?? Thanks again -
[SOLVED] check for certain text in a text area
doa24uk replied to doa24uk's topic in PHP Coding Help
nevermind. The fid is the actual variable of my forum ... sorry having a slow day today! -
[SOLVED] check for certain text in a text area
doa24uk replied to doa24uk's topic in PHP Coding Help
ahh I saw that I just wasn't sure whether $fid was defined already by virtue of being within the $fid_array ... is this the case or am I missing a step? sorry to sound like such a newbie! -
[SOLVED] check for certain text in a text area
doa24uk replied to doa24uk's topic in PHP Coding Help
Please bear with me, first time I've used arrays. So would it look like this?? <?php $fid_array[0] = "13"; $fid_array[1] = "14"; $fid_array[2] = "15"; $fid_array[3] = "20"; $fid_array[4] = "26"; $fid_array[6] = "27"; $fid_array[7] = "28"; $fid_array[8] = "29"; $fid_array[9] = "30"; $fid_array[10] = "31"; $fid_array[11] = "32"; $fid_array[12] = "33"; $fid_array[13] = "34"; $fid_array[14] = "35"; $fid_array[15] = "36"; $fid_array[16] = "37"; $fid_array[17] = "38"; $fid_array[18] = "39"; $fid_array[19] = "40"; $fid_array[20] = "41"; $fid_array[21] = "42"; $fid_array[22] = "43"; $fid_array[23] = "44"; $fid_array[24] = "45"; $fid_array[25] = "46"; $fid_array[26] = "47"; if (in_array($fid_array)) { // DO REGEXP } ?> -
Hi guys, I operate a forum & need some way to force users to input certain text when they submit a new thread. ie. Each new thread in certain forums must contain a link within [HIDE] tags [/HIDE] Therefore I can imagine the loop being something like this (would it be better to use case rather than if ... else?) If forum id=2,4,23,25 ... list all affected board id's here //CODE to check whether or not the text '[HIDE]' and '[/HIDE]' (without 's) are present in the message } True - [HIDE] and [/HIDE] ARE present --> Post message } Else (False [HIDE] and [/HIDE] AREN'T present) --> Return to new thread page with an error message of some sort. Thanks for the help guys
-
write text automatically into off-site text box
doa24uk replied to doa24uk's topic in PHP Coding Help
xand do what with cookies??? confused! -
hi guys, ok here's what I wanna do. I will be collecting variables from a process & then I need to open a new page (unseen to user - can this be done?) and paste the text from the variable into a text box on the new page. Only problem is that the text box is on an off-site page so I can't play with the coding & therefore insert the text easily. Is this do-able or not? DoA
-
web ftp upload, tree / folder view & random file names
doa24uk replied to doa24uk's topic in PHP Coding Help
^bump^ anyone?? -
web ftp upload, tree / folder view & random file names
doa24uk replied to doa24uk's topic in PHP Coding Help
Sorry, I wasn't expecting anyone to write the whole code for me. As I mentioned I can code everything apart from how to display the folder tree's in an HTML / PHP document. If anyone knows code for this I would be extremely greatful, if not don't worry I'm sure I'll find it somewhere on the net.... -
Hi guys, You have always provided great advice so I bring this one to you.... What I need is a web-based form that will enable users to input their login details and connect to the ftp server. (Easy - I can code this). When they log in they are automatically sent to their folder (not all users get root access). What I need to do then is display the folder tree of their account and give options to rename / delete / create folders etc. They should then be able to select a file from their computer & upload directly to their account. The script then dynamically renames the file (with perhaps a timestamp) and when the upload is complete they will be provided with a direct link to their file. The difficulty I'm having is how to display the folder tree & give them options such as rename / create new directory. Many thanks for your help. DoA
-
Free script for bandwidth control on all servers!
doa24uk replied to doa24uk's topic in Beta Test Your Stuff!
Script updated. Added support for a text file based list of exempt IP addresses (currently exempt IP addresses are marked via database but only valid for 24 hours). Latest version v2.0 Quota Manager v2.0 DoA ps. Good idea about the live demo, I'll get one sorted asap.