Sari la conținut
Forum Roportal
RHS

Script PHP

Evaluează acest topic

Postări Recomandate

Asi avea nevoie de umpic de ajutor.

Am urmatorul script: (este doar o parte din el)

 

<form method = "post" action = "<?php print($_SERVER['PHP_SELF']); ?>">
<table border = "0" cellspacing = "0" cellpadding = "10" width = "50%" align = "center" style = "height: 100%;">
<tr>
	<td colspan = "3" valign = "bottom">
		<span class = "bold">join our member list!</span>	<br>
		<span class = "hilight">hilighted text are required fields</span>
	</td>
</tr>
<tr>
	<td colspan = "3" height = "5%">
		<a href = "index.php">back</a>
	</td>
</tr>
<tr>
	<td width = "30%" height = "10" valign = "bottom">
		<span class = "hilight">username:</span>
	</td>
	<td width = "70%" height = "10" valign = "bottom">
		<input type = "text" id = "user" name = "user" style = "width: 80%" class = "text" tabindex = "1">
	</td>
	<td rowspan = "7" width = "16" height = "16" align = "right" valign = "bottom">
		<input type = "hidden" name = "joined" value = "<?php print(date("d.m.Y H:i:s", mktime())); ?>">
		<input type = "Image" src = "next.gif" width  = "16" height = "16" name = "submit" alt = "arrow pointing right: next" border = "0" align = "top" onfocus = "return checkFields();" tabindex = "10"></a>
	</td>
</tr>
<tr>
	<td width = "30%" height = "10" valign = "bottom">
		<span class = "hilight">password:</span>
	</td>
	<td width = "70%" height = "10" valign = "bottom">
		<input type = "password" id = "pass" name = "pass" style = "width: 80%" class = "text" tabindex = "2">
	</td>
</tr>
<tr>
	<td width = "30%" height = "10" valign = "bottom">
		<span class = "hilight"> confirm password:</span>
	</td>
	<td width = "70%" height = "10" valign = "bottom">
		<input type = "password" id = "pass2" name = "pass2" style = "width: 80%" class = "text" tabindex = "3">
	</td>
</tr>
<tr>
	<td width = "30%" height = "10" valign = "bottom">
		email:
	</td>
	<td width = "70%" height = "10" valign = "bottom">
		<input type = "text" id = "email" name = "email" style = "width: 80%" class = "text" tabindex = "4">
	</td>
</tr>
<tr>
	<td width = "30%" height = "10" valign = "bottom">
		http://
	</td>
	<td width = "70%" height = "10" valign = "bottom">
		<input type = "text" id = "url" name = "url" style = "width: 80%" class = "text" tabindex = "5">
	</td>
</tr>
<tr>
	<td width = "30%" height = "10" valign = "bottom">
		date of birth:
	</td>
	<td width = "70%" height = "10" valign = "bottom">
		<span class = "bold">d: </span><input type = "text" id = "day" name = "day" size = "2" class = "text"  maxlength = "2" tabindex = "6"> <span class = "bold">m: </span><input type = "text" id = "month" name = "month" size = "2" class = "text"  maxlength = "2" tabindex = "7"> <span class = "bold">y: </span><input type = "text" id = "year" name = "year" size = "4" class = "text"  maxlength = "4" tabindex = "8">
	</td>
</tr>
<tr>
	<td width = "30%" height = "10" valign = "bottom">
		location:
	</td>
	<td width = "70%" height = "10" valign = "bottom">
		<input type = "text" id = "location" name = "location" style = "width: 80%" class = "text" tabindex = "9">
	</td>
</tr>
<tr>
	<td colspan = "3" valign = "top">
		 
	</td>
</tr>
</table>
</form>

<script language = "javascript" type = "text/javascript">
<!--// Check field values are correct before submitting
function checkFields(){
	var flag = 1;	// Return flag

	// Check for empty values in important fields first
	if(!document.getElementById("user").value || !document.getElementById("pass").value || !document.getElementById("pass2").value){
		alert("Please enter values in the following:\n\nUSERNAME\nPASSWORD\nCONFIRM PASSWORD");
		document.getElementById("user").focus();
		return true;
	}
	// Check that passwords are the same
	else if(document.getElementById("pass").value != document.getElementById("pass2").value){
		alert("Please enter two matching passwords");
		document.getElementById("pass").value = '';
		document.getElementById("pass2").value = '';
		document.getElementById("pass").focus();
		return true;
	}
	// Check the day / month / year fields if there's a value in one of them
	else if(document.getElementById("day").value || document.getElementById("month").value || document.getElementById("year").value){

		// Check day first
		if((isNaN(document.getElementById("day").value)) || (document.getElementById("day").value > 31) || (document.getElementById("day").value < 1)){
		alert("Please enter a valid day in the DOB field");
		document.getElementById("day").value = '';
		document.getElementById("day").focus();
		return true;
		}
		// Check month next
		else if((isNaN(document.getElementById("month").value)) || (document.getElementById("month").value > 12) || (document.getElementById("month").value < 1)){
			alert("Please enter a valid month in the DOB field");
			document.getElementById("month").value = '';
			document.getElementById("month").focus();
			return true;
		}
		// Finally the year
		else if((isNaN(document.getElementById("year").value)) || (document.getElementById("year").value >= <?php print date("Y", mktime()); ?>) || (document.getElementById("year").value < 1)){
			alert("Please enter a valid year in the DOB field");
			document.getElementById("year").value = '';
			document.getElementById("year").focus();
			return true;
		}
		else flag = 0;
	}
	else flag = 0;

	// One final check if the others went through fine
	if(!flag){
		if(document.getElementById("email").value){
			// Finally, check the email
			if(document.getElementById("email").value.indexOf("@") == -1 || document.getElementById("email").value.indexOf(".") == -1){
				alert("If entering an email addy, please make sure it is valid");
				document.getElementById("email").focus();
				return true;
			}
			else return false;
		}
		else return false;
	}
}
-->
</script>

Asi vrea sa pun in el un captcha sau daca nu sa apara o "casutza" care sa trebuiasca sa fie bifata inainte de a apasa pe butonul next, un fel de termeni si conditii ca userul respectiv e de acord.

 

Va multumesc ;)

Editat de RHS

Partajează acest post


Link spre post
Distribuie pe alte site-uri

Chiar nu ma poate ajuta nimeni? Am nevoie... Va multumesc inca o data.

Partajează acest post


Link spre post
Distribuie pe alte site-uri

Hai ca te ajut eu incearca codul asta

 

 

 

 

<form id="form1" name="form1" method="post" action="">

<label>

<input type="checkbox" name="checkbox" value="checkbox" />

</label>

Acepta toate conditile

</form>

 

Daca le ai cu saiturile astea da un add andreyy_999 as avea nevoie de ajutor la ceva daca e primite un mesaj privat aicea pe forum daca nu intri pe id salut;)

Partajează acest post


Link spre post
Distribuie pe alte site-uri

Creează un cont sau autentifică-te pentru a adăuga comentariu

Trebuie să fi un membru pentru a putea lăsa un comentariu.

Creează un cont

Înregistrează-te pentru un nou cont în comunitatea nostră. Este simplu!

Înregistrează un nou cont

Autentificare

Ai deja un cont? Autentifică-te aici.

Autentifică-te acum

×