NameSilo

Need PHP help!

Spaceship Spaceship
Watch

TwiztedFake

Established Member
Impact
1
I am getting the following error:

Parse error: parse error, unexpected T_VARIABLE in /home/kmcustom/public_html/vdn/ring/process.php on line 109

PHP:
<?

require("config.php");

if($_POST["action"]=="submit")
	{
		$added=$_POST['added'];
		$password=$_POST['password'];
		$name=$_POST['name'];
		$email=$_POST['email'];
		$site_name=$_POST['site_name'];
		$url=$_POST['url'];
		$description=$_POST['description'];

		$sql = "INSERT INTO $db_table (added, password, name, email, site_name, url, description) VALUES ('$added', '$password', '$name', '$email', '$site_name', '$url', '$description')";
		$result = mysql_query($sql);

		$sql = "SELECT * FROM $db_table ORDER BY id DESC LIMIT 1";
		$result = mysql_query ($sql);
		while ($row = mysql_fetch_array($result))
			{
				$id = $row['id'];
				$password = $_POST['password'];
				$to = $_POST['email'];
				$from = "From: $admin_email";
				$subject = "$ring_name Submission";
				$message = "Thanks for joining the $ring_name webring!  Here is your login info, keep this in a safe place!\n\nSite ID: $id\nPassword: $password\n\nDon't forget to put up the ring code on your site as soon as possible!  You will not be added to the ring until I find the ring code on your site.\n\nHere's the code:\n\n<a href='$ring_url/webring.php?id=$id&action=prev'><</a> <a href='$ring_url/webring.php?action=rand'>?</a> <a href='$ring_url/webring.php?action=home'>$ring_name</a> <a href='$ring_url/webring.php?action=list'>#</a> <a href='$ring_url/webring.php?id=$id&action=next'>></a>\n\nThanks!\n$admin_name\n$ring_url";
				$name = $_POST['name'];
				$url = $_POST['url'];
				$admin_message = "$name has joined $ring_name!  To check this site for your ring code, go to:\n$url\n\nTo approve this new site, go to:\n$ring_url/process.php?id=$id&action=approve\n\nAlternatively, to remove this site, go to:\n$ring_url/process.php?id=$id&action=remove";
				if(mail($to,$subject,$message,$from))
					{
						mail($admin_email,$subject,$admin_message,"From: $to");
						print"<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";
						echo "Thanks for your submission!  We're taking you back to the main page!";
					}
				else
					{
						echo "There was a problem with your submission. Please check that you filled in the form correctly.";
					}
			}
	}

elseif($_POST["action"]=="modify")
	{
		$sql = "SELECT * FROM $db_table WHERE id=$id";
		$result = mysql_query($sql);
		while ($row = mysql_fetch_array($result))
			{
				$password1 = $row['password'];
				$password2 = $_POST['password'];

				if($password1 == $password2)
					{
						mysql_query("UPDATE $db_table SET name='$name', email='$email', site_name='$site_name', url='$url', description='$description' WHERE id='$id'");
						print"<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";
						echo "Thanks for your modification!  We're taking you back to the main page!";
					}

				else
					{
						echo "There was a problem with your submission. Please check that you filled in the form correctly.";
					}
			}
	}

elseif($_POST["action"]=="remove")
	{
		$sql = "SELECT * FROM $db_table WHERE id=$id";
		$result = mysql_query($sql);
		while ($row = mysql_fetch_array($result))
			{
				$password1 = $row['password'];
				$password2 = $_POST['password'];

				$to = $row['email'];
				$url = $row['url'];

				if($password1 == $password2)
					{
						mysql_query("DELETE FROM $db_table WHERE id=$id");

						$from = "From: $admin_email";
						$subject = "Site Deleted From $ring_name";
						$message = "Your site has been deleted from $ring_name upon your request.  Sorry you decided to go!\n\n$admin_name\n$index_php";
						$admin_message = "The site located at $url has been deleted upon the owner's request.";
						if(mail($to,$subject,$message,$from))
							{
								mail($admin_email,$subject,$admin_message,"From: $to");
								print"<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";
								echo "You've been deleted from $ring_name.  Sorry to see you go!";
							}
						else
							{
								echo "There was a problem with your submission. Please check that you filled in the form correctly.";
							}
					}

				else
					{
						echo "There was a problem with your submission. Please check that you filled in the form correctly.";
					}
			}
	}

elseif($_POST["action"]=="approve")
	{
		$id = $_POST['id']
		$sql = "SELECT * FROM $db_table WHERE id $id";   //LINE 109
		$result = mysql_query($sql);
		while ($row = mysql_fetch_array($result))
			{
				$to = $row['email'];
				$subject = "$ring_name Approval";
				$message = "Your site has been approved in the $ring_name webring!  Thanks for joining!\n\n$admin_name\n$index_php";

				if($_POST['password'] == $admin_password)
					{
						mysql_query("UPDATE $db_table SET queue='1' WHERE id=$id");
						print "<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";
						echo "Thanks for your approval!  We're taking you back to the main page!";
						mail($to,$subject,$message,"From: $admin_email");
					}
				else
					{
						echo "Wrong password.";
					}
			}
	}

elseif($_POST["action"]=="delete")
	{
		$id = $_POST['id']
		$sql = "SELECT * FROM $db_table WHERE id=$id";
		$result = mysql_query($sql);
		while ($row = mysql_fetch_array($result));
			{
				$to = $row['email'];
				$site = $row['site_name'];
				$subject = "$ring_name Deletion";
				$message = "Your site has been deleted from the $ring_name webring!  If you have any questions about why your site was deleted, respond to this email.\n\n$admin_name\n$index_php";

				if($_POST['password'] == $admin_password)
					{
						mysql_query("DELETE FROM $db_table WHERE id=$id");
						print "<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";
						echo "$site has been deleted from the webring!";
						mail($to,$subject,$message,"From: $admin_email");
					}
				else
					{
						echo "Wrong password.";
					}
			}
	}

elseif($_GET["action"]=="approve")
	{
		echo "Please enter your admin approval password:<br><br><form method=\"post\" action=\"$PHP_SELF\"><input type=\"hidden\" name=\"id\" value=\"$id\"><input type=\"password\" name=\"password\"><input type=\"submit\" name=\"action\" value=\"approve\"></form>";
	}

elseif($_GET["action"]=="remove")
	{
		echo "Please enter your admin removal password:<br><br><form method=\"post\" action=\"$PHP_SELF\"><input type=\"hidden\" name=\"id\" value=\"$id\"><input type=\"password\" name=\"password\"><input type=\"submit\" name=\"action\" value=\"delete\"></form>";
	}

else
	{
		echo "No variable passed.";
	}

?>

Does anybody see anything wrong?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Above line 109 you forgot a ;

$id = $_POST['id'];

Put that above 109...
 
0
•••
Changed that and getting a new error.

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/kmcustom/public_html/vdn/ring/process.php on line 136

PHP:
<?



require("config.php");



if($_POST["action"]=="submit")

	{

		$added=$_POST['added'];

		$password=$_POST['password'];

		$name=$_POST['name'];

		$email=$_POST['email'];

		$site_name=$_POST['site_name'];

		$url=$_POST['url'];

		$description=$_POST['description'];



		$sql = "INSERT INTO $db_table (added, password, name, email, site_name, url, description) VALUES ('$added', '$password', '$name', '$email', '$site_name', '$url', '$description')";

		$result = mysql_query($sql);



		$sql = "SELECT * FROM $db_table ORDER BY id DESC LIMIT 1";

		$result = mysql_query ($sql);

		while ($row = mysql_fetch_array($result))

			{

				$id = $row['id'];

				$password = $_POST['password'];

				$to = $_POST['email'];

				$from = "From: $admin_email";

				$subject = "$ring_name Submission";

				$message = "Thanks for joining the $ring_name webring!  Here is your login info, keep this in a safe place!\n\nSite ID: $id\nPassword: $password\n\nDon't forget to put up the ring code on your site as soon as possible!  You will not be added to the ring until I find the ring code on your site.\n\nHere's the code:\n\n<a href='$ring_url/webring.php?id=$id&action=prev'><</a> <a href='$ring_url/webring.php?action=rand'>?</a> <a href='$ring_url/webring.php?action=home'>$ring_name</a> <a href='$ring_url/webring.php?action=list'>#</a> <a href='$ring_url/webring.php?id=$id&action=next'>></a>\n\nThanks!\n$admin_name\n$ring_url";

				$name = $_POST['name'];

				$url = $_POST['url'];

				$admin_message = "$name has joined $ring_name!  To check this site for your ring code, go to:\n$url\n\nTo approve this new site, go to:\n$ring_url/process.php?id=$id&action=approve\n\nAlternatively, to remove this site, go to:\n$ring_url/process.php?id=$id&action=remove";

				if(mail($to,$subject,$message,$from))

					{

						mail($admin_email,$subject,$admin_message,"From: $to");

						print"<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";

						echo "Thanks for your submission!  We're taking you back to the main page!";

					}

				else

					{

						echo "There was a problem with your submission. Please check that you filled in the form correctly.";

					}

			}

	}



elseif($_POST["action"]=="modify")

	{

		$sql = "SELECT * FROM $db_table WHERE id=$id";

		$result = mysql_query($sql);

		while ($row = mysql_fetch_array($result))

			{

				$password1 = $row['password'];

				$password2 = $_POST['password'];



				if($password1 == $password2)

					{

						mysql_query("UPDATE $db_table SET name='$name', email='$email', site_name='$site_name', url='$url', description='$description' WHERE id='$id'");

						print"<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";

						echo "Thanks for your modification!  We're taking you back to the main page!";

					}



				else

					{

						echo "There was a problem with your submission. Please check that you filled in the form correctly.";

					}

			}

	}



elseif($_POST["action"]=="remove")

	{

		$sql = "SELECT * FROM $db_table WHERE id=$id";

		$result = mysql_query($sql);

		while ($row = mysql_fetch_array($result))

			{

				$password1 = $row['password'];

				$password2 = $_POST['password'];



				$to = $row['email'];

				$url = $row['url'];



				if($password1 == $password2)

					{

						mysql_query("DELETE FROM $db_table WHERE id=$id");



						$from = "From: $admin_email";

						$subject = "Site Deleted From $ring_name";

						$message = "Your site has been deleted from $ring_name upon your request.  Sorry you decided to go!\n\n$admin_name\n$index_php";

						$admin_message = "The site located at $url has been deleted upon the owner's request.";

						if(mail($to,$subject,$message,$from))

							{

								mail($admin_email,$subject,$admin_message,"From: $to");

								print"<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";

								echo "You've been deleted from $ring_name.  Sorry to see you go!";

							}

						else

							{

								echo "There was a problem with your submission. Please check that you filled in the form correctly.";

							}

					}



				else

					{

						echo "There was a problem with your submission. Please check that you filled in the form correctly.";

					}

			}

	}



elseif($_POST["action"]=="approve")

	{

		$id = $_POST['id'];

		$sql = "SELECT * FROM $db_table WHERE id $id";

		$result = mysql_query($sql);

		while ($row = mysql_fetch_array($result))

			{

				$to = $row['email'];

				$subject = "$ring_name Approval";

				$message = "Your site has been approved in the $ring_name webring!  Thanks for joining!\n\n$admin_name\n$index_php";



				if($_POST['password'] == $admin_password)

					{

						mysql_query("UPDATE $db_table SET queue='1' WHERE id=$id");

						print "<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";

						echo "Thanks for your approval!  We're taking you back to the main page!";

						mail($to,$subject,$message,"From: $admin_email");

					}

				else

					{

						echo "Wrong password.";

					}

			}

	}



elseif($_POST["action"]=="delete")

	{

		$id = $_POST['id'];

		$sql = "SELECT * FROM $db_table WHERE id=$id";

		$result = mysql_query($sql);

		while ($row = mysql_fetch_array($result));  //LINE 136

			{

				$to = $row['email'];

				$site = $row['site_name'];

				$subject = "$ring_name Deletion";

				$message = "Your site has been deleted from the $ring_name webring!  If you have any questions about why your site was deleted, respond to this email.\n\n$admin_name\n$index_php";



				if($_POST['password'] == $admin_password)

					{

						mysql_query("DELETE FROM $db_table WHERE id=$id");

						print "<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";

						echo "$site has been deleted from the webring!";

						mail($to,$subject,$message,"From: $admin_email");

					}

				else

					{

						echo "Wrong password.";

					}

			}

	}



elseif($_GET["action"]=="approve")

	{

		echo "Please enter your admin approval password:<br><br><form method=\"post\" action=\"$PHP_SELF\"><input type=\"hidden\" name=\"id\" value=\"$id\"><input type=\"password\" name=\"password\"><input type=\"submit\" name=\"action\" value=\"approve\"></form>";

	}



elseif($_GET["action"]=="remove")

	{

		echo "Please enter your admin removal password:<br><br><form method=\"post\" action=\"$PHP_SELF\"><input type=\"hidden\" name=\"id\" value=\"$id\"><input type=\"password\" name=\"password\"><input type=\"submit\" name=\"action\" value=\"delete\"></form>";

	}



else

	{

		echo "No variable passed.";

	}



?>
 
0
•••
Check what $db_table and $_POST['id'] are, make sure they are properly set and they actually have things in them, if one of them is blank then it won't work.
 
0
•••
Not sure if this will help any but here is the page that this file runs on.
http://www.kmcustoms.com/vdn/ring/index.php

When someone fills out the form they are assigned an ID number. Which is saved to the $db_table. This part is working correctly, checked the table for data via myadmin and there is data.

After that it sends me an email to approve the information. When I go to approve it via my browser at http://www.kmcustoms.com/vdn/ring/process.php?action=approve&id=4 it doesn't work. Check it for yourself. Temporary password for this is test.
 
0
•••
put a @ before the mysql_fetch_array()
like @mysql_fetch_array():
sometimes it works cause your mysql version (if i'm not mistaken)
 
0
•••
The @ before a function supresses error output - net exacly what you want..

What you should with ANY database query, is add a die fucntion if the query fails. That way you can see why the database spit it out. It looks like this:

PHP:
$sql = "some sql here . . .";
$result = mysql_query($sql)) or die("Database Error: " . mysql_error());

-Bob
 
0
•••
This could pertain to your problem (as for the approval problem):
Line: 217
PHP:
  $sql = "SELECT * FROM $db_table WHERE id $id";

When it should be:
PHP:
  $sql = "SELECT * FROM $db_table WHERE id=$id";

I'll look over it again here in a min
 
0
•••
Added the die funcution to every function and now getting this for every action I try.

Database Error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

SecondVersion, thanks I missed that I corrected in my file.

Don't know if this would help or not.
PHP version 4.3.10
MySQL version 4.0.25-standard
 
0
•••
post the full revised code and I will take a quick look at it and show you the problem.
 
0
•••
Updated Code:
PHP:
<?

require("config.php");

if($_POST["action"]=="submit")
	{
		$added=$_POST['added'];
		$password=$_POST['password'];
		$name=$_POST['name'];
		$email=$_POST['email'];
		$site_name=$_POST['site_name'];
		$url=$_POST['url'];
		$description=$_POST['description'];

		$sql = "INSERT INTO $db_table (added, password, name, email, site_name, url, description) VALUES ('$added', '$password', '$name', '$email', '$site_name', '$url', '$description')";
		$result = mysql_query($sql);

		$sql = "SELECT * FROM $db_table ORDER BY id DESC LIMIT 1";
		$result = mysql_query ($sql);
		while ($row = mysql_fetch_array($result))
			{
				$id = $row['id'];
				$password = $_POST['password'];
				$to = $_POST['email'];
				$from = "From: $admin_email";
				$subject = "$ring_name Submission";
				$message = "Thanks for joining the $ring_name webring!  Here is your login info, keep this in a safe place!\n\nSite ID: $id\nPassword: $password\n\nDon't forget to put up the ring code on your site as soon as possible!  You will not be added to the ring until I find the ring code on your site.\n\nHere's the code:\n\n<a href='$ring_url/webring.php?id=$id&action=prev'><</a> <a href='$ring_url/webring.php?action=rand'>?</a> <a href='$ring_url/webring.php?action=home'>$ring_name</a> <a href='$ring_url/webring.php?action=list'>#</a> <a href='$ring_url/webring.php?id=$id&action=next'>></a>\n\nThanks!\n$admin_name\n$ring_url";
				$name = $_POST['name'];
				$url = $_POST['url'];
				$admin_message = "$name has joined $ring_name!  To check this site for your ring code, go to:\n$url\n\nTo approve this new site, go to:\n$ring_url/process.php?id=$id&action=approve\n\nAlternatively, to remove this site, go to:\n$ring_url/process.php?id=$id&action=remove";
				if(mail($to,$subject,$message,$from))
					{
						mail($admin_email,$subject,$admin_message,"From: $to");
						print"<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";
						echo "Thanks for your submission!  We're taking you back to the main page!";
					}
				else
					{
						echo "There was a problem with your submission. Please check that you filled in the form correctly.";
					}
			}
	}

elseif($_POST["action"]=="modify")
	{
		$sql = "SELECT * FROM $db_table WHERE id=$id";
		$result = mysql_query($sql) or die("Database Error:" . mysql_error());
		while ($row = mysql_fetch_array($result))
			{
				$password1 = $row['password'];
				$password2 = $_POST['password'];

				if($password1 == $password2)
					{
						mysql_query("UPDATE $db_table SET name='$name', email='$email', site_name='$site_name', url='$url', description='$description' WHERE id='$id'");
						print"<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";
						echo "Thanks for your modification!  We're taking you back to the main page!";
					}

				else
					{
						echo "There was a problem with your submission. Please check that you filled in the form correctly.";
					}
			}
	}

elseif($_POST["action"]=="remove")
	{
		$sql = "SELECT * FROM $db_table WHERE id=$id";
		$result = mysql_query($sql) or die("Database Error:" . mysql_error());
		while ($row = mysql_fetch_array($result))
			{
				$password1 = $row['password'];
				$password2 = $_POST['password'];

				$to = $row['email'];
				$url = $row['url'];

				if($password1 == $password2)
					{
						mysql_query("DELETE FROM $db_table WHERE id=$id");

						$from = "From: $admin_email";
						$subject = "Site Deleted From $ring_name";
						$message = "Your site has been deleted from $ring_name upon your request.  Sorry you decided to go!\n\n$admin_name\n$index_php";
						$admin_message = "The site located at $url has been deleted upon the owner's request.";
						if(mail($to,$subject,$message,$from))
							{
								mail($admin_email,$subject,$admin_message,"From: $to");
								print"<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";
								echo "You've been deleted from $ring_name.  Sorry to see you go!";
							}
						else
							{
								echo "There was a problem with your submission. Please check that you filled in the form correctly.";
							}
					}

				else
					{
						echo "There was a problem with your submission. Please check that you filled in the form correctly.";
					}
			}
	}

elseif($_POST["action"]=="approve")
	{
		$id = $_POST['id'];
		$sql = "SELECT * FROM $db_table WHERE id=$id";
		$result = mysql_query($sql) or die("Database Error:" . mysql_error());
		while ($row = mysql_fetch_array($result))
			{
				$to = $row['email'];
				$subject = "$ring_name Approval";
				$message = "Your site has been approved for the $ring_name webring!  Thanks for joining!\n\n$admin_name\n$index_php";

				if($_POST['password'] == $admin_password)
					{
						mysql_query("UPDATE $db_table SET queue='1' WHERE id=$id");
						print "<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";
						echo "Thanks for your approval!  We're taking you back to the main page!";
						mail($to,$subject,$message,"From: $admin_email");
					}
				else
					{
						echo "Wrong password.";
					}
			}
	}

elseif($_POST["action"]=="delete")
	{
		$id = $_POST['id'];
		$sql = "SELECT * FROM $db_table WHERE id=$id";
		$result = mysql_query($sql) or die("Database Error:" . mysql_error());
		while ($row = mysql_fetch_array($result));  //LINE 136
			{
				$to = $row['email'];
				$site = $row['site_name'];
				$subject = "$ring_name Deletion";
				$message = "Your site has been deleted from the $ring_name webring!  If you have any questions about why your site was deleted, respond to this email.\n\n$admin_name\n$index_php";

				if($_POST['password'] == $admin_password)
					{
						mysql_query("DELETE FROM $db_table WHERE id=$id");
						print "<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";
						echo "$site has been deleted from the webring!";
						mail($to,$subject,$message,"From: $admin_email");
					}
				else
					{
						echo "Wrong password.";
					}
			}
	}

elseif($_GET["action"]=="approve")
	{
		echo "Please enter your admin approval password:<br><br><form method=\"post\" action=\"$PHP_SELF\"><input type=\"hidden\" name=\"id\" value=\"$id\"><input type=\"password\" name=\"password\"><input type=\"submit\" name=\"action\" value=\"approve\"></form>";
	}

elseif($_GET["action"]=="remove")
	{
		echo "Please enter your admin removal password:<br><br><form method=\"post\" action=\"$PHP_SELF\"><input type=\"hidden\" name=\"id\" value=\"$id\"><input type=\"password\" name=\"password\"><input type=\"submit\" name=\"action\" value=\"delete\"></form>";
	}

else
	{
		echo "No variable passed.";
	}

?>
 
0
•••
Made a few changes, and here is the code that I came up with...don't remember all the changes but try this:

PHP:
<?

require("config.php");

if($_POST["action"] == "submit")
{
  $added = $_POST['added'];
  $password = $_POST['password'];
  $name = $_POST['name'];
  $email = $_POST['email'];
  $site_name = $_POST['site_name'];
  $url = $_POST['url'];
  $description = $_POST['description'];

  $q = mysql_query("INSERT INTO ".$db_table." (added, password, name, email, site_name, url, description) VALUES ('$added', '$password', '$name', '$email', '$site_name', '$url', '$description')");

  $sql = mysql_query("SELECT * FROM ".$db_table." ORDER BY id DESC LIMIT 1");

  while($row = mysql_fetch_array($sql))
  {
    $id = $row['id'];
    $password = $_POST['password'];
    $to = $_POST['email'];
    $from = "From: $admin_email";
    $subject = "$ring_name Submission";
    $message = "Thanks for joining the $ring_name webring!  Here is your login info, keep this in a safe place!\n\nSite ID: $id\nPassword: $password\n\nDon't forget to put up the ring code on your site as soon as possible!  You will not be added to the ring until I find the ring code on your site.\n\nHere's the code:\n\n<a href='$ring_url/webring.php?id=$id&action=prev'><</a> <a href='$ring_url/webring.php?action=rand'>?</a> <a href='$ring_url/webring.php?action=home'>$ring_name</a> <a href='$ring_url/webring.php?action=list'>#</a> <a href='$ring_url/webring.php?id=$id&action=next'>></a>\n\nThanks!\n$admin_name\n$ring_url";
    $name = $_POST['name'];
    $url = $_POST['url'];
    $admin_message = "$name has joined $ring_name!  To check this site for your ring code, go to:\n$url\n\nTo approve this new site, go to:\n$ring_url/process.php?id=$id&action=approve\n\nAlternatively, to remove this site, go to:\n$ring_url/process.php?id=$id&action=remove";
    if(mail($to, $subject, $message, $from))
    {
      mail($admin_email, $subject, $admin_message, "From: $to");
      print"<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";
      echo "Thanks for your submission! We're taking you back to the main page!";
    }
    else
    {
      echo "There was a problem with your submission. Please check that you filled in the form correctly.";
    }
  }
}

elseif($_POST["action"] == "modify")
{
  $sql = mysql_query("SELECT * FROM ".$db_table." WHERE id='$id'") or die("Database Error:" . mysql_error());

  while($row = mysql_fetch_array($sql))
  {
    $password1 = $row['password'];
    $password2 = $_POST['password'];
    if($password1 == $password2)
    {
      mysql_query("UPDATE ".$db_table." SET name='$name', email='$email', site_name='$site_name', url='$url', description='$description' WHERE id='$id'") or die("Error: ".mysql_error());
      print"<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";
      echo "Thanks for your modification!  We're taking you back to the main page!";
    }
    else
    {
      echo "There was a problem with your submission. Please check that you filled in the form correctly.";
    }
  }
}

elseif($_POST["action"] == "remove")
{
  $sql = mysql_query("SELECT * FROM ".$db_table." WHERE id='$id'") or die("Database Error: ".mysql_error());

  while($row = mysql_fetch_array($sql))
  {
    $password1 = $row['password'];
    $password2 = $_POST['password'];

    $to = $row['email'];
    $url = $row['url'];

    if($password1 == $password2)
    {
      mysql_query("DELETE FROM ".$db_table." WHERE id='$id'");
      $from = "From: $admin_email";
      $subject = "Site Deleted From $ring_name";
      $message = "Your site has been deleted from $ring_name upon your request. Sorry you decided to go!\n\n$admin_name\n$index_php";
      $admin_message = "The site located at $url has been deleted upon the owner's request.";
      if(mail($to, $subject, $message, $from))
      {
        mail($admin_email, $subject, $admin_message, "From: $to");
        print"<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";
        echo "You've been deleted from $ring_name.  Sorry to see you go!";
      }
      else
      {
        echo "There was a problem with your submission. Please check that you filled in the form correctly.";
      }
    }
    else
    {
      echo "There was a problem with your submission. Please check that you filled in the form correctly.";
    }
  }
}

elseif($_POST["action"] == "approve")
{
  $id = $_POST['id'];
  $sql = mysql_query("SELECT * FROM ".$db_table." WHERE id='$id'") or die("Database Error:" . mysql_error());

  while($row = mysql_fetch_array($sql))
  {
    $to = $row['email'];
    $subject = "$ring_name Approval";
    $message = "Your site has been approved for the $ring_name webring! Thanks for joining!\n\n$admin_name\n$index_php";

    if($_POST['password'] == $admin_password)
    {
      mysql_query("UPDATE ".$db_table." SET queue='1' WHERE id='$id'");
      print "<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";
      echo "Thanks for your approval!  We're taking you back to the main page!";
      mail($to, $subject, $message, "From: $admin_email");
    }
    else
    {
      echo "Wrong password.";
    }
  }
}

elseif($_POST["action"] == "delete")
{
  $id = $_POST['id'];
  $sql = mysql_query("SELECT * FROM ".$db_table." WHERE id='$id'") or die("Database Error:" . mysql_error());

  while($row = mysql_fetch_array($sql));
  {
    $to = $row['email'];
    $site = $row['site_name'];
    $subject = "$ring_name Deletion";
    $message = "Your site has been deleted from the $ring_name webring!  If you have any questions about why your site was deleted, respond to this email.\n\n$admin_name\n$index_php";

    if($_POST['password'] == $admin_password)
    {
      mysql_query("DELETE FROM ".$db_table." WHERE id='$id'");
      print "<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"3; URL=$index_php\">";
      echo "$site has been deleted from the webring!";
      mail($to, $subject, $message, "From: $admin_email");
    }
    else
    {
      echo "Wrong password.";
    }
  }
}

elseif($_GET["action"] == "approve")
{
  echo "Please enter your admin approval password:<br><br><form method=\"post\" action=\"$PHP_SELF\"><input type=\"hidden\" name=\"id\" value=\"$id\"><input type=\"password\" name=\"password\"><input type=\"submit\" name=\"action\" value=\"approve\"></form>";
}

elseif($_GET["action"] == "remove")
{
  echo "Please enter your admin removal password:<br><br><form method=\"post\" action=\"$PHP_SELF\"><input type=\"hidden\" name=\"id\" value=\"$id\"><input type=\"password\" name=\"password\"><input type=\"submit\" name=\"action\" value=\"delete\"></form>";
}
else
{
  echo "No variable passed.";
}
?>
 
0
•••
I tried and it still didn't work. I'm scratching this project and starting over. Going to get rid of a few options for now so that it works. Then I'll make addons to replace what options I removed from the original.
 
0
•••
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Appraise.net
Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back