Webmasters / 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"{ $_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"> <input type="reset" name="res"><br> </form> <?} ?>
|
Webmasters / 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" mysql_select_db("$db" if($con){ return true; }else{ return false; } }//end connect
function login($tab,$val){ $sql=mysql_query("select * from $tab $val " if (mysql_num_rows($sql)>0){ return true; }else{ echo mysql_error(); } }//end login
function delete($tab,$id){ $sql=mysql_query("delete from $id " if ($sql){ return true; }else{ return false; } }//end delete
function insert ($tab,$val){ $sql=mysql_query("insert into $tab values($val)" if($sql){ return true; }else{ return false; } }//end insertion function update($tab,$val){ $sql=mysql_query("update $tab set $val " if($sql){ return true; }else{ return false; } }//end update
function validate($tab,$val){ $sql=mysql_query("select * from $tab where $val " 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 ?>
|
Webmasters / 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)" 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' " if($sql){ echo "<p> Consignment's information has been updated
successfully.</p>"; }else{ echo mysql_error(); } }
?>
|
Webmasters / 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>
|
Webmasters / 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" ?> <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> </p>
</body>
</html>
|
Webmasters / 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'" $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" 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> |
Webmasters / 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" ; mysql_select_db("$db" ; $tab="track"; if(!$con) echo "<p> Cannot connect to the database".mysql_error(); ?> |
Webmasters / 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'" 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"> </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 ; ?> </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> </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%"> </td> </tr> <tr> <td><strong>Address</strong></td> <td valign="top"><?php echo $radd ; ?></td> <td> </td> </tr> <tr> <td><strong>Tracking Number</strong></td> <td valign="top"><?php echo $track ?></td> <td> </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> </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> <?}?>
|
Webmasters / 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';
|
|
|
|
|
|
|
|
|
|
Webmasters / 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. |
|
|
|
|
|
Webmasters / 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 |
Sports / Re: Nigeria Vs Zimbabwe: Walk-Over For Super Eagles? by skima(m): 9:29am On Jan 27, 2006 |
I pray that we win..
Lookin at record we have a better chance ahead of them.. but since futbol isnt maths I'd think we play to win ! |
|
Sports / Re: CAF African Player of the Year 2005 Award by skima(m): 1:53pm On Jan 26, 2006 |
Eto'o is the choice this time.. the guy is hot.. Okocha is against him 1998,2003 and 2004 ... too bad. |
|
|
Family / Re: Rich Marrying Rich, Poor Marrying Poor: Way Forward? by skima(m): 1:57pm On Jan 24, 2006 |
I cant advice any guy to go n search for rich girl to marry.. though they can date each other and later go seperate.
If u really wanna hold ur man's position be the to provide and respect marry who is not richer dan u so dat u will have full control of ur marital life...
Note:citing from examples |
Family / Re: Rich Marrying Rich, Poor Marrying Poor: Way Forward? by skima(m): 11:31am On Jan 23, 2006 |
Love is the koko... We should also understand that some rich could have married poor but they never get contact... and i dont think its possible to go to jungle wen u already found ur love.
Though this days parent dont force their children to marry a particular person .. its now their choice. |