Jump to content

Twister1004

Members
  • Posts

    201
  • Joined

  • Last visited

Everything posted by Twister1004

  1. Thank you very much. This has fixed my issue.
  2. I'm having a bit of an issue. Its more of CSS, XHTML, and PHP error in one I suppose. if you wish to understand my issue better, please look at this website: angela.ulmb.com. Any help is very appreciated. Objective: Fix the index page to where the copyright is on the very bottom instead the right. Problem: I've tried some debugging and I think I've been missing a tag or something, because Ive tried a CSS tags and reformed it, I've also tried to debug in PHP, and I've also tried to take out some tags. However, they dont seem to be working. Here is the index: <?php include("include.php"); ?> <!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> <title>Kids Club Book Reviews - For all childens books</title> <link rel="stylesheet" type="text/css" href="Style.css"/> <!--[if IE]> <link rel="stylesheet" type="text/css" href="ieStyle.css"/> <![endif]--> <style type="text/css"> .body .content #text{ width:690px; min-height:300px; } .body .news{ width:185px; } </style> </head> <body> <?php include("body.php"); ?> <div class="content"> <div id="text"> <center><strong>New Books:</strong></center> <?php getNewBooks(); ?> </div> </div> <?php include("footer.php"); ?> Function page with issues: function getNewBooks(){ $getData = mysql_query("SELECT * FROM `books` WHERE `reviewdate` LIKE '%".date("F")."%' ORDER BY `id` DESC"); while($data = mysql_fetch_array($getData)){ $WordLimit = stripslashes(substr($data['review'], 0, 100)); echo " <span style=\"position:relative; width:230px; min-height:180px; float:left; \"> <a href=\"books.php?i=".$data['id']."&t=".stripslashes($data['title'])."\"><img style=\"float:left;\" src=\"".$data['image']."\" alt='Book picture' width=\"100px\" /></a> <i><strong>".stripslashes($data['title'])."</strong></i><br/> Review Rating: ".$data['rating']."<br/> ".$WordLimit." ... <a href=\"books.php?i=".$data['id']."&t=".stripslashes($data['title'])."\">Full Review</a> </span> "; } } Here is my CSS part concerning this issue: .body .content{ width:690px; min-height:400px; background-color:#956541; } .body .content #text{ width:600px; margin-left:25px; margin-top:10px; min-height:500px; background-color:#231545; }
  3. Thank you very much, Daniel!! It worked, but I was struggling about how to call it out. xD. but I ended up just doing this. function getblogRating($id){ $sql = mysql_query("SELECT SUM(rating)/COUNT(*) AS score, COUNT(*) AS num_votes FROM blograting AS v INNER JOIN blog AS b ON b.id = v.blogid WHERE b.id = '$id' GROUP BY b.id"); $getRating = mysql_fetch_array($sql); return $getRating[0]; } I really appreciate your work. -hugs-
  4. Hey everyone! I'm the loser who is trying to make a 5 star rating thingy. Yeah I know I know. Well, either I thought of this as being too simple and wrote it like that, or I just totally didn't think it though. Which I think it is both cases! So, If I may ask for some help, It would be greatly appreciated! Objective: Figure out a proper way to write this script to where it won't fail. As in it will never decrease to 0 all the time. Problem: When I add a NEW rating to the script, or to the variable, IT will allways decrease to 0. Even if it's all 5's. My Code will be in 2 pieces. I will provide any other information that is needed. Thank you to everyone in advance! FYI: I don't know how to use OOP. My functions page: function getblogRating($id){ $sql = mysql_query("SELECT `rating` FROM `blog` WHERE `id` = '$id' LIMIT 1"); $getBlog = mysql_fetch_array($sql); return $getBlog['rating']; } function postblogRating($id, $rating){ if($rating == 0 || $rating == NULL){ return "No value entered"; } $sql = mysql_query("SELECT * FROM `blog` WHERE `id` = '$id' LIMIT 1"); $rate = mysql_fetch_array($sql); $voters = $rate['voted'] + 1; $combine = ($rate['totalrate'] + $rating) / $voters; echo $combine; $totalRate = "$rate[totalrate] + $rating"; $update1 = mysql_query("UPDATE `blog` SET `rating` = '".$combine."', `voted` = '".$voters."', `totalrate` = '".$totalRate."' WHERE `id` = '".$id."'"); if($update1){ $update2 = mysql_query("UPDATE `peoplerating` SET `blogid` = '$id', `user` = '".$_SESSION['name']."'"); if($update2){ return "Your rating has been successfully posted!"; } else{ echo "error"; } } else{ echo "error"; } } function peopleRating($blogid, $name){ if($name == "" || $name == NULL){ return 2; } $Rated = mysql_query("SELECT * FROM `peoplerating` WHERE `blogid` = '$blogid' AND `user` = '$name' LIMIT 1"); if(mysql_num_rows($Rated) > 0){ return 1; } else{ return 0; } } Page with the displaying information. PART 1 @$checkUser = peopleRating(mysql_real_escape_string($_GET['blog']), $_SESSION['name']); if($checkUser == 0){ echo "<div style='position:absolute; top:40px; text-align:right; margin-left:137px;'> <form method='post' action='' <input type=\"radio\" name=\"thisRating\" value=\"1\" /> 1 <input type=\"radio\" name=\"thisRating\" value=\"2\" /> 2 <input type=\"radio\" name=\"thisRating\" value=\"3\" /> 3 <input type=\"radio\" name=\"thisRating\" value=\"4\" /> 4 <input type=\"radio\" name=\"thisRating\" value=\"5\" /> 5 <input type=\"submit\" name=\"vote\" value=\"Vote!\" /> </form> </div>"; } elseif($checkUser == 2){ echo "<div style='position:absolute; top:40px; text-align:right; margin-left:300px;'>Please sign in</div>"; } elseif($checkUser == 1){ echo "<div style='position:absolute; top:40px; text-align:right; margin-left:215px;'>You have voted here before</div>"; } Part 2 if(isset($_POST['vote'])){ postblogRating(mysql_real_escape_string($_GET['blog']), $_POST['thisRating']); //echo "<meta http-equiv='refresh' content='0; url='''/>"; }
  5. Well from what I remember, you can't write javascript inside PHP
  6. There is a verity of ways to make a link color change. I now have progressed into a CSS Menu, where it is much more useful for me now. However, to make a link another color: a:link{ } Whenever someone hover a link: a:hover{ } When someone has visited a link before: a:visited{ } When that page is currently opened or activated. (I don't see the point in this one though.) a:active{ } That is the main four different ways of changing a link and making it look good.
  7. There is A LOT more you need to add to the <input> if you want it to be used for JS. Post what you have and I'll try to help =/.
  8. This isn't a javascript issue FYI. However, I would say to put a z-index. or just do: margin-left:auto; margin-right:auto;
  9. I did this all the time. Well, just practicing mostly. I mainly used it with forms though. <head> <script type="text/javascript"> function checkBox(Value){ if(Value == 1){ document.thisForm.thisName.disabled = "disabled"; } else{ document.thisForm.thisName.disabled = ""; } } </script> </head> <body> <form method="post" action="" name="thisForm"> <input type="checkbox" name="thisName" value="1" onchange="checkBox(this.value)" /> </form> Basically I go from the form into the fields. document.FORM.INPUT_NAME.(w/e selector; width, disabled, etc.) = "VALUE"; Then I check if it has that value. just tested it, and it worked.
  10. Ok..... I see. I'll figure it out and get crackin' . I just hope I'll learn Javascript faster than the way it's going now.
  11. I'm understanding this better now return 32 - new Date(iYear, iMonth, 32).getDate(); Meaming: The Date of ->(year, month, day)<- will go through a process to be grabbed and see how many days are in that month. function getdayFeb(dayID, monthID, yearID) So those variables are not needed? I see now. You used getElementById... I didn't see that part. option = new Option(d+1, d); daysObj.options[d] = option; Still figuring out...... What are the values for it though? Option(d+1, d); I'm assuming the first value is the visible date, but the second value is the value of it? Anyways I'll understand it eventually. Thank you VERY much -hugs-[/code]
  12. I believe you're wanting to do pagination.
  13. Have you tried starting on this? If you have post your code. However, I would use the year it is now minus their birth year.
  14. Ok let me see about this. I'm kinda confused on how you got some variables in there. Also with some things you've done. return 32 - new Date(iYear, iMonth, 32).getDate(); I can guess what that means.... 32 - Date(YEAR, MONTH, DAY)...? Correct? function getdayFeb(dayID, monthID, yearID) Why would you need those variables. They don't do with anything O_o. option = new Option(d+1, d); daysObj.options[d] = option; Im confused about that as well. It just goes back a fourth to each other. It just doesnt make any since to me D=. I Thank you A LOT! However, I don't mean to criticize you, but I'm just very interested to know what how this works.
  15. <script type="text/javascript"> function getdayFeb(Month){ var Day = 1; if(Month == "February"){ while(Day <= 28){ document.thisForm.day.value.write = ("<option value='"+Day+"'>"+Day+"</option>"); ++Day; } } else{ while(Day <= 31){ document.thisForm.day.value.write = ("<option value='"+Day+"'>"+Day+"</option>"); ++Day; } } } </script> <select name="month" onchange="getdayFeb(this.value);"> <option value="January">January</option> <option value="February">February</option> <option value="March">March</option> <option value="April">April</option> <option value="May">May</option> <option value="June">June</option> <option value="July">July</option> <option value="August">August</option> <option value="September">September</option> <option value="October">October</option> <option value="November">November</option> <option value="December">December</option> </select> <select name="day"> <script type="text/javascript">getdayFeb();</script> </select> Kinda like this? I'm starting to try other things and trying to research my problem. However, I'm not getting anywhere. I am still trying to try different things so you know. How would you be able to check if JavaScript is off for that user? Ill just use the alternative to use PHP in that case.
  16. I have. No matter what happens, it always shows 31 days.
  17. Hey everyone! I'm currently working on a form with Javascript. (Although the information is sent to the database by PHP.) Objective: When the first field is on "February" I want it to display only 28 days. However, every other month will have 31 days (Just to keep it simple). Problem: Some reason it wont pick up as the field being in February and change the amount of days to 28. I've tried to research it, but I think I am messing up by how I'm calling it out, but I wanna make sure. <script type="text/javascript"> function getdayFeb(){ var Day = 1; if(document.thisForm.month.value == "February"){ while(Day <= 28){ document.write("<option value='"+Day+"'>"+Day+"</option>"); ++Day; } } else{ while(Day <=31){ document.write("<option value='"+Day+"'>"+Day+"</option>"); ++Day; } } } </script> --------Form---------- <form method="post" action="" name="thisForm"> <table> <tr> <td> Username: </td> <td> <input type="text" name="user" maxlength="20" /> </td> </tr> <tr> <td> Password: </td> <td> <input type="password" name="pass1" maxlength="20"/> </td> </tr> <tr> <td> Verify Password: </td> <td> <input type="password" name="pass2" maxlength="20"/> </td> </tr> <tr> <td> E-mail: </td> <td> <input type="text" name="email" maxlength="100" /> </td> </tr> <tr> <td> Gender: </td> <td> <select name="gender"> <option value="Male">Male</option> <option value="Female">Female</option> </select> </td> </tr> <tr> <td> Date of Birth </td> <td> <select name="month"> <option value="January">January</option> <option value="February">February</option> <option value="March">March</option> <option value="April">April</option> <option value="May">May</option> <option value="June">June</option> <option value="July">July</option> <option value="August">August</option> <option value="September">September</option> <option value="October">October</option> <option value="November">November</option> <option value="December">December</option> </select> <select name="day"> <script type="text/javascript">getdayFeb();</script> </select> <select name="year"> <?php $thisYear = date("Y"); while($thisYear >= 1900){ echo "<option value=\"$thisYear\">$thisYear</option>"; --$thisYear; } ?> </select> </td> <tr> <td> <input type="checkbox" name="agree" value="1" /> </td> <td> I agree to all the rules and clearly state to follow them.<br/> I also agree that if I violate the rules, my account could be suspended or deleted.<br/> </td> </tr> <tr> <td colspan="2"> <input type="submit" name="register" value="Register" /> </td> </tr> </table> </form> All help is appreciated! Thank you.
  18. Hello everyone, I am very new to Javascript. However, I have worked with it very briefly. I have a book I'm trying to learn out of. However, it is not helping me any at all. Issue: I can't seem to get the function to work to slide out my menu at all. I'm in the process of rewriting the code to see how it will affect it. I'm writing it from my head, and not from my book. objective: Make a scroll out menu. Would anyone be able to help me write a code for it? I'm kind of in a block and I don't know why. I'm not asking you to write this for me, but to help me along as I go.
  19. Ok, well, I'm having another issue. It doesn't want to connect to my database to check. I am getting nothing wrong when I check just the PHP file. So I'm kinda confused. Would anyone be so kind as to help me? The action script is, tError.autoSize = "right"; var lvSend:LoadVars = new LoadVars(); var lvReceive:LoadVars = new LoadVars(); mcLogin.onRelease = function() { lvSend.username = tUsername.text; lvSend.password = tPassword.text; lvSend.sendAndLoad("logincheck.php", lvReceive, "POST"); }; lvReceive.onLoad = function(success:Boolean) { if (success) { if (this.login == "success") { getURL("members.php"); }else{ tError.text = "I'm sorry you did not enter valid login details"; } } else { trace("no reponse from server"); } }; Here is the PHP file <?php error_reporting(E_ALL); session_start(); mysql_connect("localhost", "root", "shadows2"); mysql_select_db("abysmal"); $username = $_POST['username']; $password = $_POST['password']; /*-----------------LOGIN------------------*/ $sql = mysql_query("SELECT * FROM `accounts` WHERE `MID` = '$username' AND `password` = '$password' LIMIT 1") or die(mysql_error()); echo "SQL passes"; if(mysql_num_rows($sql) < 0){ echo '&text="You did not enter the correct details, or the server is not working."'; echo "Passes1"; } else{ while($data = mysql_fetch_array($sql)){ if(!isset($_SESSION['id'])){ echo "passes"; $_SESSION['loggedIn'] = true; $_SESSION['id'] = $data['id']; $_SESSION['name'] = $data['first']; $_SESSION['mid'] = $data['MID']; echo 'login=success'; } } echo "passes2"; } /* //in real life you will probably want to check whether the username/password exist in a database instead if($username == 'admin' && $password == 'admin123'){ $_SESSION['loggedIn'] = true; echo 'login=success'; }else{ echo 'login=failure'; }*/ ?> <?php error_reporting(E_ALL); session_start(); mysql_connect("localhost", "root", "shadows2"); mysql_select_db("abysmal"); $username = $_POST['username']; $password = $_POST['password']; /*-----------------LOGIN------------------*/ $sql = mysql_query("SELECT * FROM `accounts` WHERE `MID` = '$username' AND `password` = '$password' LIMIT 1") or die(mysql_error()); echo "SQL passes"; if(mysql_num_rows($sql) < 0){ echo '&text="You did not enter the correct details, or the server is not working."'; echo "Passes1"; } else{ while($data = mysql_fetch_array($sql)){ if(!isset($_SESSION['id'])){ echo "passes"; $_SESSION['loggedIn'] = true; $_SESSION['id'] = $data['id']; $_SESSION['name'] = $data['first']; $_SESSION['mid'] = $data['MID']; echo 'login=success'; } } echo "passes2"; } /* //in real life you will probably want to check whether the username/password exist in a database instead if($username == 'admin' && $password == 'admin123'){ $_SESSION['loggedIn'] = true; echo 'login=success'; }else{ echo 'login=failure'; }*/ ?> [/code]
  20. Hello everyone. I'm new to flash. I'm not coding the flash, however someone else I know is. He has no knowledge of PHP, but I do. I have no knowledge in Flash except that it seems like javascript, but he does. So, I am wondering if someone maybe willing to help me out with this. In the actionscript he did //On first frame stop(); userinput.restrict="a-zA-Z0-9"; Selection.setFocus(userinput); passinput.restrict="a-zA-Z0-9"; status="Enter your information and submit"; this.onEnterFrame = function () { if(_root.checklog == 1){ _root.gotoAndStop(2); } if(_root.checklog == 2){ _root.gotoAndStop(3); } } ////////////////////////////// On submit button. on (release, keyPress "<Enter>") { if (user != "" && pass != "") { status = "Begin Login Process - Wait..."; loadVariablesNum("testscript.php", 0, "POST"); } } Now, I have no idea what to do. Here is what I wrote in testscript.php <?php if(isset($_POST['submit'])){ $username = $_POST['user']; $password = $_POST['pass']; if($user != "Tyler") $error = "Username does not exist."; elseif($pass != "shadows2"){ $error = "Password is incorrect"; } else{ if($error){ echo $error; } else{ echo $error; } } } ?> I was mostly looking around and found some similarities. However, I don't know if they are correct or not. Thank you for your help - Twister
  21. Ok, well I fixed it somehow, after I checked the same script 5 times, and just stopped for a few hours, and started finding out what's wrong, it worked now. Creepy. Thanks everyon =)
  22. Ok. Well when I try to use the "Power" to be equal to 5, determining by what quotes will either work for everyone, or using single quotes will not work, or by itself will not work for anyone.
  23. You will have to declare your variables before you make the arrays
  24. Hey everyone. I've been trying to do this for about 25 mins, so I'm a little irritable! Objective: I'm making a comment thingy right now, however, now I'm adding in a feature where you can delete your own post, or if you're an admin (Level 5) you will have access to delete any post you want. Issue: Any time I try to change the Power level to match "5" or grater than 4, it changes the issue with Every account that is not that level. Code: $getComments = mysql_query("SELECT * FROM `comments` WHERE `profileid` = '{$_GET['user']}' ORDER BY `commentid` DESC LIMIT 5"); while($comments = mysql_fetch_array($getComments)){ if($_SESSION['power'] == "5"){ echo $comments['name'] . " says: (" . $comments['date'] . ") : <a href=\"?user={$_GET['user']}&delete={$comments['commentid']}\"> X </a><br/> " . stripslashes($comments['comment']) . "<br/>"; } elseif($comments['accountid'] == $_SESSION['id']){ echo $comments['name'] . " says: (" . $comments['date'] . ") : <a href=\"?user={$_GET['user']}&delete={$comments['commentid']}\"> X </a><br/> " . stripslashes($comments['comment']) . "<br/>"; } else { echo $comments['name'] . " says: (" . $comments['date'] . ") :<br/> " . stripslashes($comments['comment']) . "<br/>"; } } if(isset($_GET['delete'])){ $deleteme = mysql_query("DELETE FROM `comments` WHERE `commentid` = '{$_GET['delete']}'"); if($deleteme){ echo "Comment Deleted"; echo "<meta http-equiv=\"refresh\" content=\"2; url='?user={$_GET['user']}'\"/>"; } } If you have any questions about my post in my script, let me know =).
×
×
  • 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.