MDGM 22 Posting Whiz in Training

Hi All,

Can somebody tell me how I can remove the email addresses I naievely posted in this thread some years ago:

http://www.daniweb.com/web-development/web-design-html-and-css/threads/58133/asp-form-action-script

I can't seem to find a post edit button..

Thanks,
Max.

MDGM 22 Posting Whiz in Training

Can an admin take out all email addresses from this thread? They are getting picked up by crawlers and sold to spammers.

Either that or somebody tell me how I can do it; no edit button...

Thanks,
Max.

MDGM 22 Posting Whiz in Training

Can an admin take out all email addresses from this thread? They are getting picked up by crawlers and sold to spammers.

Either that or somebody tell me how I can do it; no edit button...

Thanks,
Max.

MDGM 22 Posting Whiz in Training

Iv had a go at that, the key I need to override is backspace but entering the backspace code (8) does not seem to work. How should that work?

MDGM 22 Posting Whiz in Training

Thanks for your reply,

The process does not involve any iFrames. I am going to use this in a browser add-on and so the javascript will be inserted directly into the page as if I was the developer of that website and just inserting code as normal.

Max

MDGM 22 Posting Whiz in Training

Hi all,

I want to know if it is possible and how to intercept an existing javascript keybind and block it.

For example, a website has some javascript that, when the user hits the letter "H" on the keyboard, the website automatically runs a function, e.g. redirecting to another web page.

I want to block this functionality after it has been loaded into the page.

Is this possible? Perhaps the stoppropagation function? Or maybe simply re-assign the key event to just run an empty function?

Thanks,
Max.

MDGM 22 Posting Whiz in Training

ahh okay, not what i would need. thanks anyway :)

MDGM 22 Posting Whiz in Training

Is there a way to, when the url changes, intercept it and take the user to a different page?

For example, if the user types in "facebook:" and then some other random words, like "facebook: eating my dinner" it takes the user to the facebook share page instead of just googling those words?

Seems unlikely for security reasons etc but im curious......

MDGM 22 Posting Whiz in Training

Ahhh of course, didnt think of that! :) I'll do that in the future. Thanks everybody for the help - it's been a while since I'v used javascript and maintained my chrome extensions :)

MDGM 22 Posting Whiz in Training

Hi,

Thanks for the reply. I know about variable scope, i just needed help getting round it.

In the end I just put the rest of my code for the page inside the same function, it required quite a lot of changes to the script but it's all I could do to work around it.

MDGM 22 Posting Whiz in Training

Hi all,

I'm making some changes to a google chrome extension I made and am having some trouble.

Heres my code on a content script page (removeAttr.js) :

chrome.extension.sendRequest({greeting: "whitelist"}, function(response) {
    var whitelist = response.whitelist;
    console.log(response.whitelist);//working
});
alert(whitelist);//alerts "undefined"

How do I acess the whitelist variable from outside the sendrequest() function?

Iv tried saving it to a window.var variable with no luck. Iv tried creating a div and assigning it's innerHTML as the whitelist variable and getting it later with no luck.

The fact that it's a chrome extension complicates things because i dont actually know if i can create elements from where the script is located.

Can anybody help me?

Max.

MDGM 22 Posting Whiz in Training

Hey, sorry for the super late reply but iv been really busy.

In the end I just started over with the articles part of the site and am now using wordpress to manage all my articles and am using it's permalink function to get search-engine-friendly urls.

here:

http://www.effectivecounselling.co.uk/articles

I made a custom theme and integrated it into my site design, was actually very easy, for anybody elses reference theres a great tutorial here:

http://codex.wordpress.org/Integrating_WordPress_with_Your_Website

Thanks for your help, i might need this later anyway :)

Max.

MDGM 22 Posting Whiz in Training

I know, the links above use the url www.example.com just for the sake of this thread.

The website currently has urls like this:

www.example.com/articles.php?aid=3

and I want to use .htaccess and apache's mod_rewrite to get information from the sites database and put that information in the url.

Let's say the article with primary key aid=3 (as shown in the url above) has the title "how to fix a laptop" in the database. I want to get that title from the database and re-write the url from what is above to the following:

www.example.com/articles/how-to-fix-a-laptop

MDGM 22 Posting Whiz in Training

Hi all,

I have a site that has a dynamically generated page and looks like this:

www.example.com/articles.php?aid=1
www.example.com/articles.php?aid=2
www.example.com/articles.php?aid=3

The page has the article title and description stored in a database and printed in the page itself.

How do I go about changing the URL from this:

www.example.com/articles.php?aid=1

To this:

www.example.com/articles/how-to-fix-a-laptop

where the article description is stored in a database?

Thanks in advance.
Max.

MDGM 22 Posting Whiz in Training

ahh great, it works now. thanks for the help

MDGM 22 Posting Whiz in Training

iv just found a function called removeattribute and am trying to figure out how to apply this to every element on the page.

So far I have this:

for(var i=0; document.all < document.all.length; i++) {
    document.all[i].removeAttribute("title");
}

but its not making any changes to the page.
Can anybody shed some light?

MDGM 22 Posting Whiz in Training

Hi all

I need a javascript code that removes all the title="*" attributes in a page, where the star (*) represents a wildcard for the content of the title attribute. So the following would occur:

<a href="#" title="test">test</a>
would be replaced with
<a href="#">test</a>

just like:

<a href="#" title="">test</a>
would be replaced with:
<a href="#">Test</a>

I know there is a function in javascript called match, but i have no idea how to write the reg expression that would work like the above example.

thanks in advance!!

MDGM 22 Posting Whiz in Training

ahhh briliant, that should work perfectly. I dont have time to test it now but when I do ill mark the thread as solved.

Thanks again!
Max.

MDGM 22 Posting Whiz in Training

Hi all,

I need a php script that gets the IP address of a user entered website, something like this:

$site = 'www.google.com';

$ip = ping($site);

obviously replacing ping with a command that actually exists!

Thanks in advance.
MAX

MDGM 22 Posting Whiz in Training

iv tried that but cant get any changes working. its quite a complex problem and I have tried many possible solutions... if anybody else has had the same thing that would be best.

I think its an encoding charset discrepency?

MDGM 22 Posting Whiz in Training

hi all,

I have a php script that saves what the user types in into a text file using fwrite, and displays it on another page using file_get_contents.

When putting in a pound sign (£), it saves the following to the text file:

£

Any idea how I can stop this from happening and instead get the pound sign working properly?

Max.

MDGM 22 Posting Whiz in Training

had some difficulty getting sqlite to work so i have decided to abandon the .db files. thanks anyway!

MDGM 22 Posting Whiz in Training

hi all,

Im desperatly looking for a .db format rhyming dictionary and have managed to get hold of three database files which I think will be VERY useful to me but I cannot open them. Can anybody help me to get them open?

I have attached the files in a .zip file to this thread.

Thanks!!

Max.

p.s. I tried importing them into a mysql database on one of my servers but it came up with a parsing error with loads of scrambled text - see below:

There is a chance that you may have found a bug in the SQL parser. Please examine your query closely, and check that the quotes are correct and not mis-matched. Other possible failure causes may be that you are uploading a file with binary outside of a quoted text area. You can also try your query on the MySQL command line interface. The MySQL server error output below, if there is any, may also help you in diagnosing the problem. If you still have problems or if the parser fails where the command line interface succeeds, please reduce your SQL query input to the single query that causes problems, and submit a bug report with the data chunk in the CUT section below:
----BEGIN CUT----
eNrsvWuMLFuW33Wm+14bN5ax/AAL2+O/he3i4LmX7q5zm+4eWTgqMyozbmVGZMeOrDpZwp7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w6/yMSYR4cqkYXfpt6EIsJjsAuSDOZYG0fCq0lVpGW2B9e7mMw1o
xfXixeNFz8+m+6tSCRWlThRCM8rYtt9MZmGim8Dp+uXj+ShfwGEMRYA+Np+4Pm/7tP6s8aT1Oc8b
2WXLaZg+MhENt5USaoUMxwry0c1DzbpfvdNhul3MwoReOcjSgFZdstuRnYQLXCNAY051DdJS25mF …
MDGM 22 Posting Whiz in Training

yeah it works great. thanks again itech

MDGM 22 Posting Whiz in Training

I didnt actually know about the .htaccess rewrite function and didnt know that this kind of setup was an option.

It's great to learn new ways of doing things through but now I have this all setup and it is working fine, I'll use this system for now, but your way will certainly be useful for future projects.

Thanks ardav and itech for your help!!

Max

MDGM 22 Posting Whiz in Training

thanks for all your help buddy! I wanted the code to replace the county/index.php pages - sorry if i wasnt clear enough. I have modified your script to change these files instead. also if anybody else uses it i have commented out the "copy" command in the "replacePage" function for testing purposes before any files are over written.

also because i cant / dont know how to run pages through command prompt or whatever i changed the argv to _GET variables so just run the page like this:

www.example.com/rpl.php?s=/www/htdocs/domain/public_html/template.php&d=/www/htdocs/domain/public_html

Thanks again!!

<?php
// Warning this may be a very bad design. Please inform nilesh [at] itech7 [dot] com if you get a better substitue.

	print "Make a backup of your files before you do modifcations\n\n";

	print "This application will overwrite any existing file without warning!\n\n";

	print "For example if your directory structure is like this -\n\n";
		
	print "\t/htdocs/domain.com/branch_finder/country/county\n\n";

	print "\tand you want to replace county/index.php with your one's\n\n";

	print "Pass argument #1 as path to source file\n\n";

	print "Pass argument #2 as the directory in which you have subdirectories as domain.com, domain.net, domain.org\n\n";

	print "NOTE: This will copy SOURCEFILE to county/index.php\n\n";

	print "By Nilesh, Site & Server Administrator of www.itech7.com\n\n<br/><br/><br/><br/><br/><br/>";



$sourcefile = '/var/www/localhost/htdocs/sharedweb/nsci/staff/cdir/template/county/index.php';

$destdir = '/var/www/localhost/htdocs/sharedweb/nsci/';

$d = new DirectoryIterator($destdir);

foreach ($d as $f) {
	
	if($f->isDir() and !$f->isDot()) { // Level 1 (domain.com's parent)
		
		$d1 = new DirectoryIterator($f->getPath() . '/' . $f);

		foreach ($d1 as $f1) {

			if($f1->isDir() and !$f1->isDot()) { // Level 2 (branch_finder's …
MDGM 22 Posting Whiz in Training

wow! thanks for all your time!!

Iv had a look at the script and it looks exactly what i needed, but im finding it a bit difficult to execute. can you give me an example of how to run it? like where should it be in the site for it to replace the right files?

also instead of executing it through the command line id like to pass the variables through the _get array

thanks again!!!

MDGM 22 Posting Whiz in Training

okay so this is the shape of the directory:

domain.com/branch_finder/country/county/branch

I have lots of pages like this so 3 examples would be:

domain.com/branch_finder/england/avon/bristol/
domain.com/branch_finder/england/dorset/poole/
domain.com/branch_finder/england/oxfordshire/banbury/

I want to overwrite each index.php page in each county (avon, dorset, orxfordshire) with a specified index.php page located on my site, using php.

MDGM 22 Posting Whiz in Training

Hi all,

I have a very large amount of files I need to update, so I thought the easiest way would be to do it with php.
Below is the current directory structure

www.domain.com/branch_finder/country/county/town/

I need to replace the existing index page in every "county" level directory inside the branch_finder folder with a page here:

www.domain.com/staff/cdir/templates/county/index.php

I am guessing I would have to run a script inside the branch_finder directory to identify each county page and replace it?

How would I go about doing this?

Thanks in advance.
Max.

MDGM 22 Posting Whiz in Training

surely just saving the login timestamp updating it every time the page is refreshed and then querying for users where the timestamp is less than x minutes ago are online would be the best answer?