Jump to content

starting forum, having problems...


ardyandkari

Recommended Posts

/\ correct...

 

i added echo $email; and it returns nothing...

 

i also erased all entries in the db just to make sure that it should work...i have a feeling that there is a problem with the formatting of the email. 

 

i am very unsure as to how that is to be done...is the email portion posted above formatted correctly?

Link to comment
Share on other sites

but the query is going to be "SELECT * FROM ForumUsers WHERE email=" because email echoes nothing.

 

so, since there are no entries where email is nothing, the script is technically working right...my main question is why is $email not getting filled by the emailed link? i think that if that were to work, then everything would fall into place.

Link to comment
Share on other sites

One thing at a time......lets get this num_rows issue sorted first, then tackle the email format. Insert something...anything, into 'email' and run this query

 

$sql="SELECT * FROM ForumUsers WHERE email !=''";
$result=mysql_query($sql) or die ("Error in query" . mysql_error());// this will throw an error if there is one in the sql
$num = mysql_num_rows($result);
if ($num != 0) {
echo '$num rows found';
}
else {
echo 'no rows';
}	

Link to comment
Share on other sites

ok...bit the bullet and am not md5ing the random number in the email.  works...sort of.

 

here is my code: (located here:http://www.everkleen.biz/testforum/forum/verify.php

<?php
include ('includes/dbconnect.php');
$email=(stripslashes(htmlentities(mysql_real_escape_string($_GET['email']))));
$rand=(stripslashes(htmlentities(mysql_real_escape_string($_GET['key']))));
$sql="SELECT random FROM ForumUsers WHERE email='$email' AND random='$rand'";
$result=mysql_query($sql) or die ("Error in query" . mysql_error());// this will throw an error if there is one in the sql
$num = mysql_num_rows($result);
echo "$email<br>$rand<br>$num";
if ($num != 0) {
$finresult=(mysql_result($result));
echo "$finresult";
if ($key == $finresult) {
	$query ="UPDATE ForumUsers SET valid='1' WHERE email='$email'";
	$result = mysql_query($query) or die(mysql_error());
	echo "Thank you for validating your email, have a nice day!";
	}
else {
	echo "Something went horribly, horribly wrong.  Please <a href='mailto:admin@example.com'>CLICK HERE</a> to email the administrator.";
	}
}
else {
echo "Something went horribly, horribly wrong.  Please <a href='mailto:admin@example.com'>CLICK HERE</a> to email the administrator.";
}	

?>

 

now, when i click on the link in the email it returns:

<<<myemail>>>

9218158<-just an echo that shows the $rand in the email.

1<-the number of rows returned from the mysql query

Warning: Wrong parameter count for mysql_result() in /home/.../validate.php on line 19

Thank you for validating your email, have a nice day!

 

in the db it comes up validated...wondering if it is ok to just shut off error reporting on the page and not worry about it.  tried changing mysql_result($result) to mysql_result($result, 0) but it gets this error message:

<<<my email again>>>

9218158<-again the echo $rand

1 <-again number of rows

9218158<-this is the

Something went horribly, horribly wrong. Please CLICK HERE to email the administrator.

it doesn't change the validity...

 

also tried to have mysql_result($result, 1).  throws this:

<<<email>>>

9218158

1

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 1 on MySQL result index 3 in /home/.../validate.php on line 19

Thank you for validating your email, have a nice day!

but still validates the address...kinda confused.

Link to comment
Share on other sites

wondering if it is ok to just shut off error reporting on the page and not worry about it.

 

no. it's not working properly, so turning off error reporting will leave you with a script that isn't working properly AND isn't displaying any errors.

 

this means just what it says, and that means mysq_result() is failing and not doing anything:

 

Warning: Wrong parameter count for mysql_result() in /home/.../validate.php on line 19

Link to comment
Share on other sites

ok, but why does it mark the valid field as 1?  i assumed that it wasn't doing what it was supposed to, but in doing so it was doing what it was supposed to, which is validate the email...

 

also, if mysql_result is not doing anything, then why do i have $finresult (the mysql_result() portion of the code) echo the correct number when i have mysql_result($result, 0), but it doesn't mark the email as valid?

 

what am i doing wrong in my code here to have it not work?

Link to comment
Share on other sites

changed a few things and now it works...by the way, im an idiot...had $key instead of $rand and that was throwing the error...also am using msql_fetch_array now...seems to work very well and, ummm, i dunno, just tried using it and it worked (even though i had fixed the prob with the $key and whatnot.  i was using it when i fixed the prob, so i am not gonna change it now.)

 

also, added a piece of code to the login section that checks to make sure that a user has validated his/her email.

Link to comment
Share on other sites

more changes:

 

1.  usrsignup.php now checks for duplicate email addresses, usernames

2.  added a 2nd box to make sure passwords match

 

if anyone wants to try it out, go ahead.  any ideas/critiques are accepted, just remember: this is a work in progress.  after the login page is nothing...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.