Jump to content

SharkBait

Members
  • Posts

    845
  • Joined

  • Last visited

    Never

Everything posted by SharkBait

  1. If your deleting just 1 item from a database, even though there may be only 1 instance of it in the database I would still suggest using LIMIT 1 a the end of the query. [code] DELETE FROM myTable WHERE id = '4' LIMIT 1; [/code]
  2. If that was a copy paste, then your mail() function is a bit buggered Change: [code] $MAILSENT = mail($MYADDRESS, $SUBJECT, $MAILMESSAGE, $MAILEADER); [/code] To [code] $MAILSENT = mail(NULL, $SUBJECT, $MAILMESSAGE, $MAILHEADER); [/code] Also noticing that your not closing your <FONT> tags and your $MAILFONT is (I am assuming) missing the <FONT> tag as well. Yes I can be picky with closing of HTML tags ;)
  3. MD5 is a hash so it can't be decrypted. You can make a complex hash if your wanting a bit more security to it. [code] $salt ="SomeRandomPhraseThatCanBeUsed"; $mypass = md5(md5("mypassword").md5($salt)); [/code] Think that is how I do mine anyway. As for keeping someone 'logged in' I believe the best way is to do it by cookie. Keep the username, and somesorta randomly generated thing to have it check against the database I guess would be a way of doing it. Have it generate a 'cookiecode' everytime they log into the website after they have put their username/password in and have checked the 'remember' me option. *shrug* Just a couple thoughts I guess
  4. I think you have the idea pretty much. [code] <?php // Check to see the status of the user if($member_status == '2') {    // User is Admin    $style = "adminStyle"; } else {    // User is Not Admin    $style = "regularStyle"; } ?> <a class="<?php echo $style;?> href="#""> First Link</a> [/code] So now if your an Admin it will look like [code] <a class="adminStyle" href="#">First Link</a> [/code] and if your Not an Admin [code] <a class="regularStyle" href="#">First Link</a> [/code]
  5. How would you go about proving its your code though? Creation date of the file perhaps? How did the other script get a hold of your code? PHP is serverside and unless you posted it somewhere, how would they get it? *shrug*
  6. One thing I've noticed is that with <input type="text"> tags in HTML when they are submitted to a database (like MySQL) it will read the carriage returns and store them properly. Using echo nl2br($string); works fine when outputting what was in the database and putting in the paragraphs properly. Seems to be fine for windows/macs/un*x type plateforms. *edit ok that is cool, the forum read my input tag and displayed it hehe
  7. [!--quoteo(post=388522:date=Jun 27 2006, 07:45 AM:name=SharkBait)--][div class=\'quotetop\']QUOTE(SharkBait @ Jun 27 2006, 07:45 AM) [snapback]388522[/snapback][/div][div class=\'quotemain\'][!--quotec--] Ah thanx for the replies. I guess I'll have to do a combination of it. directory and file ;) I'll play around and see what I can come up with with help of the examples you guys have posted. [/quote] This is what I came up with: (how I wish php tags were working ;)) [code] <ul id="breadcrumbs"> <?php // Get Directory Path and Scriptname to create BreadCrumbs $parts = explode("/", dirname($_SERVER['PHP_SELF'])); echo "<li><a href=\"/\"Home</a> "; foreach($parts as $key => $dir) {   $label = ucwords($dir);   $url = "";   for($i = 1; $i <= $key; $i++) {     $url .= $parts[$i]."/";   }   if($dir != "") {     echo "<li>> a href=\"/{$url}\">{$label}</a></li> ";   } } $script = explode(".", basename($_SERVER['PHP_SELF'])); if(script != "") {   echo "<li>> ". ucwords($script[0])."</li>"; } ?> </ul> [/code] Thanx to the sillybean.net example and suggestions :) My Breadcrumbs look like: Home > Admin > ScriptName
  8. Ah thanx for the replies. I guess I'll have to do a combination of it. directory and file ;) I'll play around and see what I can come up with with help of the examples you guys have posted.
  9. How does one do the breadcrumbs in php? Do I use a session to keep track of where they are? Kind like phpfreaks: PHP Help Forums > PHP and MySQL > PHP Help
  10. Hi, What are some good resources for bettering myself with webdesign. Mainly the graphic side. I know there are thousands of sites out there that will show me little photoshop 'tricks' etc but I am looking more for the general layouts and hints/tips etc when designing webpages. I'm goodat doing backends, I'm not a front-end person. Just trying to learn more and make sites I create a bit... nicer looking ;) Thanks
  11. [!--quoteo(post=386621:date=Jun 21 2006, 03:44 PM:name=Brent)--][div class=\'quotetop\']QUOTE(Brent @ Jun 21 2006, 03:44 PM) [snapback]386621[/snapback][/div][div class=\'quotemain\'][!--quotec--] 1) Can a spam bot harvest the email address with this method, when the form is getting it from the .inc file? [/quote] Spam bots usually are designed to go through the HTML of a document. If the .inc file is displayed in HTML to the user, then they will be able to parse the webpage for the information. They can only get what you can see when you 'view source' [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] 2) Do I have to have an array command above / before the variables in the .inc file? If so, what exactly? [/quote] Do you mean should you define the array before filling it in? Sure. $myArray = array(); [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] 3) Is the 1 in the person=1 parameter in the URL referring to the 1 in the person[1] variable in the .inc file? [/quote] It can if its designed that way. Though with php array's are zero based. So they start like myArray[0], myArray[1], myArray[2].... But if you are trying to pull the value from the URL, I do believe you are doing it correctly. [code] // URL looks like http://mysite.com/page.php?person=1 //Check to see if the variable is set if (isset($_GET['person'])) {    // Grab the value    $value = $_GET['person']    // Get that particular item from the array and spill its contents    print_r($myArray[$person]); } [/code] [code] 4) I want that parameter to tell the contact form to print the person's name on the page as the title and heading "Contact (name)" and was told I need to use the $_GET command. Which one of the following codes is right? (The 1 refers to the 1 in the person=1 parameter in the URL, which refers to the 1 in the person[1] variable in the .inc file.) [/quote] Use this one (though I put my varibles into something and try not to use the $_GET over and over): [code]<h1>Contact <? print($person[$_GET["1"]["name"]]); ?></h1>[/code] [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] 5) ASoft's form script has: [code]mail("$receiver", $subject, $messageproper, "From: $yoursitename <$email>");[/code] The "receiver" variable gets the email address from the config file, which I'll be replacing with an .inc file. Do I need to replace $receiver with: [code]$person[$_GET["1"]["email"]];[/code] with the 1 referring to the 1 in the person=1 parameter in the URL, which refers to the 1 in the person[1] variable in the .inc file? [/quote] I believe that is right, but take the quotes out around the 1 ($_GET[1]) [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] 6) Do I have to create an if / else rule to get one or both of these (printing name and getting email address) to work? If so, what exactly? [/quote] Should have to. You could loop through your 2dimensional array sorta like: [code] // Go through the top most array foreach($myArray as $something => $miniArray) {   // Now I can pull the information I want from the inner arrays   $name = $miniArray[0];   $email = $miniArray[1];   next; } [/code] I think that should give you a rough idea. Not the exact because I am unsure how your arrays are set up in the first place. Hopefully this helps you, if not I can try and further explain.... :)
  12. It would but I need it to set the start time at 6:45am everyday. So this is what I ended up with: [code] <?php $TotalUnits = 0; $sStart = mktime(06,45,0); $sCurrent = mktime(); $betweenTime = substr(($sCurrent - $sStart) / 3600, 0, 3); $startTime = date("Y-m-d 06:45:00"); $currentTime = date("Y-m-d h:m:s"); foreach($UNITS as $table => $name) {   $strqry = "SELECT COUNT(*) as count FROM {$table} WHERE Real_Date = '{$startTime}' AND Real_Date <= '{$currentTime}'";   $query = mysql_query($strqry) or die("MySQL Error: <br />{$strqry} <br /> ". mysql_error());   $result = mysql_fetch_array($query, MYSQL_ASSOC);   $TotalUnits = $TotalUnits + $result['count']; } echo substr($TotalUnits / $betweenTime, 0,2); ?> [/code] So now I can check between 6:45am and the current time, count the units that were entered and find the units per hour value :)
  13. Trying to figure out the mktime of 6:45am of this day. I'm doing: mktime(6,45); Is that right? What I will be doing is using that as my start time, then finding out what my current time is and substracting the two to see how much time has passed since.
  14. I figured out what it was. In my Apache httpd.conf I have it looking for PHP in .css files Well that would of course bugger things up. Though IE would not break, and FireFox would. So I removed the .css extension from the httpd.conf so that it would not look for PHP and it works peachy now. :)
  15. This is the HTML that is called (require("includes/header.html")) in the line 0 of the index.php [code] <?php session_start(); $sessid = session_id(); header("Cache-control: private");   // IE6 Fix for Sessions ob_start(); $mtime = microtime(); $mtime = explode(' ', $mtime); $mtime = $mtime[1] + $mtime[0]; $startime = $mtime; if (!isset($page_title)) {     $page_title = QC Test Site'; } error_reporting(E_ALL ^ E_NOTICE); require_once('mysql_connect.php'); require('includes/funcs.inc'); require('includes/defs.php');    // Check User Messages via MySQL $NEWMSGS = FALSE; $msgqry = "SELECT * FROM messages WHERE Receipient = '{$USERNAME}'"; $mysql = mysql_query($msgqry); $msgFound = mysql_num_rows($mysql); $newMsgQry = "SELECT * FROM messages WHERE Receipient = '{$USERNAME}' AND Viewed = 'N'"; $NewQuery = mysql_query($newMsgQry); $numNewMsg = mysql_num_rows($NewQuery); if ($numNewMsg > 0) {     $NEWMSGS = TRUE; } ?> <!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> <title>     <?php         echo $page_title;     ?> </title>     <link rel="stylesheet" type="text/css" href="includes/styles.css" />          <?php     if ($NEWMSGS && isset($USERNAME)) {         ?>     <script language="Javascript">         function popUP() {             mywindow= window.open ("newmsg.php", "mywindow","location=0,status=0,scrollbars=0,width=200,height=50");             mywindow.moveTo(0,0);         }     </script>         <?php     }     ?> </head> <body> <?php if (!isset($USERNAME)) { ?> <div style="background-color: #36c; color: #fff; padding: 5px;">     <form action="login.php" method="post" style="padding:0; margin:0;">         Username: <input style="font-size: 90%;" type="text" name="username" size="20" value="<?php if (isset($username)) echo $username; ?>" />         Password: <input style="font-size: 90%;" type="password" name="password" size="20" /><input style="font-size: 90%;" type="submit" name="submit" value="Login" />     </form> </div> <?php } ?> <div id="maincontainer">     <?php     if(isset($USERNAME)) {              ?>     <div class="navcontainer">         <?php         if ($USERNAME) {             echo "Logged In As:";         } else {             echo "Please Login";         }         ?>         <div class="topmenu"><br />             <?php             if(isset($USERNAME)) {                 echo "<span class=\"username\">{$USERNAME}</span>";             }             ?>             <span class="username" style="padding-left: 10px; text-align: right;">                 [ <a href="logout.php">Logout</a> ]             </span>             <br />&nbsp;         </div>     </div>     <?php     }     if ($USERLEVEL == $ADMIN) {     ?>     <div class="navcontainer">         Administation         <div class="topmenu">             <ul class="topmenu">                 <li><a href="phpMyAdmin" target="_blank">phpMyAdmin</a></li>                 <li><a href="users.php">User List</a></li>                 <!-- <li><a href="rma_dump.php">Dump RMA entries</a></li> -->                 <li> &nbsp;</li>                 <!-- <li><a href="logs.php">View Logs</a></li> -->             </ul>         </div>     </div>     <?php     }     if ($USERLEVEL >= $TESTER) {       ?>     <div class="navcontainer">         Testing         <div class="topmenu">             <ul class="topmenu">                 <li><a href="add_note.php">Add a Note</a></li>                 <li><a href="test.php">Test Units</a></li>                 <li>&nbsp;</li>             </ul>         </div>     </div>     <div class="navcontainer">         Messages         <div class="topmenu">             <ul class="topmenu">                 <li><a href="messages.php?viewall">View Messages</a>                     <span align="center" style="color:#000; text-align: center;">                         <?php echo "<font color=\"#000000\">{$numNewMsg} [ {$msgFound} ] </font> \n"; ?>                     </span></li>                 <li><a href="messages.php?send">Send a Message</a></li>                 <li>&nbsp;</li>             </ul>         </div>     </div>     <div style="clear:both;">&nbsp;</div>     <?php     }         ?>     <div style="float:left; width: 150px;">     <?php         require('nav-left.php');     ?>     </div>     <div style="float: right; width: 640px;">                 <!--  CHANGABLE CONTENT HERE --> [/code] Its on a private network so I can't show you it in action :) I am missing something in my header.html file?
  16. This is the error I get when I look at one of my sites on my test machine via the JavaScript Console in FireFox: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Error: The stylesheet [a href=\"http://tyswebserver/testsite/includes/styles.css\" target=\"_blank\"]http://tyswebserver/testsite/includes/styles.css[/a] was not loaded because its MIME type, "text/html", is not "text/css". Source File: [a href=\"http://tyswebserver/testsite/index.php\" target=\"_blank\"]http://tyswebserver/testsite/index.php[/a] Line: 0 [/quote] Now this is the CSS file (I'm still learning how to do CSS properly so please bare with me): [code] /**************************************** MAIN CSS FILE /****************************************/ body {     margin: 0;     padding: 0;     background-color: #ddd; } a:link, a:visited, a:hover, a:active {     color: #00f;     text-decoration: none; } a:hover {     color: #000; } a:active {     color: #00f; } #maincontainer {     width: 800px;     border: none;     text-align: left; } p.login {     font-size: 12px;     padding-left: 5px; } .username {     padding: 0;     margin: 0;     font-weight: bold;     color: #f00; } #leftnav {     width: 160px;     padding: 0; } #title {     margin: 10px 5px; } .navcontainer {     float:left;     border: 1px solid #000;     color: #fff;     font-weight: bold;     text-align: center;     background-image: url(../graphics/cell1.gif);     margin: 5px;     width: 150px; } .header {     border: 1px solid #000;     margin: 10px 5px;     background-image: url(../graphics/cell1.gif);     margin-left: 150px; } .navsub {     background-color: #fff;     color: #000;     text-align:left;     font-weight: normal;     padding: 5px; } #leftnav ul {     margin: 0;     padding: 0;     list-style-type: none; } #notes {     margin: 0;     padding: 0;     font-size: 120%; } #notes ul li {     list-style-type: none;     font-weight: bold; } #notes ul li ul li {     font-size: 90%;     font-weight: normal; } h2 {     color: #00f;     text-align: center; } .error {     color: #ff0000;     font-weight: bold;     font-size: 105%;     text-align: center; } .rowOne {     background-color: #ddd; } .rowTwo {     background-color: #eee; } .topmenu {     background-color: #fff;     font-weight: normal;     text-align: left;     padding: 0;     margin: 0;     padding-left: 2px; } .topmenu ul {     list-style-type: none; } .topmenu ul li a {     color: #00f; } .topmenu ul li a:hover {     color: #000; } .title_header {     border: 1px solid #000;     color: #fff;     font-weight: bold;     text-align: center;     background-image: url(../graphics/cell1.gif);     margin: 0; } #testlinks {     margin-top: 5px; } #testlinks ul {     padding: 0;     margin: 0;     color: #000;     font-size: 10pt; } #testlinks table td a {     margin: 0;     padding: .5px;     display: block;     border-bottom: 1px solid #000;     border-right: 1px solid #000;     border-top: 1px solid #aaa;     border-left: 1px solid #aaa;     text-align:center; } #testlinks table td a:hover {     background-color: #ccc;     border-bottom: 1px solid #aaa;     border-right: 1px solid #aaa;     border-top: 1px solid #000;     border-left: 1px solid #000; } #footer {     clear:both; } [/code] IE 7 (and 6) loads the CSS without issues. Anyone know a) my CSS is correct andor b) This is a bug with the latest update with FireFox? I did run the CSS throught the CSS Validator and this is what came up: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] To work as intended, your CSS style sheet needs a correct document parse tree. This means you should use valid HTML. [/quote] Though what am I doing that isnt valid HTML? In my header.html file I have this to get my css file. [code]     <link rel="stylesheet" type="text/css" href="includes/styles.css" /> [/code] I'm stuck and need help! :) Thanks
  17. Not sure how I would set up for something like this. I have a site where users enter information in and it gets time stamped to a MySQL Database. What I want to do is display to the users how many entries are entered at any given time over the course of an hour. So an Entries Per Hour kinda deal. Would I make the query look like: [code] SELECT count(*) FROM myTable WHERE date_entered >= AN AN HOUR AGO FROM NOW [/code] Not sure if I would use SQL's time functions or PHP's Time functions, and how :) Thanks
  18. [!--quoteo(post=380687:date=Jun 6 2006, 10:34 AM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jun 6 2006, 10:34 AM) [snapback]380687[/snapback][/div][div class=\'quotemain\'][!--quotec--] If you're just starting to work with JOINs, I suggest that you NEVER use the comma operator -- trust me. I can give you a laundry list of reasons why it's bad. Nonetheless, you're correct -- JOINs will accomplish the task you have outlined: [code]SELECT * FROM table1 JOIN table2 ON ( table1.id = table2.id ) WHERE table1.id = 3[/code] Not only does this make it more explicit, but it makes it much easier to change at a later date. [/quote] So when you mean I should not use the comma operator, I shouldn't do SELECT * FROM table1,table2.table3 So I should always use JOINs?
  19. I've noticed how the two sections were becoming similar. Just means the Help section will get more posts in it now ;)
  20. I know its a bit more advanced but you can get PHP's GD2 to 'draw' the letter as an image for you. I dont have the code in front of me, but thats how those Captcha (security code images) work.
  21. Are you able to get in touch with your webhost and see if they changed anything with their PHP setup? Or even their Mail setup?
  22. Can you post what you have so far with the changes you made? I'll take a peek again :)
  23. I edited my post.. i accidently hit submit in the middle of pasting ;) Also note I added single quotes inside your $_POST[] around the form names.
  24. Hehe sorry, let me see... Change these lines: [code] $myemail = "erinkuzma@yahoo.com"; $headers = "From: $visitor <$visitormail> \n"; [/code] To [code] $headers = "MINE-Version: 1.0\r\n"; $headers.= "Content-Type: text/html; charset=iso-8859-1\r\n"; $headers .= "To: Erin <erinkuzma@yahoo.com>\r\n"; $headers .= "From: {$visitor} <{$visitormail}>\r\n"; [/code] You can then add your $message and $questions as one: [code] $message = " {$todayis} [EST] \r\n       Attention: {$attn} \r\n       Message: {$notes} \r\n       From: {$visitor} ({$visitormail}) \r\n";       \r\n       How often do you visit MOSI? {$_POST['Q1']} \r\n       How often do you visit museums in general? {$_POST['Q2']} \r\n       What is your gender? {$_POST['Q3']}  \r\n       What is your age group? {$_POST['Q4]'}  \r\n       Do you currently live in Tampa? {$_POST['Q5']}  \r\n       Including yourself, how many persons are there in your group or family visiting the museum with you today? {$POST['Q6']} \r\n         How many of those are aged 12 or over, again, including yourself? $_POST['Q7'] \r\n"; if (mail(NULL, $subject, $message, $headers)) {   echo "Mail sent succesfully"; } else {   echo "Mail not sent"; } [/code] The \r\n are line breaks for the email message.
  25. I'm guessing it would have to be done with some sorta javascript when the button is pressed. If ya google for javascript popups there should be a ton of examples. You'll just have to hook it on the OnClick for the submit button I suppose. Though I would not be sure how to close it when the page is done processing the request.... Might have to javascript that and when its done processing send a cmd or variables to the currently pop'd up window?
×
×
  • 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.