How to make profit simulator by clicking on a link

Asked

Viewed 95 times

0

Hello! I am doing a web project and I needed a click simulator, in which for each click on the link simulated give 1 centimo, 0,01 euros (Portuguese currency)

The instructions they gave me were:

let’s develop the application financing module. is what will manage us the business income.

the file will be called browser.php and has the function: . receive the sponsor/news and user arguments (userid - session variable, idartigo, title, campaign value, address to open) . write in the profit table the fields: userid, idartigo, title news, value camapanha, address . inform the user that he is being redirected to the desired URL . open news/sponsor/news URL

areareserv.php

 <div class="col-md-12 fadeIn animated">
            <?php
                include('configdb.php');
                #session_start();
                if  (isset($_SESSION['loginOK'])):
                    if  ($_SESSION['loginOK']==1):
                        echo ("Bem-vindo, ". $_SESSION['nome']);
                        echo "<br><br>";
                        echo ("\n O seu login foi efectuado com sucesso.");
                          if    ($_SESSION['admin']==1): echo " <p><a href='./backoffice'>És administrador. Acesso ao backoffice.</a></p>"; endif;

                            $query = mysqli_query($mysqli, "SELECT * FROM artigos WHERE activo = 1 ORDER BY idartigos DESC");
                                    while($row_artigos = mysqli_fetch_array($query))
                                    {                       
                                echo "<br><br>";
                                echo "<strong>$row_artigos[1]</strong>";
                                echo "<br>";
                                echo($row_artigos[2]);
                                echo "<br>";
                   #LINK ONDE NECESSITO DE FAZER CONTAGEM    
                                echo("<a target='_blank' href='http://".$row_artigos[3]."'>".$row_artigos[3]."</a>");       

                                echo "<br><br>";
                                echo("<hr>");
                                    }

                    else:
                        echo ("Login necessário. Registe-se ou faça login, sff.<br>");
                        header("refresh:3;url=index.html");
                    endif;
                else:
                    echo ("Login necessário. Registe-se ou faça login, sff.<br>");
                    header("refresh:3;url=entrar.php");
                endif;

            ?>

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

  • explains better what it would be "click on the link" and "simulate giving a penny"

  • when clicking the link would be redirected to the page "browser.php" ran the query to count the click and add 0.01 euros in the database in the "campaign value" field for each click.

  • simple, in the file browser.php, puts the logic of "count the click" and the logic of adding the 0.01 euros in the bank. every time the page is accessed, the logic will be executed. Your question is missing information.

  • the problem is I don’t know how to make this logic...

  • what is common in tables articles and profits? ie have columns with equal and unique values?

  • They gave me these instructions: the file will be called browser.php and has the function: . receive the sponsor/news and user arguments (userid - session variable, idartigo, title, campaign value, address to open) . write in the table 'profits' the fields: userid, idartigo, title noticia, value camapanha, address . inform the user that he is being redirected to the intended URL . open the news/sponsor/news URL

  • Come on, does this table article column have the same values as the table income column? Are they related?

  • I will put the articles table print also in question

  • This $row_articles[3] brings the value of which column of the articles table? I’ve never worked this way, I’ve always worked with column names.

  • brings the value "link"

  • and the penny would be accumulated in the campaign value column of the income table?

  • yes, in the profit table is supposed to appear the name/id of the user who clicked on the link, the id of the article where the link is , the name of the article where the link is and the value accumulated in that click

  • echo("<a target='_Blank' href='http://".$row_articles[3]."?id=".$row_articles[idartigos]."'>".$row_articles[3]."</a>"); Dai on the page that will open when you click on the link recover the value of the variable 'id' passed in the URL and update (adding + 0.01) in the column that accumulates centimes where idartigos is equal to the value of the variable id

Show 8 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.