Jump to content

TJMAudio

Members
  • Posts

    54
  • Joined

  • Last visited

    Never

Everything posted by TJMAudio

  1. I am trying to learn how to do complete site designs with no tables, but am a complete beginner to CSS. I am having a problem with getting two divs to align on the same horizontal level, as you can see from this image: http://www.image-ant.org/files/c8098f952647b45e03e55eee71b7f762.jpg Here is my code: <!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>Untitled Website</title> <style type="text/css"> body, td, a, p { font-family: arial,sans-serif; } body { background: url(images/top_stretch_bg.gif) repeat-x; font-size: 13px; margin: 3px 8px 2em; } #logo { margin-left: 15px; margin-top: 0; width: 250px; } div#container { margin-left: auto; margin-right: auto; width: 90%; } div#toprss { width: 100%; text-align:right; } </style> </head> <body> <div id="container"> <div id="logo"> <a href="/index.html" title=".com Home"> <img src="images/logo.gif" title=".com" border="0" /></a> </div> <div id="toprss"> <a href="#subscribe" title="Subscribe to .com"> <img src="images/rss_top_right.gif" title="Subscribe to .com" border="0" /></a> </div> </div> </html> The RSS feed needs to be at a margin-top: 0; but it drops down, due to the logo div being there. How do I fix this?
  2. That is one of the main reasons I created this thread. All of my projects thus far have been solo, however when I look back at my biggest (and most technical), current project I often tell myself: "Man, if I decide to pick up another programmer on this, he is going to be digging through includes for 2 hours trying to figure out just what is going on in this mess!". I want to get away from that completely. I guess the biggest thing I could do is stop getting so excited over a new idea, sit back, collect the information I have, plan it out, and then start coding it. I rush into things, and write a whole new function because I realized I needed something in the last function, but completely forgot, and end up putting that new function in another file, because the first function gets called too early.. and it just became a mess. Thanks for the tips so far guys.
  3. So lately I have been trying to get into more OOP design and out of sloppy, repetitive coding. One thing that ends up making my projects a mess is that I get cluttered extremely quickly. I end up using require_once way too much, which results in me limiting myself to how open both my design and functionality is. How do you go about starting your projects off (do you write out your plans, draw a rough layout, etc.)? Do you use a database to hold your headers, meta tags, etc. and then pull them in a function? Any other tips on how to get OOP design without getting myself cluttered and in too deep would be appreciated!
  4. Is it possible to use the same variable names in the same script more than once, say whether it be inside a function or in the script itself, without overwriting data? First example: $query = mysql_query("SELECT * FROM table1"); while($row = mysql_fetch_array($query)) { $variable1 = $row['info']; } $query = mysql_query("SELECT * FROM table2"); while($row = mysql_fetch_array($query)) { $variable2 = $row['info']; } Would $variable1 and $variable2 contain their own data, or would $variable1 be rewrote when $query and $row are reused? Next example is reusing variables in multiple functions... function one($var) { $info = $var; } function two($var) { $info = $var; } Is that possible, or will function two overwrite function one, and vice versa?
  5. Alright, I have tried everything on this one. Now I need 4 random numbers that can't be the same. I just cannot seem to figure this out.
  6. I am trying to make a form validation, however my form uses heavy amounts of checkboxes and selects (upwards of 400 total). If a user currently does not fill the form in correctly, he has to go through and completely redo all of his work. How would you store a checkbox or select value in a form, and then set the checkbox/select to that by default if the session is set? The only way I could think of how to do it is run an if() for every single checkbox, checking if the session is set. Thanks
  7. Say I have an INT row that contains numbers 0 through 11. If the user does not define a number, I want it to pull from the row, no matter what it contains. Sorry if I am explaining this unclearly. Anyways, would I just do it like this: SELECT * FROM table WHERE $variable LIKE '%' Or is there some other way of doing it?
  8. I have a lot of variables that will either be 1 or 0. I want to loop through them, putting all that equal 1 into a list.. it would look something like this: <ul> <li>$var1</li> <li>$var2</li> </ul> And so on. Is there any way of doing this? All of the variables have different names, which is the problem I am having when coming up with this.
  9. I am trying to use the following code below, and am wondering if it is possible... <form action="index.php?pn=searchresults method="get"> Every time I click submit, however, it takes me straight to index.php without processing the form, just to the actual home page. So, is what I am trying to do impossible?
  10. Hey, I am still completely lost when it comes to this. So I would use a table, which would be set up with fields like so: | clickID (which would be auto_inc) | UserID (user who clicked it) | IP Address | AdLink | Date/Time | The thing I am confused about is how I would automatically credit their account for clicking and actually FILLING OUT the advertisement. I am scripting an online game and filling out ads (example, registering and bidding on an item on ebay), would give them extra starting money/items as a 'perk'. So, the problem I am coming across is how I would do this; the whole checking if they did it, then automatically crediting the UserID when it has processed. Normally I would come here for more exact help, but to be honest I have no idea where to even start, so even advice there would be great.
  11. My website is optimized to display at around 1050px width, give or take 50px. The problem is, it is currently stretching completely out, no matter the resolution. How would I make it so if it is 1050px, it will then center the site?
  12. I am trying to generate two random numbers, but have a check to make sure the first number isn't the same as the second. The numbers will range between 1 and 12. I have tried multiple ways of doing this, but cannot figure out an easy solution. Any ideas?
  13. Oh okay. I have been messing with this for hours and to no avail. Any ideas or suggestions on how to do this?
  14. Hello, I am having a problem with this Flash file loading before my website actually does. Is there any way to delay the loading of this Flash file, until my page is fully loaded? Would this be best achieved with PHP or with JavaScript? You can see it here: http://www.raidaholics.com/test/index.php?url=www.raidaholics.com The scripts can be seen with View Source, as they are copyright and I do not want to infringe them... Thanks!
  15. Is this even PHP? Or would it be JS? I can normally do pretty well figuring things out in terms of scripting, but this has me completely stumped.
  16. They will be able to click the advertisement after their initial account activation, so they will be signed up for the site already. Basically, I just want to make it so when the advertisement is completed and clears, the extra game money is credited to their account.
  17. I am making a web-based game, and as an incentive to clicking ads I have a script to give people some extra starter cash. The only problem is, I don't know how to track people who clicked and submitted the advertisements. Basically, the only advertisement I am running right now is one where they must go in, register, and be approved. Could anyone (I don't expect people to hold my hand through it) give me some functions that would be useful, or a link to a tutorial, or just a quick snippet of sample code? Thanks!
  18. Ah, so obvious, thank you. I haven't coded PHP in a couple of years, still rusty on some of the finer details.
  19. <?php case 'register': $addr = $_SERVER['REMOTE_ADDR']; $username = $_POST['username']; $password = $_POST['password']; $cpassword = $_POST['cpassword']; $email = $_POST['email']; $cemail = $_POST['cemail']; $challenge = $_POST['recaptcha_challenge_field']; $response = $_POST['recaptcha_response_field']; if(empty($addr) || empty($username) || empty($password) || empty($cpassword) || empty($email) || empty($cemail) || empty($challenge) || empty($response)) { echo "<script>window.location.href='index.php?m=register&e=0'</script>"; exit; } $checkmultipleusers = mysql_query("SELECT * FROM users WHERE username='$username'"); if(mysql_num_rows($checkmultipleusers) >= 1) { echo "<script>window.location.href='index.php?m=register&e=1'</script>"; exit; } if($password != $cpassword) { echo "<script>window.location.href='index.php?m=register&e=2'</script>"; exit; } if($email != $cemail) { echo "<script>window.location.href='index.php?m=register&e=3'</script>"; exit; } require_once('includes/recaptchalib.php'); $privatekey = "..."; $resp = recaptcha_check_answer ($privatekey, $addr, $challenge, $response); if (!$resp->is_valid) { echo "<script>window.location.href='index.php?m=register&e=4'</script>"; exit; } $activationcode = md5($username); $registerdate = date("F j, Y"); $registeruser = mysql_query("INSERT INTO users (`id`, `permissions`, `registerdate`, `username`, `password`, `email`, `ip`, `secondip`, `thirdip`, `fourthip`, `fifthip`, `activation`, `ipflag`) VALUES (NULL, '0', $registerdate, $username, $password, $email, $addr, '', '', '', '', '$activationcode', '0')"); if($registeruser) { $_SESSION['username'] = $username; echo "<script>window.location.href='index.php?m=home'</script>"; } else { echo "Something went wrong."; exit; } break; Even if all of the error checks pass, the MySQL will not insert the information in to the table.. not even partial.
  20. Tag this as solved.. was using mysql_fetch_row instead of mysql_fetch_array.
  21. Apparently it is also not retrieving the userid as well.
  22. Well, it pulls all but 1 row for some reason. When I call this, the User ID and Username gets pulls, however the Password doesn't. When I try to run this script, the password should be something, but it comes up blank. I have no idea what is wrong with this. My database row for the password is named 'password'. <?php $action = $_GET['a']; switch($action) { case 'login': $username = $_POST['username']; $password = $_POST['password']; $loginquery = mysql_query("SELECT * FROM users WHERE username='$username'"); if(mysql_num_rows($loginquery) < 1) { echo "<script>header.location.href='index.php?m=login&e=1'</script>"; exit; } while($users = @mysql_fetch_row($loginquery)) { $userid = $users['id']; $usern = $users['username']; $userpass = $users['password']; if($password == $userpass) { $_SESSION['username'] = $username; echo "<script>header.location.href='index.php?m=home'</script>"; exit; } else { echo "<script>header.location.href='index.php?m=login&e=1'</script>"; exit; } } break; }
  23. My Website: http://www.raidaholics.com/beta/index.php?home If you click the Arrows image on the table labeled "Karazhan" a few times you will notice the problem... it leaves the old table, and builds a new one, constantly lowering the text more and more down the page. How do I fix this? Page source code is: <div class="topBar"><a href="index.php?m=home">Home</a> // <a href="index.php?m=login">Log in</a> // <a href="index.php?m=register">Register</a></div> <table class="logo"> <tr> <td height="60" width="275"> <a href="index.php?m=home"><img src="images/logo.gif" alt="Raidaholics.com" border="0" /></a> <center><a href="index.php?m=submitinfo">Submit a guide and get paid!</a></center> </td> </tr> </table> <table class="topAd"> <tr> <td height="60" width="460"> <a href="#"><img class="adBorder" src="images/adbanners/joana_468_60_h.gif" alt="Space For Rent!" border="0" /></a> </td> </tr> </table> <div class="sideBar"> <table border="0" cellpadding="6" cellspacing="1" class="tborder" width="175"> <thead> <tr> <td class="tcat" colspan="0"> <a href="#first" onclick="shoh('first')" style="float:right"> <img alt="" border="0" name="imgfirst" src="images/collapse_tcat.gif" /> </a> <span class="smallfont"><strong>» Karazhan</strong></span> </td> </tr> </thead> <tbody id="first"> <tr> <td class="alt1"> <ul> <li>Attument</li> <li>Moroes</li> <li>Maiden</li> <li>Big Bad Wolf</li> <li>Romulo & Juliannce</li> <li>Wizard of Oz</li> <li>The Curator</li> <li>Shade of Aran</li> <li>Prince Malchezaar</li> </ul> </td> </tr> </tbody> </table> </div> Javascript for collapse/expand is: imgout=new Image(15,15); imgin=new Image(15,15); /////////////////BEGIN USER EDITABLE/////////////////////////////// imgout.src="images/collapse_tcat.gif"; imgin.src="images/collapse_tcat_collapsed.gif"; ///////////////END USER EDITABLE/////////////////////////////////// //this switches expand collapse icons function filter(imagename,objectsrc){ if (document.images){ document.images[imagename].src=eval(objectsrc+".src"); } } //show OR hide funtion depends on if element is shown or hidden function shoh(id) { if (document.getElementById) { // DOM3 = IE5, NS6 if (document.getElementById(id).style.display == "none"){ document.getElementById(id).style.display = 'block'; filter(("img"+id),'imgin'); } else { filter(("img"+id),'imgout'); document.getElementById(id).style.display = 'none'; } } else { if (document.layers) { if (document.id.display == "none"){ document.id.display = 'block'; filter(("img"+id),'imgin'); } else { filter(("img"+id),'imgout'); document.id.display = 'none'; } } else { if (document.all.id.style.visibility == "none"){ document.all.id.style.display = 'block'; } else { filter(("img"+id),'imgout'); document.all.id.style.display = 'none'; } } } } Also, how would I make it so they all start collapsed instead of expanded?
  24. Someone told me there was a way to do it with window.location.hash.
  25. Is it possible to change the URL in the address bar with no page reload when ajax or javascript is called, that way there is a permalink to the new 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.