Jump to content

Chikwado

Members
  • Posts

    287
  • Joined

  • Last visited

Posts posted by Chikwado

  1. Good day admin

    Please a newbie is struggling here and needed a help.

    <?php
    $db = new SQLite3('test.db');
    $userlog = "Chikwado";
    $userpass = "wizard&33";
    $sql = "SELECT * FROM user
    WHERE username = '$userlog'
    AND password = '$userpass'
    LIMIT = 1";
    $result = $db->query($sql);
    while ($row = $result->fetchArray(SQLITE3_ASSOC)){
    if($row['username'] === $userlog && $row['password'] === $userpass) {
    echo "Login was successfully.";
    }else{
    echo "Invalid credentials.";
    }
    }
    unset($db);
    ?>

    To run the code above, I get http code failure. 

    I need help and advice.

    Your advice is greatly appreciated.

  2. Good day administrator

    Please how to rotate image on my website, that is, each time I refresh the page it display new image. Below are my JavaScript so far.

    [code]

    <html>

     <head>

      <script>

      var photo = ["image/image1.jpg","image/image2.jpg","image/image3.jpg"];

      var i = Math.floor(photo.length*Math.random());

      document.getElementById("show").src = photo[i];

      </script>

     </head>

     <body>

     <img id="show" src="" alt="Image">

     </body>

    </html>

    [/code]

    <html>

    Thanks.

  3. Someone help with better explanations on code below. 

    I want to test uploading picture in database using the script below. The code is not showing success or error and I'm unable to figure out what to do.

    [code]


    <html>
    <head>    
    <?php
    $servername = "server";
    $username = "username";
    $password = "passme";
    $dbname = "mydb";

    $conn = new mysqli($servername, $username, $password, $dbname);
    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }

    if(isset($_POST["submit"])) {
        $name = $_FILES["fileupload"]["name"];
        $username = $_POST["username"];
        $text = $_POST["textdata"];

        $target_dir = "upload/";
        $target_file = $target_dir . basename($_FILES["fileupload"]["temp_name"]);
        // Select file type
        $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
        // Valid file extensions
        $extensions_arr = array("jpg","jpeg","png","gif");
        // Check extension
        if( in_array($imageFileType,$extensions_arr) ){
            // Upload file
            if(move_uploaded_file($_FILES['fileupload']["name"],$target_dir.$name)){
            // Convert to base64 
            $image_base64 = base64_encode(file_get_contents('upload/'.$name) );
            $image = 'data:image/'.$imageFileType.';base64,'.$image_base64;
            // prepare and bind
            $stmt = $conn->prepare("INSERT INTO messagebox (image, username, reg_date, text) VALUES (?, ?, ?, ?)");
            $stmt->bind_param("ssss", $image, $username, NOW(), $text);
            $stmt->execute();
            echo "<>Success!";
            $stmt->close();
            $conn->close();
            }
        }
    }
    ?>
    </body>
    </html>

    [/code]


  4.  

  5. Some one help with a cue. I don't understand what this properties really does. The first example was clear to me but the second example was not. Can you explain more.

  6. Http error 500 internal server error, FastCGI exited unexpectedly. Error code: 0xc0000135. I am trying to run php in IIS. Some one help please. I have read from so many address link but could not resolve it.

  7. Http error 401.3 Unauthorized. You don't have permission to view this directory or page because of access control list(ACL) configuriation or encription setting for this source on the web server. Can some one help explain these and solution to solve it. Thanks in advance.

  8. How to setup virtual directory after installing IIS, I have installed IIS successfully, if type localhost in browser it return success. Now, How to setup and create new directory and its file.

  9. The length of That your script will not stop you from posting them, You need to post them or upload it online so we can take a closer look on it. Also, you need to be specific. Always go step-by-step while creating a code. Be sure of what a code does before even trying to copy them. Because a code you wrote by yourself will never be complicated. That so called "copy and start using" that is where you will encounter problem.

  10. I do not know which language but I have a link

    What you see in that link is that you need to lay it aside. Choose a language you know, explain a certain command you want to write and how you have tried but failed. Then we will help you achive the result. Or if you are developing a new language, then It will be extremely difficult that you would get help here. After all, Your new language is not known.
  11. Some one help with cue, How to save file and preview in sublime text. After saving my file it appear at top line of the "sublime text", I try to search for it in hard drive but could not see it.

×
×
  • Create New...