Jump to content

lAZLf

Members
  • Posts

    89
  • Joined

  • Last visited

    Never

Posts posted by lAZLf

  1. Bump. And to clearify the sql i used was:

    INSERT INTO accounts (firstname, lastname, username, password, joined, email, level) VALUES ('$_POST[fname]','$_POST[lname]','$_POST[user]',sha1('$_POST[pass]'),'$date','$_POST[email]','norm')

     

    (on the original post I accidentally included the variable below it)

  2. help me find out what this error message means:

     

    "Duplicate entry '0' for key 'PRIMARY'"

     

    the sql for it is

    INSERT INTO accounts (firstname, lastname, username, password, joined, email, level) VALUES ('$_POST[fname]','$_POST[lname]','$_POST[user]',sha1('$_POST[pass]'),'$date','$_POST[email]','norm')";
    $sqlcheck= mysql_query("SELECT * FROM accounts WHERE username = '$_POST[user]' OR email = '$_POST[email]'

     

  3. I got it working, aparently all I had to do was get put in the JS after both tags/objects were parsed. At first I had the code put in after the <body> tag so that part worked fine, while the #bg div was after the code, so it didn't work...

  4. In firebug I get this error:

    uncaught exception: [Exception... "Not enough arguments"  nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)"  location: "JS frame :: http://svidler.net/ :: <TOP_LEVEL> :: line 17"  data: no]
    http://svidler.net/
    Line 76

     

    and this error:

    document.getElementById("bg") is null
    http://svidler.net/
    Line 76

  5. Why wont this code work:

    	document.getElementById("bg").style.background= "transparent url('svid.png') fixed no-repeat 10px 30px";
    

     

    When this code does:

    	document.body.style.background = "#CCC url('svid2.png') fixed no-repeat 10px 30px";
    

     

     

     

     

     

    Incase you're curious, here's the code i'm working with:

    var winW = 630, winH = 460;
    
    if (parseInt(navigator.appVersion)>3) {
    if (navigator.appName=="Netscape") {
      winW = window.innerWidth;
      winH = window.innerHeight;
    }
    if (navigator.appName.indexOf("Microsoft")!=-1) {
      winW = document.body.offsetWidth;
      winH = document.body.offsetHeight;
    }
    }
    
    if(winW > 1270) {
    document.body.style.background = "#CCC url('svid2.png') fixed no-repeat 10px 30px";
    document.getElementById("bg").style.background= "transparent url('svid.png') fixed no-repeat 10px 30px";
    }

  6. On my website I made two divs inside another div. The container div is floating right, and one div inside it is floating right, and another is floating left. On the latest versions of safari, firefox, internet explorer and google chrome it works just fine. However, on more primitive browsers (i.e. browser on my blackberry or an old version of firefox for windows) they still float left and right, but one is above the other instead of being on the same level. (its on http://svidler.net/ if you want to see it)

     

    HTML:

    <div id="leftcontent">
    
    <div class="left">
    <a href="?page=contact" class="advert"><div class="adverttitle">advertise here</div></a><br />
    <a href="?page=contact" class="advert"><div class="adverttitle">advertise here</div></a><br />
    <a href="?page=contact" class="advert"><div class="adverttitle">advertise here</div></a>
    </div>
    
    <div class="right">
      
    	<div id="login">
    	<form action="login.php" method="post">
    	<table cellspacing="0">
    	<tr><td><input type="text" id="username"name="username"width="300" value="username" onFocus="emptythefield(); glow();" onblur="fillthefield(); glow();"/></td></tr>
    	<tr><td><input type="password" id="password"name="password"width="300" value="password" onFocus="emptythefield2();" onblur="fillthefield2();"/></td></tr>
      	<tr><td id="submitrow"><input type="submit" value="login" class="btn"/></td></tr>
    	</table>
    	</form>
    </div><div id="recentposts">
        <h2>Recent Posts</h2><br />
        <a href="index.php?type=comments&page=blogpost&id=19" class="recentpostlink">A rite of passage</a><br /><a href="index.php?type=comments&page=blogpost&id=18" class="recentpostlink">Portfolio page loading time shortened</a><br /><a href="index.php?type=comments&page=blogpost&id=17" class="recentpostlink">anonymously comment on anything</a><br /><a href="index.php?type=comments&page=blogpost&id=16" class="recentpostlink">design changes be gone!</a><br /><a href="index.php?type=comments&page=blogpost&id=15" class="recentpostlink">portfolio page and other stuff</a><br /><a href="index.php?type=comments&page=blogpost&id=12" class="recentpostlink">this is a test</a><br /></div>
    </div>
    </div>

     

    CSS:

    #leftcontent {
    float:right;
    width:540px;
    display:table-cell;
    }
    
    .right {
    float:right;
    }
    .left {
    float:left;
    }
    

     

     

     

    Does anyone know why this might be happening?

  7. So I have a script to upload two images and add information about them into a database. It doesn't seem to be working but I don't know why.

     

    HTML:

    			<form enctype="multipart/form-data" action="uploadimage.php" method="POST">	
    		<table>
    		<tr><td>title:</td><td><input type="text" name="title" /></td></tr>
    		<tr><td>description:</td><td><textarea name="description" multiline="true" cols="50" rows="8" width="300px"></textarea></td></tr>
    
    		<tr><td colspan="2">Choose a file to upload: <input name="uploadedfile" type="file" /></td></tr>
    		<tr><td colspan="2">Choose another file to upload: <input name="uploadedfile2" type="file" /></td></tr>
    		<tr><td colspan="2"><input type="submit" value="Upload File" /></td></tr>
    		</table>
    		</form>

     

     

    PHP:

    <?php
    session_start();
    include('dbconfig.php');
    $date = date('g:iA M d, Y');
    
    $target_path1 = "portimages/";
    $target_path1 = $target_path1 . basename( $_FILES['uploadedfile']['name']); 
    
    $target_path2 = "portimages/";
    $target_path2 = $target_path2 . basename( $_FILES['uploadedfile2']['name']); 
    
    if($_SESSION['level'] == 'admin') {
    	if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path) && move_uploaded_file($_FILES['uploadedfile2']['tmp_name'], $target_path2)) {
    			mysql_query('INSERT INTO `portfolio images` (path, path2, date, title, description) VALUES ("/portimages/'.$_FILES['uploadedfile']['name'].'","/portimages/'.$_FILES['uploadedfile2']['name'].'","'.$date.'","'.$_POST['title'].'","'.$_POST['description'].'")') or die (mysql_error());
    
    			echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
    			" has been uploaded";
    			header("Location: ".$_SERVER['HTTP_REFERER']);
    	} else {
    		echo "There was an error uploading the file, please try again!";
    	}
    } else {
    	echo'please login with an admin account';
    }
    
    ?>

     

     

    ERROR MESSAGE:

    Warning: move_uploaded_file() [function.move-uploaded-file]: Filename cannot be empty in /home4/annarbo1/public_html/svidler/uploadimage.php on line 13
    
    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/var/tmp/phpl3c23c' to '' in /home4/annarbo1/public_html/svidler/uploadimage.php on line 13
    There was an error uploading the file, please try again!

     

     

     

     

    What's wrong with it?

  8. So, I'm trying to implement a dropdown menu. It works by putting an "onmouseover" thing on one of the links to show a list with links. On the list i put "onmouseout" attribute to hide it. The problem is that on the list are links, when you hover your mouse over the links, the menu is hidden again. How do I fix this?

     

    To see the problem go to http://www.annarboruncovered.com/  and hover over the "places" link.

     

    Javascript:

    function hide(id) {
    var obj = document.getElementById(id);
    
    obj.style.display = "none";
    }
    
    function show(id) {
    var obj = document.getElementById(id);
    obj.style.display = "block";
    }

     

    HTML:

    <div id="menu">
    <div id="links">
    
    	 	  <a href="index.php" class="link"> HOME</a>    
          <a href="#" class="link" onmouseover="show('dropdown')"> PLACES</a>    
          <a href="#" class="link"> ABOUT</a>    
          <a href="#" class="link"> LINKS</a>    
          <a href="index.php?page=contact" class="link"> CONTACT</a><br/>
      <a href="index.php?page=restaurants" class="link"> RESTAURANTS</a>    
          <a href="index.php?page=clubs" class="link"> CLUBS</a>    
          <a href="#" class="link"> SHOPS</a>    
          <a href="#" class="link"> STUDENT MAGAZINES</a>
          </div>
      </div>
          <ul id="dropdown" onMouseOut="hide('dropdown');">
          <li class="underline"><a href="index.php?page=restaurants" class="droplink"> restaurants</a></li>
          <li class="underline"><a href="index.php?page=clubs" class="droplink"> clubs</a></li>
          <li><a href="#" class="droplink"> shops</a></li>
          </ul>

  9. So on my website I have implemented paging. But with the links I've run into a problem. When I use:

    $self = $_SERVER['PHP_SELF'];
    

    I don't get the dynamic "information".

     

    Basicly I only get

    "index.php"

     

    instead of

    "index.php?page=restaurants&type=comments&num=1"

     

    How could I get the complete URL of the current page?

  10. I did what u suggested, but it won't work for some reason.

     

    I keep getting this error: "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home4/annarbo1/public_html/registerin.php on line 12

    Your passwords or email adresss don't match up"

     

    the code:

    <?php
    session_start();
    $con = mysql_connect("localhost","xxxxxxx","xxxxxxxxx");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    mysql_select_db("annarbo1_Archive", $con);
    $date = date("Y/m/d");
    $sql="INSERT INTO people (fname, lname, username, password, joined, email, level) VALUES ('$_POST[fname]','$_POST[lname]','$_POST[user]',sha1('$_POST[pass]'),'$date','$_POST[email]','norm')";
    $sqlcheck="SELECT * FROM people WHERE username = '$_POST[user]' OR email = '$_POST[email]'";
    $numrows = mysql_num_rows($sqlcheck);
    
    if (!empty($_POST['pass']) || !empty($_POST['user']) || !empty($_POST['confemail']) || !empty($_POST['confpass']) || !empty($_POST['email']) || !empty($_POST['fname']) || !empty($_POST['lname'])) {
    if($_POST['confemail'] == $_POST['email'] && $_POST['pass'] == $_POST['confpass']) {
    
    	if($numrows == 0) {
    		if (!mysql_query($sql,$con))
      			{
      				die('Error: ' . mysql_error());
      			} else{
    			header ("Location: userinfo.php");
    		}
    	} else {
    		echo "username or email taken already";
    	}
    
    } else {
    echo"Your passwords or email adresss don't match up";
    }
    } else {
    echo "empty fields";
    }
    mysql_close($con);
    ?>

  11. I wanted everyone to know that there is a better alternative to JavaScript rollover images that uses simple CSS.

     

    HTML:

    <div class="rolloverdiv">
          <a href="#"  class="rolloverimg"></a>
    </div>
    

     

    the CSS:

    .rolloverdiv {
          height:150px;
          width: 150px;
    }
    
    .rolloverimg {
          background: url(imgname.extension);
          width:100%;
          height:100%;
          display:block;
          cursor: pointer;
    }
    
    .rolloverimg:hover {
          background: url(secondimgname.extension);
    }
    

     

    This should be a healthier, simpler alternative to JavaScript rollover images.

  12. I have been having problems with DIV , is it useful? when the browser is resized or restored to a screen size the items on DIV overlap and make the page ugly.

     

    Any idea?

     

    you must be using absolute positioning for your divs.

     

    provide us code or page to the link to review the problem.

     

    vineet

    I've also noticed that on my website, when you zoom out from the page and everything is smaller, my div's positioning is slightly messed up, and i'm using position:relative.

×
×
  • 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.