Jump to content

jim.davidson

Members
  • Posts

    218
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

jim.davidson's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. I found the problem, there was a opening comment tag <-- without and ending tag.
  2. If you go to this link in Chrome all loads fine. Try it in IE( and nothing loads. http://www.independentmicromedia.com/san_rocco/
  3. no, that's not the problem. That file copyright.php is in that directory.
  4. I have page that loads fine in Chrome, Mozilla,etc but won't load in IE9. Can someone point me to the error? All help will be appreciated. Here's the code: index.php
  5. I found the error, it was this line GetSQLValueString($chair_man, "txt")); It needed to be this GetSQLValueString($chair_man, "text"));
  6. I get this error when trying to insert form data and don't know why Unknown column 'yes' in 'field list' The table has (4) columns committee_member_id, committee_id, member_id, and chairman Here's the code $MM_flag="MM_insert"; if (isset($_POST[$MM_flag])) { if (empty($_POST['committee_id'])) { $error['committee'] = 'You must select a committee'; } else { $committee_id = $_POST['committee_id']; } if (empty($_POST['member_id'])) { $error['member'] = 'You must select a member'; } else { $member_id = $_POST['member_id']; } if (isset($_POST['chairman_group'])) { $chairman = $_POST['chairman_group']; } if (!$error) { // Assign the tag $insertSQL = sprintf("INSERT INTO committee_members (committee_id, member_id, chairman) VALUES (%s, %s, %s)", GetSQLValueString($committee_id, "int"), GetSQLValueString($member_id, "int"), GetSQLValueString($chairman, "txt")); mysql_select_db($database_racc, $racc); $Result1 = mysql_query($insertSQL, $racc) or die(mysql_error()); } } Any help will be greatly appreciated.
  7. ok, I made sure session_start() is the first line and is spelled correctly and I still get the same results.
  8. Made the change replaced if (!isset($_SESSION)) { session_start(); } with sesson_start(); I still get the same results
  9. I'm having a problem with session variable retaining updated values. Here's what I'm doing member_login.php <?php require_once('Connections/rclub.php'); ?> <?php session_start(); $_SESSION['MM_Username'] = 'X'; $_SESSION['MM_UserGroup'] = 0; $_SESSION['user_name'] = 'j'; $_SESSION['Logged_in'] = 'no'; $_SESSION['MM_user_level'] = 0; if (isset($_POST['username'])) { $loginUsername=trim($_POST['username']); $password=$_POST['password']; $MM_fldUserAuthorization = "user_level"; $MM_redirectLoginSuccess = "login_passed.php"; $MM_redirectLoginFailed = "login_failed.php"; $MM_redirecttoReferrer = false; mysql_select_db($database_rclub, $rclub); $LoginRS__query=sprintf("SELECT username, password, user_level, user_id, first_name, last_name, member_id FROM users WHERE username=%s AND password=%s", GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); $LoginRS = mysql_query($LoginRS__query, $rclub) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); $row_loginFoundUser = mysql_fetch_assoc($LoginRS); // echo $loginFoundUser; if ($loginFoundUser) { $loginStrGroup = mysql_result($LoginRS,0,'user_level'); $loginMemberId = mysql_result($LoginRS,0,'member_id'); //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; $_SESSION['MM_user_level'] = $loginStrGroup; $_SESSION['member_id'] = $loginMemberId; $_SESSION['user_id'] = $row_loginFoundUser['user_id']; $f_name = $row_loginFoundUser['first_name']; $l_name = $row_loginFoundUser['last_name']; $fullname = trim($f_name); $fullname .= ' '; $fullname .= trim($l_name); $_SESSION['user_name'] = $fullname; echo $_SESSION['MM_Username']; echo $_SESSION['MM_UserGroup']; echo $_SESSION['user_name']; echo $_SESSION['user_id']; header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } echo results are: $_SESSION['MM_Username'] = jim.davidson $_SESSION['MM_UserGroup'] = 1 $_SESSION['user_name'] = Jim Davidson $_SESSION['user_id'] = 1 So the session variables have been updated. I then go back,comment out the echos (otherwise get headers sent error) enter the same data and now goes to login_passed.php. login_passed.php <?php //initialize the session if (!isset($_SESSION)) { session_start(); } ?> <?php require_once('Connections/rclub.php'); ?> <?php Here I echo the session variables echo $_SESSION['MM_Username']; echo $_SESSION['MM_UserGroup']; echo $_SESSION['user_name']; echo $_SESSION['user_id']; echo results are: $_SESSION['MM_Username'] = X $_SESSION['MM_UserGroup'] = 0 $_SESSION['user_name'] = j $_SESSION['user_id'] = nothing Three of the session variable reverted back to their original state and the fourth one is empty. Anyone have an idea as to why session varibles are notshowing the updated state?
  10. function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { $isValid = False; // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. // Therefore, we know that a user is NOT logged in if that Session variable is blank. if (!empty($UserName)) { // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. // Parse the strings into arrays. $arrUsers = Explode(",", $strUsers); $arrGroups = Explode(",", $strGroups); if (in_array($UserName, $arrUsers)) { $isValid = true; } // Or, you may restrict access to only certain users based on their username. if (in_array($UserGroup, $arrGroups)) { $isValid = true; } if (($strUsers == "") && true) { $isValid = true; } } return $isValid; } $MM_restrictGoTo = "not_logged_in.php"; if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) { $MM_qsChar = "?"; $MM_referrer = $_SERVER['PHP_SELF']; if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&"; if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) $MM_referrer .= "?" . $QUERY_STRING; $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer); header("Location: ". $MM_restrictGoTo); exit; } Am I sending the following to isAuthorized function "" as $strUsers $MM_authorizedUsers as $strGroups $_SESSION['MM_Username'] as $Username $_SESSION['MM_UserGroup'] as $UserGroup It returns False and I thing it's because of "" as $strUsers. Am I reading this right? Any help will be appreaciated
  11. I need to be able to attach a file(s) to a form. So I found some sample code that shows the basics. When I run it i get these errors: Warning: include_once(Mail.php) [function.include-once]: failed to open stream: No such file or directory in C:\Domains\palandtitles.com\wwwroot\send-email-form.php on line 4 Warning: include_once() [function.include]: Failed opening 'Mail.php' for inclusion (include_path='.;C:\php5\pear') in C:\Domains\palandtitles.com\wwwroot\send-email-form.php on line 4 Warning: include_once(Mail_Mime/mime.php) [function.include-once]: failed to open stream: No such file or directory in C:\Domains\palandtitles.com\wwwroot\send-email-form.php on line 5 Warning: include_once() [function.include]: Failed opening 'Mail_Mime/mime.php' for inclusion (include_path='.;C:\php5\pear') in C:\Domains\palandtitles.com\wwwroot\send-email-form.php on line 5 The server is running PHP version5.2.17 and has the following in the include path: include_path .;C:\php5\pear .;C:\php5\pear Can someone point me in the right direction? All help will be greatly appreciated. Here's the code: <?php // Pear library includes // You should have the pear lib installed include_once('Mail.php'); include_once('Mail_Mime/mime.php'); //Settings $max_allowed_file_size = 100; // size in KB $allowed_extensions = array("jpg", "jpeg", "gif", "bmp", "txt"); $upload_folder = './uploads/'; //<-- this folder must be writeable by the script $your_email = 'jim@independent-micro.com';//<<-- update this to your email address $errors =''; if(isset($_POST['submit'])) { //Get the uploaded file information $name_of_uploaded_file = basename($_FILES['uploaded_file']['name']); //get the file extension of the file $type_of_uploaded_file = substr($name_of_uploaded_file, strrpos($name_of_uploaded_file, '.') + 1); $size_of_uploaded_file = $_FILES["uploaded_file"]["size"]/1024; ///------------Do Validations------------- if(empty($_POST['name'])||empty($_POST['email'])) { $errors .= "\n Name and Email are required fields. "; } if(IsInjected($visitor_email)) { $errors .= "\n Bad email value!"; } if($size_of_uploaded_file > $max_allowed_file_size ) { $errors .= "\n Size of file should be less than $max_allowed_file_size"; } //------ Validate the file extension ----- $allowed_ext = false; for($i=0; $i<sizeof($allowed_extensions); $i++) { if(strcasecmp($allowed_extensions[$i],$type_of_uploaded_file) == 0) { $allowed_ext = true; } } if(!$allowed_ext) { $errors .= "\n The uploaded file is not supported file type. ". " Only the following file types are supported: ".implode(',',$allowed_extensions); } //send the email if(empty($errors)) { //copy the temp. uploaded file to uploads folder $path_of_uploaded_file = $upload_folder . $name_of_uploaded_file; $tmp_path = $_FILES["uploaded_file"]["tmp_name"]; if(is_uploaded_file($tmp_path)) { if(!copy($tmp_path,$path_of_uploaded_file)) { $errors .= '\n error while copying the uploaded file'; } } //send the email $name = $_POST['name']; $visitor_email = $_POST['email']; $user_message = $_POST['message']; $to = $your_email; $subject="New form submission"; $from = $your_email; $text = "A user $name has sent you this message:\n $user_message"; $message = new Mail_mime(); $message->setTXTBody($text); $message->addAttachment($path_of_uploaded_file); $body = $message->get(); $extraheaders = array("From"=>$from, "Subject"=>$subject,"Reply-To"=>$visitor_email); $headers = $message->headers($extraheaders); $mail = Mail::factory("mail"); $mail->send($to, $headers, $body); //redirect to 'thank-you page header('Location: thank-you.html'); } } ///////////////////////////Functions///////////////// // Function to validate against any email injection attempts function IsInjected($str) { $injections = array('(\n+)', '(\r+)', '(\t+)', '(%0A+)', '(%0D+)', '(%08+)', '(%09+)' ); $inject = join('|', $injections); $inject = "/$inject/i"; if(preg_match($inject,$str)) { return true; } else { return false; } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>File upload form</title> <!-- define some style elements--> <style> label,a, body { font-family : Arial, Helvetica, sans-serif; font-size : 12px; } </style> <!-- a helper script for vaidating the form--> <script language="Javascript" src="scripts/gen_validatorv31.js" type="text/javascript"></script> </head> <body> <?php if(!empty($errors)) { echo nl2br($errors); } ?> <form method="POST" name="email_form_with_php" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" enctype="multipart/form-data"> <p> <label for='name'>Name: </label><br> <input type="text" name="name" > </p> <p> <label for='email'>Email: </label><br> <input type="text" name="email" > </p> <p> <label for='message'>Message:</label> <br> <textarea name="message"></textarea> </p> <p> <label for='uploaded_file'>Select A File To Upload:</label> <br> <input type="file" name="uploaded_file"> </p> <input type="submit" value="Submit" name='submit'> </form> <script language="Javascript"> // Code for validating the form // Visit http://www.javascript-coder.com/html-form/javascript-form-validation.phtml // for details var frmvalidator = new Validator("email_form_with_php"); frmvalidator.addValidation("name","req","Please provide your name"); frmvalidator.addValidation("email","req","Please provide your email"); frmvalidator.addValidation("email","email","Please enter a valid email address"); </script> <noscript> <small><a href='http://www.html-form-guide.com/email-form/php-email-form-attachment.html' >How to attach file to email in PHP</a> article page.</small> </noscript> </body> </html>
  12. Installed Apache, php, and missed something. When I try loading a page on the testing server I get a box that says "View track your downloads" What did I miss?
  13. Thank you very much! That did it.
  14. I would like to create a list from two tables First Table members table member_id 10 int member_first_name 25 text member_last_name 30 text Second table id_tags table tag_id 10 int tag_number 5 text member_id 10 int from (members table) The list would have the name from the members table and the tag number from the id_tags table How do I write the join? Also some members do not have an id tag but I want them in the list too. Any and all help will be greatly appreciated!
  15. Thank you very much, now that I see that, the error makes sense.
×
×
  • 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.