Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP
Author Message
Truden
New Member
New Member



Joined: Dec 14, 2004
Posts: 18
Location: Johannesburg/South Africa

PostPosted: Mon Oct 16, 2006 2:56 pm Reply with quote

Hi friends Smile

I need help Very Happy
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 Smile))

Now the last thing I want to use is THIS and then I think (I hope) that TruBar will be unbreakable.

But... I'm not good with coding Wink

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:

Code:
{SECURITYIMG}


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 Very Happy
 
View user's profile Send private message Visit poster's website
gregexp
The Mouse Is Extension Of Arm



Joined: Feb 21, 2006
Posts: 1497
Location: In front of a screen....HELP! lol

PostPosted: Mon Oct 16, 2006 4:35 pm Reply with quote

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!! 
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Truden







PostPosted: Tue Oct 17, 2006 12:16 am Reply with quote

Thank You, darklord Smile
I'll try both of them tonight (now I have to do some woodwork) Very Happy
Thank You very much.
 
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Tue Oct 17, 2006 3:10 am Reply with quote

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.
 
View user's profile Send private message Send e-mail
Truden







PostPosted: Tue Oct 17, 2006 4:04 am Reply with quote

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







PostPosted: Tue Oct 17, 2006 6:53 am Reply with quote

Thats gret news!!
 
Truden







PostPosted: Tue Oct 17, 2006 2:36 pm Reply with quote

darklord, when you come in South Africa you'll have five days (minimum) at my home Very Happy

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 test forum.
 
gregexp







PostPosted: Tue Oct 17, 2006 6:28 pm Reply with quote

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







PostPosted: Wed Oct 18, 2006 6:50 am Reply with quote

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 Very Happy
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)
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©