Author |
Message |
Truden
New Member


Joined: Dec 14, 2004
Posts: 18
Location: Johannesburg/South Africa
|
Posted:
Mon Oct 16, 2006 2:56 pm |
|
Hi friends
I need help
I did improved TruBar to the point that now it uses random background, random font, random font color, random position and angle of the string... everything is random ))
Now the last thing I want to use is Only registered users can see links on this board! Get registered or login! and then I think (I hope) that TruBar will be unbreakable.
But... I'm not good with coding
Here is the problem:
Code://Define function to insert security image
function insertSecurityImage($inputname) {
$refid = md5(mktime()*rand());
$insertstr = "<img src=\"securityimage.php?refid=$refid\" alt=\"Security Image\" />\n
<input type=\"hidden\" name=\"$inputname\" value=\"$refid\" />";
return $insertstr;
}
|
The above is the function that is used to insert the image and the field where the code is inserted.
The function is used like this:
Code:'SECURITYIMG' => insertSecurityImage('security_refid'),
|
and then in the *.tpl:
Now I want to use two outputs from this function in two places.
I need
Code:<img src=\"securityimage.php?refid=$refid\" alt=\"Security Image\" />
|
here:
Code:<scri pt type="text/javascript">
loadMagnifier("binding", "securityimage.php?refid=$refid", 200, 35);
</scr ipt>
|
(the img tag is not a problem)
And I still need
Code:<input type=\"hidden\" name=\"$inputname\" value=\"$refid\" />
| as function return for {SECURITYIMG}
The thing is that I can not use two functions because they will generate two images with two ID's
How to do it, Raven  |
|
|
|
 |
gregexp
The Mouse Is Extension Of Arm

Joined: Feb 21, 2006
Posts: 1497
Location: In front of a screen....HELP! lol
|
Posted:
Mon Oct 16, 2006 4:35 pm |
|
Well, I believe I can help with that. In order to return 2 seperate things within a function, I would do it one of 2 ways.
I use a $var in one of my functions to tell it exactly what to return OR you can return an array.
For example.
Function test($var){
$name='darklord';
$notes='this will be the second thing';
$messed_up='try again is it really that hard to type test(name) or test(notes)?';
if ($var=='name'){
return $name;
}
if ($var=='notes'){
return $notes;
}
if (($var!='name') AND ($var!=notes)){
return $messed_up;
}
}
Or you can do this:
Function test(){
$name='darklord';
$notes='this will be the second thing';
$final=array(name=>$name,notes=>$notes)
return $final;
}
Now in the second case, you will need to break it down AFTER the function is called, in the first case you will need to write 2 seperate lines.
First case:
$var1=test(name);
$var2=test(notes);
then use $var1 and $var2 where you need the different outputs.
in the second case:
$var=test();
now you will need to use $var['name'] for one and $var['notes'] for the other.
Hope this helps. |
_________________ For those who stand shall NEVER fall and those who fall shall RISE once more!! |
|
 |
 |
Truden

|
Posted:
Tue Oct 17, 2006 12:16 am |
|
Thank You, darklord
I'll try both of them tonight (now I have to do some woodwork)
Thank You very much. |
|
|
|
 |
Guardian2003
Site Admin

Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam
|
Posted:
Tue Oct 17, 2006 3:10 am |
|
Truden I really like this!!
Is the class cross browser compatible?
I have been looking at a new animated gif captcha class which is pretty good - even if OCR is used to try and read the code it will only grab one charcter due to the animation effect. |
|
|
|
 |
Truden

|
Posted:
Tue Oct 17, 2006 4:04 am |
|
Guardian2003 wrote: | Truden I really like this!!
Is the class cross browser compatible?
I have been looking at a new animated gif captcha class which is pretty good - even if OCR is used to try and read the code it will only grab one charcter due to the animation effect. |
On the sample page there is a link to the author of the effect.
It is stated that this effect works with all browsers.
I checked it with IE6, IE7, FireFox and Opera.
Works with all of them. |
|
|
|
 |
Guardian2003

|
Posted:
Tue Oct 17, 2006 6:53 am |
|
|
|
 |
Truden

|
Posted:
Tue Oct 17, 2006 2:36 pm |
|
darklord, when you come in South Africa you'll have five days (minimum) at my home
The second example (I've tried it first) works like a charm.
Thank You, my friend.
Your name will be credited for that function.
I'll still have to do the alignment, but that is not a problem for now.
See it how it works in the Only registered users can see links on this board! Get registered or login!. |
|
|
|
 |
gregexp

|
Posted:
Tue Oct 17, 2006 6:28 pm |
|
I was thinking about the first example, The first one wouldnt work out anyway, It would create a problem, being called a second time would generate a second Random number and therefore throw off the attempt you had. Sorry.
And really, no credit needed, Just helping out is all. |
|
|
|
 |
Truden

|
Posted:
Wed Oct 18, 2006 6:50 am |
|
I picked the second one because it made more sense to me.
Works perfect, but I took off the new effect, because IE6 is having problem with the java script.
Must go through the code and see (if I can) what is wrong.
I don't really think that it is much secure with this effect, but at least it looks cool
Now I'm looking for some more *.TTF fonts to include, which must be small in file size and easy for a human to read when the characters are flipped down (forward) |
|
|
|
 |
|