Jump to content

KillerWolf

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

KillerWolf's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. this is the best i can make it, it looks weird cause of this data box. <p class="headermain"></p> </p> <!--header text --> <?php //address the mail is to be sent to $mailTo="test@test.test, $req_email"; //mails to the user $mailFrom="test@test.test"; //mailing info $msgBody="The following was submitted on ".$sentdate."\n Name:\t".$name." Email:\t".$_POST['email']." Query:\n".$_POST['comments']; $xHeaders = "From: $mailFrom\nX-Mailer: PHP/" . phpversion(); //error msgs $req_name="Name"; $req_email="Email address"; $req_comments="missing comments"; //message that is displayed on the screen when mail is sent. $success_message="<b>Your message has been sent. Thank you for input.</b>"; $comments="Query from ".$_POST['comments']; if ($_POST['submit']) { $sentdate=Date("l F jS, Y"); //Check if there is a response from the required fields. if(!$_POST['name']&&$req_name) { $missing[]=$req_name; $nosuccess[0]=' class="nosuccess"'; } if(!$_POST['email']&&$req_email) { $missing[]="Email address"; $nosuccess[1]=' class="nosuccess"'; } if(!$_POST['comments']&&$req_comments) { $missing[]="Comments"; $nosuccess[2]=' class="nosuccess"'; } if(count($missing)>0) { $s=""; if(count($missing)>1) { $s="s"; } print "<div class=\"errormsg\">You missed out the following required field$s:<br><ul>\n"; for ($i=0; $i<count($missing); $i++) { print "<li>$missing[$i]</li>"; } print"</ul></div>"; // exit; } //endifcountmissing else { if(mail($mailTo, $comments, stripslashes($comments), $xHeaders)){ // confirmation print "<p>$success_message</p>" ; print "<h1>Message successfully sent</h1>"; } else { print"<p>Sorry, could not send mail, please try later.</p>"; } } } else { } ?> <form action="<?php $_SERVER['PHP_SELF']?>" method="post"> <h3>Contact Us</h3> <fieldset> <p class="headermain"<?php print $nosuccess[0];?>> <b>Name:</b> <input type="text" name="name" value="<?php if (!empty($_POST['name'])) Echo $_POST['name'];?>" size="20" maxlength="40" /></p> <p class="headermain" <?php print $nosuccess[1];?>> <b>Email:</b><input type="text" name="email" value="<?php if (!empty($_POST['email'])) Echo $_POST['email'];?>"size="20" maxlength="40" /></p> <p class="headermain"<?php print $nosuccess[2];?>> <b>Comments:</b> <textarea name="comments" rows="5" cols="50"><?php if (!empty($_POST['comments'])) Echo $_POST['comments'];?><?php echo stripslashes($_POST['details']) ;?></textarea></p> <div> <input type="submit" name="submit" value="submit" /> </div> </feildset>
  2. tryihng to figure out how to edit the code i posted
  3. thanks, ill figure out how to implement that now. but everything else looks alright?
  4. oh thats tight, so just put that in were i have the existing email check?
  5. Ok two things i need help with first one is if someone can make sure that this should work alright, no real big bugs in it. And 2. I not sure how i should go about validating the email address, i want it to look to see if their is a @ and . in the feild. Thank you for any help. <p class="headermain"></p> </p> <!--header text --> <?php //address the mail is to be sent to $mailTo="test@test.test, $req_email"; //mails to the user $mailFrom="test@test.test"; //mailing info $msgBody="The following was submitted on ".$sentdate."\n Name:\t".$name." Email:\t".$_POST['email']." Query:\n".$_POST['comments']; $xHeaders = "From: $mailFrom\nX-Mailer: PHP/" . phpversion(); //error msgs $req_name="Name"; $req_email="Email address"; $req_comments="missing comments"; //message that is displayed on the screen when mail is sent. $success_message="<b>Your message has been sent. Thank you for input.</b>"; $comments="Query from ".$_POST['comments']; if ($_POST['submit']) { $sentdate=Date("l F jS, Y"); //Check if there is a response from the required fields. if(!$_POST['name']&&$req_name){ $missing[]=$req_name; $nosuccess[0]=' class="nosuccess"'; } if(!$_POST['email']&&$req_email){ $missing[]="Email address"; $nosuccess[1]=' class="nosuccess"'; } if(!$_POST['comments']&&$req_comments){ $missing[]="Comments"; $nosuccess[2]=' class="nosuccess"'; } if(count($missing)>0){ $s=""; if(count($missing)>1){ $s="s"; } print "<div class=\"errormsg\">You missed out the following required field$s:<br><ul>\n"; for ($i=0; $i<count($missing); $i++){ print "<li>$missing[$i]</li>"; } print"</ul></div>"; // exit; } //endifcountmissing else{ if(mail($mailTo, $comments, stripslashes($comments), $xHeaders)){ // confirmation print "<p>$success_message</p>" ; print "<h1>Message successfully sent</h1>"; } else{print"<p>Sorry, could not send mail, please try later.</p>"; } } } else{ } ?> <form action="<?php $_SERVER['PHP_SELF']?>" method="post"> <h3>Contact Us</h1> <fieldset> <p class="headermain"<?php print $nosuccess[0];?>> <b>Name:</b> <input type="text" name="name" value="<?php if (!empty($_POST['name'])) Echo $_POST['name'];?>" size="20" maxlength="40" /></p> <p class="headermain" <?php print $nosuccess[1];?>> <b>Email:</b><input type="text" name="email" value="<?php if (!empty($_POST['email'])) Echo $_POST['email'];?>"size="20" maxlength="40" /></p> <p class="headermain"<?php print $nosuccess[2];?>> <b>Comments:</b> <textarea name="comments" rows="5" cols="50"><?php if (!empty($_POST['comments'])) Echo $_POST['comments'];?><?php echo stripslashes($_POST['details']) ;?></textarea></p> <div><input type="submit" name="submit" value="submit" /> </div> </feildset> </td> </tr>
  6. ok this is what i have so far. import java.util.ArrayList; import java.util.EmptyStackException; public class Stacked { protected int top = -1; ArrayList stacked = new ArrayList(); public int size() { return (top + 1); } public ArrayList top() throws EmptyStackException { if (isEmpty()) throw new EmptyStackException(); return stacked[top]; } public void push(Object obj) { stacked.add(obj); } public Object pop() { if (stacked.isEmpty()) throw new EmptyStackException(); return stacked.remove(stacked.size()-1); } public boolean isEmpty() { return stacked.isEmpty(); } } i get this error " array required, but java.stack.util.ArrayList found" what is going on problem with this "return stacked[top];". what iam trying to do is make a stack using an arraylist. anyhelp or pointers on the overall code so far will be much apreciated iam new at java.
  7. if you find a way let me know, i always have to use a script to reload the screen upon the size diffrence and reset it to 100%
  8. $password = md5($password1);
  9. i wanted to greet the users using his name. could i run another querry and grab it instead?
  10. ok how then :) i need to know
  11. cool thx i do have another question is their a ezy way to take a md5 session id and convert it to char?
  12. ok this else statment is an else from a set session if !set kick back to loggin else ... hopfully you get the idea. but iam getting this error "Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in C:\web\home.php on line 25" [code]echo "<div id="loggedin"><p class="success">Welcome {$_SESSION['name']}</p></div>";[/code]
  13. ok heres my current code the index page as follows: [code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Modders Back Door</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css"> <!-- @import url("style2.css"); --> </style> </head> <body> <div id="banner"><img src="photos/banner.jpg" alt="banner"></img> </div> <div id="Contentindex"><p class="headermain"></p> </p> <!--header text --> <?php $page_title = 'index'; if (isset($_POST['submit'])) { require_once('../db_connect.php'); //validate user input if(!empty($_POST['name'])){ $e = escape_data($_POST['Name']); } else{ echo '<p><font color="red">You forgot to enter your name</font></p>'; $e= FALSE; } if(!empty($_POST['password'])) { $p = escape_data($_POST['password']); } else{ $p = FALSE; echo '<p><font color="red">You forgot to enter your password</font></p>'; } if($e && $p) { //$query = "SELECT Name, 'password' From users WHERE (Name='$e' AND 'password'='md5($p)')"; $query = "SELECT Name, `password` From users WHERE Name = '$e' AND `password` = '" . md5($p) . "'"; $result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error()); if(@mysql_num_rows($result) == 1) { //match was made //register the values and redirect $row = mysql_fetch_array($result, MYSQL_NUM); mysql_free_result($result); mysql_close(); //cose database connection $_SESSION['Name']=$row[1]; $_SESSION['ID'] = $row[0]; //defin the url $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); //check for slashes if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\')) { $url = substr ($url, 0, -1); } $url .='home.php'; ob_end_clean(); header("Location: $url"); exit(); } else{ //nomatch echo '<p><font color="red" size="+1"> Either your name or password was entered incorrect</font></p>'; } } else { echo '<p><font color="red" size="+1">Please try again</font></p>'; } mysql_close(); //closed the database connection } //end of script ?> <!-- beggining of the forum --> <form action="index.php" method="post"> <h3>To Enter, please enter your username and password to enter.</h3> <fieldset> <p class="headermain"<?php print $nosuccess[0];?>> <b>Name:</b> <input type="text" name="name" value="<?php if (!empty($_POST['name'])) Echo $_POST['name'];?>" size="20" maxlength="40" /></p> <p class="headermain" <?php print $nosuccess[2];?>> <b>Password:</b> <input type="text" name="password" value="<?php if (!empty($_POST['password'])) Echo $_POST['password'];?>"size="20" maxlength="40"  /></p> <p class="headermain">If you havent registered to so <a href="register.php" \>here,</a> its free. </p> <div><input type="submit" name="submit" value="Login" /> <p class="Veiw">You Are Veiwing this page from: <?php echo $_SERVER['PHP_SELF'];?> </p> </div>   </fieldset> </form> </body> </html> <?php // send buffer ob_end_flush(); ?>[/code] the register page: [code]<?php // start buffer ob_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Modders Back Door</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css"> <!-- @import url("style2.css"); --> </style> </head> <body> <!--Menu space below --> <!-- <ul>         <li><a href="index.php">Home</a></li> <li><a href="linuxmods.php">Linux modds</a></li> <li><a href="windows.php">Window modds</a></li> <li><a href="contact.php">Contact Us</a></li> </ul> --> <!--ULR of the day --> <div id="banner"><img src="photos/banner.jpg" alt="banner"></img> </div> <div id="Contentindex"><p class="headermain"></p> <p class="Veiw">You Are Veiwing this page from: <?php echo $_SERVER['PHP_SELF'];?> </p> </p> <!--header text --> <?php //start cookie ob_start(); // Get info. $name =  trim($_POST["name"]); $email = trim($_POST["email"]); $password1 = trim($_POST["password1"]); $password2 = trim($_POST["password2"]); $months = array (1 => 'January', 'Febuary', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); //message that is displayed on the screen when mail is sent. $success_message="<b>Your message has been sent. Thank you for input.</b>"; if ($_POST['submit']) { // Check for spaces in the username. if (!stristr($name, " ") === FALSE)  { header("Location: index.php?spaces"); } // Check that the username is at least 3 characters. else if (strlen($name) < 3) { header("Location: register.php?noname"); } // Check that the email address is valid.  Must have a '@', and '.' and be at least 1@123.12 long. else if (stristr($email, "@") === FALSE || stristr($email, ".") === FALSE || strlen($email) < 8)     {         header("Location: index.php?noemail");       } else if ($password1 == NULL)     {       header("Location: index.php?nocpass");         } else if ($password2 == NULL)     {         header("Location: index.php?nocpass");         } else if ($password1 <> $password2)     {         header("Location: index.php?nomatch");         }        // Add info to database. else     {     include "../db_connect.php";  // charla changed this path...                 // Remove unwanted HTML from hosers submissions.         $date =  date("Y/m/d (H:i l dS of M)");         $name =  strip_tags($name, '');         $email = strip_tags($email, '');         $password1 = strip_tags($password1, '');         $u_priv = "User"; $password = md5($password1); // Get the user's info.   $q = mysql_query       ("           SELECT * FROM Users WHERE Name = '$name'       ");           // Count the number of rows returned.      $count = mysql_num_rows($q);         // The count should be zero.        if ($count == 0)                  {         // Insert info into table.       $query="INSERT INTO users (Name, password, Email) VALUES ('$name', '$password', '$email')";  // charla took out user privs and added stuff $result=mysql_query($query); // this is error handling to make sure the insertion into the database works if (empty($result)) { // comment out the following line after debugging // comment out the following line after debugging die ("<p>The query failed: $query due to error <strong>".mysql_error(). " </strong></p>\n"); // leave this line in as a general error // leave this line in as a general error die("<p>Sorry, we could not find you in our database, please try later</p>\n"); } else { echo "Your email address has been updated.\n"; } // end else // Send a notification email to admin users.         $q2 = mysql_query // changed this to name since user priv doesn't exist             ("             SELECT Name, Email FROM Users WHERE Name = '$name'              "); $num_rows=mysql_num_rows($q2);         while ($row = mysql_fetch_object($q2))             {             $to_name = $row->name;             $to_email = $row->email;             $subject = "User pending approval";             $message = "Hi " . $to_name . ",\r\n";             $message .= "The following user has created an account on the system.  ";             $message .= "As an Admin user it would be great if you could check to ";             $message .= "see if they still require approval, or indeed removal.\r\n \r\n";             $message .= "Username: " . $name . "\r\n";             $message .= "email: " . $email . "\r\n";             $message .= "Date: " . $date . "\r\n \r\n";             $message .= "Thank you.\r\n";             $message .= "---------------------------------------\r\n";             $message .= "";             $header = "From: <not@real.address>";             mail($to_email, $subject, $message, $header);             } // Forward the user elsewhere.         echo "oh this didn't work either"; //header("Location: index.php?pending"); }         else             {         // Forward the user elsewhere.         echo "sorry, name taken, didn't work"; // header("Location: index.php?nametaken");                 }     } } ?> <form action="<?php $_SERVER['PHP_SELF']?>" method="post"> <h2>To Enter, please enter your information</h2> <fieldset> <p class="headermain"<?php print $nosuccess[0];?>> <b>Name:</b> <input type="text" name="name" value="<?php if (!empty($_POST['name'])) Echo $_POST['name'];?>" size="20" maxlength="40" /></p> <p class="headermain" <?php print $nosuccess[1];?>> <b>Email:</b><input type="text" name="email" value="<?php if (!empty($_POST['email'])) Echo $_POST['email'];?>"size="20" maxlength="40"  /></p> <p class="headermain" <?php print $nosuccess[2];?>> <b>Password:</b> <input type="text" name="password1" value="<?php if (!empty($_POST['password'])) Echo $_POST['password1'];?>"size="20" maxlength="40"  /></p> <p class="headermain" <?php print $nosuccess[3];?>> <b>Re-Enter Password:</b> <input type="text" name="password2" value="<?php if (!empty($_POST['password'])) Echo $_POST['password2'];?>"size="20" maxlength="40"  /></p> <p class="headermain"> <b>Choose your birthday:</b> <?php echo '<select name="month">'; foreach ($months as $key => $value) { echo "<option value=\"$key\">$value</option>\n"; } print '</select>'; echo '<select name="day">'; for ($day = 1; $day <= 31; $day++){   echo"<option value=\"$day\">$day</option>\n";  } echo '</select>'; echo '<select name="year">'; for ($year=2006; $year >= 1900; $year--){   echo"<option value=\"$year\">$year</option>\n"; } echo '</select>'; ob_end_flush(); ?> </p> <div><input type="submit" name="submit" value="submit" /> </div> </fieldset> </form> </body> </html> [/code]
×
×
  • 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.