Jump to content

etsted

Members
  • Posts

    274
  • Joined

  • Last visited

Everything posted by etsted

  1. etsted

    json

    results.innerHTML = "requesting..."; that part is working, but it does not get the user content from my mylist.json
  2. etsted

    video tag

    its an mp4 movie
  3. etsted

    video tag

    i have different files in the DB, also do i need to specify the type?
  4. etsted

    json

    any reason to why json wont work localy or on my server? i am trying this code: // this is my json_script.htm <!DOCTYPE html><html><head><script type="text/javascript">function ajax_get_json(){var results = document.getElementById("results"); var hr = new XMLHttpRequest(); hr.open("GET", "mylist.json", true); hr.setRequestHeader("Content-type", "application/json", true); hr.onreadystatechange = function() { if(hr.readyState == 4 && hr.status == 200) { var data = JSON.parse(hr.responseText); results.innerHTML = ""; var results = document.getElementById("results"); results.innerHTML = data.user; } } hr.send(null); results.innerHTML = "requesting...";}</script></head><body><div id="results"></div><script type="text/javascript">ajax_get_json();</script></body></html> // this is my mylist.json { "user":"John", "age":22, "country":"United States" };
  5. etsted

    video tag

    // this is how i get the files from the DB $mp4 = ""; // get all the mp3 files from the DB $sql = "SELECT * FROM mp3"; $query = mysqli_query($con, $sql); while($row = mysqli_fetch_array($query) ) { $id = $row['id']; $tittel = $row['tittel']; $description = $row['description']; $username = $row['username']; $file_url = $row['file_url']; $upload_date = $row['upload_date']; $mp4 .= "<video width='320' height='240' controls>n"; $mp4 .= "<source src='$file_url' type='audio/mpeg'>n"; $mp4 .= "</video>n"; } // the url from the DB look like this videos/2014042727116180637260000009088958.mp4 // this is how the echo part look like <div><?php echo $show;?></div>
  6. etsted

    video tag

    my code doesnt work, if i specify a type attribute, any suggestions?
  7. this code shows me duplicate audio tags, why? $mp3 .= "<audio width='320' height='240' controls>n"; $mp3 .= "<source src='$file_url' type='audio/mpeg'>n"; $mp3 .= "</audio>n"; $show .= "<div>n"; $show .= "$mp3 <br> Tittel: $tittel <br>n <span style='float:left;'>Description:</span>n <div style='border:1px red solid;overflow:hidden;width: 100px; height:20px;'>$description</div>n"; $show .= "</div>n <br>"; it is supposed to show 1 file form the DB then a break line, but instead shows 2 of the same audio on line with each other.
  8. etsted

    video tag

    that has nothing to with that case, ofcourse the $file_url is above my video tag! Besides, do i need to specify the type attribute when i use video tag og audio tag?
  9. etsted

    video tag

    it doesnt work, when i specify the type attribute? why? do i even need it? it looks something like this: <video width="320" height="240" controls> <source src="<?php echo $file_url;?>" type="video/mp4"> <source src=<?php echo $file_url;?>" > Your browser does not support the video tag. </video> $file_url = "videos/2014042727116180637260000009088958.mp4";
  10. etsted

    clear both

    my bottomDiv is still not able to clear:both, whats wrong?
  11. etsted

    strtolower

    even professionals like me can make mistakes
  12. etsted

    strtolower

    $haystack = array("gif");$fileParts = array("extension" =>"GIF", nr2 => "JPG");$fileParts = $fileParts['extension'];$fileParts = strtolower($fileParts[0]);if(in_array($fileParts, $haystack)){ echo "right";} else { echo "false";} this returns false, how can i make it return true? in real life, the $fileParts array is acctaully $_FILES['fileName']['name'], where i try to make the extension into lower case before the array check
  13. etsted

    clear both

    <body><div id='topDiv'> <!-- Main Top Div --><!-- logo image/link --><div id='Logo'><a href='index.php'><img src='images/logo.png' height='90' width='120' alt='logo' border='0'></a></div><div id='inside1_topDiv'><a href='user.php?u=victor'> victor </a> &nbsp; | &nbsp; <a href='logout.php'>Log Out</a> </div><div id='inside2_topDiv'><a href='index.php'>Home</a><a href="notifications.php" title="Your notifications and friend requests"><img src="images/note_still.png" width="22" height="12" alt="Notes"></a><a href='upload.php?u=victor'>Upload</a> </div><span style='margin-left: 30%';>Hello victor, lastlogin: 2014-04-26</span> </div> <!-- Main Top Div --> <div id="middleDiv"> </div><!-- template_bottomDiv.php includes both </body> and </html> --><div id="bottomDiv">bottom text</div></body></html>
  14. etsted

    clear both

    <?php // this already includes a connection to the DB, and a session_start() // also check to see if a user i logged in // include_once "check_user.php"; // this stores error messages redirected from other pages $msg = ""; if(isset($_GET['msg'])) { $msg = $_GET['msg']; } ?> <!-- contains !DOCTYPE and all of the header elements --> <?php include_once "header_function.php"; echo header_function("Home page");?> <!-- template_topDiv.php also includes a <body> and </head> tag --> <?php include_once "template_topDiv.php";?> <div id="middleDiv"> <?php echo $msg;?> </div> <!-- template_bottomDiv.php includes both </body> and </html> --> <?php include_once "template_bottomDiv.php"; // this include the <div id="bottomDiv"></div>
  15. etsted

    mkdir

    is there something wrong with this code? // make them a folder, where we store their files if(!file_exists("user/$username")) { $image = "avatardefault.png"; mkdir("/user/$username/$image"); } else { $message = "something went wrong, while trying to make you a own folder"; } bcz at my server it doesnt allow me to make a folder to each user. WHat should i do?
  16. etsted

    type_unknow

    i have here a tekst field and a button, that interacts with php using ajax $status_ui = '<textarea id="statustext" onkeyup="statusMax(this,250)" placeholder="What's new with you '.$u.'?"></textarea>'; $status_ui .= '<button id="statusBtn" onclick="postToStatus('status_post','a',''.$u.'','statustext')">Post</button>'; But i get some sort of an error, which i dont know why is there i get all the variables using the postToStatus function, and then send them to a php script using: ajax.send("action="+action+"&type="+type+"&user="+user+"&data="+data); in the php script i have an if statement if($_POST['type'] != 'a' || $_POST['type'] != 'c') { echo "type_unknow"; exit; } it doesnt say anything about $_POST['type'], but when i run print_r i can see that the $_POST['type'] is set
  17. etsted

    clear both

    this is my style.css, and the ids refers to divs, but i cant make the bottomDiv clear:both. And it stacks above some of my elements body { margin: 0px; }/* topDiv */ /* #topDiv, the main top div */ #topDiv{ height: 90px; background-color: #00ff00; margin: 0px; padding: 0px; border: 0px; } /* used to design the logo */ #topDiv > #Logo{ margin-left: 30px; float: left; width: 120px; height: 90px; } /* used inside the first div of topDiv */ #topDiv > #inside1_topDiv { height: 45px; margin-top: 20px; margin-right: 50px; float: right; } /* use this to change the links that are inside #inside1_topDiv */ #topDiv > #inside1_topDiv > a{ margin: 20px; color: #004000; } /* use this to change the hover state of links that are inside #inside1_topDiv */ #topDiv > #inside1_topDiv > a:hover{ margin: 20px; color: #ffffff; } /* used inside the second div of topDiv */ #topDiv > #inside2_topDiv { height: 45px; margin-left: 20px; border: 1px solid red; float: left; } /* use this to change the links that are inside #inside2_topDiv */ #topDiv > #inside2_topDiv > a{ margin: 20px; color: #004000; } /* use this to change the hover state of links that are inside #inside2_topDiv */ #topDiv > #inside2_topDiv > a:hover{ margin: 20px; color: #ffffff; }/* topDiv *//* middleDiv */#middleDiv{ height: 600px;}/* middleDiv *//* bottomDiv */#bottomDiv{ text-align: center; color: #00ff00; clear:both; border: 5px solid red; margin-bottom: 0px; padding: 24px;}/* bottomDiv */
  18. etsted

    ccs3

    what is the name of that css3 function that allows pictures to be stacked vertically whenever the are to many pictures horizantly?
  19. etsted

    validation

    i am trying to make a validation script. This script return false if i use two or more variables that are empty $usernameErr = $pass1Err = $emailErr = $genderErr = $pass2Err = $wrong_passErr = ""; if($emailErr && $usernameErr == "") { echo "right"; } else { echo "wrong"; } // this returns false if($usernameErr == "") { echo "right"; } else { echo "wrong"; } // this return true if($emailErr == "") { echo "right"; } else { echo "wrong"; } // this returns true
  20. etsted

    inputs width

    i want to make the input field longer by using the width property, but in w3schools it says that it should only be used with type="image". If that so, how could i make a longer search bar? Do i use something else?
  21. body { margin: 0px; } it still doesnt work
  22. this is my code to a div i have background: #11ff11; padding: 24px; font-size: 12px; color: #000000; text-align: center; clear: both; margin-bottom: 0px; but i keep seeing that there is always some white space at bottom that i cant clear away. there is about 20 pixel with white space from the bottominbetween my div.
  23. etsted

    strchr

    this script is supposed to only register a user if he has not been on my website, but this script keep on adding the IP of a person all the time $filref = fopen("tekst.txt", "a");$ip = $_SERVER['SERVER_ADDR'];$les_fil = fread($filref, filesize("tekst.txt"));if(!strchr($les_fil, $ip) ){ fwrite($filref, $ip);}else{ echo "cannot register more";}
  24. etsted

    php learning sites

    is there any good php learning sites, where i wont just be teached how to code php, but also given task to complete. Just like codecademy.com?
  25. etsted

    php gallery system

    i am trying to make a php gallery system without a database. I want to make 2 cols with 3 rows, for each picture. And there should be a link that i can press to take me to another page, to show me other pictures, in case the first gallery becomes full. ( i am not asking someone to build it for me, i am just wondering about diffrent functions i would need).
×
×
  • Create New...