Jump to content

Smudly

Members
  • Posts

    148
  • Joined

  • Last visited

    Never

Everything posted by Smudly

  1. Hi there, I have posted some threads on this awesome forum of yours to get assistance with coding. It has been of the most help. I am currently getting ready to launch my website, and I realized that on the threads I posted I forgot to remove the name of my website. I am not requesting deleting the threads as that would be very unfair to you. I would just appreciate the chance to remove the links to my website in my posts. Thanks for your time
  2. I'm working on a Lottery system. The user uses their Drawing Tickets for a chance to win. The way I currently have this setup, is the user can type in 8 Drawing tickets for example, and this will be placed into a row. So it would be like: id -- userid -- username -- drawing_ticket -- status -- date 1 -- 12 -- PapaGeorgio -- 8 -- active -- 2011-04-28 So this row will have 8 chances to be selected as the winner. I thought of just making 1 row for each drawing ticket entered, but this would be a lot of querying. What method may I use to do this? $drawquery = mysql_query("SELECT * FROM weeklydrawing WHERE `drawing_ticket`>=1 AND status='active' ORDER BY rand() LIMIT 50");
  3. That did it. Thanks for the rundown on it all. It helps a lot. I found that the session was created in the Customer class (customer.php) function reload_session($cod) { $rowCutomer= $this->mPer->getOne($cod); $_SESSION['customer'] = mysql_fetch_object($rowCutomer); }
  4. object(stdClass)#1 (12) { ["id"]=> string(2) "25" ["member_type"]=> string(1) "1" ["username"]=> string(6) "Smudly" ["password"]=> string(32) "63ab6b8cc73215d1608b4c10607452c7" ["email"]=> string(19) "myemail@gmail.com" ["name"]=> string(6) "bob" ["referrer"]=> string( "myfriend" ["country"]=> string(13) "UNITED STATES" ["join_date"]=> string(10) "2011-04-22" ["session"]=> string(42) "afef8c6234410e4970067f052f67b37b1303445583" ["confirm_code"]=> string(10) "0194688414" ["status"]=> string(6) "Active" }
  5. Honestly I'm not sure. I had a pro setup the member's system and it's over my head. He has a bunch of Classes that take care of this stuff, so I'm unsure how I'm supposed to use it.
  6. I'm creating a Contact Us page that has a form users may use to send a message. I've run into an issue and I have never seen this error before. Could anyone help explain how to fix this please? Catchable fatal error: Object of class stdClass could not be converted to string in /homepages/30/d354929366/htdocs/contact.php on line 13 Line 13 is: $contactsql = "SELECT * FROM users WHERE username='$username'"; <?php include("inc/config.php"); include_once("inc/functions.php"); $ip = $_SERVER['REMOTE_ADDR']; $username = $_SESSION['customer']; $submit = (isset($_POST['submit'])); $to = "myemail@gmail.com"; $subject = "New Contact!"; $contactsql = "SELECT * FROM users WHERE username='$username'"; $result = mysql_query($contactsql); $row = mysql_fetch_assoc($result); $userid = $row['userid']; $name = $row['name']; $email = $row['email']; $username = $row['username']; if($submit){ if(!isset($_SESSION['customer'])){ $getusername = mysql_query("SELECT username FROM users WHERE email='$email'"); $getrow = mysql_fetch_assoc($getusername); $username = $getrow['username']; } $answered = 0; $date = date("Y-m-d"); $name = mysql_safe($_POST["name"]); $email = mysql_safe($_POST["email"]); $message = mysql_safe($_POST["comments"]); $name = $name; $email = $email; if($name){ if($email){ if($comments){ $success = "<div id='contsuccess'>We have received your message!</div>"; $newcontquery = "INSERT INTO contact VALUES ('','$userid','$username','$name','$email','$message','$answered','$date')"; mysql_query($newcontquery); mail("$to", "$subject", "My Site Title","From: admin@mysite.com"); } else{ $error = "<div id='conterror'>Please type a question or comment!</div>"; } } else{ $error = "<div id='conterror'>Type in your Email!</div>"; } } else{ $error = "<div id='conterror'>Type in your Name!</div>"; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Language" content="en" /> <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" /> <title> my site </title> <meta name="description" content="" /> <meta name="keywords" content="" /> <link rel="stylesheet" type="text/css" href="styles/main.css" /> <!--[if lt IE 7]> <link rel="stylesheet" type="text/css" href="styles/ie6.css" media="screen" /> <![endif]--> <!--[if gte IE 7]> <link rel="stylesheet" type="text/css" href="styles/ie7.css" media="screen" /> <![endif]--> </head> <body id="contact"> <div id="wrap"> <? include("inc/header/header.php")?> <div id="cwrap"> <div id="content"> <center><p><?php echo $success, $error; ?></p></center> <div class="contGen"> <FORM ACTION="contact.php" METHOD="POST" name="contactform1"> <div id="contformfirst">First Name: </div> <div id="contformfirstfld"><INPUT NAME="name" SIZE="30" class="FormField" value="<?php echo $dbfname; ?>"></div> <div id="contformemail">E-mail: </div> <div id="contformemailfld"><INPUT NAME="email" SIZE="30" class="FormField" value="<?php echo $dbemail; ?>"></div> <div id="contformcomments"><br><br>Comments: </div> <div id="contformcommentsfld"><textarea NAME="comments" rows="6" cols="23" SIZE="250"></textarea></div> <div id="contformsubmit"></div> <div id="contformreset"><input type='submit' name='submit' value='Submit'> <input type='reset' value='Reset'></div> </FORM> </div> </div> <? include("inc/left/leftnav.php")?> </div> <? include("inc/content/footer.php")?> </div> </body> </html> </body> </html>
  7. Actually, I'm not trying to make it turn blue when I am clicking on it. It needs to stay blue when I am on that current page.
  8. I'm working on creating a top Navigation that has 6 Buttons along the top. Home - Account - FAQs - Tips - Forum - Contact. Each of the buttons are PNG images. The original image displayed is Orange. When hovered over, it turns Blue. I now need to figure out how to keep one of the buttons Blue IF on that current page. So for example: The user is on the Home page. This "Home" button should be the blue image while on the page. You can see the example page I'm working on here: http://tinyurl.com/44dzkwf And my code here: -- HTML below -- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Language" content="en" /> <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" /> <title> Test </title> <meta name="description" content="" /> <meta name="keywords" content="" /> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <div id="menu"> <div id="menu_l"></div> <div id="menu_r"></div> <ul> <li><a class="homebutton" href="index.php">Home</a></li> <li><a href="members.php">Account</a></li> <li><a href="faq.php">FAQs</a></li> <li><a href="tips.php">Tips</a></li> <li><a href="forum.php">Forum</a></li> <li><a href="contact.php">Contact</a></li> </ul> </div> </body> </html> -- CSS below -- #menu{ height:37px; margin:0 8px; background:url(images/menu_bg.png); position:relative; } #menu_l, #menu_r{ position:absolute; width:8px; height:37px; top:0; } #menu_l{ left:-8px; background:url(images/menu_l.png); } #menu_r{ left:100%; background:url(images/menu_r.png); } #menu ul{ margin-left:170px; list-style:none; } #menu li{ display:inline; } #menu a{ float:left; line-height:37px; height:37px; } #menu .current a{ border:none !important; } .homebutton { display: block; width: 101px; height: 37px; background: url('images/home_orange.png') bottom; text-indent: -99999px; } .homebutton:hover { background-position: 0 0; background:url(images/home_blue.png); }
  9. I am trying to create a script that will choose from 3 different Variables. This is much like a Chance game. Variable A has a 20% chance to be chosen Variable A has a 35% chance to be chosen Variable A has a 45% chance to be chosen How would I go about setting each of these variables chance to be chosen?
  10. I'm working on a Stats page that will need to run multiple queries to access the information needed to dislpay on the page. Rather than running 30+ queries to get the user's Stats, is there a better method? Any tips that you suggest I further research? Thanks
  11. I was told using charCode is a bad idea and isNaN is more efficient. Is this true? EDIT: Also, using your function doesn't allow users to backspace, delete or move the cursor left or right using the arrows.
  12. I'm working on only allowing numbers & decimals into text fields. So far, I have it deleting Letters, but it really should never allow letters to be typed in in the first place. It is also deleting decimal points, which is not what I need it to do. How do I prevent typing in letters altogether using this code? see example page here: click here The top field is the one we're working with right now. Here is a snippet of my code: creditsBanner = parseFloat(document.convertform.creditsbanner.value); creditsBalance = "<?php echo $creditsBalance;?>"; if (!isNaN(creditsBanner)) { if(creditsBanner>creditsBalance){ document.convertform.creditsbanner.value = creditsBalance; creditsBanner = creditsBalance; } document.convertform.creditsbanner.value = creditsBanner; } else{ alert ("Only numbers are allowed in this field"); document.convertform.creditsbanner.value = ""; }
  13. I am working on a Contact Form in my .php file. I have always worked with loose doctypes, however, today I am using strict. I have my php above my html, and none of the code runs. Instead, it just displays some of the Echos to the page (these aren't even called yet). Also, in my form, I have the following: <INPUT NAME="Name" SIZE="30" value="<?php echo $Name; ?>"> On the page inside the field, it is displaying: <?php echo $Name; ?> What is going on here and how can I fix this issue? Yes, the pages are .php Here is the doctype: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> Any input appreciated
  14. Hi, I am currently creating the template for a website I am working on. When I resize the window, the Links and the top right image move out of place. I need these to stay in place no matter what size the window is or what resolution is using. What am I doing wrong? Here's my code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta name="description" content="Bed Bug & Dust Mite Services - Mattress Doctor"> <meta name="keywords" content="bed,bug,dust,mite,mattress,cleaning,service,doctor,saint,george,utah"> <meta name="author" content="Mattress Doctor - We clean mattresses to destroy and remove dust mites and bed bugs!"> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> <title>Mattress Doctors</title> <link rel="stylesheet" type="text/css" href="styles/style.css"> <style type="text/css"> #header{ height: 130px; background:url(../img/header.gif); width: 100%; } #headleft{ width: 40px; height: 130px; background:url(../img/header.gif); float: left; } #logo{ width: 222px; height: 130px; text-align: center; position: relative; overflow: hidden; } #slogan{ width: 602px; height: 130px; float: left; } #schedule{ position: absolute; right: 0px; top: 20px; width: 200px; height: 130px; text-align: center; overflow: hidden; } #nav{ position: absolute; top: 130px; width: 100%; height: 40px; background:url(../img/nav.gif); text-align: center; } #link{ float: left; } #container{ height: 600px; background:url(../img/bg.gif); } body{ font-weight: bold; margin: 0px auto; } img{ border: none; } </style> </head> <body bgcolor="#ffffff"> <!-- Header --> <div id="header"> <div id="headleft"></div> <div id="logo"><img src="img/logo.png" alt="Mattress Doctors"></div> <div id="slogan"></div> <div id="schedule">1-800-Bug-Free<br><a href="schedule.php"><img src="img/schedule.png" alt="Schedule Service"></a></div> </div> <!-- Nav --> <div id="nav"> <a href="home.php"><img src="img/home.gif"></a> <a href="problem.php"><img src="img/problem.gif"></a> <a href="solution.php"><img src="img/solution.gif"></a> <a href="process.php"><img src="img/process.gif"></a> <a href="faq.php"><img src="img/faq.gif"></a> <a href="contact.php"><img src="img/contact.gif"></a> </div> <!-- Content --> <div id="container"> </div> <!-- Footer --> <div id="footer"> </div> </body> </html>
  15. I'm having an issue with users uploading files with a Semi Colon in the file name. I am currently using a script that replaces characters within the file name, however, when I try to add a ";" as invalid characters to replace, it is like the semi-colon just stops the script, as the file does not upload (no errors are displayed). Here's the code I'm working with: $valid_chars_regex = '.A-Z0-9_ !@#$%^&()+={}\[\],~`-'; $file_name = preg_replace('/[^'.$valid_chars_regex.']|\'.+$/i', "", basename($_FILES[$upload_name]['name'])); if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) { HandleError("Invalid file name"); exit(0); } I tried placing the semi colon all over the place in the preg_replace function, but nothing seems to work. How can I do this?
  16. Thanks for the reply. I tried using file exist to check each row in the table and determine if the file does in fact exist. If it does not, that row will be displayed to the page. If it does exist, nothing will be done. The problem I am having is it is displaying ALL rows to the page. I've tried changing up the code in various ways but nothing seems to work. Here is my code. (no errors are displayed either) $result = mysql_query("SELECT * FROM sheets WHERE active='yes'"); $path = "/uploads/"; echo "<table border='0' cellspacing='0' cellpadding='0'>"; echo "<th>ID</th> <th>Artist</th> <th>Title</th> <th>URL</th> "; $i = 1; while($row = mysql_fetch_array($result)){ $url = $row['url']; $sheet = $path.$url; if (file_exists($sheet)){ $artist = ""; $title = ""; $sheet = ""; } else{ $artist = $row['artist']; $title = $row['title']; echo "<tr>"; echo "<td>$i</td>"; echo "<td>$artist</td>"; echo "<td>$title</td>"; echo "<td>$url</td>"; echo "</tr>"; $i++; } } echo "</table>";
  17. When I upload new files, their file name is stored into my database. I have been told that a couple of the file downloads weren't working. Upon further investigation I figured out that the file the person wanted to download was nowhere to be seen in my downloads directory. How can I determine if a file exists in my directory? I assume I can somehow use the location that is stored inside my database (ex: myfile.pdf) and compare that with what's in the folder.
  18. Hi, I'm trying to figure out the best way to determine if a user is currently downloading a file from my website. The way my site works, is the user waits 30 seconds and views an ad. After the timer is up the download becomes available. I heard that I could probably use a timestamp or something of the sort. I've read up on it but not sure how I could go about this.
  19. Cool thanks for the examples. I implemented the bottom into my code and it all works great. This also fixed the problem with special characters. For a last feature, I'm trying to determine which artist/title (combined) have the most matching words with what the user typed in to search for. Then this sheet (artist/title) will be highlighted. Is there anyway to determine something like this or am I left to do preg_match?
  20. My preg_match is checking if the user types in single letter words in a search phrase. For example, I have a sheet on my site called "A Whole New World" from Aladdin. If the user types in "A Whole New World", the results that are shown are every artist & title that have "A" in them. And thanks for tip. Yeah I typed it wrong Thanks
  21. Hey Yeah, I would like it to be able to search for those characters. I tried doing another pregmatch, to check if the search the user typed included these characters, but I didn't do it right. Now that you explain what's happening with "_" and %, that make a bit more sense.
  22. After further testing, I have run into a few obstacles. When typing in any of the following characters: /*()+?[ I receive this error: Warning: preg_match() [function.preg-match]: Unknown modifier '/' in /home/content/46/6746946/html/search.php on line 149 Also, if I type in _ all 4233 results are posted. I've attempted to include some if statements in the code I'm using, but it seems to cause problems. Here is how my current query looks. $words = explode(' ', $trimmed); $words = array_map('trim', $words); $sep = ''; $query = "select * from `sheets` where `active`='yes' AND ("; foreach ($words as $w) { if(!$var==""){ if (preg_match("/$w/i", "abcdefghijklmnopqrstuvwxyz")) { $skip = 1; } } if($skip==0){ $query .= $sep . "artist like \"%$w%\" OR title like \"%$w%\""; $sep = ' AND '; } else{ // For now, I just set $blank equal to "garblygook28472" $query .= $sep . "artist like \"%$blank%\" OR title like \"%$blank%\""; $sep = ' AND '; $skip = 0; } } $query .= ") ORDER BY `artist`";
  23. I guess I was a bit confused as to how I wanted it. The problem with using OR, was I was getting about 832 results when I was only looking for one. After I changed: $sep = "OR" to ... $sep = "AND" I got about 30 results. What will adding brackets do? If you want to test the search to see if it is working correctly you can check it out here: www.sheetmusichaven.com thanks
  24. That helps VERY much. I just modified the $sep variable to "AND" and now it works exactly how I need it to. Thanks for all your assistance!
  25. I've been working at this for a few hours and can't get my head around it. Could you give an example of how to get this to work?
×
×
  • 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.