NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Need PHP help!

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 11-14-2005, 10:51 PM THREAD STARTER               #1 (permalink)
NamePros Regular
 
TwiztedFake's Avatar
Join Date: Apr 2004
Location: IL
Posts: 348
TwiztedFake is on a distinguished road
 



Need PHP help!


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 Code:
<?

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'];
????: NamePros.com http://www.namepros.com/programming/140150-need-php-help.html
                
$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
                    {
????: NamePros.com http://www.namepros.com/showthread.php?t=140150
                        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?
__________________
-TwiztedFake-
RTard Tutorials
Digital-Dummy to Total-Techie
TwiztedFake is offline  
Old 11-15-2005, 01:10 AM   #2 (permalink)
The original NP Emo Kid
 
liam_d's Avatar
Join Date: Jan 2005
Location: Plymouth, UK
Posts: 1,693
liam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to all
 




Above line 109 you forgot a ;

$id = $_POST['id'];

Put that above 109...
liam_d is offline  
Old 11-15-2005, 10:24 AM THREAD STARTER               #3 (permalink)
NamePros Regular
 
TwiztedFake's Avatar
Join Date: Apr 2004
Location: IL
Posts: 348
TwiztedFake is on a distinguished road
 



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 Code:
<?



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.";

                    }
????: NamePros.com http://www.namepros.com/showthread.php?t=140150

            }

    }



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";
????: NamePros.com http://www.namepros.com/showthread.php?t=140150



                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.";

    }



?>
__________________
-TwiztedFake-
RTard Tutorials
Digital-Dummy to Total-Techie
TwiztedFake is offline  
Old 11-15-2005, 10:36 AM   #4 (permalink)
The original NP Emo Kid
 
liam_d's Avatar
Join Date: Jan 2005
Location: Plymouth, UK
Posts: 1,693
liam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to all
 




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.
liam_d is offline  
Old 11-15-2005, 11:43 AM THREAD STARTER               #5 (permalink)
NamePros Regular
 
TwiztedFake's Avatar
Join Date: Apr 2004
Location: IL
Posts: 348
TwiztedFake is on a distinguished road
 



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.
????: NamePros.com http://www.namepros.com/showthread.php?t=140150

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/pr...n=approve&id=4 it doesn't work. Check it for yourself. Temporary password for this is test.
__________________
-TwiztedFake-
RTard Tutorials
Digital-Dummy to Total-Techie
TwiztedFake is offline  
Old 11-15-2005, 11:50 AM   #6 (permalink)
JFS
NamePros Regular
 
JFS's Avatar
Join Date: Oct 2005
Location: Portugal
Posts: 886
JFS has much to be proud ofJFS has much to be proud ofJFS has much to be proud ofJFS has much to be proud ofJFS has much to be proud ofJFS has much to be proud ofJFS has much to be proud ofJFS has much to be proud ofJFS has much to be proud of
 



put a @ before the mysql_fetch_array()
like @mysql_fetch_array():
sometimes it works cause your mysql version (if i'm not mistaken)
__________________
João Fernandes Silva
Free Resources - Image Hosting - Allergy Info
Hosting - NP-Hosting.com - in beta, accepting orders
JFS is offline  
Old 11-15-2005, 01:01 PM   #7 (permalink)
NamePros Regular
 
moondog's Avatar
Join Date: Jun 2004
Posts: 563
moondog is a name known to allmoondog is a name known to allmoondog is a name known to allmoondog is a name known to allmoondog is a name known to allmoondog is a name known to allmoondog is a name known to allmoondog is a name known to all
 



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 Code:
$sql "some sql here . . .";
$result mysql_query($sql)) or die("Database Error: " mysql_error()); 
????: NamePros.com http://www.namepros.com/showthread.php?t=140150
-Bob
__________________
Want a way to monitor your website against hacking? Check out CrossCheck.net
moondog is offline  
Old 11-15-2005, 02:42 PM   #8 (permalink)
Tech Support
Join Date: Mar 2005
Posts: 4,944
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
This could pertain to your problem (as for the approval problem):
Line: 217
PHP Code:
  $sql "SELECT * FROM $db_table WHERE id $id"
When it should be:
PHP Code:
  $sql "SELECT * FROM $db_table WHERE id=$id"
I'll look over it again here in a min
Eric is offline  
Old 11-15-2005, 10:18 PM THREAD STARTER               #9 (permalink)
NamePros Regular
 
TwiztedFake's Avatar
Join Date: Apr 2004
Location: IL
Posts: 348
TwiztedFake is on a distinguished road
 



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
__________________
-TwiztedFake-
RTard Tutorials
Digital-Dummy to Total-Techie
TwiztedFake is offline  
Old 11-16-2005, 03:06 PM   #10 (permalink)
NamePros Regular
 
dkin69's Avatar
Join Date: May 2005
Posts: 358
dkin69 has a spectacular aura aboutdkin69 has a spectacular aura about
 



post the full revised code and I will take a quick look at it and show you the problem.
dkin69 is offline  
Old 11-16-2005, 10:22 PM THREAD STARTER               #11 (permalink)
NamePros Regular
 
TwiztedFake's Avatar
Join Date: Apr 2004
Location: IL
Posts: 348
TwiztedFake is on a distinguished road
 



Updated Code:
PHP Code:
<?

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";
????: NamePros.com http://www.namepros.com/showthread.php?t=140150
                
$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!";
????: NamePros.com http://www.namepros.com/showthread.php?t=140150
                        
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.";
    }

?>
__________________
-TwiztedFake-
RTard Tutorials
Digital-Dummy to Total-Techie
TwiztedFake is offline  
Old 11-17-2005, 07:24 AM   #12 (permalink)
Tech Support
Join Date: Mar 2005
Posts: 4,944
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
Made a few changes, and here is the code that I came up with...don't remember all the changes but try this:

PHP Code:
<?

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))
????: NamePros.com http://www.namepros.com/showthread.php?t=140150
  {
    
$to $row['email'];
    
$subject "$ring_name Approval";
????: NamePros.com http://www.namepros.com/showthread.php?t=140150
    
$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.";
}
?>
Eric is offline  
Old 11-18-2005, 07:27 AM THREAD STARTER               #13 (permalink)
NamePros Regular
 
TwiztedFake's Avatar
Join Date: Apr 2004
Location: IL
Posts: 348
TwiztedFake is on a distinguished road
 



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.
__________________
-TwiztedFake-
RTard Tutorials
Digital-Dummy to Total-Techie
TwiztedFake is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial: Getting started with PHP (The Basics) deadserious Webmaster Tutorials 60 11-17-2007 11:35 AM
Googlism - What does google think of you? deadserious The Break Room 55 12-15-2005 09:09 AM
Beware of PHP! PolurNET The Break Room 25 03-29-2005 03:04 PM

 
All times are GMT -7. The time now is 02:03 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger