Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,839 members, 7,813,815 topics. Date: Tuesday, 30 April 2024 at 06:54 PM

Need Script, Or Any Solution For Website Design Task! - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Need Script, Or Any Solution For Website Design Task! (3228 Views)

I Need Ebook Rebrander Script Or Software / Bulk Sms Script Or Software / Writing A Time Based Expiration Script Or Function Using Php And Mysql (2) (3) (4)

(1) (2) (Reply) (Go Down)

Need Script, Or Any Solution For Website Design Task! by gbolio4(m): 2:15am On Jan 25, 2006
hi All,

Plz ppl i need Help as i have an ultimatum to Beat on Web Dev project. my job is on the line here!!!!

I need the resource or resource's [script, program or software] to build a website that basically mimics the shipment-tracking ability of sites like FedEx, dhl or ups

I basically need to construct a page where users can enter a login ID and tracking # combination, and on clicking 'go', the user should be brought to a page detailing the movement of goods he/she ordered and dispatched and where exactly such shipment/package is at that particular point in time..... It should be be something with a interface to generate the login and tracking numbers and also specify what data to present on the results page belonging to any particular tracking number / login ID combination.

Call it a kinda Shipment or On-line Order tracking Solution and you'd be right. i don't mind if its a script, database solution, software or combination of those to produce the solution...

I'm posting an example here ::

http://www.ups.com/WebTracking/track?loc=en_NG&WT.svl=SubNav


Please People I know that We have the Brains in this E-community to help me find a solution to this task... I would Appreciate any/all help...

E-kolanuts would be presented to the problem solver grin


Re: Need Script, Or Any Solution For Website Design Task! by sbucareer(f): 2:34am On Jan 25, 2006
We are willing to help you since you asked nicely, but you need to tell us what script language you would prefer it on i.e. php, asp, jsp, c#, j#, .NET etc. and I thinks it would probably be a database solution for optimization purpose.  What database server, would like it one oracle, mysql, db2, pointbase etc.?

I believe there are professional web-driven database designers here.  I would personally help you if it were on Java platform.  I don't want to start learning php and asp as I find them boring.


[center][glow=red,2,150]Java rocks[/glow][/center]
Re: Need Script, Or Any Solution For Website Design Task! by sbucareer(f): 3:21am On Jan 25, 2006
#### ATTENTION:

#
# Table structure for table `customer`
#
CREATE DATABASE upsTraking;
USE upsTraking;

#### ATTENTION:

#
# Table structure for table `customer`
#
CREATE DATABASE {databasename};
GRANT ALL PRIVILEGES ON {databasename}.* TO 'databaseuse_user'@'localhost' IDENTIFIED BY 'thepassword';
USE {databasename};
FLUSH privileges;

CREATE TABLE Customer (
  CID int(11) unsigned NOT NULL auto_increment,
  ID_MSG int(10) unsigned NOT NULL default '0',
  Firstname varchar(128) NOT NULL default '-1,0',
  Lastname  varchar(128) NOT NULL default '-1,0',
  Address   varchar(128) NOT NULL default '-1,0',
  Postcode  varchar(10) NOT NULL default '-1,0',
  Telephone int(10) unsigned NOT NULL default '0',
  DOB       int(10) unsigned NOT NULL default '0',
  Sex       varchar(5) NOT NULL default '-1,0',
  CONSTRAINT cid_pk PRIMARY KEY (CID),
  UNIQUE ID (ID, CID),
  KEY ID_MSG (ID_MSG)
);

#
# Table structure for table `tracking`
#

CREATE TABLE tracking (
  TrakingID int(10) unsigned NOT NULL default '0',
  UNIQUE ID (ID, CID),
  CID int(11) unsigned NOT NULL,
  FOREIGN KEY (CID),
  REFERENCES customer(CIS) ,

);


The is probably the mysql database schema you will need NOTE is it not normalized, so you can do that. Save it as my.sql and run it on your prefer database.  Change the {} to your prefer settings.
Re: Need Script, Or Any Solution For Website Design Task! by sbucareer(f): 3:30am On Jan 25, 2006
[move][glow=navy,1,50]
A simple interface, HTML, modify to suit your style[/glow]
[/move]

[center][glow=magenta,1,50]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>UPS</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>



<body><form name="form1" method="post" action="">
<div align="center">
 <table width="465" border="0" cellpadding="0" cellspacing="0">
   <!--DWLayoutTable-->
   <tr>
     <td width="30" height="21">&nbsp;</td>
     <td width="28">&nbsp;</td>
     <td width="21">&nbsp;</td>
     <td width="24">&nbsp;</td>
     <td width="202">&nbsp;</td>
     <td width="55">&nbsp;</td>
     <td width="40">&nbsp;</td>
     <td width="65">&nbsp;</td>
   </tr>
   <tr>
     <td height="77">&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td colspan="2" valign="top"><table cellspacing="0" cellpadding="0">
       <tr>
         <td class="pi-mA1-c-t-spc"></td>
       </tr>
       <tr>
         <td class="pi-mA1-c" valign="top"><table cellspacing="0" cellpadding="0">
             <tr>
               <td>Please enter your UPS Tracking Numbers below and select the Track button. You can enter only to 1 numbers at a time. </td>
             </tr>
         </table></td>
       </tr>
     </table></td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
   </tr>
   <tr>
     <td height="22">&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
   </tr>
   <tr>
     <td height="31">&nbsp;</td>
     <td valign="top">1.</td>
     <td>&nbsp;</td>
     <td colspan="4" valign="top">  <input name="textfield" type="text" size="50" maxlength="30"></td>
     <td>&nbsp;</td>
   </tr>
   <tr>
     <td height="26">&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
   </tr>
   <tr>
     <td height="33">&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td colspan="4" valign="top"><input type="submit" name="Submit" value="ok                "></td>
     <td>&nbsp;</td>
   </tr>
   <tr>
     <td height="155">&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
   </tr>
 </table>

</div>  </form>
</body>
</html>
[/glow][/center]

I will post the [glow=red,2,50]JSP[/glow] code later to access the database.  Remember my solution is purely Java platform
Re: Need Script, Or Any Solution For Website Design Task! by gbolio4(m): 11:47pm On Jan 25, 2006
cheesy

Thanks a lot sbucareer you've been very good to me

i really apprecate your help thank you

please expedite action on completeing it for me. thanks again
Re: Need Script, Or Any Solution For Website Design Task! by sbucareer(f): 5:55pm On Jan 26, 2006
In tomcat reference container for Java the directory structure is organised in this form.


     webapps
        appsDir
          index.html
         jsp
            search.jsp
            login.jsp
         WEB-INF
           web.xml
            classes
                com -- optional
                   sun  -- optional
                      projecDir   -- optional
                        db  -- optional
                        beans -- optional
                        controller -- optional
                        servlet -- optional
           lib -- optional

             

Put this code in the beans directory

[glow=brown,0,50]
import java.io.*;
import java.io.serializable;

public class SessionBean extends Serializable{
/**
   * If you need to use other session attributes, mut be listed here
*/

       String upsTrackNumber = null;
       public SessionBean ( ){
       }//End default Contructor

     // Get the string from the user HTTP session and set it to object
      public void setUpsTrackNumber (String toSet){
         this.upsTrackNumber = toSet;
      }//End setUpsTrackNumber

    // Return this object back to any calling object, probably to access the db
     public String getUpsTrackNumber ( ){
        return this.upsTrackNumber;
    }//End getUpsTrackNumber
}//End SessionBean
[/glow]

The HTML file above find the <form method=post action=""> in the action part between the quotes put search.jsp . Below is the search script


[glow=magenta,0,50]
<@ page import="com.sun.projectDir.beans.SessionBean"%>
<@ page import="com.sun.projectDir.db.EnterpriseBean" %>
<jsp:useBean id="ups" scope="page" class="com.sun.projectDir.SessionBean" />
<jsp:useBean id="eb" scope="session" class="com.sun.projectDir.db.EnterpriseBean" />
<jsp:setProperty name="uspTrackNumber" property="*" />
<HTML>
   <HEAD></TITLE>Ups Tracker</TITLE>
    </HEAD>

  <body>
                  <%

                        String firstName = null;
                        String lastName = null;
                        String address   = null;
                        String postCode = null;

                         //etc. Put all the information You want to display

                             
                            String upsNumber = ups.getUpsTrackNumber();
                            if ( upsNumber != null ){
                               eb = new EnterperiseBean ( );
                               firstname = eb.getFirstname();
                                //etc.
                            }//End if
       %>

         <Table boder=0>
                  <Td>
                       <tr>First Name</tr>
                        </tr>Last Name</tr>
                       etc.
                    </Td>

            <%=firstName%>
            <%=lastName%>
            <!--
                    etc.  All the information you want to view
             -->
     </table>
   </body>
</html>

[/glow]

I will write the EnterpriseBean for you later.  This is how the system access your database.
Re: Need Script, Or Any Solution For Website Design Task! by sbucareer(f): 6:31pm On Jan 26, 2006
@Senu, please can you increase the charater numbers for "Maximum allowed characters in signatures" I need to edit my signature to a url link but the character you set do not allow me to add more entries... please
Re: Need Script, Or Any Solution For Website Design Task! by sbucareer(f): 12:37am On Jan 27, 2006
[glow=#bbffcc,0,50]I know this is long code and most probably you will not need all the methods.  Use the ones that apply to use and discard the rest[/glow]
       
       

package com.sun.projectDir.db;

import java.net.*;
import java.sql.*;
import java.io.*;
import java.util.*;
import java.util.Date;

public class EnterpriseBean {
   
   
    private String temp;
    private static final String username = "admin";
    private static final String password = "admin";
    private static String error;
    private static Connection con;
    private static Statement stm;
    private static ResultSet rs;
    private static final String DRIVER = "jdbc:mysql://localhost:3306/databasename";
    private static final String url = "com.mysql.jdbc.Driver";
   
    public EnterpriseBean( ){
        try{
            this.connect( );
        }catch( SQLException e ){
            error = "Unable to connect to databse from initial Contructor";
        }catch( Exception ed ){
            error = "Exception in the constructor";
        }//End exception
    }//End contructor
   
  /*
    This method connect user(s) to MDBS
   */
    public void connect( )throws SQLException, Exception{
        try{
            Class.forName( DRIVER ).newInstance( );
            con = DriverManager.getConnection( url, username, password );
        }catch( SQLException sql ){
            error = "Could not connect to data base";
            throw new SQLException( error );
        }catch( Exception ioe ){
            error = "An unknown error while connecting to data base";
            throw new Exception( error );
        }//End exceptions
    }//End connect method
/*
This methos disconnect user(s) from MDBS
*/
    public void disconnect( )throws SQLException, Exception{
        try{
            if( con != null ){
                con.close( );
            }//End if
        }catch( SQLException exp ){
            error = "Unable to close data base connection";
            throw new SQLException( error );
        }//End try catch
    }//End disconnect Method
/*
This method insert an array string containing data into
MDBS. The querry must be an array of type String Object
*/
    public void executeQuery( String []query )throws SQLException, Exception{
        try{
            PreparedStatement update;
            update = con.prepareStatement( "INSERT INTO tracking VALUES( ?, ?, ?, );" );
            for( int index = 0; index < query.length ; index++ ){
                update.setString( index+1, query[index] );
            }//End for
            update.execute( );
//stm = con.createStatement( );
//stm.executeUpdate( query );
        }catch( SQLException sql ){
            error = "executeQuery problem from database";
            throw new SQLException( error );
        }catch( Exception ioe ){
            error = "An unknown error while connecting to data base";
            throw new Exception( error );
        }//End exceptions
    }//End executeQuery
   
/*
This method insert an array string containing data into
MDBS. The querry must be an array of type String Object
*/
    public void executeQuery( String query )throws SQLException, Exception{
        try{
            PreparedStatement update;
            update = con.prepareStatement( query );
            update.execute( );
//stm = con.createStatement( );
//stm.executeUpdate( query );
        }catch( SQLException sql ){
            error = "executeQuery problem from database";
            throw new SQLException( error );
        }catch( Exception ioe ){
            error = "An unknown error while connecting to data base";
            throw new Exception( error );
        }//End exceptions
    }//End executeQuery
/*
This method insert an array string containing data into
MDBS. The querry must be an array of type String Object
*/
    public void executeQueryInventory( String []query )throws SQLException, Exception{
        try{
            PreparedStatement update;
            update = con.prepareStatement( "INSERT INTO customer VALUES( ?, ?, ?, ?, ?, ?, ?, ?, ?, );" );
            for( int index = 0; index < query.length; index++ ){
                update.setString( index+1, query[index] );
            }//End for
            update.execute( );
//stm = con.createStatement( );
//stm.executeUpdate( query );
        }catch( SQLException sql ){
            error = "executeQuery problem from database";
            throw new SQLException( error );
        }catch( Exception ioe ){
            error = "An unknown error while connecting to data base";
            throw new Exception( error );
        }//End exceptions
    }//End executeQueryInventory
/*
This method try to update a record column where values which are array type of
string to "Resolved"
*/
    public void resolveData( String [] values ) throws SQLException, Exception{
       
        if ( con != null ){
            try{
                PreparedStatement resolve;
                resolve = con.prepareStatement( "UPDATE customer SET status= ? WHERE telephone = ?" );
                for ( int index = 0; index < values.length; index++ ){
                    resolve.setString( 1, "Resolved" );
                    resolve.setString( 2, values[index] );
                    resolve.executeUpdate( );
                }//End for
            }catch ( SQLException e ){
                error = "update failed: possible update error";
                throw new SQLException( error );
            }catch ( Exception e ){
                error = "An exception occured while updating bug";
                throw new Exception( error );
            }//End try
        }else{
            error = "Exception occured while connecting to database";
            throw new Exception( error );
        }//End if
    }//End removeBug
/*
This method take every selected string record from bugDetails and put them into
archive table
*/
    public void archiveData( String []theData ) throws SQLException, Exception{
       
        String fname = null;
        String lname = null;
        String address = null;
        String postcode = null;
        String telephone = null;
        String dob = null;
        String sex = null;
       
        if( !isConnect( ) ){
            this.connect( );
        }//End if
        try{
            for( int index = 0; index < theData.length; index++ ){
                String query = "SELECT * FROM customers WHERE cid="+theData[index];
                stm = con.createStatement( );
                rs = stm.executeQuery( query );
                while( rs.next( ) ){
                    fname =rs.getString( "name" );
                    lname =rs.getString( "lastname" );
                    address =rs.getString( "address" );
                    postcode =rs.getString( "postcode" );
                    telephone = rs.getString( "telephone" );
                    dob =rs.getString( "dob" );
                    sex =rs.getString( "sex" );
                   
                }//End while
//If you want to save customer details for later i.e. customer values
                String insert = "INSERT INTO archive VALUES( '"+fname+"', '"+last+"',"+
                        "'"+address+"', '"+postcode+"', '"+telephone+"',"+
                        "'"+dob+"','"+sex"')";
            }//End for
        }catch( SQLException e ){
        }catch( Exception ex ){
        }//En exception
    }//End archiveData
   
/*
Update the database record by supplying the values as string array

*/
    public void updateData( String []key, String values ) throws SQLException, Exception{
        try{
            PreparedStatement update;
            update = con.prepareStatement( "UPDATE customer SET cid= ? WHERE phone = ?" );
            for( int index = 0; index < key.length; index++ ){
                update.setString( 1, values );
                update.setString( 2, key[index] );
                update.executeUpdate( );
            }//End for
        }catch ( SQLException e ){
            error = "update failed: possible update error";
            throw new SQLException( error );
        }catch ( Exception e ){
            error = "An exception occured while updating bug";
            throw new Exception( error );
        }//End try
    }//End updateData
   
/*
Reomve or delete record from database. Pass this method string array of
record to delete.
*/
    public void removeData( String [] values ) throws SQLException, Exception{
//con.setAutoCommit( false );
        if ( con != null ){
            try{
                PreparedStatement delete;
                delete = con.prepareStatement( "DELETE FROM customer WHERE phone=?;" );
                for ( int index = 0; index < values.length; index++ ){
                    delete.setString( 1, values[index] );
                    delete.execute( );
                }//End for
//con.commit( );
//con.setAutoCommit( true );
            }catch ( SQLException e ){
                error = "update failed: possible delete error";
                throw new SQLException( error );
            }catch ( Exception e ){
                error = "An exception occured while deleting bug";
                throw new Exception( error );
            }//End try
        }else{
            error = "Exception occured while connecting to database";
            throw new Exception( error );
        }//End if
    }//End removeBug
/*
Get all the records from any database table. The record is store in
Resultset, which is return to the caller of this method
*/
    public ResultSet viewQuery( String query )throws SQLException, Exception{
        try{
            stm = con.createStatement( );
            rs = stm.executeQuery( query );
        }catch( SQLException sql ){
            error = "Record set update problems";
            throw new SQLException( error );
        }
        return rs;
    }//End viewQuery
/*
Get all the records from any database table. The record is store in
Resultset, which is return to the caller of this method
*/
    public ResultSet viewQuery( )throws SQLException, Exception{
        return rs;
    }//End viewQuery
/*
Close Rseultset that is connected to a conncetion database
Call this method if you want to close Resultset connection
*/
    public void closeRs( )throws SQLException, Exception{
        try{
            rs.close( );
        }catch( SQLException e){
            error = "Could not close result set";
            throw new SQLException( error );
        }//End exception
    }//End closeRs
    public boolean isConnect( ) {
        if( con != null )
            return true;
        else
            return false;
    }//End isConnect
}//End EnterpeiseBean



Tell me if you need any help

[glow=#ff55tt,0,50]Learn Software Engineer using Java[/glow]
Re: Need Script, Or Any Solution For Website Design Task! by skima(m): 9:48am On Jan 27, 2006
I have complete this kind of system but it excludes date of but will autogenerate tracking number for u. Its also has the admin area where u would add and edit sender/reciever info.

PHP/MySQL
Re: Need Script, Or Any Solution For Website Design Task! by sbucareer(f): 1:05pm On Jan 30, 2006
[move][glow=#3f8f3d,0,50]PHP/MYSQL SOLUTION BY SKIMA[/glow][/move]

@skima, could you posted your solution for us ?
Re: Need Script, Or Any Solution For Website Design Task! by sbucareer(f): 1:07pm On Jan 30, 2006
[move][glow=#9e43ef,0,50]PHP/MYSQL SOLUTION BY SKIMA[/glow][/move]

@skima, could you post your solution for us ?

Sorry for the previous post posted
Re: Need Script, Or Any Solution For Website Design Task! by skima(m): 5:39pm On Jan 30, 2006
ill do so soon! tonight just hopped in now.
Re: Need Script, Or Any Solution For Website Design Task! by skima(m): 1:23am On Jan 31, 2006
here comes the Solution :

filename : sql.sql
purpose : for database table set



CREATE TABLE `track` (
`id` INT NOT NULL AUTO_INCREMENT ,
`name` VARCHAR( 100 ) NOT NULL ,
`add` VARCHAR( 100 ) NOT NULL ,
`descr` VARCHAR( 100 ) NOT NULL ,
`rname` VARCHAR( 100 ) NOT NULL ,
`radd` VARCHAR( 100 ) NOT NULL ,
`prior` VARCHAR( 100 ) NOT NULL ,
`status` VARCHAR( 100 ) NOT NULL ,
`location` VARCHAR( 100 ) NOT NULL ,
`deldate` VARCHAR( 100 ) NOT NULL ,
`tim` VARCHAR( 100 ) NOT NULL ,
`summ` VARCHAR( 100 ) NOT NULL ,
PRIMARY KEY ( `id` )
) TYPE = MYISAM COMMENT = 'tracking info';
Re: Need Script, Or Any Solution For Website Design Task! by skima(m): 1:25am On Jan 31, 2006
filename: track.php
purpose: to enable user track their shipment info

<?
include "constr.php";

//the $tab variable was set in constr.php

$id=$_POST['Input']; //user input source

$sql=mysql_query("select * from $tab where track='$id'"wink;
if(mysql_num_rows($sql)<1){
echo "<p> You have entered a wrong tracking number, please try again.</p>";
}else{
$fet=mysql_fetch_array($sql);
$name="<P>".stripslashes($fet['name']);
$add="<P>".stripslashes($fet['addr']);
$desc="<P>".stripslashes($fet['descr']);
$rname="<P>".stripslashes($fet['rname']);
$radd="<P>".stripslashes($fet['radd']);
$prior="<P>".stripslashes($fet['prior']);
$status="<P>".stripslashes($fet['status']);
$location="<P>".stripslashes($fet['location']);
$deldate="<P>".stripslashes($fet['deldate']);
$track="<P>".stripslashes($fet['track']);
$summ="<P>".stripslashes($fet['summ']);
$tim="<P>".stripslashes($fet['tim']);


?>
              <p>Consigment information</p>
              <table width="98%" border="0">
                <tr bgcolor="#006699">
                  <td width="49%"> <div align="center"><font color="#FFFFFF"><strong>Sender's
                      Information</strong></font></div></td>
                  <td width="3%" bgcolor="#FFFFFF"><font color="#FFFFFF">&nbsp;</font></td>
                  <td width="48%"> <div align="center"><font color="#FFFFFF"><strong>Reciever's
                      Information</strong></font></div></td>
                </tr>
                <tr>
                  <td height="200" valign="top"> <table width="100%" border="0">
                      <tr>
                        <td width="42%"><strong>Name</strong></td>
                        <td width="58%" valign="top"><?php echo $name ; ?>&nbsp;</td>
                      </tr>
                      <tr>
                        <td><strong>Address</strong></td>
                        <td valign="top"><?php echo $add; ?></td>
                      </tr>
                      <tr>
                        <td height="85" valign="top"><strong>Consigment Description</strong></td>
                        <td valign="top"><?php echo $desc ; ?></td>
                      </tr>
                    </table>
                    <table width="98%" border="0">
                      <tr bgcolor="#006699">
                        <td> <div align="center"><font color="#FFFFFF"><strong>Delivery
                            Date</strong></font></div></td>
                        <td> <div align="center"><font color="#FFFFFF"><strong>Ref.
                            Number</strong></font></div></td>
                      </tr>
                      <tr>
                        <td><?php echo $deldate ; ?></td>
                        <td>TEC7878/BR/ESP/05</td>
                      </tr>
                    </table></td>
                  <td>&nbsp;</td>
                  <td valign="top"><table width="100%" border="0">
                      <tr>
                        <td width="46%"><strong>Name</strong></td>
                        <td width="42%" valign="top"><?php echo $rname ; ?></td>
                        <td width="12%">&nbsp;</td>
                      </tr>
                      <tr>
                        <td><strong>Address</strong></td>
                        <td valign="top"><?php echo $radd ; ?></td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr>
                        <td><strong>Tracking Number</strong></td>
                        <td valign="top"><?php echo $track ?></td>
                        <td>&nbsp;</td>
                      </tr>
                    </table>
                    <table width="95%" border="0">
                      <tr bgcolor="#006699">
                        <td><font color="#FFFFFF"><strong>Location</strong></font></td>
                        <td><font color="#FFFFFF"><strong>Time</strong></font></td>
                        <td><font color="#FFFFFF"><strong>Status</strong></font></td>
                      </tr>
                      <tr>
                        <td><?php echo $location.$addr ; ?></td>
                        <td><?php echo $tim ; ?></td>
                        <td><?php echo $status ; ?></td>
                      </tr>
                    </table>
                    <p>&nbsp;</p></td>
                </tr>
                <tr bgcolor="#006699">
                  <td height="23" colspan="3" valign="top"> <div align="center"><font color="#FFFFFF"><strong>Summary</strong></font></div></td>
                </tr>
                <tr valign="top">
                  <td height="87" colspan="3"><?php echo $summ ; ?></td>
                </tr>
              </table>
              <?}?>
   

Re: Need Script, Or Any Solution For Website Design Task! by skima(m): 1:27am On Jan 31, 2006
filename: constr.php
purpose : for database connect and table declaration
<?
$user=""; // enter database username
$pass="" ; //enter ur database password
$db=""; // database name
$con=mysql_connect("localhost","$user","$pass"wink;
mysql_select_db("$db"wink;

$tab="track";

if(!$con)
echo "<p> Cannot connect to the database".mysql_error();

?>
Re: Need Script, Or Any Solution For Website Design Task! by skima(m): 1:32am On Jan 31, 2006
filename : add.php
purpose : to add,edit/update and delete tracking information

<?
include "link.php";
include "class.php";
include "constr.php";

if(isset($_GET['update'])){

$id=$_GET['id'];
$sql=mysql_query("select * from $tab where id='$id'"wink;
$fet=mysql_fetch_array($sql);
$name=$fet['name'];
$add=$fet['addr'];
$desc=$fet['descr'];
$rname=$fet['rname'];
$radd=$fet['radd'];
$prior=$fet['prior'];
$status=$fet['status'];
$location=$fet['location'];
$deldate=$fet['deldate'];
$tim=$fet['tim'];
$summ=$fet['summ'];
}

if(isset($_GET['delete'])){
$id=$_GET['id'];
$sql=mysql_query("delete from $tab where id=$id"wink;
if($sql){
echo "<b><p>User with this id ($id) has been deleted.All information relating to that user has been cleared off the database.</b>";
}else {
echo mysql_error();
}
}
?>
<p><b><font size="2" color="#000000">Use this to add user consignment
information, their track number will be display for you.</font></b><form action="add2.php" method="post">
<table border="0" width="65%">
<tr>
<td width="50%" colspan="2">
<p align="center"><b>Sender's Information</b></p>
</td>

</tr>
<tr>
<td width="39%">Name</td>
<td width="61%"><input type="text" name="name" size="20" value="<?=$name;?>"><? if(isset($_GET['id'])) echo "<input type=\"hidden\" name=\"id\" size=\"20\" value=\"$id\">";?></td>
</tr>
<tr>
<td width="39%">Address</td>
<td width="61%"><input type="text" name="add" size="20" value="<?=$add;?>"></td>
</tr>
<tr>
<td width="39%" valign="top">Consignment Description</td>
<td width="61%" valign="top"><textarea rows="3" name="desc" cols="20"><?=$desc;?></textarea></td>
</tr>
<tr>
<td width="39%" valign="top">Consignment Summary</td>
<td width="61%" valign="top"><textarea rows="3" name="summ" cols="20"><?=$summ;?></textarea></td>
</tr>

<tr>
<td width="39%" valign="top" colspan="2">
<p align="center"><b>Receiver's Information</b></p>
</td>

</tr>
<tr>
<td width="39%" valign="top">Name</td>
<td width="61%" valign="top"><input type="text" name="rname" size="20" value="<?=$rname;?>"></td>
</tr>
<tr>
<td width="39%" valign="top">Address</td>
<td width="61%" valign="top"><input type="text" name="radd" size="20" value="<?=$radd;?>"></td>
</tr>
<tr>
<td width="39%" valign="top">Priority</td>
<td width="61%" valign="top"><input type="text" name="prior" size="20" value="<?=$prior;?>"></td>
</tr>
<tr>
<td width="39%" valign="top">Status</td>
<td width="61%" valign="top"><input type="text" name="status" size="20" value="<?=$status;?>"></td>
</tr>
<tr>
<td width="39%" valign="top">Location</td>
<td width="61%" valign="top"><input type="text" name="location" size="20" value="<?=$location;?>"></td>
</tr>
<tr>
<td width="39%" valign="top">Delivery date</td>
<td width="61%" valign="top"><input type="text" name="deldate" size="20" value="<?=$deldate;?>"></td>
</tr>
<tr>
<td width="39%" valign="top">Time</td>
<td width="61%" valign="top"><input type="text" name="tim" size="20" value="<?=$tim;?>"></td>
</tr>
<tr>
<td width="39%" valign="top">
<p align="right"><input type="submit" value="<? if (isset($_GET['update'])){echo "Update";}else{echo "Submit";}?> " name="<? if (isset($_GET['update'])){echo "update";}else{echo "submit";}?>"></td>
<td width="61%" valign="top"><input type="reset" value="Reset" name="B2"></td>
</tr>
</table></form>

</body>

</html>
Re: Need Script, Or Any Solution For Website Design Task! by skima(m): 1:34am On Jan 31, 2006
filename: index2.php
purpose : to view all users in the database... to enable us edit/delete their information independently.

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>admin area</title>
</head>

<body>
<? include "link.php"; ?>
<p>This are the users in your database:</p>
<?
include "class.php";
include "constr.php";
$sql=mysql_query("select * from $tab"wink;
?>
<form method="GET" ACTION="add.php">
<input type="submit" value="Update" name="update"><input type="submit" value="Delete" name="delete"></p>
<p><select size="1" name="id">
<option selected>-- select a user ---</option>
<? while($fet=mysql_fetch_array($sql)){
$id=$fet['id'];
$track=$fet['track'];
echo "<option value=$id>$track</option>";
}?>
</select>

</form>


<p>&nbsp;</p>

</body>

</html>


Re: Need Script, Or Any Solution For Website Design Task! by skima(m): 1:36am On Jan 31, 2006
filename: link.php
purpose: to display links to other pages and to secure against interludes. it secures the page (uses session)



<?

session_start();
if(!isset($_SESSION['admin'])){
include "index.php";
exit;
}

//$path="http://topedgecourier.com/admin";

?>

<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link rel="stylesheet" type="text/css" href="/style.css">

<title>Topedge Courier Services </title>
</head>

<body style="margin:0px;">



<p><a href="index.php">Home</a> <a href="add.php">Add User</a> <a href="logout.php"> Log out</a></p>




Re: Need Script, Or Any Solution For Website Design Task! by skima(m): 1:38am On Jan 31, 2006
filename: add2.php
purpose : to generate and add tracking information includeing tracking number with leading company code;


<?


include "link.php";

include "constr.php";
include "class.php";


$name=mysql_real_escape_string($_POST['name']);
$addr=mysql_real_escape_string($_POST['add']);
$descr=mysql_real_escape_string($_POST['desc']);
$rname=mysql_real_escape_string($_POST['rname']);
$radd=mysql_real_escape_string($_POST['radd']);
$prior=mysql_real_escape_string($_POST['prior']);
$status=mysql_real_escape_string($_POST['status']);
$location=mysql_real_escape_string($_POST['location']);
$deldate=mysql_real_escape_string($_POST['deldate']);
$tim=mysql_real_escape_string($_POST['tim']);
$summ=mysql_real_escape_string($_POST['summ']);
$id=mysql_real_escape_string($_POST['id']);

$track="TEC".rand();//this generates the tracking number with leading company code

$val="'','$name','$addr','$descr','$rname','$radd','$prior','$status','$location','$deldate','$track','$tim','$summ'";

if(isset($_POST['submit'])){
//if($cc->insert($tab,$val)){

$sql=mysql_query("insert into $tab

values($val)"wink;
if($sql){
echo "<p> New Consignment has been added successfully. Tracking number

=$track</p>";
}else{
echo "<p>". mysql_error();
}
}

if(isset($_POST['update'])){

$sql=mysql_query("update $tab set name='$name', addr='$addr', descr='$descr',

rname='$rname',radd='$radd',prior='$prior',status='$status',location='$location',deldate='$deldate',tim='$tim

',summ='$summ' where id='$id' "wink;
if($sql){
echo "<p> Consignment's information has been updated

successfully.</p>";
}else{
echo mysql_error();
}
}

?>

Re: Need Script, Or Any Solution For Website Design Task! by skima(m): 1:42am On Jan 31, 2006
filename : class.php
purpose : simplified functions wrapped up in a file with OOP concept php >=4


<?

/* we use this class to retrieve general from the database for the user
*/
class get {

function get($loc,$user,$pwd,$db){
$con=mysql_connect("$loc","$user","$pwd"wink;
mysql_select_db("$db"wink;
if($con){
return true;
}else{
return false;
}
}//end connect

function login($tab,$val){
$sql=mysql_query("select * from $tab $val "wink;
if (mysql_num_rows($sql)>0){
return true;
}else{
echo mysql_error();
} }//end login

function delete($tab,$id){
$sql=mysql_query("delete from $id "wink;
if ($sql){
return true;
}else{
return false;
}
}//end delete

function insert ($tab,$val){
$sql=mysql_query("insert into $tab values($val)"wink;
if($sql){
return true;
}else{
return false;
}
}//end insertion
function update($tab,$val){
$sql=mysql_query("update $tab set $val "wink;
if($sql){
return true;
}else{
return false;
}
}//end update

function validate($tab,$val){
$sql=mysql_query("select * from $tab where $val "wink;
if (mysql_num_rows($sql)>0){
return true;
}else{
return false;
}
}//end login


function authentic($username, $password)
{
$one = $username;$two = $password;$thr = $one . $two;
$fou = $thr . $one;$fiv = $fou . $one;
$six = $thr . $thr;$sev = $one . $two . $thr . $one;
$md1 = md5( $sev . $two . md5($one . $fiv . md5($sev . strrev( $sev))));
$md2 = md5( $md1 . md5( $one . $thr . $fou . md5( $sev . $md1)));
$md3 = md5( $md2 . md5($md1));
$md4 = md5( $md3 . $md1 . $md2 . md5($sev));
return $md2 . $md1. $md4 . md5($md3 . $md2);
}
function secure ($un,$pw){
$_SESSION['secure']=$this->authentic($un,$pw);
}//end enscription

function logout (){
setcookie(session_name(), '', time()-42000, '/');

// Finally, destroy the session.
session_destroy();
}
function version(){//the software version
$ver="Unleashed mail v1.0 by <a href='http://unleashedsolution.com>Unleashedsolution.com</a>";
return $ver;
}
}//end class
?>
Re: Need Script, Or Any Solution For Website Design Task! by skima(m): 1:45am On Jan 31, 2006
filename : index.php
purpose : to prompt user for login credential and create session . remember i just used simplified "if " to make sure the user marches a preset one... i didnt prompt from the DB u may do so


<?

session_start();

if (isset($_POST['sub'])){
$na=$_POST['uname'];
$pwd=$_POST['pwd'];

if($na=="computer" && $pwd=="computer"wink{
$_SESSION['admin']=$na;
?>
<head>
<meta http-equiv="Refresh" content="0; url=index.php" />
</head>
<?
}else{
echo "<p> You have entered wrong information, please try again.</p>";
}
}

if(isset($_SESSION['admin'])){
include "index2.php";
exit;
}else{
?>
<p> Login to administrate your users</p><form method="post" action="index.php">
Username :<input type="text" name="uname"><br>
Password :<input type="password" name="pwd"><br>
<input type="submit" name="sub">&nbsp;<input type="reset" name="res"><br>
</form>
<?}
?>


Re: Need Script, Or Any Solution For Website Design Task! by skima(m): 1:46am On Jan 31, 2006
filename : logout.php
purpose : to end users session


<?
session_start();
unset($_SESSION['admin']);
session_unregister($_SESSION['admin']);
echo "You have been signed out successfully.<a href=/admin/index.php>Continue</a>";
?>
Re: Need Script, Or Any Solution For Website Design Task! by skima(m): 1:53am On Jan 31, 2006
i'd liked to send the .zip version to via mail but didnt know your ID .

just try that out and let me know wats up after ill be glad to help out.


[move]PHP ROCKS[/move]
Re: Need Script, Or Any Solution For Website Design Task! by sbucareer(f): 2:30am On Jan 31, 2006
@ gbolio4, you have two solutions now, try either one or both and let us know if we met your criteria.  Any further assistance, I will be glad to help.

[move][glow=#f4e31d,1,50]EJB/JAVA is the way forward[/glow][/move]
Re: Need Script, Or Any Solution For Website Design Task! by joftech(m): 3:51am On Feb 01, 2006
He better go the PHP/MySql way, it's really really faster to learn.
Re: Need Script, Or Any Solution For Website Design Task! by skima(m): 5:25pm On Feb 01, 2006
yeah he should...
Re: Need Script, Or Any Solution For Website Design Task! by sbucareer(f): 5:48pm On Feb 01, 2006
99.9% of nairaland forum members are addictively php followers, what a shame... embarassed
Re: Need Script, Or Any Solution For Website Design Task! by skima(m): 5:55pm On Feb 01, 2006
I dont think there is anything bad .. and knowing other lang. is not a bad idea also.


People in here (some with php knowledge) also know other langs.
Re: Need Script, Or Any Solution For Website Design Task! by joftech(m): 8:53pm On Feb 01, 2006
I prefer PHP because it's open source and easy to learn. I used to dig ASP before since i know VB but i need something that's not going to put strains on ones pocket.
Re: Need Script, Or Any Solution For Website Design Task! by bolaoni(m): 7:18pm On Feb 03, 2006
Hi guys, thanks so much for all these wonderful posts, especially skima and sbu.

At the beginning of the year, don't know JACK about PHP/MySQL but this thread and other provided a source of motivation for me. I just decided to check out Google and I saw tonnes of tutorials. Picked up the pick of the pack and it was solid GEM cool

Now I can create a basic database. Hope to commence a DB-driven website project SOON!

Thanks so much guys, I love ya all.

Bola
Re: Need Script, Or Any Solution For Website Design Task! by skima(m): 8:33pm On Feb 03, 2006
Dats gr8 man... you are on your way to becoming a world class developer. while learn make google ur companion... (php.net,zend.com,www.w3schools.com/sql for sql knowledge, mysql.com) etc. Always learn by practising (developing apps).

To ur success !
Re: Need Script, Or Any Solution For Website Design Task! by bolaoni(m): 1:34pm On Feb 04, 2006
Thanks Man.

Ur suggestions are noted!

kiss kiss kiss

Can you please suggest any project for a beginner?

I will like to work on that too.

(1) (2) (Reply)

Traffic Spirit Alternative For Both Traffic / Nairaland Worth $1.06 Million Dollars According To Websiteoutlook.com / LiveScores - Football Pools Results and Fixtures

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 136
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.