Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onclick in appletts

Status
Not open for further replies.

gwar2k1

Programmer
Apr 17, 2003
387
0
0
GB
Is it possible to have an onclick"" in an applett's parameters? I need a paramater to run a script that you guys helped me with before on a piece of freeware code:

<param name=&quot;cgi&quot; value=&quot;functions.php?mode=picsaveo&edit=<?=$edit?>&edittimes=<?=time()?>&quot;>

thats the parameter (i think) where it would need to go. Ive already tried just whacking it on the end before the last &quot;>&quot; but it had no effect.

The section of functions.php that it calls is:

if($mode==&quot;picsave&quot;){
include('dbconn.php');
$p = strpos($HTTP_RAW_POST_DATA, &quot;\r&quot;);

$size = strlen($HTTP_RAW_POST_DATA);

if( $p === false) {
print &quot;Content-type: text/plain\n\n&quot;;

print &quot;error $size\n&quot;;
} else {
if(isset($edit)){
unlink($image_filename);
$fp = fopen($image_filename,'wb');
$edittime2 = time() - $edittimes;
$result2 = mysql_query(&quot;UPDATE &quot;.$OekakiPoteto_Prefix.&quot;oekakidta SET edittime=(edittime + $edittime2) WHERE PIC_ID='$edit'&quot;);

mysql_close();
$resno = $edit;
} else {

$result = mysql_query(&quot;UPDATE &quot;.$OekakiPoteto_Prefix.&quot;oekakimisc set miscvalue=miscvalue+1 where miscname='piccount'&quot;);
$result = mysql_query(&quot;SELECT miscname, miscvalue FROM &quot;.$OekakiPoteto_Prefix.&quot;oekakimisc where miscname='piccount'&quot;);
$row = mysql_fetch_array($result);
$resno = $row[miscvalue];

//check if the picture is archived or not before saving
$awrite = &quot;false&quot;;
while($awrite == &quot;false&quot;){
$result = mysql_query(&quot;SELECT * FROM &quot;.$OekakiPoteto_Prefix.&quot;oekakidta WHERE PIC_ID=&quot;.$resno);
$row = mysql_fetch_array($result);
if($row[archive] == &quot;1&quot;){
//go to the next number
$result = mysql_query(&quot;UPDATE &quot;.$OekakiPoteto_Prefix.&quot;oekakimisc set miscvalue=miscvalue+1 where miscname='piccount'&quot;);
$result = mysql_query(&quot;SELECT miscname, miscvalue FROM &quot;.$OekakiPoteto_Prefix.&quot;oekakimisc where miscname='piccount'&quot;);
$row = mysql_fetch_array($result);
$resno = $row[miscvalue];

} else {
$awrite = &quot;true&quot;;
}
}


}

$image_filenamejpg = $OPpics.'/'.$resno.&quot;.jpg&quot;;
$image_filename = $OPpics.'/'.$resno.&quot;.png&quot;;
unlink($image_filename);

$fp = fopen($image_filename,'wb');


if ($fp) {
fwrite($fp,substr($HTTP_RAW_POST_DATA,$p+2));
fclose($fp);

if($jpgcompression == &quot;yes&quot;){

//convert to JPEG

$img = imagecreatefrompng($image_filename);

imagejpeg($img,$image_filenamejpg, $jpgcompressqual);

}

if(!isset($edit)){
$result = mysql_query(&quot;DELETE from &quot;.$OekakiPoteto_Prefix.&quot;oekakicmt where PIC_ID='$resno'&quot;);
$result = mysql_query(&quot;DELETE from &quot;.$OekakiPoteto_Prefix.&quot;oekakidta where PIC_ID='$resno'&quot;);

$thetime = time() - $edittimes;
//insert the picture into the database
$inserted = &quot;false&quot;;
while($inserted == &quot;false&quot;){
$result = mysql_query(&quot;INSERT into &quot;.$OekakiPoteto_Prefix.&quot;oekakidta SET usrname='$username',hostname='$hostname', PIC_ID='$resno', IP='$REMOTE_ADDR', postdate=NOW(), edittime='$thetime'&quot;);
$result = mysql_query(&quot;SELECT count(*) as rowcount FROM &quot;.$OekakiPoteto_Prefix.&quot;oekakidta WHERE PIC_ID='$resno'&quot;);
$r_rows = mysql_fetch_array($result);
if($r_rows[rowcount] == 1){
$inserted = &quot;true&quot;;
}
}
}


mysql_close();
} else {
mysql_close();
fclose($fp);
print &quot;Content-type: text/plain\n\n&quot;;
print &quot;error $size\n&quot;;

}
}
echo &quot;Content-type: text/plain\n\n&quot;;
echo &quot;ok&quot;;
}
?>

Clearly thats waaaay too long so I doubt any1s gonna look at that BUT i dont think its neccessary anyway, I just posted it incase any one was curious.

Is there any way i can make the applett parameter (button thingy) use an onclick attribute? If not is there any sneaky way I could add a hidden submit button to do the same job?

Thanks



~*Gwar3k1*~
&quot;To the pressure, everything's just like: an illusion. I'll be losing you before long...&quot;
 
hehe didnt think ppl'd read it =P

~*Gwar3k1*~
&quot;To the pressure, everything's just like: an illusion. I'll be losing you before long...&quot;
 
Lets focus here on the problem. Forget you PHP codings for now. The question is whether you can attach(through parameter) a URL that some button in the applet will send to. By writing code in your applet yes! But can/did you write the applet code? Explain what your applet is - is it a button only - and so on.
 
its an oekaki which is an online paint thingy. so yeah its a painting applet. there are many buttons, options etc and of course the cnvas. ... heres the code:

<applet name=&quot;oekakibbs&quot; code=&quot;a.p.class&quot; archive=&quot;oekakibbs.jar&quot; width=&quot;<?=$axcord?>&quot; height=&quot;<?=$aycord?>&quot; mayscript>
<?if(isset($edit)){?>
<param name=&quot;readfilepath&quot; value=&quot;./&quot;>
<param name=&quot;readpicpath&quot; value=&quot;./&quot;>
<param name=&quot;readpic&quot; value=&quot;<?=$OPpics?>/<?=$edit?>.png&quot;>
<param name=&quot;url&quot; value=&quot;index.php&quot;>
<param name=&quot;cgi&quot; value=&quot;functions.php?mode=picsaveo&edit=<?=$edit?>&edittimes=<?=time()?>&quot; onclick=&quot;return checkTimer();&quot;>
<? } else {?>
<param name=&quot;url&quot; value=&quot;index.php?mode=res_msg&quot;>
<param name=&quot;cgi&quot; value=&quot;getoekakibbs.php?username=<?=urlencode($OekakiU)?>&edittimes=<?=time()?>&mode=norm&quot; onclick=&quot;return checkTimer();&quot;>
<? } ?>
<param name=&quot;popup&quot; value=&quot;0&quot;>
<param name=&quot;tooltype&quot; value=&quot;full&quot;>
<param name=&quot;anime&quot; value=&quot;0&quot;>
<param name=&quot;animesimple&quot; value=&quot;1&quot;>
<param name=&quot;tooljpgpng&quot; value=&quot;0&quot;>
<param name=&quot;tooljpg&quot; value=&quot;0&quot;>
<param name=&quot;passwd&quot; value=&quot;hardidhihihiahrih&quot;>
<param name=&quot;passwd2&quot; value=&quot;I like to eat, ice cream.&quot;>
<param name=&quot;picw&quot; value=&quot;<?=$xcord?>&quot;>
<param name=&quot;pich&quot; value=&quot;<?=$ycord?>&quot;>
<param name=&quot;baseC&quot; value=&quot;888888&quot;>
<param name=&quot;brightC&quot; value=&quot;aaaaaa&quot;>
<param name=&quot;darkC&quot; value=&quot;666666&quot;>
<param name=&quot;backC&quot; value=&quot;000000&quot;>
<param name=&quot;mask&quot; value=&quot;12&quot;>
<param name=&quot;toolpaintmode&quot; value=&quot;1&quot;>
<param name=&quot;toolmask&quot; value=&quot;1&quot;>
<param name=&quot;toollayer&quot; value=&quot;1&quot;>
<param name=&quot;toolalpha&quot; value=&quot;1&quot;>
<param name=&quot;toolwidth&quot; value=&quot;200&quot;>
<param name=&quot;target&quot; value=&quot;_self&quot;>
<param name=&quot;catalog&quot; value=&quot;0&quot;>
<param name=&quot;catalogwidth&quot; value=&quot;100&quot;>
<param name=&quot;catalogheight&quot; value=&quot;100&quot;>
</applet>

Nope i didnt write the code but its freeware / open source so all i need to do is link to the creators on pages that use it.



~*Gwar3k1*~
&quot;To the pressure, everything's just like: an illusion. I'll be losing you before long...&quot;
 
<param name=&quot;url&quot; value=&quot;index.php&quot;>
<param name=&quot;cgi&quot; value=&quot;functions.php?mode=picsaveo&edit=<?=$edit?>&edittimes=<?=time()?>&quot; onclick=&quot;return checkTimer();&quot;>

Obviously thats the URL / Save button and I tried putting the onclick=&quot;timer()&quot; in the cgi one but it didnt work.

~*Gwar3k1*~
&quot;To the pressure, everything's just like: an illusion. I'll be losing you before long...&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top