
Perplexity 🤖
Members-
Posts
27 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
Perplexity 🤖's Achievements

Newbie (1/5)
0
Reputation
-
well my problem is I cant get test to show.... can you aim me? volonetmatt
-
with the below code it is dieing.... it should be passing? <?php if ($_SESSION['userLevel'] > 2) { echo "<li><a href=\"#\">TEST</a></li>"; } die(); ?>
-
Hey everyone, how would I get the word TEST to show correctly? I am trying to pass my user level into the menu. <?php if ($_SESSION['userLevel'] > 2) { die(); echo "<li><a href=\"#\">TEST</a></li>"; } ?> <?php $mode="mode22"; if(isset($_POST['mode'])) { $mode = $_POST['mode']; } if(isset($_GET['mode'])) { $mode = $_GET['mode']; } switch ($mode) { case 'login': $username = $_POST['login']; $password = $_POST['password']; include ('db_fns.php'); if (!connector()) { die ('connection dies'); } if (loginCheck($username, $password)) { header('location: loggedin.php'); } else { die ('login has failed <a href="login.html">Click here to login again</a>'); } break; case 'adduser': if ($_SESSION['userLevel'] < 2) { die('access denied'); } $username = $_REQUEST['userName']; $password = $_REQUEST['passWord']; $firstName = $_POST['firstName']; $lastName = $_POST['lastName']; $department = $_POST['department']; $userLevel = $_POST['userLevel']; if (empty($username) || empty($password)){ echo "please enter a username."; die; } //print_r($_POST); include ('db_fns.php'); if (!connector()) { die ('connection dies'); } if(!addUser($username,$password,$firstName,$lastName,$department,$userLevel)) { die('There was a problem - contact the system administrator'); } else { echo "Data has been submitted. <a href=\"/IOM/admin\">return to administration</a>"; } break; default: break; } ?>
-
Need Help! Notice: Undefined variable
voloproductions replied to voloproductions's topic in PHP Coding Help
how about this??? Notice: Undefined index: userLevel in C:\wamp\www\iom\index.php on line 28 -
Need Help! Notice: Undefined variable
voloproductions replied to voloproductions's topic in PHP Coding Help
never mind I fixed it... I used a funky value. -
Need Help! Notice: Undefined variable
voloproductions replied to voloproductions's topic in PHP Coding Help
doing the above gets the following... Notice: Undefined index: login in C:\wamp\www\iom\log.php on line 15 Notice: Undefined index: password in C:\wamp\www\iom\log.php on line 16 -
Need Help! Notice: Undefined variable
voloproductions replied to voloproductions's topic in PHP Coding Help
im sorry I dont get it still, can you give me a written code example on how to fix this. -
Hey everyone I get this error and need to know how to fix it in my code. I am new to PHP so I am not sure what to do here. Thanks! Notice: Undefined variable: mode in C:\wamp\www\iom\log.php on line 12 THE ERROR AND OR ISSUE: Notice: Undefined variable: mode in C:\wamp\www\iom\log.php on line 37 MY CODE: <?php if(isset($_POST['mode'])) { $mode = $_POST['mode']; } if(isset($_GET['mode'])) { $mode = $_GET['mode']; } switch ($mode) { case 'login': $username = $_POST['login']; $password = $_POST['password']; include ('db_fns.php'); if (!connector()) { die ('connection dies'); } if (loginCheck($username, $password)) { header('location: loggedin.php'); } else { die ('login has failed <a href="login.html">Click here to login again</a>'); } break; case 'adduser': if ($_SESSION['userLevel'] < 2) { die('access denied'); } $username = $_REQUEST['userName']; $password = $_REQUEST['passWord']; $firstName = $_POST['firstName']; $lastName = $_POST['lastName']; $department = $_POST['department']; $userLevel = $_POST['userLevel']; if (empty($username) || empty($password)){ echo "please enter a username."; die; } //print_r($_POST); include ('db_fns.php'); if (!connector()) { die ('connection dies'); } if(!addUser($username,$password,$firstName,$lastName,$department,$userLevel)) { die('There was a problem - contact the system administrator'); } else { echo "Data has been submitted. <a href=\"/IOM/admin\">return to administration</a>"; } break; default: break; } ?>
-
uggh I gotta get going out of the office think you can email me? [email protected] I would greatly appreciate more help! Thanks mike.
-
how do I write this code to do this dump on the variable. No errors on upload checks.... I can echo out the uploadEND variable fine and it works great, just cannot get it saved into the database.
-
look under here: the variable $uploadEND is created there. //chcek file & size $filename = basename($_FILES['uploaded_file']['name']); $ext = substr($filename, strrpos($filename, '.') + 1); if (($ext = "jpg,gif,xls,doc,png") && ($_FILES["uploaded_file"]["type"] = "jpg,gif,xls,doc,png") && ($_FILES["uploaded_file"]["size"] < 350000000)) { //Determine the path to which we want to save this file $newname = dirname(__FILE__).'/files/'.$filename; //Check if the file with the same name is already exists on the server if (!file_exists($newname)) { //Attempt to move the uploaded file to it's new place if ((move_uploaded_file($_FILES['uploaded_file']['tmp_name'],$newname))) { $uploadEND = '<a href=\"downloadfilelink\">' . $newname . "</a>"; // AND LETS RUN OUR UPLOAD CHECKS!! } else { echo "Error: A problem occurred during file upload!"; } } else { echo "Error: File ".$_FILES["uploaded_file"]["name"]." already exists"; } } else { echo "Upload Error, Only JPG,GIF,XLS,DOC Allowed."; } //} else { //echo "Error: No file uploaded"; }
-
here is my code again. <?php function ShowHTML() { ?> <!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> <?php if ($GLOBALS['redirect'] == "1") { ?> <meta http-equiv="refresh" content="2;url=?act=index"> <?php } elseif ($GLOBALS['redirect'] == "2") { ?> <meta http-equiv="refresh" content="2;url=?act=index"> <?php } ?> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>IOM - Internal Office Manager 1.0</title> <link rel="stylesheet" href="style.css" type="text/css" media="screen" /> </head> <body> <div id="wrapper"> <div id="header"> </div> <div id="menu"> <ul> <li><a href="?act=index">Home</a></li> <?php if ($GLOBALS['loggedin'] == "Log In") { ?> <li><a href="?act=login"> <?php echo $GLOBALS['loggedin']; ?> <?php } else { ?> <li><a href="?act=logout"> <?php echo $GLOBALS['loggedin']; ?> </li></a> <li><a href="?act=submit">Submit Ticket</a></li> <li><a href="?act=view">View Tickets</a></li> <?php } ?> </ul> </div> <div id="content"> <div class="entry"> <div class="entry-title"><?php echo $GLOBALS['pagetitle'] ?></div> <p><?php echo $GLOBALS['maincontent'] ?></p> </div> </div> <div id="footer"> </div> </div> </div> </body> </html> <?php } function encrypt($string) { $crypted = crypt(md5($string), md5($string)); return $crypted; } //////////////////////////////////////////////////////////////////////////// // POST AND GET: // //////////////////////////////////////////////////////////////////////////// if ($_POST["act"]!="") $act = $_POST['act']; else if ($_GET["act"]!="") $act = $_GET["act"]; // if ($_POST["username"]!="") $username = $_POST['username']; else if ($_GET["username"]!="") $username = $_GET["username"]; // if ($_POST["password"]!="") $password = $_POST['password']; else if ($_GET["password"]!="") $password = $_GET["password"]; // if ($_POST["email"]!="") $email = $_POST['email']; else if ($_GET["email"]!="") $email = $_GET["email"]; // if ($_POST["id"]!="") $id = $_POST['id']; else if ($_GET["id"]!="") $id = $_GET["id"]; // if ($_POST["subject"]!="") $subject = $_POST['subject']; else if ($_GET["subject"]!="") $subject = $_GET["subject"]; // if ($_POST["issue"]!="") $issue = $_POST['issue']; else if ($_GET["issue"]!="") $issue = $_GET["issue"]; // if ($_POST["upload"]!="") $issue = $_POST['upload']; else if ($_GET["upload"]!="") $issue = $_GET["upload"]; //////////////////////////////////////////////////////////////////////////// // LETS START THE USER SESSION OF IOM: // //////////////////////////////////////////////////////////////////////////// session_start(); require("config.php"); if (!$_SESSION['username']) { $login = 0; $loggedin = "Log In"; } else { $login = 1; $loggedin = "Log Out"; } //////////////////////////////////////////////////////////////////////////// // DATE INFO: // //////////////////////////////////////////////////////////////////////////// $curdate = date("Y-m-d"); //////////////////////////////////////////////////////////////////////////// // MYSQL CONNECT: // //////////////////////////////////////////////////////////////////////////// $db=mysql_connect($dbhostname,$dbusername, $dbpassword) OR DIE ("Unable to connect to database! [email protected]"); mysql_select_db($dbname); if ($act == "" | $act == "index") { if(!$_SESSION['username']) { $pagetitle = "Welcome"; $maincontent = "Hello and welcome to IOM - Internal Office Mananger. Please login with your supplied user name and password to submit a request to our web department."; } else { $usertemp2 = $HTTP_COOKIE_VARS["IOM"]; $query = "SELECT * FROM users"; $result = mysql_query($query); if($result) { while($row = mysql_fetch_array($result)){ $tempuser = $row["username"]; $lastlogin = $row["date"]; if ($tempuser == $usertemp2) { break; } } } session_start(); $maincontent = "You are logged in as:<strong><font color=\"red\">" ." " ." " . $_SESSION['username'] . "</strong></font>"; } ShowHTML(); die; } elseif ($act == "register") { $pagetitle = "Register"; $maincontent = "Please enter your details below to register for an account.</p> <p> <table border=\"0\" width=\"100%\"> <form action = \"?act=registeracc\" method=\"post\"> <tr> <td>Username:</td> <td><input type=\"text\" name=\"username\" size=\"50\"></td> </tr> <tr> <td>Password:</td> <td><input type=\"password\" name=\"password\" size=\"50\"></td> </tr> <tr> <td>Email:</td> <td><input type=\"text\" name=\"email\" size=\"70\"></td> </tr> <tr> <td> </td> <td><input type=\"submit\" value=\"Submit\"></td> </tr> </form> </table>"; ShowHTML(); die; } elseif ($act == "login") { $pagetitle = "<br />Login"; $maincontent = "</p> <p> <table border=\"0\" width=\"100%\"> <form action = \"?act=loginpass\" method=\"post\"> <tr> <td>Username:</td> <td><input type=\"text\" name=\"username\" size=\"50\"></td> </tr> <tr> <td>Password:</td> <td><input type=\"password\" name=\"password\" size=\"50\"></td> </tr> <tr> <td> </td> <td><input type=\"submit\" value=\"Submit\"></td> </tr> </form> </table></p> "; ShowHTML(); die; } elseif ($act == "logout") { setcookie ("IOM", "", time()-604800); $_SESSION['username'] = ""; $pagetitle = "Logged Out"; $maincontent = "You have been successfully logged out. You will be redirected shortly."; $redirect = "2"; ShowHTML(); die; } elseif ($act == "loginpass") { $query = "SELECT * FROM users"; $result = mysql_query($query); if($result) { while($row = mysql_fetch_array($result)){ $tempuser = $row["username"]; $temppass = $row["password"]; $temprank = $row["rank"]; $tempdate = $row["date"]; if($username == $tempuser) { if ($temppass === (Encrypt($password))) { $success = "1"; break; } else { $success = "0"; } } else { $success = "0"; } } } if ($success != "1") { $pagetitle = "Incorrect"; $maincontent = "You have specified and incorrect username or password."; } else { $pagetitle = "Success"; $redirect = "1"; $maincontent = "Login successful, you will be redirected now."; setcookie('IOM', $username, time()+60*60*24*30); $_SESSION['username'] = $username; mysql_query("UPDATE users SET date='$curdate' WHERE username='$username'") or die (mysql_error()); } ShowHTML(); die; } elseif ($act == "registeracc") { if ($username == "" | $password == "" | $email == "") { $pagetitle = "Error"; $maincontent = "Please make sure that you fill in all fields."; } else { $query = "SELECT * FROM users"; $result = mysql_query($query); if($result) { while($row = mysql_fetch_array($result)){ $tempuser = $row["username"]; if($tempuser == $username) { $pagetitle = "Error"; $maincontent = "That username already exists within our database."; ShowHTML(); die; } } $member1 = "Member"; $encpassword = encrypt($password); mysql_query("INSERT INTO users VALUES ('','$username','$encpassword', '$email', '$member1', '$curdate')") or die (mysql_error()); $pagetitle = "Success"; $maincontent = "You have been successfully added to the database."; } } ShowHTML(); die; } if ($login != "1") { $pagetitle = "Login"; $maincontent = "You can't do that because your not logged in"; } else { if ($act == "view") { $maincontent =" <table width=\"100%\" border=\"0\" > <tr> <td>ID</td> <td>Subject</td> <td>Summary</td> <td>Status</td> <td>Progress</td> <td>View/Delete</td> <td>Replies</td> </tr>"; $usertemp2 = $HTTP_COOKIE_VARS["IOM"]; $pagetitle = "View Support Tickets - $usertemp2"; $query = "SELECT * FROM tickets ORDER BY progress ASC"; $result = mysql_query($query); if($result) { while($row = mysql_fetch_array($result)){ $tempuser = $row["username"]; $tempid = $row["index"]; $tempsubject = $row["subject"]; $tempsummary = $row["summary"]; $tempstatus = $row["status"]; $tempprogress = $row["progress"]; $tempreply = $row["replied"]; $upload = $row["uploadEND"]; if ($tempuser == $usertemp2) { $maincontent .= " <tr> <td>$tempid</td> <td>$tempsubject</td> <td>$tempsummary</td> <td>$tempstatus</td> <td>$tempprogress %</td> <td>$uploadEND</td> <td><a href=\"?act=viewticket&id=$tempid\">View</a> <a href=\"?act=deleteticket&id=$tempid\">Delete</a></td><td> "; if ($tempreply == "1") { $maincontent .= "Yes"; } else { $maincontent .= "No"; } $maincontent .="</td> </tr> "; } } } $maincontent .= "</table>"; } elseif ($act == "viewticket") { $usertemp2 = $HTTP_COOKIE_VARS["IOM"]; $query = "SELECT * FROM tickets"; $result = mysql_query($query); if($result) { while($row = mysql_fetch_array($result)){ $tempuser = $row["username"]; $tempid = $row["index"]; $tempsubject = $row["subject"]; $tempissue = $row["issue"]; $tempstatus = $row["status"]; $tempprogress = $row["progress"]; $tempreply = $row["replied"]; $newname = $row["uploadEND"]; if ($id == $tempid) { if ($tempuser == $usertemp2) { $pagetitle = "View Support Ticket - $tempsubject"; $maincontent .= " <table width=\"100%\" border=\"0\"> <tr> <td>ID:</td> <td>$tempid</td> </tr> <tr> <td>Subject:</td> <td>$tempsubject</td> </tr> <tr> <td>Status:</td> <td>$tempstatus</td> </tr> <tr> <td>Progress:</td> <td>$tempprogress %</td> </tr> <tr> <td>Conversation:</td> <td>$tempissue</td> </tr> <tr> <td> </td> <td>"; if ($tempstatus == "Open") { $maincontent .="<a href=\"?act=closeticket&id=$tempid\">Close Ticket?</a>"; } else { $maincontent .="<a href=\"?act=openticket&id=$tempid\">Open Ticket?</a>"; } $maincontent.= "</td> </tr> "; if ($tempreply != "0") { $maincontent .= " <tr> <td> </td> <td><a href=\"?act=replyticket&id=$tempid\">Reply to ticket?</a></td> </tr>"; } $maincontent .= " </table>"; break; } } } } } elseif ($act == "replyticket") { $usertemp2 = $HTTP_COOKIE_VARS["IOM"]; $query = "SELECT * FROM tickets"; $result = mysql_query($query); if($result) { while($row = mysql_fetch_array($result)){ $tempid = $row["index"]; $tempuser = $row["username"]; $tempissue = $row["issue"]; if ($tempid == $id) { if ($tempuser == $usertemp2) { $pagetitle = "Reply to Ticket"; $maincontent .= " Please use the form below to reply to the ticket:</p> <p> <table width=\"100%\" border=\"0\"> <form method=\"post\" action=\"?act=replyticketgo\"> <input type=\"hidden\" name=\"id\" value=\"$tempid\"> <tr> <td>Conversation:</td> <td>$tempissue</td> </tr> <tr> <td>Reply:</td> <td><textarea name=\"issue\" cols=\"50\" rows=\"10\"></textarea></td> </tr> <tr> <td> </td> <td><input type=\"submit\" value=\"Submit\" size=\"50\"></td> </tr> </form> </table>"; break; } } } } } elseif ($act == "replyticketgo") { $usertemp2 = $HTTP_COOKIE_VARS["IOM"]; $query = "SELECT * FROM tickets"; $result = mysql_query($query); if($result) { while($row = mysql_fetch_array($result)){ $tempid = $row["index"]; $tempuser = $row["username"]; $tempissue = $row["issue"]; if ($tempid == $id) { if ($tempuser == $usertemp2) { $tissue = "<u>".$HTTP_COOKIE_VARS["IOM"]."</u>:<br> ".$issue."<br> -----------------------------------------------<br>".$tempissue; mysql_query("UPDATE tickets SET issue='$tissue', replied='0' WHERE `index`='$id'") or die (mysql_error()); $pagetitle = "Ticket Reply"; $maincontent = "The ticket has been replied to successfully"; } } } } } elseif ($act == "uploadfile") { $usertemp2 = $HTTP_COOKIE_VARS["IOM"]; mysql_query("INSERT INTO uploadEND VALUES ('','$uploadEND')") or die (mysql_error()); $pagetitle = "Upload Complete"; $maincontent = "Your upload has been added to the ticket successfully"; } elseif ($act == "deleteticket") { $usertemp2 = $HTTP_COOKIE_VARS["IOM"]; mysql_query("DELETE FROM tickets WHERE `index`='$id' AND username='$usertemp2'") or die (mysql_error()); $pagetitle = "Ticket Deleted"; $maincontent = "Your ticket has been deleted successfully"; } elseif ($act == "closeticket") { $closed = "Closed"; $usertemp2 = $HTTP_COOKIE_VARS["IOM"]; mysql_query("UPDATE tickets SET status='$closed' WHERE `index`='$id' AND username='$usertemp2'") or die (mysql_error()); $pagetitle = "Ticket Closed"; $maincontent = "Your ticket has been closed successfully"; } elseif ($act == "openticket") { $open = "Open"; $usertemp2 = $HTTP_COOKIE_VARS["IOM"]; mysql_query("UPDATE tickets SET status='$open' WHERE `index`='$id' AND username='$usertemp2'") or die (mysql_error()); $pagetitle = "Ticket Opened"; $maincontent = "Your ticket has been opened successfully"; } elseif ($act == "submit") { $pagetitle = "Submit New Ticket"; //Check that we have a file if((!empty($_FILES["uploaded_file"])) && ($_FILES['uploaded_file']['error'] == 0)) { //chcek file & size $filename = basename($_FILES['uploaded_file']['name']); $ext = substr($filename, strrpos($filename, '.') + 1); if (($ext = "jpg,gif,xls,doc,png") && ($_FILES["uploaded_file"]["type"] = "jpg,gif,xls,doc,png") && ($_FILES["uploaded_file"]["size"] < 350000000)) { //Determine the path to which we want to save this file $newname = dirname(__FILE__).'/files/'.$filename; //Check if the file with the same name is already exists on the server if (!file_exists($newname)) { //Attempt to move the uploaded file to it's new place if ((move_uploaded_file($_FILES['uploaded_file']['tmp_name'],$newname))) { $uploadEND = '<a href=\"downloadfilelink\">' . $newname . "</a>"; // AND LETS RUN OUR UPLOAD CHECKS!! } else { echo "Error: A problem occurred during file upload!"; } } else { echo "Error: File ".$_FILES["uploaded_file"]["name"]." already exists"; } } else { echo "Upload Error, Only JPG,GIF,XLS,DOC Allowed."; } //} else { //echo "Error: No file uploaded"; } $maincontent = "Please enter the details about the new ticket below:</p> <p> <table border=\"0\" width=\"100%\"> <form action = \"?act=submitticket\" method=\"post\"> <tr> <td>Subject:</td> <td><input type=\"text\" name=\"subject\" size=\"50\"></td> </tr> <tr> <td>Issue:</td> <td><textarea cols=\"50\" rows=\"10\" name=\"issue\"></textarea></td> </tr> <tr> <td> </td> <!-- <td><input type=\"submit\" value=\"Submit\"></td> --> </tr> <td>File:</td> <td> <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"10000000000\" /> <input name=\"uploaded_file\" type=\"file\" /> <input type=\"submit\" value=\"Submit\" /> </form></td> <td> </table>"; } elseif ($act == "submitticket") { if ($subject == "" | $issue == "") { $pagetitle = "Error"; $maincontent = "Please make sure all fields are filled in."; } else { $usertemp2 = $HTTP_COOKIE_VARS["IOM"]; $status = "Open"; $progress = "0"; $pagetitle = "Ticket Submitted"; $upload = $newname; $summary = substr($issue, 0, 30)."..."; $maincontent = "Your ticket has been submitted! <br />"; $issue = "<u>".$usertemp2."</u>:<br>".$issue."<br> -----------------------------------------------<br> "; mysql_query("INSERT INTO tickets VALUES (NULL,'$username','$subject','$summary', '$status', '$progress', '$issue', '$replied','$uploadEND')") or die (mysql_error()); } } else { $pagetitle = "Invalid"; $maincontent = "You have specified an invalid action."; } } ShowHTML(); ?>
-
I am not sure how the handle that part of the process....still learning php.
-
does this help?
-
Anymore help with this? I am just not getting it. Greatly apprecaited.