Jump to content

Kadage

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Everything posted by Kadage

  1. Yeah sorry about that. I was coding for hours and for the life of me couldn't see the what you guys were trying to say last night. Such a simple Fix i should have been able to realise. Once again sorry, and thanks heaps for your assistance guys.
  2. You don't get what i'm trying to say. This is Page.php $View = $_GET['ID']; if($View == '1') { echo "Hello"; } if($View == '2') { echo "Goodybye"; } If Page.php is viewed like this: http://www.example.com.au/admin/Page.php Nothing can be displayed, because $View is not equal to 1 or 2. This is what include does. Include does not specify which ID i want loaded...
  3. Yes correct, they are. But the page displays different info based on the URL. E.g. http://www.example.com.au/admin/Page.php?ID=2 http://www.example.com.au/admin/Page.php?ID=1 Both of these pages display completely different info. When we include a file it only includes the Page.php. Because of that the code doesn't know which ID to load and so it doesn't load anything...
  4. This isn't the exact code. But it shows exactly what I mean. I have a page that is displaying info based on results from a database. If the form fails to pass a check then i need it to include the previous page while getting the correct results. Include only lets me include the base file "Page.php" not "Page.php?ID=".$ID" thus resulting in no results being returned from the database. Page: $View = $_GET['ID']; $Query = "SELECT * FROM TBL_Clients WHERE ID = '$View'"; $Result = mysql_query($Query, $Host); while($R=mysql_fetch_array($Result)) { $ID = $R[iD]; $Name = $R[Name]; echo "<form action='Process.php?ID=".$ID."&Mode=New' method='post' name='New'> <b>Name:</b> <input name='Name' type='text' /> </form"; } Process: if($Mode == 'New') { $Name = $_POST['Name']; $ID = $_GET['ID']; if($Name == '') { $Error = "Insert Name"; include ("Page.php?ID=".$ID); die; } }
  5. I am developing a page that displays info from a database based on a variable called "ID". On this page is a form that when submitted runs an external function file to first error check the form and then insert it into the database. The problem i'm having is if i include the page which had to form to display the error message on, it doesn't load the right info from the database because its not loading based on the ID. So is there an alternative way to write: include ("toDo.php?ID=".$ToDoID); Any help is much appreciated.
  6. It works now!! Thanks heaps mjdamato! You help on this matter is much appreciated!
  7. Thanks Heaps! I got the number of friends displaying now. I got two more question though, i have had a look around and i cant really find any answers as to how to get info back out of this query. And secondly can i join another table and get info out of that one as well. E.g. We got our friends id, we got our online friends id's, now i need to get info out of "TBL_Users". More specifically i need to get the "Name" "Email" and "Display_Photo" out of "TBL_Users". Then i echo that for every friend online.
  8. Hey everyone, I'm currently working on a friends online script and i have a slight problem that i need help with. Basically the code first searches "TBL_Friends" to see if you have any friends added. If it returns results it then turns your friends ID's into a variable. It then searches "TBL_Users_Online" to see if any body is logged based on the friend's ID it returned before. The first bit of the code works and it retrieves all the friends i got added. The second half is odd, if i have one or two friends added it will show that one is online. If i have more then three friends added it returns no results. I know my code is a bit sloppy and probably not the best way of writing it, im still learning PHP. Anyways this is the code, any help is appreciated. <?php $FriendsOnline = mysql_query("SELECT Sender_ID FROM TBL_User_Friends WHERE Reciever_ID = $UserID"); while($fo=mysql_fetch_array($FriendsOnline)) { $FriendsOnlineID = $fo[sender_ID]; $FriendsOnlineNumber = mysql_query("SELECT * FROM TBL_Users_Online WHERE User_ID = $FriendsOnlineID"); $FriendsNumber = mysql_num_rows($FriendsOnlineNumber); echo $FriendsNumber; } ?> $SenderID = Friends ID $Reciever_ID = User ID $UserID = User ID
  9. Hey everyone, I have a website and a V Bulletin forum. The forum is located in a separate directory. (/forums). I want to add a login form to my website that logins using the accounts from my V Bulletin forum. I then need it to save a session of logged in to true. Any help would be much appreciated.
  10. I got it working!!! Basically my code was mostly right, i just had to add the connection to DB code again once the submit button is pressed.
  11. Thanks for all your help so far everyone! Much appreciated! Hi Zane, sorry but like i said im really new to php and don't really know too much about it. xyph, I have made the changes you suggested to the code and it's still not working. Im not too sure but i think there is something wrong with the verification code generator. No matter what i type into the text field it always says the code is incorrect. This is the updated script. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Synical-Soldiers</title> <link href="scripts/style.css" rel="stylesheet" type="text/css" /> <link rel="shortcut icon" href="images/favicon.ico" /> </head> <?php session_start(); $EmailReset = $_POST['email']; ?> <body> <?php if($_SESSION['CodeSent'] != 'true') { ?> <form action="passwordReset.php" method="post" name="verification"> <table width="300" border="0"> <tr> <td colspan="2"><h2 align="center">Synical-Soldiers: Reset Password</h2></td> </tr> <tr> <td colspan="2"><b>Please enter the Email you used to register.</b></td> </tr> <tr> <td width="72"><b>Email:</b></td> <td width="218"><input name="email" type="text" class="textBoxReset" value="<?php echo $EmailReset; ?>"/></td> </tr> <tr> <td> </td> <td><input name="submit" type="submit" class="button" /></td> </tr> </table> </form> <?php if($_POST['submit']) { if ($EmailReset == "") { echo "<b><font color='#FF0000'>Error(s) Listed Below:</font></b> <br/><b>Please enter your Email.</b> <br/>"; die(); } // Connect the config file include_once("scripts/config.php"); // Connect to the Server mysql_connect($db_host,$db_user,$db_password) or die(mysql_error()); // Select the Database mysql_select_db($db_name) or die(mysql_error()); // Check if the Email is in use. $VEmail = mysql_query("SELECT email FROM tbl_members WHERE email = '$EmailReset'") or die(mysql_error()); $check2 = mysql_num_rows($VEmail); if ($check2 != 1) { echo "<b><font color='#FF0000'>Error(s) Listed Below:</font></b> <br/><b>No account is registered with that Email.</b> <br/>"; die; } $RandomCode=md5(uniqid(rand())); $VerificationCode=substr($RandomCode, 0, ; $EncryptCode = md5($VerificationCode); $query = sprintf("INSERT INTO tbl_resetPassword VALUES ('NULL', '$_SERVER[REMOTE_ADDR]', '$EmailReset','%s', 'no')", mysql_real_escape_string($EncryptCode)); mysql_query($query)or die('Could not Reset Password ' . mysql_error()); $subject = "Verification Code"; $siteName = "http://www.synical-soldiers.com.au"; $siteEmail = "support@pixemadesigns.com.au"; $message = "If you did not request a password reset for the site 'Synical-Soldiers.com.au' please ignore this email. ---------------------------- Verification Code: $VerificationCode ---------------------------- This email was automatically generated."; if(!mail($EmailReset, $subject, $message, "FROM: $siteName <$siteEmail>")) { die ("Sending Email Failed, Please Contact a Site Admin!)"); } $_SESSION['CodeSent'] = 'true'; $_SESSION['EmailVerification'] = $EmailReset; header("location: passwordReset.php"); } } else { echo'<form action="passwordReset.php" method="post" name="reset"> <table width="300" border="0"> <tr> <td colspan="2"><h2 align="center">Synical-Soldiers: Reset Password</h2></td> </tr> <tr> <td colspan="2"><b><font color="#00FF00">Verification Code Sent to:</font></b></td> </tr> <tr> <td colspan="2"><b>Email: </b>'; echo $_SESSION['EmailVerification']; echo'</td> </tr> <tr> <td width="72"><b>Code:</b></td> <td width="218"><input name="code" type="text" class="textBox" value="'; echo $_POST['code']; echo'"/></td> </tr> <tr> <td> </td> <td><input name="submit2" type="submit" class="button" /></td> </tr> </table> </form>'; if($_POST['submit2']) { $CodeReset = $_POST['code']; $ResetEmail = $_SESSION['EmailVerification']; if ($CodeReset == "") { echo "<b><font color='#FF0000'>Error(s) Listed Below:</font></b> <br/><b>Please enter your Verification Code.</b> <br/>"; die(); } $SQL = "SELECT * from tbl_resetPassword WHERE email = '$ResetEmail' AND resetCode = '$CodeReset'"; $Result = mysql_query($SQL); if(mysql_num_rows($SQL) > 0 ) { echo "Passed"; } else { echo "<b><font color='#FF0000'>Error(s) Listed Below:</font></b> <br/><b>Verification Code is Incorrect.</b> <br/>";; } } } ?> </body> </html>
  12. Ohh sorry, okay well the script generates the random code and uploads it to the database as well as sends it to the email. However i cant get the second part of the script right so the info typed into the text box is equal to whats on the database the script will progress. It just passes no matter what text is in the box.
  13. Hey everyone, im rather new to PHP and I need a little bit of help with a script im writing. If anybody can help it would be great. Basically the code checks to see if the email field has text in it, if it does it will then check to see if that email address has been registered to an account. If an account is registred with that email it willl generate a random md5 code and insert it into a table, it will also send that code the email address. Lastly it will allow you to insert the code that was just emailed and it will check to see if it matches the one on the database. This is where im having trouble... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Synical-Soldiers</title> <link href="scripts/style.css" rel="stylesheet" type="text/css" /> <link rel="shortcut icon" href="images/favicon.ico" /> </head> <?php session_start(); $EmailReset = $_POST['email']; ?> <body> <?php if($_SESSION['CodeSent'] != 'true') { ?> <form action="passwordReset.php" method="post" name="verification"> <table width="300" border="0"> <tr> <td colspan="2"><h2 align="center">Synical-Soldiers: Reset Password</h2></td> </tr> <tr> <td colspan="2"><b>Please enter the Email you used to register.</b></td> </tr> <tr> <td width="72"><b>Email:</b></td> <td width="218"><input name="email" type="text" class="textBoxReset" value="<?php echo $EmailReset; ?>"/></td> </tr> <tr> <td> </td> <td><input name="submit" type="submit" class="button" /></td> </tr> </table> </form> <?php if($_POST['submit']) { if ($EmailReset == "") { echo "<b><font color='#FF0000'>Error(s) Listed Below:</font></b> <br/><b>Please enter your Email.</b> <br/>"; die(); } // Connect the config file include_once("scripts/config.php"); // Connect to the Server mysql_connect($db_host,$db_user,$db_password) or die(mysql_error()); // Select the Database mysql_select_db($db_name) or die(mysql_error()); // Check if the Email is in use. $VEmail = mysql_query("SELECT email FROM tbl_members WHERE email = '$EmailReset'") or die(mysql_error()); $check2 = mysql_num_rows($VEmail); if ($check2 != 1) { echo "<b><font color='#FF0000'>Error(s) Listed Below:</font></b> <br/><b>No account is registered with that Email.</b> <br/>"; die; } $RandomCode=md5(uniqid(rand())); $VerificationCode=substr($RandomCode, 0, ; $EncryptCode = md5($VerificationCode); $query = sprintf("INSERT INTO tbl_resetPassword VALUES ('NULL', '$_SERVER[REMOTE_ADDR]', '$EmailReset','%s', 'no')", mysql_real_escape_string($EncryptCode)); mysql_query($query)or die('Could not Reset Password ' . mysql_error()); $subject = "Verification Code"; $siteName = "http://www.synical-soldiers.com.au"; $siteEmail = "support@pixemadesigns.com.au"; $message = "If you did not request a password reset for the site 'Synical-Soldiers.com.au' please ignore this email. ---------------------------- Verification Code: $VerificationCode ---------------------------- This email was automatically generated."; if(!mail($EmailReset, $subject, $message, "FROM: $siteName <$siteEmail>")) { die ("Sending Email Failed, Please Contact a Site Admin!)"); } $_SESSION['CodeSent'] = 'true'; $_SESSION['EmailVerification'] = $EmailReset; header("location: test.php"); } } else { echo'<form action="passwordReset.php" method="post" name="reset"> <table width="300" border="0"> <tr> <td colspan="2"><h2 align="center">Synical-Soldiers: Reset Password</h2></td> </tr> <tr> <td colspan="2"><b><font color="#00FF00">Verification Code Sent to:</font></b></td> </tr> <tr> <td colspan="2"><b>Email: </b>'; echo $_SESSION['EmailVerification']; echo'</td> </tr> <tr> <td width="72"><b>Code:</b></td> <td width="218"><input name="code" type="text" class="textBox" value="'; echo $_POST['code']; echo'"/></td> </tr> <tr> <td> </td> <td><input name="submit2" type="submit" class="button" /></td> </tr> </table> </form>'; if($_POST['submit2']) { $CodeReset = md5($_POST['code']); $ResetEmail = $_SESSION['EmailVerification']; if ($CodeReset == "") { echo "<b><font color='#FF0000'>Error(s) Listed Below:</font></b> <br/><b>Please enter your Verification Code.</b> <br/>"; die(); } $SQL = "SELECT * from tbl_resetPassword WHERE email = '$ResetEmail'"; $Result = mysql_query($SQL); $DATA = mysql_fetch_assoc($Result); if($CodeReset != $DATA['resetCode']) { echo "Pass"; } else { echo "Fail"; } } } ?> </body> </html>
  14. Yay! I got it working now, thanks a lot hyster!! Much appreciated
  15. Still no luck It sends my to a white page and doesn't give me any errors... So i don't know whats wrong.
  16. Hey everyone, i am currently working on a "contact us" script. I want the form to first allow the user which department they want to email. E.g. "Sales" and "Support" By changing this drop down box it will change which email the form is sent to. Im having trouble setting the PHP side of this script up to change the emails. Any help regarding this matter is much appreciated. HTML FORM: <form name="contactForm" method="post" action="forms/contactUs.php"> <table width="350" border="0"> <tr> <td width="150" class="bold">Department:</td> <td width="200" align="left"> <select name="department" class="dropDown"> <option value="sales">Sales</option> <option value="support">Support</option> </select> </td> </tr> <tr> <td class="bold">Full Name:</td> <td> <input name="name" type="text" class="contactTextBox" /> </td> </tr> <tr> <td class="bold">Company:</td> <td> <input name="company" type="text" class="contactTextBox" /> </td> </tr> <tr> <td class="bold">Email:</td> <td> <input name="email" type="text" class="contactTextBox" /> </td> </tr> <tr> <td class="bold">Comments:</td> <td> <textarea name="com" id="com" cols="5" rows="5" class="contactTextArea" /></textarea> </td> </tr> <tr> <td> </td> <td align="right"> <input type="submit" class="button" value="Submit" /> <input type="reset" class="button" value="Reset" /> </td> </tr> </table> </form> PHP <?php $department = $_POST['department']; $confirm = "sales"; if(isset($_POST['email'])) { if($department == $confirm) { $email_to = "sales@pixemadesigns.com"; $email_subject = "Sales Question"; } else { $email_to = "support@pixemadesigns.com"; $email_subject = "Support Question"; } $fullName = $_POST['name']; $company = $_POST['company']; $email_from = $_POST['email']; $comments = $_POST['com']; $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "Full Name: ".clean_string($fullName)."\n"; $email_message .= "Company: ".clean_string($company)."\n"; $email_message .= "Email: ".clean_string($email_from)."\n"; $email_message .= "Comments: ".clean_string($comments)."\n"; // create email headers $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); header("location: ../contactSubmit.html"); ?> <? } ?>
×
×
  • 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.