0

Hi,

I'm doing a page where the user is logged with facebook and when he buys something. when the process is completed it shares a default text in my facebook timeline.

I can't find that API code, can someone help me?

Here's what i have:

<?php
    include('header.php');
?>

    <body>
        <div id="wrapper">
            <?php
                /* connect to mysql */
                $connecDB = mysql_connect($hostname, $db_username, $db_password) or die("Unable to connect to MySQL");  
                mysql_select_db($db_name,$connecDB);

                $QueryTrip=mysql_query("SELECT * FROM horarios WHERE IdHorario='".$_GET['trip_hour']."'");
                $ResultTrip=mysql_fetch_assoc($QueryTrip);


                if(isset($_SESSION['logged_in'])){                      
                    if(!isset($_GET['trip_hour_volta'])){           
                        $trip=$_GET['trip_hour'];

                        if($ResultTrip['NroVagas']==0){
            ?>  
                            <div id="erro2"> Já não há vagas para essa viagem </div>
                            <span id="timer" style="display:none;">  
                                <script>
                                    countDown();  
                                </script>
                            </span>  
            <?php
                        }
                        else{
                            $vaga=$ResultTrip['NroVagas']-1;
                            $UpdateVagas=mysql_query("UPDATE horarios
                                                      SET NroVagas='".$vaga."'
                                                      WHERE IdHorario='".$ResultTrip['IdHorario']."'");
                            if($UpdateVagas){
                                echo '<script>window.location="success_buy.php"</script>';
                            }
                            else{
                                echo '<div id="erro2"> Ocorreu um erro. Tente mais tarde. </div>';
                            }
                        }
                    }
                    else{
                        $trip=$_GET['trip_hour'];
                        $trip_volta=$_GET['trip_hour_volta'];



                        /* connect to mysql */
                        $connecDB = mysql_connect($hostname, $db_username, $db_password) or die("Unable to connect to MySQL");  
                        mysql_select_db($db_name,$connecDB);

                        $QueryTrip=mysql_query("SELECT * FROM horarios WHERE IdHorario='".$trip."'");
                        $ResultTrip=mysql_fetch_assoc($QueryTrip);

                        $QueryTripVolta=mysql_query("SELECT * FROM horarios WHERE IdHorario='".$trip_volta."'");
                        $ResultTripVolta=mysql_fetch_assoc($QueryTripVolta);

                        if($ResultTrip['NroVagas']==0){
            ?>  
                            <div id="erro2"> Já não há vagas para essa viagem. </div>
                            <span id="timer" style="display:none;">  
                                <script>
                                    countDown(); 
                                </script>
                            </span>
            <?php
                        }
                        else{
                            $vaga=$ResultTrip['NroVagas']-1;
                            $vaga_volta=$ResultTripVolta['NroVagas']-1;

                            $UpdateVagas=mysql_query("UPDATE horarios
                                                      SET NroVagas='".$vaga."'
                                                      WHERE IdHorario='".$ResultTrip['IdHorario']."'");

                            $UpdateVagasVolta=mysql_query("UPDATE horarios
                                                      SET NroVagas='".$vaga_volta."'
                                                      WHERE IdHorario='".$ResultTripVolta['IdHorario']."'");

                            if($UpdateVagas && $UpdateVagasVolta){
                                //shares the link of the website 'www.sitename.com' with a text like 'i bought a ticket to Download Festival for 200£. Wann join me?'
                            }
                            else{
                                echo '<div id="erro2"> Ocorreu um erro. Tente mais tarde. </div>';
                            }
                        }
                        mysql_close($connecDB);
                    }
                }
                else{
                    if($ResultTrip['NroVagas']==0){
            ?>  
                        <div id="erro2"> Já não há vagas para essa viagem. </div>
                        <span id="timer" style="display:none;">  
                            <script>
                                countDown();
                            </script>
                        </span>
            <?php
                    }
                    else{
                        header('Location: login.php?erro=1');
                    }
                }
            ?>
        </div>
    </body>
</html>  

Can someone help me?

2
Contributors
1
Reply
20
Views
4 Years
Discussion Span
Last Post by AARTI SHRIVAS
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.