Comunidad de diseño web y desarrollo en internet online

Quien me ayuda a probar el Gateway?

Citar            
MensajeEscrito el 26 Jul 2005 04:34 pm
acabo de instalarlo, pero necesito probarlo, aqui la URL:
www.coderic.net/gateway.php

las funciones que le coloque son las de el sistema de pizza.
ayudenme Please. :crap: :crap: :crap:
no tengo Flash en mi PC.

Gracias.

Por jhony192

791 de clabLevel

1 tutorial

Genero:Masculino  

Just Another Programmer

firefox
Citar            
MensajeEscrito el 26 Jul 2005 04:54 pm
Si quieres que alguien pruebe tu gateway, proporciona una de dos cosas:

1.- Nombre de algun servicio que funcione(Nombre, no decir, el ejemplo de las pizzas)

2.- Crear una cuenta FTP, para subir algun servicio.

De otra forma, no podriamos ayudarte.
:wink:

Por Dano

BOFH

4273 de clabLevel

14 tutoriales
4 articulos
10 ejemplos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Lugar estratégico para vigilarte

firefox
Citar            
MensajeEscrito el 26 Jul 2005 06:19 pm
bien.
a continuación el codigo de el servicio.
se que a muchos no les va a agradar que haga esto, pero es la forma rapida que conozco:

Código :

<?php
/**
*    Sample pizzaService
*
* @author Klassjan Tukker
* @author Justin Watkins
*/
class pizzaService {

    // A container to store all of the relevant
    // db connection info
    var $_dataStore = array (
        "host" => "localhost",
        "db" => "****",
        "user" => "****",
        "pwd" => "****"
    );
    
    var $ordertable = "****_orders"; // the orders table
    var $pizzatable = "****_pizzas"; // the pizzas table

    /**
     *    Constructor function.
     * Contains the methodTable metadata to enable the designated methods to
     * be available via the amfphp Gateway.
     */
    function pizzaService ()
    {
        global $sf_dbhost, $sf_dbname, $sf_dbuser, $sf_dbpass;
        $this->_dataStore['host'] = $sf_dbhost;
        $this->_dataStore['db'] = $sf_dbname;
        $this->_dataStore['user'] = $sf_dbuser;
        $this->_dataStore['pwd'] = $sf_dbpass;
        $this->methodTable = array (
            "order" => array (
                "description" => "Orders a pizza",
                "access" => "remote",
                "roles" => "pizzaLovers",
                "arguments" => array ("type", "count")
            ),
            "cancelOrder" => array (
                "description" => "Cancel an order",
                "access" => "remote",
                "roles" => "pizzaLovers",
                "arguments" => array ("orderID")
            ),
            "orderStatus" => array (
                "description" => "Status of an order",
                "access" => "remote",
                "roles" => "pizzaLovers",
                "arguments" => array ("orderID")
            ),
            "getOrderList" => array (
                "description" => "Get the list of orders",
                "access" => "remote",
                "roles" => "pizzaLovers",
                "arguments" => array ()
            ),
            "listToppings" => array (
                "description" => "Returns the list of toppings as an array",
                "access" => "remote",
                "roles" => "pizzaLovers"
            )
        );
    }

    /**
     *    _queryDataSource is a private method used to actually perform the sql transaction on the data source
     *
     * @param string The sql string to execute
     * @returns resouce The resource pointer to the database result
     */
    function _queryDataSource ($sql)
    {
        $conn = mysql_connect($this->_dataStore['host'], $this->_dataStore['user'], $this->_dataStore['pwd'])
            or trigger_error("Could not connect: " . mysql_error()); // don't use die (Fatal Error), return useful info to the client
        mysql_select_db($this->_dataStore['db'], $conn)
            or trigger_error("Could not connect: " . mysql_error());
        $result = mysql_query($sql, $conn)
            or trigger_error("Error executing query: " . mysql_error());
        return $result; // return the mysql result resource
    }

    /**
     *    Order is the remote method that places an order
     *
     * @param string The name to place the order ad
     * @param Array A list of pizza orders
     * @returns Int The new order id.
     */
    function order ($name, $orders)
    {
        $t = time(); // grab the time stamp
        $sql = "INSERT INTO $this->ordertable (order_status, order_time, order_name) VALUES (1, $t, '$name');"; // generate the SQL statement
        $this->_queryDataSource($sql); // execute the query
        $orderid = mysql_insert_id(); // grab the new id from the auto increment key
        
        foreach ($orders as $key => $value) { // loop over each order
            $sql = "INSERT INTO $this->pizzatable (order_id, pizza_details, pizza_quantity) VALUES ($orderid, '{$value['details']}', {$value['quantity']})"; // generate the SQL
            $result = $this->_queryDataSource($sql); // execute the transaction
        }
        return $orderid; // return the new order id
    }
    
    /**
     *    cancelOrder takes an order id as it's input and then sets the order_status field to 0.
     *
     * @param int The order id
     * @returns boolean Returns true if the update was successful
     */
    function cancelOrder ($orderId)
    {
        $sql = "UPDATE $this->ordertable SET order_status=0 WHERE order_id=$orderId";
        $result = $this->_queryDataSource($sql);
        return true;
    }
    
    /**
     *    getOrderList returns a recordset of all of the orders that have an order_status of 1
     *
     * @returns RecordSet The recordset containing the order information
     */
    function getOrderList ()
    {
        $sql = "SELECT o.order_id as orderid, o.order_status as status, o.order_name as name, p.pizza_id as pizzaid, p.pizza_details as details, p.pizza_quantity as quantity FROM $this->ordertable o, $this->pizzatable p WHERE o.order_id = p.order_id AND o.order_status=1 ORDER BY o.order_time";
        return $this->_queryDataSource($sql);
    }
    
    /**
     * listToppings returns the available toppings as an array
     */
    function listToppings ()
    {
        return array("cheese", "sausage", "pepperoni", "mushrooms", "tomatoes", "onions", "peppers", "garlic");
    }

}
?>

espero que sea suficiente información.
los archivos de el ejemplo los he sacado de aqui:

http://amfphp.sourceforge.net/examples/pizzaservice/

Ya lo he Logrado, a continuación mi Hola Mundo.
Gracias Mikel :wink:

Por jhony192

791 de clabLevel

1 tutorial

Genero:Masculino  

Just Another Programmer

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.