I open Requirements Specification for Advance One Time URL script.
You can see and help with ideas.
Hi,
I wrote little script + lib for one time url.
this script make MD5 hash string for one time using and redirect file.
the links looks like: http://garry-lachman.com/link/ce75f50f55bcedf0a72098a01764548bĀ and can be used one time only.
The url storing is based on PHP Sessions and link redirection on MOD_REWRITE but there is example
for non MOD_REWRITE using
Example of create of the link:
1 2 3 4 5 | <?php require_once("libs/one_time_url.lib.php"); $one_time_url = new one_time_url(); ?> <a href="<?php echo $one_time_url->make_url("http://www.garry-lachman.com"); ?>">This is one time URL to http://www.garry-lachman.com</a> |
The code & example can be downloaded form here.
License: GNU/GPL (open source)
Losing “this” scope in JavaScript – Solution
Hi….
When using Javascript as OOP mode deep functions (function in function) lose the “this” scope.
I found some solution for this problem…
Same problem i found when you call other class with callback, the callback function returns without “this” scope.
how the problem looks:
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
this.test_var = "test";
this.level_one = function() {
alert("Level One: " + this.test_var);
function level_two() {
alert("Level Two: " + this.test_var);
}
level_two();
}
}
var test_scope = new scope_experiment();
test_scope.level_one();
The output will be:
1) Level One: test
2) Level Two: undefined
And now…. The solution:
All what you need is to pass “this” to the deep function…
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
this.test_var = "test";
this.level_one = function() {
alert("Level One: " + this.test_var);
function level_two(_this_scope) {
// we use _this_scope as this
alert("Level Two: " + _this_scope.test_var);
}
level_two(this); // we pass this to the function
}
}
var test_scope = new scope_experiment();
test_scope.level_one();
The output will be:
1) Level One: test
2) Level Two: test
Mission Accomplished