Jump to content

patelp7

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

patelp7's Achievements

Member

Member (2/5)

0

Reputation

  1. its for a edit screen....so if they were to edit their password, as it is encrypted the wrong character values will be inserted. You know what i mean Govner
  2. Hello. I encryt a password and put it in a table. How would i retrieve the password in a decrypted format? $Encryptedpassword = crypt($Password, "ND"); $query = "insert into adminmember (Username, Password, First_Name, Last_Name, EmailAdd , User_Level) Values ('$Username', '$Encryptedpassword', '$Firstname', '$Lastname', '$Emailadd', '$Userlevel')"; Thats how mi encrypt it when inserting....any ideas on retrieving? Cheers
  3. the PHP query gives the problem. Do you know how to not make it repeat? thank you.
  4. i got a search function and for some reason every results are pulled out twice. Can sum1 PLEASE HELP!!! $query = "select B.Bulletin_ID ,B.Subject, B.Description from Bulletin B, Relative R WHERE B.Adminusername = R.Adminusername AND B.Description like '%$searchDesc%'"; above is the code in PHP. I done it in MySQL as well without the loops that i have in PHP and the results still pulled out twice. select B.Bulletin_ID ,B.Subject, B.Description from Bulletin B, Relative R WHERE 'shakeys' = 'shakeys' AND 'vw' like 'vw'; Does anyone know why? or have any ideas?
  5. I have got answers stored in a table row. I have created a page where answers can be written. How do I compare the answers to the data in the table? The users needs to get 3 ot of 5 right to porgress to next phase. session_start(); require ("db.php.inc"); require ("checkvaliduserfunc.inc"); if (isset($_POST['SUBMIT'])){ extract($_POST); $error=1; //check to see if variables are set if ( (isset($ans1)) && (isset($ans2)) && (isset($ans3)) && (isset($ans4)) && (isset($ans5)) ){ //Remove leading and trailing white spaces $ans1 = trim($ans1); $ans2 = trim($ans2); $ans3 = trim($ans3); $ans4 = trim($ans4); $ans5 = trim($ans5); $query = "select * from secretquest where Admin_ID ='".$_SESSION['Admin_ID']."'"; $query_result = mysql_query($query); if (mysql_num_rows($query_result)<>1){ $errorstring = "<br>Unable to match answers in database<br>"; } else { //set flag to 0 $error = 0; $results_user = mysql_fetch_array($query_result); $_session['valid'] = "YES"; $_SESSION['Admin_ID'] = $results_user['Admin_ID']; $_SESSION['Username'] = $results_user['Username']; } } if ($error<>0){ DisplayLogForm($errorstring); }else{ DisplayMenu($Username, $Userlevel, ""); } }else{ DisplayLogForm($errorstring); } } else { // if user is already logged in display relevant menu $Username = $_session['Username']; $Userlevel = $_session['Userlevel']; DisplayMenu($Username, $Userlevel, ""); }
  6. on the same page as well as inserting it into the database
  7. <? session_start(); require ("db.php.inc"); require ("addBulletinfunc.inc"); require("authenticateadmin.inc"); //lines 4 to 15 uploads a picture for the product. this picture can be located from anywhere within the computers hard drive. $flname=""; if (isset($_POST['subfile'])){ $flname = basename($_FILES['userfile']['name']); $flname = str_replace(" ","",$flname); $uploaddir = "Pictures/"; $uploadfile = $uploaddir . $flname; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { } else { echo "Possible file upload attack!\n"; } } $Userlevel=0; $fname=$_POST['fname']; if (isset($_POST['SUBMIT']) ){ extract($_POST); $error=1; //check to see variables are set if ( (isset($Subject)) && (isset($Description)) && (isset($Drcomments)) ) { //set error flag to 0 $error=0; //Remove leading and trailing white spaces in input $Subject=trim($Subject); $Description=trim($Description); //check to see if username and password contain sufficient characters $Subjectlen = strlen($Subject); $Desclen= strlen($Description); If ( (($Subjectlen>2) && ($Desclen>2)) ){ //palis shit up to here. $query = "insert into bulletin (Subject, Description, DrComments, Adminusername, Datecreated, Image) Values ('$Subject', '$Description', '$Drcomments', '".$_SESSION['Username']."', NOW(), '$fname')"; $result=mysql_query($query); if (mysql_errno()<>0) { $error =1; $errorstring = mysql_error() . "\n"; } }else{ $error=1; } if(($Subjectlen<0)){ $errorstring.="<BR>Your name was $Subjectlen characters long it must be more than 1 character long.<BR>"; } if (($Desclen<0)){ $errorstring .= "<BR> Your Supplier was $Descriptionlen characters long in must be above 0. <BR>"; } } if ($error<>0){ DisplayAddForm($errorstring); }else{ $Username=$_session['Username']; $Userlevel= $_session['Userlevel']; DisplayMenu($Username, $Userlevel, "Bulletin added sucessfully"); } }else{ DisplayAddForm($errorstring); } ?>
  8. I am having difficulties in uploading a image if a user attaches a image. It will go through the upload process, but will not display the image. Can someone please help? Been stuck for days!! function DisplayAddForm ($errorstring) { print ('<html> <head></head> <body> <H3>Create Bulletin</H3> <P>Please enter Todays log</p> '); echo $errorstring; print(' <form action="AddBulletin.php" method=post> <label><br /><br /> Subject <input name="Subject" type="text" id="Subject" size="100" /> <input type="hidden" name="fname" value="<?=$flname?>" > <br /><br />Description <textarea name="Description" cols="100" rows="8" id="Description"></textarea> <br /> <br />Dr Comments <textarea name="Drcomments" cols="100" rows="2" id="Drcomments"></textarea> </label> <p> </p> <p><img src="Pictures/<?=$flname?>" width="100" height="100"></p> <br><Input type =SUBMIT name ="SUBMIT" value="SUBMIT"> <Input type = Reset> </form> <form method=post enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="300000" /> <input name="userfile" type="file" class="inputbox-boder" size="20"> <input name="subfile" type="submit" value="Upload"> </form> </body> </html> '); }
  9. I have manage to output a list of bulletins. But I have to be able to indicate ones which have not been read, by highlighting unread bulletins in a different colour. I have no idea how to do this, or what topic to search for on the net. Can someone please help? <? session_start(); require ("db.php.inc"); //require ("ViewBulletin.inc"); $query = "select B.Subject, B.Datecreated From Bulletin B, Relative R WHERE B.Adminusername = R.Adminusername AND R.Username = '".$_SESSION['Username']."' ORDER BY Datecreated DESC"; $result = mysql_query ($query); // Run the query. $numofsubs = mysql_num_rows($result); if ($numofsubs > 0) { // If it ran OK, display the records. echo "<p>There are currently $numofsubs bulletins published.</p>\n"; // Fetch and print all the records. while ($numofsubs = mysql_fetch_array($result)) { //echo <td align="left"><a href="viewspecificbull.php?id=' . $numofsubs['Subject'] . '">View</td></br> echo ('<td align="left">' . $numofsubs['Datecreated'] . '</td> <td align="left">' . $numofsubs['Subject'] . '</td> <td align=left><a href="viewspecificbull_NextWay.php?id=' . $numofsubs['Subject'] . '">View Subject: </a></td></br>'); } //$_SESSION['Subject']= $numofsubs['Subject']; } ?>
  10. I am having trouble in the user being able to upload files. The file gets stored in the file which is suppose to, But the reference name of the file is not recorded in the database table. Does any one have any suggestions? function DisplayAddForm ($errorstring) { print ('<html> <head></head> <body> <H3>Create Bulletin</H3> <P>Please enter Todays log</p> '); echo $errorstring; print(' <form action="AddBulletin.php" method=post> <label><br /><br /> Subject <input name="Subject" type="text" id="Subject" size="100" /> <br /><br />Description <textarea name="Description" cols="100" rows="8" id="Description"></textarea> <br /> <br />Dr Comments <textarea name="Drcomments" cols="100" rows="2" id="Drcomments"></textarea> </label> <input type="hidden" name="fname" value="<?=$flname?>"> <p> </p> <br><Input type =SUBMIT name ="SUBMIT" value="SUBMIT"> <Input type = Reset> </form> <form enctype="multipart/form-data" name="form3" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="300000" /> <input name="userfile" type="file" class="inputbox-boder" size="20"> <input name="subfile" type="submit" value="Upload"> </form> </body> </html>'); } <? session_start(); //lines 4 to 15 uploads a picture for the product. this picture can be located from anywhere within the computers hard drive. $flname=""; if (isset($_POST['subfile'])){ $flname = basename($_FILES['userfile']['name']); $flname = str_replace(" ","",$flname); $uploaddir = "Pictures/"; $uploadfile = $uploaddir . $flname; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { } else { echo "Possible file upload attack!\n"; } } require ("db.php.inc"); require ("addBulletinfunc.inc"); require("authenticateadmin.inc"); $Userlevel=0; if (isset($_POST['SUBMIT']) ){ extract($_POST); $error=1; //check to see variables are set if ( (isset($Subject)) && (isset($Description)) && (isset($Drcomments)) ) { //set error flag to 0 $error=0; //Remove leading and trailing white spaces in input $Subject=trim($Subject); $Description=trim($Description); //check to see if username and password contain sufficient characters $Subjectlen = strlen($Subject); $Desclen= strlen($Description); If ( (($Subjectlen>2) && ($Desclen>2)) ){ //palis shit up to here. $query = "insert into bulletin (Subject, Description, DrComments, Adminusername, Datecreated, Image) Values ('$Subject', '$Description', '$Drcomments', '".$_SESSION['Username']."', NOW(), '$fname')"; $result=mysql_query($query); if (mysql_errno()<>0) { $error =1; $errorstring = mysql_error() . "\n"; } }else{ $error=1; } if(($Subjectlen<0)){ $errorstring.="<BR>Your name was $Subjectlen characters long it must be more than 1 character long.<BR>"; } if (($Desclen<0)){ $errorstring .= "<BR> Your Supplier was $Descriptionlen characters long in must be above 0. <BR>"; } } if ($error<>0){ DisplayAddForm($errorstring); }else{ $Username=$_session['Username']; $Userlevel= $_session['Userlevel']; DisplayMenu($Username, $Userlevel, "Bulletin added sucessfully"); } }else{ DisplayAddForm($errorstring); } ?>
  11. im trying to upload pictures but it does not record it in the database that a file has been attached for a particular bulletin. Dont want to view it, just record that its been attached. Can someone please help? function DisplayAddForm ($errorstring) { print ('<html> <head></head> <body> <H3>Create Bulletin</H3> <P>Please enter Todays log</p> '); echo $errorstring; print(' <form enctype="multipart/form-data" action="AddBulletin.php" method=post> <label><br /><br /> Subject <input name="Subject" type="text" id="Subject" size="100" /> <br /><br />Description <textarea name="Description" cols="100" rows="8" id="Description"></textarea> <br /> <br />Dr Comments <textarea name="Drcomments" cols="100" rows="2" id="Drcomments"></textarea> </label> <p> </p> <br><Input type =SUBMIT name ="SUBMIT" value="SUBMIT"> <Input type = Reset> </form> <form enctype="multipart/form-data" name="form3" action="AddBulletin.php" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="300000" /> <input name="userfile" type="file" class="inputbox-boder" size="20"> <input name="subfile" type="submit" value="Upload"> </form> </body> </html>'); <? session_start(); require ("db.php.inc"); require ("addBulletinfunc.inc"); require("authenticateadmin.inc"); //lines 4 to 15 uploads a picture for the product. this picture can be located from anywhere within the computers hard drive. $flname=""; if (isset($_POST['subfile'])){ $flname = basename($_FILES['userfile']['name']); $flname = str_replace(" ","",$flname); $uploaddir = "Pictures/"; $uploadfile = $uploaddir . $flname; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { } else { echo "Possible file upload attack!\n"; } } $Userlevel=0; if (isset($_POST['SUBMIT']) ){ extract($_POST); $error=1; //check to see variables are set if ( (isset($Subject)) && (isset($Description)) && (isset($Drcomments)) ) { //set error flag to 0 $error=0; //Remove leading and trailing white spaces in input $Subject=trim($Subject); $Description=trim($Description); //check to see if username and password contain sufficient characters $Subjectlen = strlen($Subject); $Desclen= strlen($Description); If ( (($Subjectlen>2) && ($Desclen>2)) ){ //palis shit up to here. $fname=$_POST['fname']; $query = "insert into bulletin (Subject, Description, DrComments, Adminusername, Datecreated, Image) Values ('$Subject', '$Description', '$Drcomments', '".$_SESSION['Username']."', NOW(), '$fname')"; $result=mysql_query($query); if (mysql_errno()<>0) { $error =1; $errorstring = mysql_error() . "\n"; } }else{ $error=1; } if(($Subjectlen<0)){ $errorstring.="<BR>Your name was $Subjectlen characters long it must be more than 1 character long.<BR>"; } if (($Desclen<0)){ $errorstring .= "<BR> Your Supplier was $Descriptionlen characters long in must be above 0. <BR>"; } } if ($error<>0){ DisplayAddForm($errorstring); }else{ $Username=$_session['Username']; $Userlevel= $_session['Userlevel']; DisplayMenu($Username, $Userlevel, "Bulletin added sucessfully"); } }else{ DisplayAddForm($errorstring); } ?>
  12. I am creating a polling script that creates a graph and i am getting the following error: Warning: imagettfbbox() [function.imagettfbbox]: Could not find/open font in C:\Program Files\xampp\htdocs\showpoll.php on line 74 Warning: imagettftext() [function.imagettftext]: Could not find/open font in C:\Program Files\xampp\htdocs\showpoll.php on line 80 Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\xampp\htdocs\showpoll.php:74) in C:\Program Files\xampp\htdocs\showpoll.php on line 117 ‰PNG IHDRô2%r¾À_IDATxœíÁ‚ ÿ¯nH@Àƒ%9ÃüútIEND®B`‚ here is my line 74, 80, and 117 $title_dimensions = ImageTTFBBox($title_size, 0, $font, $title); ImageTTFText($im, $title_size, 0, $title_x, $title_y, $text_color, $font, $title); Header('Content-type: image/png'); any help will be much appreciated
  13. Hi I am doing a Project that i am working on which is based on creating a web-based 360 appraisal system. Its based around multiple individuals providing feedback through answering a questionnaire on the appraisee. Im currently working on the questionanire and have got the questions outputting from the database with the standard radio buttons being outputted. I need to be able to store the answers (the value) from the selected radio buttons to be stored for each user that is completes the questionnaire, this then has to be stored in the database somehow to be later used for perfroming calculations from which averages can be calculated once other individuals have completed their qauestionnaire. I think i need to store the value into an array before inputting it into the database. is this right? Also is there an easy way in which I can output the value of aselected radio button. Below is the code i have developed so far; which outputs the questions and answers. <html> <head><basefont face = 'Arial'></head> <body> <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); /* // include configuration file include('config.php'); // open database connection $connection = mysql_connect($host, $user, $pass) or die('ERROR: Unable to connect!'); */ // select database }mysql_select_db("feedback") or die('ERROR: Unable to select database!'); // TASKS....need to store answers - format q page // generate and execute query $query = "SELECT qid, qtitle1 FROM questions"; $result = mysql_query($query) or die("ERROR: $query.".mysql_error()); // if records are present if (mysql_num_rows($result) > 0) { $row = mysql_fetch_object($result); $index = 1; // LOOP TO OUTPUT QUESTIONs while ($row = mysql_fetch_object($result)) { //LOOP OUTPUTTING EACH QUESTION // get question ID and title $qid = $row->qid; echo '<h4>'.$row->qtitle1 .'</h4>'; echo "<form method = post action = 'user_submit.php'>"; // variable used to assign name to each group of radio buttons $name = "answer".$index; //output radio buttons, assigning value to each button, outputtin a different label for e echo "<input type=\"radio\" name=$name value=4 \>"; echo $name; echo "<label>Strongly Agree <br/>"; echo "<input type=\"radio\" name=$name value=3 \>"; echo $name; echo "<label>Agree <br/>"; echo "<input type=\"radio\" name=$name value=2 \>"; echo $name; echo "<label>Strongly Disagree <br/>"; echo "<input type=\"radio\" name=$name value=1 \>"; echo $name; echo "<label>Disagree <br/>"; $index++; } //CLOSES IF echo "<input type = hidden name = qid value = '".$qid."'>\n"; echo "<input type = submit name = submit value = 'Vote!'>\n\n"; //for ($i = 1; $i < 10; $i++) { // echo "answer$i\n"; //} echo '</form>'; }//Closes 1st IF // if no records present, display message else { echo '<font size="-1">No questions currently configured</font>'; } // close connection //mysql_close($connection); ?> </body> </html>
  14. Notice: Undefined variable: Subject in h:\Project\HTDOCS\new patient database\editspecificbull.php on line 37 Notice: Undefined variable: Description in h:\Project\HTDOCS\new patient database\editspecificbull.php on line 37 Notice: Undefined variable: DrComments in h:\Project\HTDOCS\new patient database\editspecificbull.php on line 37 Query: UPDATE Bulletin SET Subject = '', Description ='', DrComments = '' WHERE Bulletin_ID =35 AND Adminusername = 'shakeys'
×
×
  • 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.