Jump to content

Imoddedu

Members
  • Posts

    141
  • Joined

  • Last visited

Everything posted by Imoddedu

  1. Of course I am going to try it, I was just curious though.EDIT: It did not change, maybe it isn't supported?
  2. How is that different from just background? I currently use background right now in the CSS and it shows up
  3. Does anybody know how I can change the background image of the body with jQuery? I've tried something like this but it doesn't seem to work: $("#webDesignLink").hover(function() { $('body').css('background', 'url(img/bgWeb.png)'); });
  4. I'm afraid I don't understand that o.O
  5. Hey there! I have a question, how can I make it so that if a user hovers over a link, then a certain div appears and stays there, and then if the user hovers onto another div, the exising div fades out and a new one fades in?
  6. Imoddedu

    Parsing XML

    Also: any reason why I only get that error with those two specific lines? ->item(0)->childNodes->item(0)->nodeValue;and this line right below it:->item(0)->childNodes->item(0)->nodeValue;
  7. Imoddedu

    Parsing XML

    Hey there! I have a problem when this parses XML...I get these errors:Notice: Trying to get property of non-object in . . .just use this as the feed: http://articlefeeds.nasdaq.com/nasdaq/symbols?symbol=GOOG <?php // Get ticker string and explode $searchstring = $_GET["ticksearch"]; $ticker = explode(":", $searchstring); // Find ticker news feed $tickerfeed = "http://articlefeeds.nasdaq.com/nasdaq/symbols?symbol=" . $ticker[0];?><!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" lang="en"><head><title></title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta content="IE=8" http-equiv="X-UA-Compatible"><meta name="keywords" content="" /><meta name="description" content="" /><link type="text/css" href="css/ui-lightness/jquery-ui-1.8.14.custom.css" rel="stylesheet" /><link type="text/css" href="style.css" rel="stylesheet" /><script type="text/javascript" src="js/jquery-1.5.1.min.js"></script><script type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script></head><body><div id="tabs"> <ul> <li><a href="#tabs-1">Info</a></li> <li><a href="#tabs-2">News</a></li> </ul> <div id="tabs-1"> <form id="search" method="get" action="results.php"> <input id="searchbox" name="ticksearch" size="40" type="text" value="" /> <input id="searchbutton" value="Go" type="submit" /> </form> <br /> <b> <u> <?php echo $ticker[0]; ?> </u> </b> <?php echo " | "; echo $ticker[1]; ?> <br /> <br /> <?php // XML Parsing $xmlDoc = new DOMDocument();$xmlDoc->load($tickerfeed);//get elements from "<channel>"$channel=$xmlDoc->getElementsByTagName('channel')->item(0);$channel_title = $channel->getElementsByTagName('title')->item(0)->childNodes->item(0)->nodeValue;$channel_link = $channel->getElementsByTagName('link')->item(0)->childNodes->item(0)->nodeValue;$channel_desc = $channel->getElementsByTagName('description')->item(0)->childNodes->item(0)->nodeValue;//get and output "<item>" elements$x=$xmlDoc->getElementsByTagName('item');for ($i=0; $i<=2; $i++) { $item_title=$x->item($i)->getElementsByTagName('title') ->item(0)->childNodes->item(0)->nodeValue; $item_link=$x->item($i)->getElementsByTagName('link') ->item(0)->childNodes->item(0)->nodeValue; $item_desc=$x->item($i)->getElementsByTagName('description') ->item(0)->childNodes->item(0)->nodeValue; echo ("<p><a href='" . $item_link . "'>" . $item_title . "</a>"); echo ("<br />"); echo ($item_desc . "</p>"); }?> </div> <div id="tabs-2"> </div></div></body></html>
  8. I think that might've helped, but I still don't ever get $error set to anything.Here is the whole code: // Validate form startif ($_POST) { $username = $_POST['username']; $password = $_POST['password']; $firstName = $_POST['fname']; $lastName = $_POST['lname']; $passwordb = $_POST['passwordb']; $email = $_POST['email']; $###### = $_POST['######']; $age = $_POST['age']; $country = $_POST['country']; $ip = $_POST['ip']; // validate /* CHECK FOR FILLED FIELDS */ if ( ($username || $password || $firstName || $lastName || $passwordb || $email) == "") { $error = '1'; } else { $error = '0'; } /* CHECK FOR FILLED FIELDS */ /* EMAIL VALIDATION */ if ( filter_var($email, FILTER_VALIDATE_EMAIL) == TRUE) { $email = $email; } else { $error = '2'; } // Filter and Split Email $splitemail = explode('@', $email); if(checkdnsrr($splitemail[1])) { $email = mysql_real_escape_string($email); } else { $error = '2'; } /* EMAIL VALIDATION */ if($error = '0') { // real escape the strings: // insert data to DB $query = sprintf("INSERT INTO customers(username,password,firstName,lastName,######,age,email,country,ip) VALUES ('$username','$password','$firstName','$lastName','$######','$age','$email','$country','$ip');", mysql_real_escape_string(md5($password))); mysql_query($query); $error = '99'; } }?>
  9. Hey! I get the error: Notice: Undefined offset: 1whenever I run this code: // Filter and Split Email $splitemail = explode('@', $email); if(checkdnsrr("$splitemail[1]")) { $email = mysql_real_escape_string($email); } else { $error = '2'; } Shouldn't there be a $splitemail[1]?
  10. Imoddedu

    PHP variables

    thanks! short and simple explanation that I understood :)which leads to another question...:how come in this code while($row = mysql_fetch_array($result)) { echo $row['title']; echo "<br />"; echo "<br />"; echo $row['response']; } I tried putting [ echo "<h4>$row['title']</h4>"; but it actually put out $row['title'] the variable name, not it's value.
  11. Imoddedu

    PHP variables

    I see URL's like this all the time:index.php?k=4(the k doesn't mean anything, just representing anything that can go there.what exactly does this mean in terms of PHP? Also, how is it used for things like looking up information in a search box and displaying the result? like ?result=blahblahblah
  12. I think there is a limit on how many of google ads you can have on a page. I'm not sure though...
  13. New problem. Now that I think I got mysql_real_escape_string working, I tried to check to see if the email is valid. I keep recieving this error if I don't put in anything for the "email" field: Notice: Undefined offset: 1 in C:\Program Files (x86)\EasyPHP-5.3.3.1\www\SearchWiDe\contact.php on line 35 here is the code, reworked: <?php$error = 0;$name = "";$email = "";$category = "";$text = "";if(isset($_POST['userName']) && isset($_POST['userEmail']) && isset($_POST['userCat']) && isset($_POST['userText'])) { $name = $_POST['userName']; $email = $_POST['userEmail']; $category = $_POST['userCat']; $text = $_POST['userText']; $ip = $_SERVER['REMOTE_ADDR']; $name = mysql_real_escape_string($name); $email = mysql_real_escape_string($email); $text = mysql_real_escape_string($text); // Error Messages if ( filter_var($email, FILTER_VALIDATE_EMAIL) == TRUE) { $email = mysql_real_escape_string($email); } else { $error = 4; } // Filter and Split Email $splitemail = explode('@', $email); if(checkdnsrr("$splitemail[1]")) { $email = mysql_real_escape_string($email); } else { $error = 4; } if($name == "") { $error = 1; } elseif($email == "") { $error = 2; } elseif($text == "") { $error = 3; } if ($error == 0) { // Insert into DB $query = sprintf("INSERT INTO contact(name,email,category,text,ip) VALUES ('$name','$email','$category','$text','$ip')"); mysql_query($query) or exit(mysql_error()); $id = mysql_insert_id(); $result = mysql_query("SELECT * FROM users WHERE id = '$id'"); $to = $email; $subject = 'dffdhdsfhdf '; $message = "<p>sdfhfdhdsfhsf</p><p><a href='http://example.com/confirm.php?id=$result'>below</a></p>"; $headers = 'From: webmaster@example.com' . "\r\n" . 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; mail($to,$subject,$message,$headers); $error = 99;}} ?>
  14. That exit(mysql_error()); really helps!$error = 0;$name = "";$email = "";$category = "";$text = "";if(isset($_POST['userName']) && isset($_POST['userEmail']) && isset($_POST['userCat']) && isset($_POST['userText'])) { $name = $_POST['userName']; $email = $_POST['userEmail']; $category = $_POST['userCat']; $text = $_POST['userText']; $ip = $_SERVER['REMOTE_ADDR']; /* $name = mysql_real_escape_string($name); $email = mysql_real_escape_string($email); $text = mysql_real_escape_string($text); */ // Error Messages if($name == "") { $error = 1; } elseif($email == "") { $error = 2; } elseif($text == "") { $error = 3; } if ($error == 0) { // Insert into DB $query = sprintf("INSERT INTO contact(name,email,category,text,ip) VALUES ('$name','$email','$category','$text','$ip')"); mysql_query($query) or exit(mysql_error()); $error = 99;}} ?> Did I use the mysql_real_escape_string right?
  15. Alright, now I have this:When I fill in everything BUT the "Name" field, it gives me an error. Then when I don't fill in the email field, or text field, or anything it all, and I submit, it just basically refreshes the page. Even when I fill in everything and it gives me the "ok" no records show up in the MySQL database. Is there something wrong with the MySQL query now? <?php$error = 0;$name = "";$email = "";$category = "";$text = "";if(isset($_POST['userName']) && ($_POST['userEmail']) && ($_POST['userCat']) && ($_POST['userText'])) { $name = $_POST['userName']; $email = $_POST['userEmail']; $category = $_POST['userCat']; $text = $_POST['userText']; $ip = $_SERVER['REMOTE_ADDR']; // Error Messages if($name == "") { $error = 1; } elseif($email == "") { $error = 2; } elseif($text == "") { $error = 3; } if ($error == 0) { // Insert into DB $query = sprintf("INSERT INTO contact(name,email,category,text,ip) VALUES ('$name','$email','$category','$text','$ip')"); mysql_query($query); $error = 99;}} ?>
  16. You can also find a list of TLD's and their uses:http://en.wikipedia.org/wiki/List_of_Inter...p-level_domains
  17. I added $name = "";$email = "";$category = "";$text = ""; before the IF statement, but now it displays the $error = 1 message I have. If you want your web pages to communicate with a server and do cool things, yes
  18. I tried using this (which is basically what you had). And received this error: Notice: Undefined variable: name in C:\Program Files (x86)\EasyPHP-5.3.3.1\www\SearchWiDe\contact.php on line 23I thought $name was already given a value? if(isset($_POST['userName']) && ($_POST['userEmail']) && ($_POST['userCat']) && ($_POST['userText'])) { $name = $_POST['userName']; $email = $_POST['userEmail']; $category = $_POST['userCat']; $text = $_POST['userText']; $ip = $_SERVER['REMOTE_ADDR']; // Insert into DB $query = sprintf("INSERT INTO contact(name,email,category,text,ip) VALUES ('$name','$email','$category','$text','$ip');"); mysql_query($query); $error = 99;} else { // Error Messages if($name == "") { $error = 1; } elseif($email == "") { $error = 2; } elseif($text == "") { $error = 3; };}
  19. I tried something...but I'm afraid it didn't work. Do I have things in the wrong places? if(isset($_POST['userName']) && ($_POST['userEmail']) && ($_POST['userCat']) && ($_POST['userText'])) {if($_POST) { $name = $_POST['userName']; $email = $_POST['userEmail']; $category = $_POST['userCat']; $text = $_POST['userText']; $ip = $_SERVER['REMOTE_ADDR']; // Error Messages if($name == NULL) { $error = 1; } elseif($email == NULL) { $error = 2; } elseif($text == NULL) { $error = 3; }} else {$query = sprintf("INSERT INTO contact(name,email,category,text,ip) VALUES ('$name','$email','$category','$text','$ip');");mysql_query($query);$error = 99;}}else {}
  20. I get this error: Notice: Undefined index: userName in C:\Program Files (x86)\EasyPHP-5.3.3.1\www\SearchWiDe\contact.php on line 10Notice: Undefined index: userEmail in C:\Program Files (x86)\EasyPHP-5.3.3.1\www\SearchWiDe\contact.php on line 11Notice: Undefined index: userCat in C:\Program Files (x86)\EasyPHP-5.3.3.1\www\SearchWiDe\contact.php on line 12Notice: Undefined index: userText in C:\Program Files (x86)\EasyPHP-5.3.3.1\www\SearchWiDe\contact.php on line 13 A session is started in header.phpconfig.php contains the MySQL connection detailsI think it has something to do where I set my variables = to the $_POST ones. <?php include("header.php"); ?><?php include("config.php"); $conn = mysql_connect($dbhost,$dbuser,$dbpass)or die ('Error connecting to mysql');?><?php $error = 0; ?><?php $name = $_POST['userName']; $email = $_POST['userEmail']; $category = $_POST['userCat']; $text = $_POST['userText']; $ip = $_SERVER['REMOTE_ADDR'];if($_POST) { // Error Messages if($name == NULL) { $error = 1; } elseif($email == NULL) { $error = 2; } elseif($text == NULL) { $error = 3; }} else {$query = sprintf("INSERT INTO contact(name,email,category,text,ip) VALUES ('$name','$email','$category','$text','$ip');");mysql_query($query);$error = 99;}?><div style="margin-left: 300px;"><h2>Contact Form</h2><p>fdhfhdhsf</p><?php if ($error == 1) { echo "<div class='ui-widget'><div class='ui-state-error ui-corner-all' style='padding: 0 .7em;'> <p><span class='ui-icon ui-icon-alert' style='float: left; margin-right: .3em;'></span> <strong>Error:</strong> You didn't fill out the <b>name</b> field!</p></div></div>"; }elseif ($error == 2) { echo "<div class='ui-widget'><div class='ui-state-error ui-corner-all' style='padding: 0 .7em;'> <p><span class='ui-icon ui-icon-alert' style='float: left; margin-right: .3em;'></span> <strong>Error:</strong> You didn't fill out the <b>email</b> field!</p></div></div>"; }elseif ($error == 3) { echo "<div class='ui-widget'><div class='ui-state-error ui-corner-all' style='padding: 0 .7em;'> <p><span class='ui-icon ui-icon-alert' style='float: left; margin-right: .3em;'></span> <strong>Error:</strong> You didn't fill out the <b>type</b> field!</p></div></div>"; }elseif ($error == 99) {echo "<div class='ui-state-highlight ui-corner-all' style='margin-top: 20px; padding: 0 .7em;'> <p><span class='ui-icon ui-icon-info' style='float: left; margin-right: .3em;'></span> Thanks! You will recieve a confirmation and follow up email shortly.</p> </div>";}?> <form method="post" action="contact.php"><table><tr id="userName"><td><h4>Name:</h4></td><td><input type="text" name="userName" id="userNameField" size="31" style="background: #dbdbdb; border: 1px solid #474747" /></td></tr><tr id="userEmail"><td><h4>Email:</h4></td><td><input type="text" name="userEmail" id="userEmailField" size="31" style="background: #dbdbdb; border: 1px solid #474747" /></td></tr><tr id="userCat"><td><h4>Category:</h4></td><td><select name="userCat" id="userNameField" style="background: #dbdbdb; border: 1px solid #474747"><option>hfd</option><option>dfh</option><option>dhfd</option><option>dhfd</option></select></td></tr><tr id="userText"><td><h4>Type:</h4></td><td><textarea name="userText" id="userTextField" rows="7" cols="70" style="background: #dbdbdb; border: 1px solid #474747"></textarea></td></tr><tr id="userSubmit"><td></td><td><input type="submit" name="submit" value="Submit" style="background: #dbdbdb; border: 1px outset #d97c03; color: #000000;" /></td></tr></table></form></div><?php include("footer.php"); ?></div></body></html>
  21. Ah, ok it works now. Looking back at your code I was actually thinking of doing something similar like that to fix the problem!
  22. No, it doesn't. I just go straight to the index.phpI don't go to like, index.php?lang=fr for example. I thought the script automatically puts it to "en"?
  23. Hey there! I'm trying to learn how to localize my website with PHP and I'm running into..an annoing error. >.< The PHP error is:Notice: Undefined index: lang in C:\Program Files (x86)\EasyPHP-5.3.3.1\www\SearchWiDe\lang.php on line 8here is the code:header.php <?xml version="1.0" encoding="UTF-8"?><!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 Information --><?php include ("lang.php"); ?><title>----</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><meta name="Robots" content="index,follow" /><meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" /> <meta name="Keywords" content="----" /><meta name="Description" content="----" /><!-- CSS/JavaScript --><link rel="Shortcut Icon" href="img/logo16.png" /><style type="text/css">@import url("style.css");</style> <script type="text/javascript" src="js/jquery.js"></script></head><body><div id="page"><div id="topnav"><a href="index.php" class="linktop">Search</a><span class="pipetop">|</span><a href="about.php" class="linktop">About</a><span class="pipetop">|</span><a href="faq.php" class="linktop">FAQ</a><span class="pipetop">|</span><a href="privacy.php" class="linktop">Privacy</a><span class="pipetop">|</span><a href="terms.php" class="linktop">Terms</a><span class="pipetop">|</span><a href="help.php" class="linktop">Help</a><span class="pipetop">|</span><a href="news.php" class="linktop">News</a><span class="pipetop">|</span><a href="blog.php" class="linktop">Blog</a><span class="pipetop">|</span><a href="contact.php" class="linktop">Contact</a><span class="pipetop">|</span><span class="pipetop">Follow us:</span><a href=""><img src="img/social/blogger.png" alt="Blogger" height="11" width="11" /></a><a href=""><img src="img/social/facebook.png" alt="Facebook" height="11" width="11" /></a><a href=""><img src="img/social/twitter.png" alt="Twitter" height="11" width="11" /></a><br /><span class="pipetop">Choose Region:</span><a class="langSelect" href="">US<img class="langFlag" src="img/flags/us.png" alt="United States" /></a><span class="pipetop">|</span><a class="langSelect" href="">CA<img class="langFlag" src="img/flags/ca.png" alt="Canada" /></a><span class="pipetop">|</span><a class="langSelect" href="">UK<img class="langFlag" src="img/flags/gb.png" alt="United Kingdom" /></a><span class="pipetop">|</span><a class="langSelect" href="">IE<img class="langFlag" src="img/flags/ie.png" alt="Ireland" /></a><span class="pipetop">|</span><a class="langSelect" href="">AU<img class="langFlag" src="img/flags/au.png" alt="Australia" /></a><span class="pipetop">|</span><a class="langSelect" href="">NZ<img class="langFlag" src="img/flags/nz.png" alt="New Zealand" /></a><!-- Start of Language Chooser --><br /><span class="pipetop">Choose Language:</span><a class="langSelect" href="?lang=en">English</a><span class="pipetop">|</span><a class="langSelect" href="?lang=fr">French</a><span class="pipetop">|</span><a class="langSelect" href="?lang=es">Spanish</a><span class="pipetop">|</span><?php if ($currLang == "en") { echo "<span class='pipetop'><i>You are viewing ---- in English</i></span>";}elseif ($currLang == "fr") {echo "<span class='pipetop'><i>Vous voyez --- en français</i></span>";} elseif ($currLang == "es") {echo "<span class='pipetop'><i>Usted está viendo la --- en español</i></span>";} else { echo "<span class='pipetop'><i>---</i></span>";} ?></div><br /><div id="logo"><img id="imglogo" src="img/64logo.png" alt="-----" /></div> and lang.php <?php session_start(); // Start PHP Sessionif ($_SESSION['lang'] == "") { $_SESSION['lang'] = "en"; $currLang = "en"; } else { $currLang = $_GET['lang']; $_SESSION['lang'] = $currLang;} switch($currLang) { case "en": define("CHARSET","ISO-8859-1"); define("LANGCODE", "en"); break; case "fr": define("CHARSET","ISO-8859-1"); define("LANGCODE", "fr"); break; case "es": define("CHARSET","ISO-8859-1"); define("LANGCODE", "es"); break; default: define("CHARSET","ISO-8859-1"); define("LANGCODE", "en"); break; } header('Content-type: text/html;charset=”.CHARSET'); header('Content-Language: ”.LANGCODE');?> According to the error, it has something to do with the $_GET I think.
  24. Hey there! I decided to try to use the jQuery UI features (which are really cool!) and I'm having some trouble with the according. It appears everything is linked correctly, but it still appears as regular, non-formatted text. Here is the code: <?xml version="1.0" encoding="UTF-8"?><!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 Information --><title>sdfhdfhsfdhsf - Web Design and Programming | Free Themes, Styles, Scripts </title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><meta name="Robots" content="index,follow" /><meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" /> <meta name="Keywords" content="" /><meta name="Description" content="" /><!-- CSS/JavaScript --><link rel="stylesheet" href="main.css" type="text/css" /><link rel="Shortcut Icon" href="images/logo/64logotrans.png" /><style type="text/css">@import url("css/theme/jquery-ui-1.8.9.custom.css");</style> <link href="blue.css" rel="stylesheet" type="text/css" /><script type="text/javascript" src="js/jquery.js"></script><script type="text/javascript" src="js/jquery-1.4.4.min.js"></script><script type="text/javascript" src="js/jquery-ui-1.8.9.custom.min.js"></script><script type="text/javascript" src="js/jsapi.js"></script> <script type="text/javascript" src="js/accordion.js"></script> </head><body><div id="page"><div id="pageheader"><center><img src="images/logo/pagelogo.png" alt="sdfhdhfd - Web Design and Programming"/></center><center><div id="topnavbar"><a href="#"><img src="images/home.png" name="home" id="home" alt="sdfhfdhfd" /></a><a href="#"><img src="images/blog.png" alt="Blog" /></a><a href="#"><img src="images/portfolio.png" alt="Portfolio" /></a><a href="#"><img src="images/download.png" alt="Download" /></a><a href="#"><img src="images/videos.png" alt="Videos" /></a><a href="#"><img src="images/contact.png" alt="Contact" /></a></div></center></div><center><div id="content"><h1>dsfhfdhfsdh</h1><div id="accordion"><h2><b><a href="#">Test</a></b></h2><div><p>fhfdhfdhfdshsd</p></div><h2><b><a href="#">Test2</a></b></h2><div><p>dfhsdfhsdfhfdshs</p></div></div></div></center><center><div id="footer"><span id="footerText">Copyright 2011 <a href="#"><span id="footerLink">dfhdfhsdf</span></a>. | (999)-999-999 | 9999 Somewhere Place | Web Design and Programming </span><br /><br /><a href="#"><img src="images/social/feed.png" alt="Feed" /></a><a href="#"><img src="images/social/blogger.png" alt="Blogger" /></a><a href="#"><img src="images/social/facebook.png" alt="Facebook" /></a><a href="#"><img src="images/social/twitter.png" alt="Twitter" /></a><a href="#"><img src="images/social/linkedin.png" alt="LinkedIn" /></a><a href="#"><img src="images/social/digg.png" alt="Digg" /></a><br /><br /><a href="#"><span id="footerLink">fdhfdhfdhfdshfds</span></a><span id="footerText">|</span><a href="#"><span id="footerLink">Blog</span></a><span id="footerText">|</span><a href="#"><span id="footerLink">Portfolio</span></a><span id="footerText">|</span><a href="#"><span id="footerLink">Download</span></a><span id="footerText">|</span><a href="#"><span id="footerLink">Videos</span></a><span id="footerText">|</span><a href="#"><span id="footerLink">Contact</span></a><br /></div></center></div></body></html> accordion.js: $(document).ready(function() { $("#accordion").accordion({ header: "h2"}); });
×
×
  • Create New...