Jump to content

nicolette

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

About nicolette

  • Birthday 10/16/1980

Profile Information

  • Gender
    Female
  • Location
    Las Cruces NM

Contact Methods

  • Yahoo
    nicolette_000405

nicolette's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. nothing from what i can see....well whatever it does, it doesn't let me echo out the user from the session like i need
  2. I put the code in php file that processes the login form and connects to the database and the output i got is as follows "k1ctl76d1v3u568hp2m82480p3 Notice: A session had already been started - ignoring session_start() in C:\xampp\htdocs\FinalPart5ProcessForm1.php on line 43 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\FinalPart5ProcessForm1.php: in C:\xampp\htdocs\FinalPart5ProcessForm1.php on line 51"
  3. I am still playing with the css text-indent but I still haven't figured it out yet. does anyone have any idea's?
  4. i have not changed any setting anywhere in the browser. I checked and there is a localhost cookie. All pages are accessed through http://localhost/... here is the session info: session.cookie_path / / session.cookie_domain no value no value session Session Support enabled Registered save handlers files user sqlite Registered serializer handlers php php_binary wddx I don't know if this what you meant by all the info but... Directive Local Value Master Value session.auto_start Off Off session.bug_compat_42 On On session.bug_compat_warn On On session.cache_expire 180 180 session.cache_limiter nocache nocache session.cookie_domain no value no value session.cookie_httponly Off Off session.cookie_lifetime 0 0 session.cookie_path / / session.cookie_secure Off Off session.entropy_file no value no value session.entropy_length 0 0 session.gc_divisor 100 100 session.gc_maxlifetime 1440 1440 session.gc_probability 1 1 session.hash_bits_per_character 5 5 session.hash_function 0 0 session.name PHPSESSID PHPSESSID session.referer_check no value no value session.save_handler files files session.save_path \xampp\tmp \xampp\tmp session.serialize_handler php php session.use_cookies On On session.use_only_cookies Off Off session.use_trans_sid 0 0
  5. yeah i noticed that... I don't know what I was thinking but I fixed it and it didn't change anything....
  6. it seems like a lot of people are having this same problem but I haven't found one solved topic that worked for me so I'm gonna ask again. page 1: <?php error_reporting(E_ALL); ini_set('display_errors', '1'); //host name $host = "localhost"; //mysql login info $username = "root"; $password = ""; //DB info $db_name = "syllabus"; //DB table info $tbl_name = "syll"; //Connecting to server and selecting the DB mysql_connect("$host", "$username","$password") or die ("cannot connect to the database"); mysql_select_db("$db_name") or die ("cannot select the database"); //send username and password from form $user = $_POST['user']; $pass = $_POST['pass']; //protection for mysql $user = stripslashes($user); $pass = stripslashes($pass); $user = mysql_real_escape_string($user); $pass = mysql_real_escape_string($pass); $sql = "SELECT * FROM $tbl_name WHERE user='$user' and pass='$pass'"; $result = mysql_query($sql); //Count rows $count = mysql_num_rows($result); // if there is a match there must be only one row if ($count == 1) { //register the session and redirect to next page session_start(); $_SESSION['user'] = $user; $_SESSION['pass'] = $pass; session_write_close(); if (isset($_SESSION['user'])) { if (isset($_SESSION['pass'])) { header("location:http://localhost/FinalPart5Form2.html"); } } } else { echo "Invalid username $user or password $pass"; } ?>; I did var dumping before session_write_close and both were set properly page2: <? //pass session over ini_set ("display_errors", "1"); error_reporting(E_ALL | E_STRICT); session_start(); var_dump($_SESSION['client']); ?> <html> <body> <h2>Form 2</h2> <h3> Welcome, <?PHP echo $_SESSION['user']?>!</h3> <p> Please complete your profile below.</p> <form action="form2process.php" method="POST" target="_blank" > Course Title: <input type="text" name="title" size="50" /> <br /> <br /> Instructor name: <input type="text" name="instname" size="40" /> <br /> <br /> Office Hours: <p style="text-indent:50px">Room No: <input type="text" name="hrsroomno" size="38" /></p> <p style="text-indent:50px">Days: <input type="text" name="hrsdays" size="42" /></p> <p style="text-indent:50px">Time: <input type="text" name="hrstime" size="42" /></p> Phone: <input type="text" name="phn" size="48" /> <br /> <br /> Email: <input type="text" name="email" size="49" /> <br /> <br /> Website: <input type="text" name="url" size="47" /> <br /> <br /> Course Description: <br /><textarea rows="10" cols="58" name="crsdes"> </textarea> <br /> <br /> Book Recommendec: <br /><textarea rows="10" cols="58" name="bookrec"> </textarea> <br /> <br /> Grading Scale: <p style="text-indent:50px">Assignments(%): <input type="text" name="gradeassign" size="32" /></p> <p style="text-indent:50px">Quiz(%): <input type="text" name="gradequiz" size="40" /></p> <p style="text-indent:50px">Exam(%): <input type="text" name="gradeexam" size="40" /></p> <br /> Syllabus: <br /><textarea rows="25" cols="150" name="syll"> </textarea> <br /> <input type="submit" name="SubmitPart4B" value="Create!" /> </form> </body> when I did the var dumping on this page it returned NULL
  7. //register the session and redirect to next page session_start(); $_SESSION['user'] = $user; $_SESSION['pass'] = $pass; header("location:FinalPart5Form2.php"); ok so while I was waiting I played with the code and changed the session stuff it removed all the errors I was getting in the previous post but now i'm getting told that the redirect location was not found on this server which i find interesting because i was just playing with that file **ken you posted as I was typing this you said to do everything that i did so it is nice to know I was on the right track However I didn't know about the: if (isset($_SESSION['user'])) would I do another one for the password? anyway i'm off to play some more just thought I would post this for anyone else who was having the same problems. Nicolette
  8. <?php error_reporting(E_ALL); ini_set('display_errors', '1'); //host name $host = "localhost"; //mysql login info $username = "root"; $password = ""; //DB info $db_name = "syllabus"; //DB table info $tbl_name = "syll"; //Connecting to server and selecting the DB mysql_connect("$host", "$username","$password") or die ("cannot connect to the database"); mysql_select_db("$db_name") or die ("cannot select the database"); //send username and password from form $user = $_POST['user']; $pass = $_POST['pass']; //protection for mysql $user = stripslashes($user); $pass = stripslashes($pass); $user = mysql_real_escape_string($user); $pass = mysql_real_escape_string($pass); $sql = "SELECT * FROM $tbl_name WHERE user='$user' and pass='$pass'"; $result = mysql_query($sql); //Count rows $count = mysql_num_rows($result); // if there is a match there must be only one row if ($count == 1) { //register the session and redirect to next page session_register("user"); session_register("pass"); header("location:FinalPart5Form2.php"); } else { echo "Invalid username $user or password $pass"; } ?> I receive these errors: Deprecated: Function session_register() is deprecated in C:\xampp\htdocs\FinalPart5ProcessForm1.php on line 39 Warning: session_register() [function.session-register]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\FinalPart5ProcessForm1.php:39) in C:\xampp\htdocs\FinalPart5ProcessForm1.php on line 39 Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\FinalPart5ProcessForm1.php:39) in C:\xampp\htdocs\FinalPart5ProcessForm1.php on line 39 Deprecated: Function session_register() is deprecated in C:\xampp\htdocs\FinalPart5ProcessForm1.php on line 40 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\FinalPart5ProcessForm1.php:39) in C:\xampp\htdocs\FinalPart5ProcessForm1.php on line 41 Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively in Unknown on line 0 I have checked for whitespace and there is none but the first time i attempted to log in i spelled it wrong and got the echo statement "invalid blah blah..." does that cause this header problem? I know that the session_register is depreciated and is now $_SESSION() i just haven't quite figured out how to use it. Does anyone see the problem or is the session_register depreciation causing the header problems? thanks
  9. ok so here is a section of my code if (!isset($_POST['title']) || trim($_POST['title'])=="") { die ('Error: You must enter a course title.'); } else { $title = $_POST['title']; echo "<p><span style='font-weight:bold'>Course Title</span><span style='font-weight:normal'> : $title</span></p>"; } if (!isset($_POST['instname']) || trim($_POST['instname'])=="") { die ('Error: You must enter an instructor name.'); } else { $instname = $_POST['instname']; print "<p><span style='font-weight:bold'>Instructor</span><span style='font-weight:normal; text-indent:500px'>: $instname</span></p>"; }if (!isset($_POST['phn']) || trim($_POST['phn'])=="") { die ('Error: You must enter a phone number.'); } else { $phn = $_POST['phn']; print "<p><span style='font-weight:bold'>Phone </span><span style='font-weight:normal'>\t$phn</span></p>"; } ok now obviously the first else statement is bad with all the I know but that is the problem I am running into I tried a css style on the next one and that isn't indenting and on the last one I have tried using \t although I don't know if it needs "", '', or nothing in this situation I tried all variations and I couldn't get that to work either can someone assist I need the output to look like this Course Title : Whatever Instructor : Whatever etc...
  10. ok but what about numbers that don't have a GCD like 8191 and 1023 how can I get it to print out that they don't have a GCD if they don't (normally returns 1)
  11. ok got that fixed, these tired eyes are not helping matters any. so how would i go about getting the code to say that there is no common divisor?
  12. what is wrong with this code? it keeps showing the message "Warning: Division by zero in C:\xampp\htdocs\FinalPart3.php on line 34" This is lines 33, 34, and 35: while ($c = $num1 % $num2) { $num1 = $num2; here is the entire code. <?php if (!isset($_POST['SubmitPart3'])) { ?> <HTML> <head> <title> Final Part 3</title> <body> <h2>Please enter two number you wish to find the GCD of.</h2> <form method="POST"> <table> <tr> <td>Nmber 1: </td> <td> <input type="text" name="num1" /></td><br /> </tr> <tr> <td>Number 2: </td> <td> <input type="text" name="num2" /> </td> </tr> <tr> <td><input type="submit" name="SubmitPart3" value="Find GCD" /></td> </tr> </table> </form> </body> <?php } $num1 = ($_POST['num1']); $num2 = ($_POST['num2']); $c = 0; function gcd($num1, $num2) { while ($c = $num1 % $num2) { $num1 = $num2; $num2 = $c; } return $num2; } echo "The GCD of $num1 and $num2 is " . gcd($num1,$num2); ?>code]
  13. Hi thanks, I am getting a header error here is the code you gave me edited to my pre-existing form <HTML> <head> <title> Final Part 2</title> <body> <h2>Please Select a search engine.</h2> <form method="POST"target="_blank"> <table> <tr> <td>Sites: </td> <td> <select name="url"> <option value="http://yahoo.com">Yahoo.com</option> <option value="http://google.com">Google.com</option> <option value="http://ask.com">Ask.com</option> <option value="http://lycos.com">Lycos.com</option> <option value="http://bing.com">Bing</option> </select> </td> </tr> <tr> <td><input type="submit" name="SubmitPart2" value="<<< Go To" /></td> </tr> </table> </form> <?php if(isset($_POST['SubmitPart2'])) { $urls = array('http://yahoo.com','http://google.com','http://ask.com','http://lycos.com','http://bing.com'); if(in_array($_POST['url'],$urls)) { header("Location: " . $_POST['url']); } else { echo "<p>Invalid Search Engine!</p>"; } } ?> </body>
×
×
  • 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.