Jump to content

cmb

Members
  • Posts

    100
  • Joined

  • Last visited

Everything posted by cmb

  1. I have an admin section which requires a log in, and to accomplish this i do this <?php require('check.php'); ?> on the check.php page i have this line <?php require('../login/database.php'); ?> Now my problem is i have created another folder inside the admin one, for organization, and i still try and reference the check.php page but i get require(../login/database.php): failed to open stream: No such file or directory in C:\xampp\htdocs\compfair\admin\check.php on line2 so i changed the link on check.php to ../../login/database.php and it works for the folder but for the admin folder stuff i get this error require(../../login/database.php): failed to open stream: No such file or directory in C:\xampp\htdocs\compfair\admin\check.php on line2 So is their a way to make this work without having 2 check.php pages
  2. Thanks for the help i will look into this
  3. So what should i do to sterilize the variables
  4. I know that I've tried it but i get an error
  5. I'm letting the admin users be able to create tables for polls and this is the query i have: $aquery = $con->prepare("ALTER TABLE `$table` ADD `$field` $enum DEFAULT '$def' NOT NULL"); the $table and $enum fields are both coming from another table so they are safe, but the $def and $field variables are both coming from the user. How can i check to be sure they are safe to use. I've tried this $aquery->bindParam(':field', $field); $aquery->bindParam(':def', $def); but that doesn't work
  6. So im useing the phpmailer class. The html message sends correctly when i have the html hardcoded into the php like this $mail->MsgHTML('<html> <body style="background-color: #000;"> <table> <tr> <td id="pinkpanthers" style="border: 2px solid #393;padding: 40px 40px; width: 100px;border-radius: 25px; color: #000; background-color: #393;font-size: x-large;" style="border: 2px solid #393;padding: 40px 40px; width: 100px;border-radius: 25px; color: #000; background-color: #393;font-size: x-large;"><a href="http://www.photosbychristian.com/pinkpanthers/index.php" style="text-decoration:none;color: #fff;">Pink<br />Panthers</a></td> <td id="gbsa" style="border: 2px solid #393;padding: 40px 40px; width: 100px;border-radius: 25px; color: #000; background-color: #393;font-size: x-large;"><a href="http://www.photosbychristian.com/gbsa/index.php" style="text-decoration:none;color: #fff;">GBSA</a></td> <td id="elite" style="border: 2px solid #393;padding: 40px 40px; width: 100px;border-radius: 25px; color: #000; background-color: #393;font-size: x-large;"><a href="http://www.photosbychristian.com/elite/index.php" style="text-decoration:none;color: #fff;">Elite</a></td> <td id="THS" style="border: 2px solid #393;padding: 40px 40px; width: 100px;border-radius: 25px; color: #000; background-color: #393;font-size: x-large;"><a href="http://www.photosbychristian.com/THS/index.php" style="text-decoration:none;color: #fff;">THS</a></td> <td id="HDR" style="border: 2px solid #393;padding: 40px 40px; width: 100px;border-radius: 25px; color: #000; background-color: #393;font-size: x-large;"><a href="#" style="text-decoration:none;color: #fff;">HDR</a></td> <td id="family" style="border: 2px solid #393;padding: 40px 40px; width: 100px;border-radius: 25px; color: #000; background-color: #393;font-size: x-large;"><a href="#" style="text-decoration:none;color: #fff;">Family</a></td> </tr> <tr> <td colspan="6"> <p style="color: #fff; text-align:center;">Text will go here</p> </td> </tr> </table> </body> </html>'); but when i try and get it to post from a form, using the below code, it doesn't send correctly (the css and links don't work) $htmlmsg = $_REQUEST['htmlmsg']; $html = "'".$htmlmsg."'"; $mail->MsgHTML($html);
  7. cmb

    Html Email

    the email sent fine and it showed up in my imbox but it was just a simple table with no css showing and the links not working the message is coming from a form as is bcc, to, and subject i changed the headers to look like this $headers = "From: Christian Basse <christian@photosbychristian.com>\r\n"; $headers .= "Reply-To: ". $from ."\r\n"; $headers .='MIME-Version: 1.0' . "\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n"; $headers .= "Bcc:" . $bcc . "\r\n";
  8. cmb

    Html Email

    Im trying to send a html email when i do this locally using mercury mail it works fine. Once i uploaded it and tried sending a email to gmail and yahoo it didn't work this is my php code <?php $from = $_REQUEST['from']; $to = $_REQUEST['to']; $bcc = $_REQUEST['bcc']; $subject = $_REQUEST['subject']; $message = $_REQUEST['msg']; // To send the HTML mail we need to set the Content-type header. $headers = 'From: ' . $from . "\nReply-To: ". $from ."\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=iso-8859-1' . "\r\n" . 'Bcc:' . $bcc . "\r\n"; // now lets send the email. mail($to, $subject, $message, $headers); print json_encode( "Message has been sent....!"); ?> this is the html i was trying to send (i also tried something simpler and that didn't work either) <html> <body style="background-color: #000;"> <table> <tr> <td id="pinkpanthers" style="border: 2px solid #393;padding: 40px 40px; width: 100px;border-radius: 25px; color: #000; background-color: #393;font-size: x-large;" style="border: 2px solid #393;padding: 40px 40px; width: 100px;border-radius: 25px; color: #000; background-color: #393;font-size: x-large;"><a href="http://www.photosbychristian.com/pinkpanthers/index.php" style="text-decoration:none;color: #fff;">Pink<br />Panthers</a></td> <td id="gbsa" style="border: 2px solid #393;padding: 40px 40px; width: 100px;border-radius: 25px; color: #000; background-color: #393;font-size: x-large;"><a href="http://www.photosbychristian.com/gbsa/index.php" style="text-decoration:none;color: #fff;">GBSA</a></td> <td id="elite" style="border: 2px solid #393;padding: 40px 40px; width: 100px;border-radius: 25px; color: #000; background-color: #393;font-size: x-large;"><a href="http://www.photosbychristian.com/elite/index.php" style="text-decoration:none;color: #fff;">Elite</a></td> <td id="THS" style="border: 2px solid #393;padding: 40px 40px; width: 100px;border-radius: 25px; color: #000; background-color: #393;font-size: x-large;"><a href="http://www.photosbychristian.com/THS/index.php" style="text-decoration:none;color: #fff;">THS</a></td> <td id="HDR" style="border: 2px solid #393;padding: 40px 40px; width: 100px;border-radius: 25px; color: #000; background-color: #393;font-size: x-large;"><a href="#" style="text-decoration:none;color: #fff;">HDR</a></td> <td id="family" style="border: 2px solid #393;padding: 40px 40px; width: 100px;border-radius: 25px; color: #000; background-color: #393;font-size: x-large;"><a href="#" style="text-decoration:none;color: #fff;">Family</a></td> </tr> <tr> <td colspan="6"> <p style="color: #fff; text-align:center;">Text will go here</p> </td> </tr> </table> </body> </html> this is the headers from gmail Delivered-To: cmbswim@gmail.com Received: by 10.194.21.41 with SMTP id s9csp621144wje; Sun, 14 Oct 2012 18:02:53 -0700 (PDT) Received: by 10.66.86.42 with SMTP id m10mr29016349paz.3.1350262972933; Sun, 14 Oct 2012 18:02:52 -0700 (PDT) Return-Path: <christianbasse@p3nlhg198.shr.prod.phx3.secureserver.net> Received: from p3nlsmtp20.shr.prod.phx3.secureserver.net (p3nlsmtp20.shr.prod.phx3.secureserver.net. [72.167.234.245]) by mx.google.com with ESMTP id bc7si3012631pab.65.2012.10.14.18.02.52; Sun, 14 Oct 2012 18:02:52 -0700 (PDT) Received-SPF: pass (google.com: domain of christianbasse@p3nlhg198.shr.prod.phx3.secureserver.net designates 72.167.234.245 as permitted sender) client-ip=72.167.234.245; Authentication-Results: mx.google.com; spf=pass (google.com: domain of christianbasse@p3nlhg198.shr.prod.phx3.secureserver.net designates 72.167.234.245 as permitted sender) smtp.mail=christianbasse@p3nlhg198.shr.prod.phx3.secureserver.net Received: from p3nlhg198.shr.prod.phx3.secureserver.net ([97.74.24.198]) by p3nlsmtp20.shr.prod.phx3.secureserver.net with id BD2n1k0044GSV4Z01D2nXS; Sun, 14 Oct 2012 18:02:52 -0700 Received: from p3nlhg198.shr.prod.phx3.secureserver.net (localhost [127.0.0.1]) by p3nlhg198.shr.prod.phx3.secureserver.net (8.14.4/8.12.11) with ESMTP id q9F12b5Q001356 for <cmbswim@gmail.com>; Sun, 14 Oct 2012 18:02:42 -0700 Received: (from christianbasse@localhost) by p3nlhg198.shr.prod.phx3.secureserver.net (8.14.4/8.14.4/Submit) id q9F12b7P001352; Sun, 14 Oct 2012 18:02:37 -0700 Date: Sun, 14 Oct 2012 18:02:37 -0700 Message-Id: <201210150102.q9F12b7P001352@p3nlhg198.shr.prod.phx3.secureserver.net> To: cmbswim@gmail.com Subject: Sample From: christian@photosbychristian.com Reply-To: christian@photosbychristian.com MIME-Version: 1.0 Content-type: text/html; charset=iso-8859-1
  9. cmb

    Simplexml

    I removed the indention on the lines and now it works class SimpleXMLExtended extends SimpleXMLElement{ public function addCData($cdata_text){ $node= dom_import_simplexml($this); $no = $node->ownerDocument; $node->appendChild($no->createCDATASection($cdata_text)); } }
  10. cmb

    Simplexml

    I got the same syntax error, unexpected T_VARIABLE. This is my full code with most of it commented out at the moment because i'm trying to get this to work <?php $is_ajax = 1;//$_REQUEST['is_ajax']; if(isset($is_ajax) && $is_ajax){ $id = "test3";//$_REQUEST['id']; $from = "cmbswim@gmail.com";//"<![CDATA[".$_REQUEST['from']."]]>" ; $to = "";//"<![CDATA[".$_REQUEST['to']."]]>"; $bcc = "test1@localhost,test2@localhost";//"<![CDATA[".$_REQUEST['bcc']."]]>" ; $subject = "test 3";//$_REQUEST['subject'] ; $msg = "this is the third test";//"<![CDATA[".$_REQUEST['msg']."]]>" ; class SimpleXMLExtended extends SimpleXMLElement{ public function addCData($cdata_text){ $node= dom_import_simplexml($this); $no = $node->ownerDocument; $node->appendChild($no->createCDATASection($cdata_text)); } } $xml_doc = new SimpleXMLExtended('save.xml',NULL,TRUE); $email = $xml_doc->addChild('email'); $email->addAttribute('id',$id); $email->from = NULL; $email->from->addCData($from); //$email->addChild('from', $from); // $email->addChild('to', $to); // $email->addchild('bcc', $bcc); // $email->addChild('subject', $subject); // $email->addChild('msg', $msg); $xml_doc->asXML('save.xml'); //echo "Success!!!"; } ?>
  11. cmb

    Simplexml

    I tried removing public and it still didn't work. I then uploaded it to my server and tried it there with public and without public and it still didn't work
  12. $dir = "path/to/directory/*"; foreach(glob($dir) as $file){ if (filetype($file)== 'file'){//only displays files no subdirectorys echo "<a href='http://www.google.com' target='_blank'><img src='".$file."' width='570' height='270 alt='slide' /></a><br />"; }//close file check }//close foreach
  13. cmb

    Simplexml

    In searching how to wright cdata tags into my xml document using simpleXML i came across this example and when i try and use it Dreamweaver shows that lines 4-7 are wrong i try and run the code anyway and i get this error syntax error, unexpected T_VARIABLE on line 4 <?php class SimpleXMLExtended extends SimpleXMLElement{ public function addCData($cdata_text){ $node= dom_import_simplexml($this); $no = $node->ownerDocument; $node->appendChild($no->createCDATASection($cdata_text)); } } $xml_doc = new SimpleXMLExtended('save.xml',NULL,TRUE); $email = $xml_doc->addChild('email'); $email->addAttribute('id',$id); $email->from = NULL; $email->from->addCData($from); $xml_doc->asXML('save.xml'); ?>
  14. cmb

    Site Search Help

    Thank you so much im new to regex so i would have never even thought about that
  15. This is the first part of the search script and i was doing some debuging and i cant figure out why this code if( !($fd = fopen($url,"r")) ){ die( "Could not open URL!" ); } while( $buf = fgets($fd,1024) ) { /* Remove whitespace from beginning and end of string: */ $buf = trim($buf); /* Try to remove all HTML-tags: */ $buf = strip_tags($buf); $buf = preg_replace('/&\w;/', '', $buf); /* Extract all words matching the regexp from the current line: */ preg_match_all("/(\b[\w+]+\b)/",$buf,$words); print_r($words); } doubles each associate array like this Array ( [0] => Array ( ) [1] => Array ( ) ) Array ( [0] => Array ( [0] => It [1] = > was [2] => November ) [1] => Array ( [0] => It [1] = > was [2] => November ) ) When I would expect this Array ( [0] => Array ( ) ) Array ( [0] => Array ( [0] => It [1] = > was [2] => November ) )
  16. So what i'm trying to do is a user selects a gallery, and then it shows up with out the page reloading. The number of pictures varies in each gallery. This is what i have attempted but instead of showing the images in the div nothing happens, but looking at the source code in the developer tools it is there. Ajax code: <script type="text/javascript"> function ajax(gal){ $.ajax({ cache: false, type: "GET", url: "ths.php", data: "gal=" + gal, success: function(p){ document.getElementById('thumbs').innerHTML = p; } }); } </script> php code: <?php include("database.php"); $gal = $_GET['gal']; $query = "SELECT * FROM ths_soccer WHERE Gallery_no = '$gal'"; $results = mysql_query($query); $row = mysql_fetch_assoc($results); $x = $row['no_Pics']; $gender = $row['Gender']; $day = $row['Date_Played']; $y = 1; echo "<ul class='thumbs noscript'>"; echo " <script type=\"text/javascript\" src=\"../../js/jquery.galleriffic.js\"></script>"; echo "<ul class='thumbs noscript'>"; if ($x == 0){ echo "<li> <a class='thumb' href='../../images/nopics.jpg' title=''><img src='../../images/nopicsthumb.jpg ' /></a></li>"; }else if ($x == 10000){ echo "<li> <a class='thumb' href='../../images/coming.jpg' title=''><img src='../../images/comingthumb.jpg ' /></a></li>"; }else{ while ($y <= $x){ echo "<li> <a class='thumb' href='../../images/Sections/ths/" . $gender . "/" . $day . "/" . $y . ".jpg' title=''><img src='../../images/Sections/ths/" . $gender . "/" . $day . "/thumbs/" . $y . ".jpg ' /></a><div class='caption'><div class='download'><a href='../../images/Sections/ths/" . $gender . "/" . $day . "/big/" . $y . ".jpg ' target='_blank' />Download</a></div></div></li>"; $y ++ ; } } echo "</ul>"; echo "</ul>"; ?>
  17. right now this is my code for clicking a button and it shows a div, click it again and it disappears. what i want to do is i just show that div on top of the rest how would i modify this to do that function toggle_visibility(id) { var e = document.getElementById(id); if(e.style.display == 'none') e.style.display = 'block'; else e.style.display = 'none'; }
  18. The code is suppose to put 6 pics in a row then move to the next line. What happens is the first line only has 5 pics and all the rest have 6. How do i fix this <?php $c_query = "SELECT * FROM products WHERE Type='Candy' ORDER BY Price"; $c_results = mysql_query($c_query) or die(mysql_error()); $c = 1; while ($c_row = mysql_fetch_array($c_results)){ if($c %6 == 0){ echo "</tr><tr>"; echo "<td><center><img src='" . $c_row['Path'] . "' width='50' height='50' /></center>"; echo "<br /><center><p>" . $c_row['Product'] . " $" . $c_row['Price']. "</p></center></td>"; $c++; }else{ echo "<td><center><img src='" . $c_row['Path'] . "' width='50' height='50' /></center>"; echo "<br /><center><p>" . $c_row['Product'] . " $" . $c_row['Price']. "</p></center></td>"; $c++; } } ?>
  19. while ( 5 < $c && $c <= 9){ }
  20. what is the correct way to wright this while ( 5 < $c <= 9){ }
  21. I figured out that IE will only upload files whose names only have letters in them
  22. pod_mod.php (form page) <?php require("check_login.php"); echo "<h3><a href='products.php'>Go Back</a> | <a href='../login/logout.php'>Logout</a>"; $pid = mysql_real_escape_string($_POST['pid']); $query = "SELECT * FROM products WHERE id='$pid'"; $results = mysql_query($query) or die("Query failed ($query) - " . mysql_error()); $row = mysql_fetch_array($results); ?> <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Modify Products</title> </head> <body> <center> <table> <tr><td><img src="../<?php echo $row['Path']?>" /></td></tr> <tr><td> <form method="post" action="prod_update.php" enctype="multipart/form-data"> <label for="product">Product : <input type="text" id="product" name="product" value="<?php echo $row['Product']?>" /> </label> </td></tr><tr><td> <label for="price">Price : <input type="text" id="price" name="price" value="<?php echo $row['Price']?>" /> </label> </td></tr><tr><td> <label for="file">Picture : <input type="file" name="file" id="file" accept="image/*" /> </label> </td></tr><tr><td> <input type="submit" value="Update" /> <input type="button" value="Delete" onclick="del();" /> </td></tr> </form> </table> </center> </body> </html> prod_update.php (upload script) <?php if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg"))) //&& ($_FILES["file"]["size"] < 20000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "../images/products/" . $_FILES["file"]["name"]); echo "Stored in: " . "images/products/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } ?>
  23. sorry the upload script is on a second page
×
×
  • 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.