Jump to content

etsted

Members
  • Posts

    274
  • Joined

  • Last visited

Everything posted by etsted

  1. etsted

    script

    i got a little script i want to show: var scrollY = 0; var distance = 40; var speed = 24; function autoScrollTo(el) { var currentY = window.pageYOffset; var targetY = document.getElementById(el).offsetTop; var bodyHeight = document.body.offsetHeight; var yPos = currentY + window.innerHeight; var animator = setTimeout('autoScrollTo(''+el+'')',24); if(yPos > bodyHeight){ clearTimeout(animator); } else { if(currentY < targetY-distance){ scrollY = currentY+distance; window.scroll(0, scrollY); } else { clearTimeout(animator); } } } this is supposed to clear the "animator" if yPos is greater than bodyHeight, but woudnt yPos and bodyHeight have the same value? if not explain.
  2. etsted

    offset

    there are many functions in js that uses the word offset, now i have search a little but i still dont understand it. What does offset mean? give me a nice and easy example.
  3. etsted

    .htaccess

    i am trying to use a .htaccess on my website, but it wont work. When i try to write in a fake url in the address bar i get the following error: Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. this is my .htaccess file: # 1 ---- Establish a custom 404 File not Found page ----ErrorDocument 404 /index.php# 2 ---- Prevent directory file listing in all of your folders ----IndexIgnore * this is the fake url i used when testing the .htaccess: http://localhost/root/fdsdf.php // all of my files are stored inside "root"
  4. etsted

    UNIQUE KEY

    how should the UNIQUE KEY syntax look? // is this right? UNIQUE KEY username (username, email)? // or this?? because i think this is the right syntax, but i have seen some use the above. Why? UNIQUE KEY(username, email)?? Is both legit?
  5. etsted

    phpmyadmin

    what exactly is the enum type? what values are ussally stored inside it?
  6. etsted

    text files

    i mean when u make a text file in php whit fopen, what do people ussally write in them?
  7. etsted

    text files

    what do people ussally use the for?
  8. etsted

    live chat

    i get it when i write: hi and message
  9. etsted

    live chat

    I have live chat that is supposed to display the "sender" and the "message", but instead give me some weird result. script: function get_msg(){ global $con; $query = "SELECT Sender, Message FROM chat"; $run = mysqli_query($con, $query); $messages = array(); while($message = mysqli_fetch_assoc($run)){ $messages = array('sender' => $message['Sender'], 'message' => $message['Message']); } return $messages; } <div id="messages"> <?php $messages = get_msg(); foreach($messages as $sender => $message){ echo "Sender: " . $sender . "<br >"; echo "Message: " . $message . "<br />"; } ?></div> this is what it outputs: Message has been sent. Sender: senderMessage: hiSender: messageMessage: message
  10. you can read it in w3schools.com
  11. etsted

    undefined variable

    this is a little reference from my live chat script, but it wont work. The error message is variable $con is not defined, but it is clearly defined. $con = mysqli_connect("localhost","root","123","chat") or die(mysqli_error($con));function get_msg(){ $query = mysqli_query($con, "SELECT Sender, Message FROM chat"); $run = mysqli_query($con, $query); $messages = array(); while($message = mysqli_fetch_assoc($run)){ $messages = array('sender' => $message['Sender'], 'message' => $message['Message']); } return $messages; }
  12. whats the diffrence between the value they get? Can u write it down?
  13. etsted

    text files

    what are text files acctually used for?
  14. you should use a while loop instead. while($rows = mysql_num_rows($result)){ $data1 = $rows['data1']; echo "$data1 <br />"; }
  15. this is an animation script that works fine, but i notize that the init() function only works if the brackets are not included. Why? <html><head><title>JavaScript Animation</title><script type="text/javascript"><!--var imgObj = null;function init(){ imgObj = document.getElementById('myImage'); imgObj.style.position= 'relative'; imgObj.style.left = '110px';}function moveRight(){ imgObj.style.left = parseInt(imgObj.style.left) + 10 + 'px';}window.onload =init ; // works window.onload = init(); // doesnt work//--></script></head><body><form><img id="myImage" src="smiley.gif" /><p>Click button below to move the image to right</p><input type="button" value="Click Me" onclick="moveRight();" /></form></body></html>
  16. etsted

    uploadify

    i need i to call the picture later, do u have a better way of storing/calling an image?
  17. etsted

    uploadify

    i include the path to the localhost, because i work localy.
  18. etsted

    whats wrong?

    this is a uploader script. in my phpmyadmin the image is stored in a type = blob. it works, the image is being uploaded to phpmyadmin, but i still get an error. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1 <?phpinclude "conn.php";$name = mysqli_real_escape_string($con, $_POST['name']);$details = mysqli_real_escape_string($con, $_POST['details']);$photo = addslashes(file_get_contents($_FILES['photo']['tmp_name']));$image = getimagesize($_FILES['photo']['tmp_name']);$imagetype = $image['mime'];echo "<br/>";$q = mysqli_query($con, "INSERT INTO animal VALUES('','$name','$details','$photo','$imagetype')") or die(mysqli_error($con));$r = mysqli_query($con, $q);if($r){ echo "information stored";}else{ echo mysqli_error($con);}?>
  19. etsted

    live support

    is there a website where i can get live php support?
  20. etsted

    types in phpmyadmin

    do u mean in a folder?
  21. etsted

    upload videos

    thats not what i ment, i just wanted you to tell me of a free source media player that i can put on my website.
  22. etsted

    uploadify

    this is an uploading system from uploadify that i have tried to change so that i can pass inn information into the DB, but it wont work. Can somebody change it so that i would pass is data to a DB? <?php/*UploadifyCopyright © 2012 Reactive Apps, Ronnie GarciaReleased under the MIT License <http://www.opensource.org/licenses/mit-license.php>*/// Define a destination$targetFolder = '/uploads'; // Relative to the root$verifyToken = md5('unique_salt' . $_POST['timestamp']);if (!empty($_FILES) && $_POST['token'] == $verifyToken) { $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder; $targetFile = rtrim($targetPath,'/') . '/' . $_FILES['Filedata']['name']; // Validate the file type $fileTypes = array('jpg','jpeg','gif','png', 'MP4'); // File extensions $fileParts = pathinfo($_FILES['Filedata']['name']); if (in_array($fileParts['extension'],$fileTypes)) { move_uploaded_file($tempFile,$targetFile); echo '1'; } else { echo 'Invalid file type.'; } // my code below // this is my code below, but it only insert some data to the database, and gives no error away. include "../conn.php";if (!empty($_FILES) && $_POST['token'] == $verifyToken){ $name = $_FILES['file']['name']; $tmp = $_FILES['file']['tmp_name']; move_uploaded_file($tmp,"uploaded/".$name); $url = "localhost/uploaded/$name"; mysqli_query($con,"INSERT INTO video VALUES('','$name','$url')");}}?>
  23. etsted

    types in phpmyadmin

    But if i save an address that refers to my image or video, should it be in a BLOB type? I mean what is BLOB. Answer my above questions.
  24. etsted

    types in phpmyadmin

    when people upload image or video to my site, do i store them in any special type in phpmyadmin? are you supposed to use BLOB? What is BLOB? Which of them do i use? I would guess they can store different amount of data, how much do each of them store?
  25. etsted

    upload videos

    my problem isnt the uploader, its how to display them on my webpage whit a free source media player. Any suggest and tutorials whit it?
×
×
  • Create New...