JavaScript and client side scripting.
Moderator: General Moderators
m3rajk
DevNet Resident
Posts: 1191 Joined: Mon Jun 02, 2003 3:37 pm
Post
by m3rajk » Mon Sep 08, 2003 9:51 pm
the button to call the block.php page doesn't worrk. i've used submits and resets before, but not buttons. so i'm not sure what's wrong here. if anyone can explain it, i would really like to know.
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>FindYourDesire.com -- Reading/Sending FYDim</title>
<meta name="Author" content="Pages coded by Josh Perlmutter for Desired Creations LLC">
<meta name="Author" content="Graphics created by Alix Stolzer for Desired Creations LLC">
<meta name="Author" content="Smileys created by Amber Beausoleil for Desired Creations LLC">
<style type="text/css">
<!-- this comment is for non-css compliant browsers
a {text-decoration:none}
end of css -->
</style>
</head>
<body bgcolor="#878787" text="#ffffff" alink="#950c0c" vlink="#3347c5" link="#000000">
<center> <form action="/findyourdesire/message.php" method="POST" onReset="window.close();" style="margin:0">
<input type="hidden" name="to" value="Jersey_Girl17">
<table frame="box" bgcolor="#878787" border="1" cellpadding="0" cellspacing="0" text="#ffffff">
<tr>
<td rowspan="3" width="75" height="75"><a href="profile.php?un=Jersey_Girl17" target="profile"><img border="0" src="pic.php?pic=main.Jersey_Girl17.jpg&fn=ltn"></a></td>
<td colspan="2">Message To/From: <a href="profile.php?un=Jersey_Girl17" target="profile">Jersey_Girl17</a></td>
<td colspan="2"><input type="button" name="block" value="Block User" onClick="window.self('block.php');"></td>
</tr>
<tr>
<td colspan="3"></td>
<td ><a href="code.php" target="code">SiteCode</a> On</td>
</tr>
<tr>
<td><input type="submit" value="Send Mail"></td>
<td><input type="reset" value="Close Window"></td>
<td colspan="2"><a name="#desire" href="#desire" onClick="window.open('adddesire.php?fun=Jersey_Girl17&fuin=13', 'desire', 'height=196,width=288');">Add Desire</a></td>
</tr>
<tr>
<td colspan="5"><textarea name="message" rows="5" cols="59"></textarea></td>
</tr>
</table>
</form>
<font size="-2">
<p>Pages coded by Josh Perlmutter for Desired Creations LLC
<br />Graphics created by Alix Stolzer for Desired Creations LLC
<br />Smileys created by Amber Beausoleil for Desired Creations LLC
<br />All creations copyrighted by their respective Creators. Reproduction Requires Consent of the Creator and Desired Creations LLC.
</p>
</font>
</center>
</body>
</html>
nigma
DevNet Resident
Posts: 1094 Joined: Sat Jan 25, 2003 1:49 am
Post
by nigma » Mon Sep 08, 2003 10:07 pm
window.open()?
Vincent Puglia
Forum Commoner
Posts: 67 Joined: Thu Sep 04, 2003 4:20 pm
Location: where the World once stood
Post
by Vincent Puglia » Tue Sep 09, 2003 9:20 am
howzabout: onclick="window.location='block.php'"
Vinny
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Tue Sep 09, 2003 9:36 am
those methods won't pass any info from the current page though!!
You need to change the action of the form and subit it using Javascript.
Try this code
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>FindYourDesire.com -- Reading/Sending FYDim</title>
<meta name="Author" content="Pages coded by Josh Perlmutter for Desired Creations LLC">
<meta name="Author" content="Graphics created by Alix Stolzer for Desired Creations LLC">
<meta name="Author" content="Smileys created by Amber Beausoleil for Desired Creations LLC">
<style type="text/css">
<!-- this comment is for non-css compliant browsers
a {text-decoration:none}
end of css -->
</style>
<script language="JavaScript" type="text/JavaScript">
function blockUser() {
document.findyourdesire.action="block.php";
document.findyourdesire.submit();
}
</script>
</head>
<body bgcolor="#878787" text="#ffffff" alink="#950c0c" vlink="#3347c5" link="#000000">
<center> <form name="findyourdesire" action="/findyourdesire/message.php" method="POST" onReset="window.close();" style="margin:0">
<input type="hidden" name="to" value="Jersey_Girl17">
<table frame="box" bgcolor="#878787" border="1" cellpadding="0" cellspacing="0" text="#ffffff">
<tr>
<td rowspan="3" width="75" height="75"><a href="profile.php?un=Jersey_Girl17" target="profile"><img border="0" src="pic.php?pic=main.Jersey_Girl17.jpg&fn=ltn"></a></td>
<td colspan="2">Message To/From: <a href="profile.php?un=Jersey_Girl17" target="profile">Jersey_Girl17</a></td>
<td colspan="2"><input type="button" name="block" value="Block User" onClick="blockUser();"></td>
</tr>
<tr>
<td colspan="3"></td>
<td ><a href="code.php" target="code">SiteCode</a> On</td>
</tr>
<tr>
<td><input type="submit" value="Send Mail"></td>
<td><input type="reset" value="Close Window"></td>
<td colspan="2"><a name="#desire" href="#desire" onClick="window.open('adddesire.php?fun=Jersey_Girl17&fuin=13', 'desire', 'height=196,width=288');">Add Desire</a></td>
</tr>
<tr>
<td colspan="5"><textarea name="message" rows="5" cols="59"></textarea></td>
</tr>
</table>
</form>
<font size="-2">
<p>Pages coded by Josh Perlmutter for Desired Creations LLC
<br />Graphics created by Alix Stolzer for Desired Creations LLC
<br />Smileys created by Amber Beausoleil for Desired Creations LLC
<br />All creations copyrighted by their respective Creators. Reproduction Requires Consent of the Creator and Desired Creations LLC.
</p>
</font>
</center>
</body>
</html>
Mark
Vincent Puglia
Forum Commoner
Posts: 67 Joined: Thu Sep 04, 2003 4:20 pm
Location: where the World once stood
Post
by Vincent Puglia » Tue Sep 09, 2003 9:41 am
hi bech
As I posted, no; but, you could append whatever is needed to the location string and then handle it server side:
window.location = "block.php?blahblah"
Vinny
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Tue Sep 09, 2003 9:42 am
true, but the form is using POST, my way will do it using POST too
Vincent Puglia
Forum Commoner
Posts: 67 Joined: Thu Sep 04, 2003 4:20 pm
Location: where the World once stood
Post
by Vincent Puglia » Tue Sep 09, 2003 9:46 am
Hi bech,
I defer to the phper
Vinny
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Tue Sep 09, 2003 9:48 am
LOL
m3rajk
DevNet Resident
Posts: 1191 Joined: Mon Jun 02, 2003 3:37 pm
Post
by m3rajk » Tue Sep 09, 2003 9:56 am
there's no reason i reallly need to use pos aside form the fact it would stop people from creating links to get people to block other users by clicking on them.. but since i alredy have the way to remove them is that really an issue? not sure which is the simpler solution right now
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Tue Sep 09, 2003 10:00 am
i don't think either metod is simpler or not really, just two methods of doing the same thing, but as you said, the POST method may be safer, even though that can still be faked!
Mark
JAM
DevNet Resident
Posts: 2101 Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:
Post
by JAM » Tue Sep 09, 2003 2:02 pm
Did I miss something? Why not use more than one submit button?
Code: Select all
<pre>
<?php
// just examples...
print_r($_POST);
if (isset($_POST['block'])) {
echo 'Run functions for blocking, header to another page...';
} else if (isset($_POST['send'])) {
echo 'Run functions for sending mail';
}
?>
<form method="post">
<input type="text" name="something" value="example">
<input type="submit" name="block" value="Block User">
<input type="submit" name="send" value="Send Mail">
</form>
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Tue Sep 09, 2003 4:05 pm
Yeah jam, that could be another way of doing it, but his block user script is currently in another .php file, so the way we suggested saves re-writing code.
Mark
JAM
DevNet Resident
Posts: 2101 Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:
Post
by JAM » Tue Sep 09, 2003 10:40 pm
Hmmm... Having the rewriting in mind, youre right.
I did something similiar, where I instead included my 'block' file, as opposite to header()/window.open it.