Jump to content

help


tritus

Recommended Posts

i get error and cant seem to fix it....

Fatal error: Call to undefined function sendemail() in /home/tritusco/public_html/booktrade/register.php on line 226

 

 

heres part of my code line

 

 

 

function register($domainName)

{

include("functions/dbconn.php");

 

$sumbittime = time();

$vcode = sha1(submittime);

@mysql_query("insert into users set regtime=" . $sumbittime . ", verified='N', vcode='" . $vcode . "', fname='" . $_POST['fname'] . "', lname='" . $_POST['lname'] . "', email='" . strtolower($_POST['email']) . "', pword='" . sha1($_POST['pword']) . "', address1='" . $_POST['address1'] . "', address2='" . $_POST['address2'] . "', city='" . $_POST['city'] . "', state='" . $_POST['state'] . "', zip='" . $_POST['zip'] . "', level='U'");

 

$toName = $_POST['fname'] . ' ' . $_POST['lname'];

$toAddress = $_POST['email'];

$subject = 'Account activation email from ' . $_SESSION['domainName'];

$body = 'Thank you for registering at ' . $_SESSION['domainName'] . '. To complete registration, please go to:\n\n ' . $_SESSION['url'] . '/?page=register&email=' . $_POST['email'] . '&vcode=' . $vcode . ' \n\nThank You, \n' . $_SESSION['domainName'] . ' Administration';

$successMessage = '<br/>A confirmation email has been sent to ' . $_POST['email'] . '<br><br>Please check your email in a few minutes to complete registration.<br/><br/>Thank you,<br/><br/>' . $_SESSION['domainName'] . ' Administration</font><br/><br/><center><b>Please ensure that your email settings are set to allow emails from ' . $_SESSION['noreply'] . '</b><br/><br/><font color="#ff0000"><b>* Accounts that are not verified within 48 hours will be automatically deleted to keep the site running efficiently. *</b></font></center>';

sendemail($toName, $toAddress, $subject, $body, $successMessage);

}

Link to comment
https://forums.phpfreaks.com/topic/69119-help/
Share on other sites

i feel stupid now , that part works now my error is showing up... Email address is already in use, but its not... heres my code

 

 

<?php

session_start();

$errlist="";

 

if(isset($_POST['submit']))

{

checkerrors();

if($errlist == "")

{

checkinuse();

}

if($errlist == "") // email is not in use already

{

register($domainName);

}

else // show the form with errors, because email in use

{

showform();

}

}

else // form wasnt submitted

{

if(isset($_GET['email']) && isset($_GET['vcode'])) // following verification link

{

verifyacct();

}

else // wanting to register

{

showform();

}

}

 

 

 

function checkerrors()

{

if($_POST['fname']=="")

{ $GLOBALS['errlist'] = $GLOBALS['errlist'] . "<font color='#ff0000'><b>First Name Required<b></font><br/>";}

if($_POST['lname']=="")

{ $GLOBALS['errlist'] = $GLOBALS['errlist'] . "<font color='#ff0000'><b>Last Name Required<b></font><br/>";}

if($_POST['email']=="")

{ $GLOBALS['errlist'] = $GLOBALS['errlist'] . "<font color='#ff0000'><b>Email Address Required<b></font><br/>";}

 

if($_POST['address1'] == "")

{ $GLOBALS['errlist'] = $GLOBALS['errlist'] . "<font color='#ff0000'><b>Address Required<b></font><br/>";}

if($_POST['city'] == "")

{ $GLOBALS['errlist'] = $GLOBALS['errlist'] . "<font color='#ff0000'><b>City Required<b></font><br/>";}

if($_POST['state'] == "")

{ $GLOBALS['errlist'] = $GLOBALS['errlist'] . "<font color='#ff0000'><b>State Required<b></font><br/>";}

if($_POST['zip'] == "")

{ $GLOBALS['errlist'] = $GLOBALS['errlist'] . "<font color='#ff0000'><b>Zip Code Required</b></font><br/>";}

elseif(($_POST['zip'] < 10000 || $_POST['zip'] > 99999) && strlen($_POST['zip']) == 5)

{ $GLOBALS['errlist'] = $GLOBALS['errlist'] . "<font color='#ff0000'><b>Zip Code Must Be Numeric</b></font><br/>";}

elseif($_POST['zip'] < 10000 || $_POST['zip'] > 99999)

{ $GLOBALS['errlist'] = $GLOBALS['errlist'] . "<font color='#ff0000'><b>Zip Code Must Be 5 Digits</b></font><br/>";}

elseif(strlen($_POST['zip']) < 5 || strlen($_POST['zip']) > 5)

{ $GLOBALS['errlist'] = $GLOBALS['errlist'] . "<font color='#ff0000'><b>Zip Code Must Be Numeric</b></font><br/>";}

 

if($_POST['pword']=="")

{ $GLOBALS['errlist'] = $GLOBALS['errlist'] . "<font color='#ff0000'><b>Password Required<b></font><br/>";}

if($_POST['pver']=="")

{ $GLOBALS['errlist'] = $GLOBALS['errlist'] . "<font color='#ff0000'><b>Verify Password Required<b></font><br/>";}

if($_POST['pver']!=$_POST['pword'])

{ $GLOBALS['errlist'] = $GLOBALS['errlist'] . "<font color='#ff0000'><b>Passwords Must Match<b></font><br/>";}

 

if($GLOBALS['errlist']!="")

{ $GLOBALS['errlist'] = $GLOBALS['errlist'] . "<hr/>";}

}

 

 

function verifyacct()

{

$vcode="";

include("functions/dbconn.php");

$result = @mysql_query("select vcode, unum from users where email='" . strtolower($_GET['email']) . "'");

while($row = mysql_fetch_row($result))

{

$vcode = $row[0];

$unum = $row[1];

}

if($_GET['vcode'] == $vcode) {

mysql_query("update users set verified='Y' where email='" . strtolower($_GET['email']) . "'");

echo('Your account has been verified. You may now log in.<br/>' . $_SESSION['domainName'] . ' Administration');

}else{

echo("The verification email/verification code used does not exist. If you did not validate your account within 48 hours of registering, you must re-register.<br><br><a href='?page=verify'>Click here to return to the verification page.</a>");

}

mysql_close($link);

}

 

function showform()

{

?>

<form name="register" method="post" action="?page=register">

<?php if(@$_GET['error'] == "inuse") { ?><br/><font color="#ff0000">Registration failed, email is already registered. Please try again.<br/></font><?php } ?>

<center>

<table border="1" cellpadding="5" cellspacing="0">

<tr>

<th>User Registration</th>

</tr>

<tr>

<td>

<table border="0" cellpadding="0" cellspacing="1">

 

<!-- output any errors -->

<?php

if(strlen($GLOBALS['errlist']) > 25)

{

echo("<tr><td colspan='2'>");

echo $GLOBALS['errlist'];

echo("</td></tr>");

}

?>

 

<tr><td valign="top" align="left">First Name: </td><td valign="top" align="left"><input name ="fname" type="text" value="<?php echo(@$_POST['fname']); ?>"></td></tr>

<tr><td valign="top" align="left">Last Name: </td><td valign="top" align="left"><input name="lname" type="text" value="<?php echo(@$_POST['lname']); ?>"></td></tr>

<tr><td valign="top" align="left">Email Address: </td><td valign="top" align="left"><input name="email" type="text" value="<?php echo(@$_POST['email']); ?>"></td></tr>

 

<tr><td> </td><td> </td></tr>

 

<tr><td valign="top" align="left">Address Line 1: </td><td valign="top" align="left"><input name="address1" type="text" value="<?php echo(@$_POST['address1']); ?>"></td></tr>

<tr><td valign="top" align="left">Address Line 2: </td><td valign="top" align="left"><input name="address2" type="text" value="<?php echo(@$_POST['address2']); ?>"></td></tr>

<tr><td valign="top" align="left">City: </td><td valign="top" align="left"><input name="city" type="text" value="<?php echo(@$_POST['city']); ?>"></td></tr>

<tr><td valign="top" align="left">State: </td><td valign="top" align="left">

<select name="state">

  <option value="" selected>Choose a State</option>

  <option value="AL"<?php if($_POST['state'] == "AL") { echo(" SELECTED"); } ?>>Alabama</option>

  <option value="AK"<?php if($_POST['state'] == "AK") { echo(" SELECTED"); } ?>>Alaska</option>

  <option value="AZ"<?php if($_POST['state'] == "AZ") { echo(" SELECTED"); } ?>>Arizona</option>

 

  <option value="AR"<?php if($_POST['state'] == "AR") { echo(" SELECTED"); } ?>>Arkansas</option>

  <option value="CA"<?php if($_POST['state'] == "CA") { echo(" SELECTED"); } ?>>California</option>

  <option value="CO"<?php if($_POST['state'] == "CO") { echo(" SELECTED"); } ?>>Colorado</option>

  <option value="CT"<?php if($_POST['state'] == "CT") { echo(" SELECTED"); } ?>>Connecticut</option>

  <option value="DC"<?php if($_POST['state'] == "DC") { echo(" SELECTED"); } ?>>D.C.</option>

  <option value="DE"<?php if($_POST['state'] == "DE") { echo(" SELECTED"); } ?>>Delaware</option>

 

  <option value="FL"<?php if($_POST['state'] == "FL") { echo(" SELECTED"); } ?>>Florida</option>

  <option value="GA"<?php if($_POST['state'] == "GA") { echo(" SELECTED"); } ?>>Georgia</option>

  <option value="HI"<?php if($_POST['state'] == "HI") { echo(" SELECTED"); } ?>>Hawaii</option>

  <option value="ID"<?php if($_POST['state'] == "ID") { echo(" SELECTED"); } ?>>Idaho</option>

  <option value="IL"<?php if($_POST['state'] == "IL") { echo(" SELECTED"); } ?>>Illinois</option>

  <option value="IN"<?php if($_POST['state'] == "IN") { echo(" SELECTED"); } ?>>Indiana</option>

 

  <option value="IA"<?php if($_POST['state'] == "IA") { echo(" SELECTED"); } ?>>Iowa</option>

  <option value="KS"<?php if($_POST['state'] == "KS") { echo(" SELECTED"); } ?>>Kansas</option>

  <option value="KY"<?php if($_POST['state'] == "KY") { echo(" SELECTED"); } ?>>Kentucky</option>

  <option value="LA"<?php if($_POST['state'] == "LA") { echo(" SELECTED"); } ?>>Louisiana</option>

  <option value="ME"<?php if($_POST['state'] == "ME") { echo(" SELECTED"); } ?>>Maine</option>

  <option value="MD"<?php if($_POST['state'] == "MD") { echo(" SELECTED"); } ?>>Maryland</option>

 

  <option value="MA"<?php if($_POST['state'] == "MA") { echo(" SELECTED"); } ?>>Massachusetts</option>

  <option value="MI"<?php if($_POST['state'] == "MI") { echo(" SELECTED"); } ?>>Michigan</option>

  <option value="MN"<?php if($_POST['state'] == "MN") { echo(" SELECTED"); } ?>>Minnesota</option>

  <option value="MS"<?php if($_POST['state'] == "MS") { echo(" SELECTED"); } ?>>Mississippi</option>

  <option value="MO"<?php if($_POST['state'] == "MO") { echo(" SELECTED"); } ?>>Missouri</option>

  <option value="MT"<?php if($_POST['state'] == "MT") { echo(" SELECTED"); } ?>>Montana</option>

 

  <option value="NE"<?php if($_POST['state'] == "NE") { echo(" SELECTED"); } ?>>Nebraska</option>

  <option value="NV"<?php if($_POST['state'] == "NV") { echo(" SELECTED"); } ?>>Nevada</option>

  <option value="NH"<?php if($_POST['state'] == "NH") { echo(" SELECTED"); } ?>>New Hampshire</option>

  <option value="NJ"<?php if($_POST['state'] == "NJ") { echo(" SELECTED"); } ?>>New Jersey</option>

  <option value="NM"<?php if($_POST['state'] == "NM") { echo(" SELECTED"); } ?>>New Mexico</option>

  <option value="NY"<?php if($_POST['state'] == "NY") { echo(" SELECTED"); } ?>>New York</option>

 

  <option value="NC"<?php if($_POST['state'] == "NC") { echo(" SELECTED"); } ?>>North Carolina</option>

  <option value="ND"<?php if($_POST['state'] == "ND") { echo(" SELECTED"); } ?>>North Dakota</option>

  <option value="OH"<?php if($_POST['state'] == "OH") { echo(" SELECTED"); } ?>>Ohio</option>

  <option value="OK"<?php if($_POST['state'] == "OK") { echo(" SELECTED"); } ?>>Oklahoma</option>

  <option value="OR"<?php if($_POST['state'] == "OR") { echo(" SELECTED"); } ?>>Oregon</option>

  <option value="PA"<?php if($_POST['state'] == "PA") { echo(" SELECTED"); } ?>>Pennsylvania</option>

 

  <option value="RI"<?php if($_POST['state'] == "RI") { echo(" SELECTED"); } ?>>Rhode Island</option>

  <option value="SC"<?php if($_POST['state'] == "SC") { echo(" SELECTED"); } ?>>South Carolina</option>

  <option value="SD"<?php if($_POST['state'] == "SD") { echo(" SELECTED"); } ?>>South Dakota</option>

  <option value="TN"<?php if($_POST['state'] == "TN") { echo(" SELECTED"); } ?>>Tennessee</option>

  <option value="TX"<?php if($_POST['state'] == "TX") { echo(" SELECTED"); } ?>>Texas</option>

  <option value="UT"<?php if($_POST['state'] == "UT") { echo(" SELECTED"); } ?>>Utah</option>

 

  <option value="VT"<?php if($_POST['state'] == "VT") { echo(" SELECTED"); } ?>>Vermont</option>

  <option value="VA"<?php if($_POST['state'] == "VA") { echo(" SELECTED"); } ?>>Virginia</option>

  <option value="WA"<?php if($_POST['state'] == "WA") { echo(" SELECTED"); } ?>>Washington</option>

  <option value="WV"<?php if($_POST['state'] == "WV") { echo(" SELECTED"); } ?>>West Virginia</option>

  <option value="WI"<?php if($_POST['state'] == "WI") { echo(" SELECTED"); } ?>>Wisconsin</option>

  <option value="WY"<?php if($_POST['state'] == "WY") { echo(" SELECTED"); } ?>>Wyoming</option>

</select>

</td></tr>

<tr><td valign="top" align="left">Zip Code: </td><td valign="top" align="left"><input name="zip" type="text" value="<?php echo(@$_POST['zip']); ?>"></td></tr>

 

<tr><td> </td><td> </td></tr>

 

<tr><td valign="top" align="left">Password: </td><td valign="top" align="left"><input name="pword" type="password"></td></tr>

<tr><td valign="top" align="left">Verify Password: </td><td valign="top" align="left"><input name="pver" type="password"></td></tr>

<tr><td colspan="2" align="center"><br/><input type="submit" name="submit" value="Submit Registration"></td></tr>

<tr><td colspan="2" align="center"><?php echo('<br/><b>Please ensure that your email settings are set to allow emails from ' . $_SESSION['noreply'] . '</b>'); ?></td></tr>

</table>

</td>

</tr>

</table>

</center>

</form>

<?php

}

 

function checkinuse()

{

include("functions/dbconn.php");

$result = @mysql_query("select email from users where email='" . strtolower($_POST['email']) . "'");

while($row = mysql_fetch_row($result)) {

$GLOBALS['errlist'] = $GLOBALS['errlist'] . "<font color='#ff0000'><b>Email Address Already Registered</b></font><br/><hr/>";

}

}

 

function register($domainName)

{

include("functions/dbconn.php");

 

$sumbittime = time();

$vcode = sha1(submittime);

@mysql_query("insert into users set regtime=" . $sumbittime . ", verified='N', vcode='" . $vcode . "', fname='" . $_POST['fname'] . "', lname='" . $_POST['lname'] . "', email='" . strtolower($_POST['email']) . "', pword='" . sha1($_POST['pword']) . "', address1='" . $_POST['address1'] . "', address2='" . $_POST['address2'] . "', city='" . $_POST['city'] . "', state='" . $_POST['state'] . "', zip='" . $_POST['zip'] . "', level='U'");

 

$toName = $_POST['fname'] . ' ' . $_POST['lname'];

$toAddress = $_POST['email'];

$subject = 'Account activation email from ' . $_SESSION['domainName'];

$body = 'Thank you for registering at ' . $_SESSION['domainName'] . '. To complete registration, please go to:\n\n ' . $_SESSION['url'] . '/?page=register&email=' . $_POST['email'] . '&vcode=' . $vcode . ' \n\nThank You, \n' . $_SESSION['domainName'] . ' Administration';

$successMessage = '<br/>A confirmation email has been sent to ' . $_POST['email'] . '<br><br>Please check your email in a few minutes to complete registration.<br/><br/>Thank you,<br/><br/>' . $_SESSION['domainName'] . ' Administration</font><br/><br/><center><b>Please ensure that your email settings are set to allow emails from ' . $_SESSION['noreply'] . '</b><br/><br/><font color="#ff0000"><b>* Accounts that are not verified within 48 hours will be automatically deleted to keep the site running efficiently. *</b></font></center>';

mail($toName, $toAddress, $subject, $body, $successMessage);

}

?>

Link to comment
https://forums.phpfreaks.com/topic/69119-help/#findComment-347428
Share on other sites

Try changing this:

 

<?php

while($row = mysql_fetch_row($result)) {
   $GLOBALS['errlist'] = $GLOBALS['errlist'] . "<font color='#ff0000'>Email Address Already
   Registered</font>";
}

?>

 

To:

 

<?php

if (mysql_num_rows($result) > 0){
   $GLOBALS['errlist'] = $GLOBALS['errlist'] . "<font color='#ff0000'>Email Address Already  
   Registered</font>";
}

?>

Link to comment
https://forums.phpfreaks.com/topic/69119-help/#findComment-347438
Share on other sites

i am getting this error

 

 

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/tritusco/public_html/booktrade/register.php on line 209

 

 

this is my code

 

<?php

}

 

function checkinuse()

{

include("functions/dbconn.php");

$result = @mysql_query("select email from users where email='" . strtolower($_POST['email']) . "'");

 

while($row = mysql_fetch_row($result)) {

  $GLOBALS['errlist'] = $GLOBALS['errlist'] . "<font color='#ff0000'>Email Address Already

  Registered</font>";

}}

 

function register($domainName)

{

include("functions/dbconn.php");

 

$sumbittime = time();

$vcode = sha1(submittime);

@mysql_query("insert into users set regtime=" . $sumbittime . ", verified='N', vcode='" . $vcode . "', fname='" . $_POST['fname'] . "', lname='" . $_POST['lname'] . "', email='" . strtolower($_POST['email']) . "', pword='" . sha1($_POST['pword']) . "', address1='" . $_POST['address1'] . "', address2='" . $_POST['address2'] . "', city='" . $_POST['city'] . "', state='" . $_POST['state'] . "', zip='" . $_POST['zip'] . "', level='U'");

 

$toName = $_POST['fname'] . ' ' . $_POST['lname'];

$toAddress = $_POST['email'];

$subject = 'Account activation email from ' . $_SESSION['domainName'];

$body = 'Thank you for registering at ' . $_SESSION['domainName'] . '. To complete registration, please go to:\n\n ' . $_SESSION['url'] . '/?page=register&email=' . $_POST['email'] . '&vcode=' . $vcode . ' \n\nThank You, \n' . $_SESSION['domainName'] . ' Administration';

$successMessage = '<br/>A confirmation email has been sent to ' . $_POST['email'] . '<br><br>Please check your email in a few minutes to complete registration.<br/><br/>Thank you,<br/><br/>' . $_SESSION['domainName'] . ' Administration</font><br/><br/><center><b>Please ensure that your email settings are set to allow emails from ' . $_SESSION['noreply'] . '</b><br/><br/><font color="#ff0000"><b>* Accounts that are not verified within 48 hours will be automatically deleted to keep the site running efficiently. *</b></font></center>';

mail($toName, $toAddress, $subject, $body, $successMessage);

}

?>

Link to comment
https://forums.phpfreaks.com/topic/69119-help/#findComment-347461
Share on other sites

That means there is something wrong with one of your queries. You need to put

or die(mysql_error());

at the end of all of your queries, that will tell you the error. You also need to remove the '@' symbols, that is keeping the errors from displaying.

Link to comment
https://forums.phpfreaks.com/topic/69119-help/#findComment-347463
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.