# Solved: Edit and browse through URL's automatically



## great7 (Jun 18, 2012)

i want a web browser addon that can edit the url and then go to that url automatically

the URL will be the same url.. but different number at end.

example:

www.example.com/56049301

that would be the start url. the addon would then go

www.example.com/56049302
www.example.com/56049303
www.example.com/56049304
www.example.com/56049305
www.example.com/56049306
etc etc

just adding 1 to the end of url each time.

i have looked all over the net for something like this no luck

hopefully i will get a result from this website


----------



## colinsp (Sep 5, 2007)

I don't know of anything like that. If you explain why you want to do that someone may be able to offer an alternative way of doing what you want.


----------



## allnodcoms (Jun 30, 2007)

As colin said, there's nothing out there that will do what you are asking, but if you want those URI's to open in separate windows then it would be a pretty simple thing to hand code in Javascript.

If you can let us know what you need it for (so that we can suggest an appropriate context), and your level of experience in JS then we can provide a more detailed explanation.

Danny


----------



## valis (Sep 24, 2004)

what are you going to do when you get a null return?


----------



## great7 (Jun 18, 2012)

Thanks for all the responses.



allnodcoms said:


> As colin said, there's nothing out there that will do what you are asking, but if you want those URI's to open in separate windows then it would be a pretty simple thing to hand code in Javascript.
> 
> If you can let us know what you need it for (so that we can suggest an appropriate context), and your level of experience in JS then we can provide a more detailed explanation.
> 
> Danny


Want it to browse through logs. just to save me editing the url each time.. frustrating when got to do 100s times manually.

what you mentioned "but if you want those URI's to open in separate windows then it would be a pretty simple thing to hand code in Javascript." that sounds good. but would it be able to open in tabs instead of new windows?

well.. ive been wanting to do this for about a month or 2 . i have been trying to learn Php and html since i thought that is what i would need to know how to do this. From your post i now know it isnt needed. so i wasted my time.i have not tried writing java scripts yet.

would it be possible you could create that script for me ? if its simple and wouldn't be to much trouble for you i would be greatfull, if not will you point me in the right direction to where i can learn to write the script myself ?

Thank you.


----------



## colinsp (Sep 5, 2007)

That would be something easy to code in php. But if you have 100's of these to go through opening a new tab for each automatically would probably kill your browser. Probably better with a php page on it with a next button that opens the next log file.


----------



## great7 (Jun 18, 2012)

colinsp said:


> That would be something easy to code in php. But if you have 100's of these to go through opening a new tab for each automatically would probably kill your browser. Probably better with a php page on it with a next button that opens the next log file.


that would be perfect. i could use imacro to record me clicking the next page button and loop it then.

But i don't know how to do this.

possible you could create it for me? or could link me to tutorials on how to add a next page button to a web page using php


----------



## allnodcoms (Jun 30, 2007)

Basically you'd need a script, showlogfile.php or similar, which accepts the number of the log file you want to view. The PHP script would then fetch this log (from where ever you store it) and echo this to the page. It would also create the 'next' and 'previous' links by incrementing and decrementing the current value and converting this into the corresponding URI according to your numbering methods. This script could also echo a GOTO field to allow you to enter the number of the log you wanted to jump to...

All of this should be fairly easy to implement with a basic knowledge of PHP, but if you have any specific questions regarding the implementation then just let us know and we'll see what we can do. I can't speak for Colin, but I don't usually give "Here's your code..." type solutions, I prefer to point people in the right direction and assist further if they get stuck. I just think it helps people to learn that way...

Danny


----------



## colinsp (Sep 5, 2007)

I'm with Danny here. Try and code it yourself to start and then come back when you have specific issues that we can help you resolve. It is how I learnt to code php pages and it is a great way of learning.


----------



## great7 (Jun 18, 2012)

Okay..

i just googled "how to create showlogfile.php" i now know i need to get MySQL to create the databases.
need to learn SQL for the database and PhP to create the webpage. for the PHP i will be using notepad++. for the sql i will be using MySQL.

been studying SQL & PHP on this website for the last 2hours ... www.w3schools.com doesn't mention how i can start to fetch information from the webpage using php to create the databse with sql though.

how would i do that? fetch information from a webpage and then put it into the database then create the next page button?

if someone could direct me to some tutorials that specifically teaches how i do what i am aiming to do instead of information i wont be using. i would appreciate it.

Just to make clear if it isnt obvious already. i have very little knowledge in scripting/coding.
http://www.w3schools.com/


----------



## allnodcoms (Jun 30, 2007)

How do you store your log files at the moment? If you hold them on file then I'd leave MySQL for another day and just concentrate on the PHP.

Danny


----------



## great7 (Jun 18, 2012)

im not storing them anywhere . logs on a website that i use a lot

Honestly.. doubt i will be able to figure out how to do this.

its like learning a new language..


you know some very good tutorials that explain it in simple terms? or know of a website where there is willing people to do simple scripts for people ?


----------



## allnodcoms (Jun 30, 2007)

What do you type into the address bar of your browser to access these log files? Replace the actual domain with some made up one, but I need everything after the ".com" (for example), punctuation, question marks, the lot. This will tell me whether you are serving up a page that calls the log, or accessing it directly from a stored file.

Is this your domain (i.e. a domain to which you have server side access), or are we talking some other 3rd party site to which you have no backend access? It makes a difference as to what language we write this script in.

Get back to me and I'll see what can be done.

Danny


----------



## allnodcoms (Jun 30, 2007)

You're after a '_browser feature_' that will provide easier navigation of a site over which you have no control.

This is kind of beyond the realms of what *TechGuy* is all about, but it's possible and quite an interesting side project, so I'm not going to write the script for you (for reasons I pointed out yesterday), but I will tell you how it can be achieved quite easily with a bit of HTML and Javascript.

You'll need to create a web page and fill it with an iFrame. Leave a small border (either top or bottom), around 20 - 30 pix high should be good, for your '_pagination_' controls. In this border you'll need two buttons (for next and previous) and a text field (to directly enter a log id).

Here's the gist of it. You have half a URI (the bit up to and including "?id="), and to finish this address you just need to pin a number on the end of it. You can read that number from the text box, add it to the first half of the URI and set the completed string as the "src=" attribute of the iFrame. The next arrow (when clicked) adds one to the current number before adding it to the string, and the previous arrow takes one away, and so on. You could even get really lairy and store the current value as a cookie, so it's remembered for next time.

Really simple stuff, and all you need to do to view your logs is click a couple of buttons 

Happy coding...

Danny


----------



## great7 (Jun 18, 2012)

Just want you to know i really appreciate the amount of feed back you are giving me. thank you.

i did some google searching. came up with this so far..



</center

that brings up the Log in a browser .. what you said "around 20 - 30 pix high should be good," when its set as that its just a tiny square, cant see any of the webpage.. was it meant to be like that? i have adjusted it so i can see more.


​
{

that script above gives a next button. But when i click the button it doesn't go to the next log. came across that script when i searched for _pagination.

"_You have half a URI (the bit up to and including "?id="), and to finish this address you just need to pin a number on the end of it. You can read that number from the text box, add it to the first half of the URI and set the completed string as the "src=" attribute of the iFrame. The next arrow (when clicked) adds one to the current number before adding it to the string, and the previous arrow takes one away."

that part confuses me i don't understand, could you explain it some more?

how would i get the button to add one to the current log number?

when i open the script into the browser the url is: file:///C:/Users/username/Desktop/testin1.html
is that suppose to be like that?​


----------



## allnodcoms (Jun 30, 2007)

Making progress... 

The iFrame / border reference was supposed to read fill the page with the frame *except* for a 20 pix border - kind of like a menu bar, either at the top or bottom depending on your preference. As long as you can see it though it doesn't really matter.

The two part URI thing is all about '_variables_'. A variable (and excuse me if you already know this, I do like to ramble on) is a named place where you can hold data. It's like a box with a label on it that you can refer to by name, and put things in that you want to remember. The javascript statement:

```
var a=5;
```
 creates a variable (or labelled box) called 'a', and puts the value 5 in it. If you print a, you get "5". Simple really...
When your page loads, I'd create a variable and set it to some arbitrary value (the log you want to start from would be good) and when the next button is clicked (for example) you'd add one to your variable. This is just a case of typing:

```
a=a+1;
```
You would need to place this in a function, and call that function in response to the onClick event on the button. I've probably just completely lost you there, but a quick Google should solve that, and if not you know the address...

Once you've modified your variable you just need to add it to the rest of your URI and change the iFrame 'src' attribute:

```
var myURI="http://example.com/log_display_page.php?id=" + myVariable.toString();
document.getElementByID("myiFrameID").src=myURI;
```
Well that's enough to be going on with. I'm going to have a quiet beer... I'll leave you to have a play with this and probably see you tomorrow? 

Danny


----------



## great7 (Jun 18, 2012)

i am finding this very hard to understand. so i think i will have to take some time to try learn how to write functions and variables.
so will be a while before i can move on to the next step on completing this script.

just thought i would let you know so you don't think i have given up on this.

thanks for feedback so far.

update :

i have found out how to use the function to add 1 to current number. so i am going in the right direction.


```
<html>
<HEAD>
<SCRIPT language="JavaScript">


var a=40216480; a=a+1;

function sample() {
  
  a = 40216480;

var a=a+40216480;


}
sample();
alert(a);


[SIZE=2]</SCRIPT>
</HEAD>
</html>[/SIZE]
```


but i am still unsure how i would make that work with this.



```
[SIZE=2]var myURI="http://example.com/log_display_page.php?id=" + myVariable.toString(); document.getElementByID("myiFrameID").src=myURI;[/SIZE]
```
also a question about the button.. i have 2. i dont need 2 that both go to the next page.. so what one do i delete ?

do i keep this button


```
<center><button onclick="myFunction()">next page</button></center>
```
or


```
<center><form action="http://example.com/log_display_page.php?id=.html" method="get">
<input type="submit" value="Next" />
</form>
</center>
```
that button?

some more helpful tips would be appreciated


----------



## great7 (Jun 18, 2012)

var myURI="http://example.com/log_display_page.php?id=" + var a=5; a=a+1; .toString();
document.getElementByID("myiFrameID").src=myURI; a=a+1; 

is that right?

what do i need to put in ("myiFrameID") ?


----------



## allnodcoms (Jun 30, 2007)

Just copy this code and paste it into a new file. Save it as plain text (no fancy stuff) and stick a .htm extension on it. Double click and away the lads!

You will need to edit the _baseURL_ variable (as described in the code) to the actual address of the page, but otherwise it's good to go...

```
<!DOCTYPE HTML>

HTML / Javscript Pagination

	Pagination Page by Danny of [URL=http://techguy.org]TechGuy.org[/URL]
```
Happy Log viewing...

Danny


----------



## great7 (Jun 18, 2012)

Thanks!! works good much easier than editing the log id by hand each time.

would have took me weeks/months to learn how to do that.. much appreciated.

i am still going to continue learning php/java though, even though this is complete.

if i could i would buy you a pint of beer


----------



## allnodcoms (Jun 30, 2007)

Next time you're in my neck of the woods I'll hold you to that... 

Danny


----------

