Need a help for my PHP Assignment (very urgent)

Hi I need a help for an assignment. When a user logins it should be directed the page biditems.php . I tried to do it but can’t. I have only an hour to submit this.

If you can send your email address I can send the files I have created including the database.

Assignment

create a web based solution for the following business scenario using PHP/MySQL and HTML.

Prototype auction site Scenario

  • Any user can self-register with the system, upon providing his name, unique user name and valid email address.

  • If the user name doesn’t exist, password will be generated and email to user.

  • User can use that access credentials to login to the systems.

  • User may log on or log off, and many features are available only to users who are logged on.

  • Any logged-in user may add an item. Each item is an auction. It has an owner, a closing date, and a (possibly empty) collection of bids. Adding items, user enters a description and closing date, and set the list of bids initially empty.

  • Present a list of items currently available. For each one, show the owner, description, closing date, number of bids and high bid(If Any).

  • Any logged-in user may bid on any item which has not closed. the bid must be an integer amount and must exceed the current high bid, if there is one.

  • When a bid is submitted, You must check that it meets all requirements. if not, generate an appropriate message and do not record the bid.

  • Each allowed bid creates a record containing the bidder, the amount of the bid, and the date and time the bid was submitted.

  • Anyone may display the list of bids for any item. This listing shows the biddeer, amount and date for each bid, in chronological order.

  • An item’s list of bids is deleted when the items is deleted.

  • Should be created with a nice .CSS (interface)

you should get started and ask when you get stuck on something.

do not pretend that we are going to do your whole assignment.

Hi, I have already started and files are with me. I can email you (what is your email?)

I really appreciate your help.

post your php files with the name and code inside the php quote block so we all can help

There is a SQL database (small) as well for users. I have created files but need to redirect when a user logs to the file biditems.php .

Could you please help me to upload them here? There is no option to upload / attach files. There are some files including images, sql, php. etc.

could you please send your email address? I have only an hour to finish this and submit. I didn’t have time due to some issues with my internet during last few days. Hope you will understand my situation.

Thanks…

Sorry, when a user logs through index it should be redirected to biditems.php . Also would like to add a nice css to get a decent interface. first need to fix the previous issue and css can be done later.

you can post your php code like this

example.php
[php]

<?php $database = array ("localhost","PHPuSeR","A9Pqj2Ejf26hZN7E","wil_practice"); $conn = mysql_connect($database[0],$database[1],$database[2]) or die("cant open the connection ".mysql_error()); mysql_select_db($database[3]) or die("could not select db ".mysql_error()); $q = "SELECT * FROM `overload`"; $q_result = mysql_query($q) or die(mysql_error()); $row = mysql_fetch_row($q_result) or die(mysql_error()); $num_fields = mysql_num_fields($q_result); $total = 0; for ($i = 0; $i < $num_fields; ++$i) { $total = $total + $row[$i]; } //echo number_format($total); $SuperAttack= 'http://services.runescape.com/m=itemdb_rs/c=0JM1O3bafpw/results.ws?page=1&query=super%20attack/'; $url='http://services.runescape.com/m=itemdb_rs/c=0JM1O3bafpw/results.ws?page=1&query=super%20attack/'; //rss link for the twitter timeline //print_r(get_data($url)); //dumps the content, you can manipulate as you wish to /* gets the data from a URL */ function get_data($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $data = curl_exec($ch); curl_close($ch); return $data; } $ch = curl_init("http://www.example-webpage.com/file.html"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); $content = curl_exec($ch); curl_close($ch); echo $content; /** * Link: http://www.bin-co.com/php/scripts/load/ * Version : 3.00.A */ $options = array( 'return_info' => true, 'method' => 'GET'); // $result = load('http://services.runescape.com/m=itemdb_rs/c=0JM1O3bafpw/results.ws?page=1&query=super%20attack/',$options); // print_r($result); //print load("http://runescape.com"); function load($url,$options=array()) { $default_options = array( 'method' => 'get', 'post_data' => false, 'return_info' => false, 'return_body' => true, 'cache' => false, 'referer' => '', 'headers' => array(), 'session' => false, 'session_close' => false, ); // Sets the default options. foreach($default_options as $opt=>$value) { if(!isset($options[$opt])) $options[$opt] = $value; } $url_parts = parse_url($url); $ch = false; $info = array(//Currently only supported by curl. 'http_code' => 200 ); $response = ''; $send_header = array( 'Accept' => 'text/*', 'User-Agent' => 'BinGet/1.00.A (http://www.bin-co.com/php/scripts/load/)' ) + $options['headers']; // Add custom headers provided by the user. if($options['cache']) { $cache_folder = joinPath(sys_get_temp_dir(), 'php-load-function'); if(isset($options['cache_folder'])) $cache_folder = $options['cache_folder']; if(!file_exists($cache_folder)) { $old_umask = umask(0); // Or the folder will not get write permission for everybody. mkdir($cache_folder, 0777); umask($old_umask); } $cache_file_name = md5($url) . '.cache'; $cache_file = joinPath($cache_folder, $cache_file_name); //Don't change the variable name - used at the end of the function. if(file_exists($cache_file)) { // Cached file exists - return that. $response = file_get_contents($cache_file); //Seperate header and content $separator_position = strpos($response,"\r\n\r\n"); $header_text = substr($response,0,$separator_position); $body = substr($response,$separator_position+4); foreach(explode("\n",$header_text) as $line) { $parts = explode(": ",$line); if(count($parts) == 2) $headers[$parts[0]] = chop($parts[1]); } $headers['cached'] = true; if(!$options['return_info']) return $body; else return array('headers' => $headers, 'body' => $body, 'info' => array('cached'=>true)); } } if(isset($options['post_data'])) { //There is an option to specify some data to be posted. $options['method'] = 'post'; if(is_array($options['post_data'])) { //The data is in array format. $post_data = array(); foreach($options['post_data'] as $key=>$value) { $post_data[] = "$key=" . urlencode($value); } $url_parts['query'] = implode('&', $post_data); } else { //Its a string $url_parts['query'] = $options['post_data']; } } elseif(isset($options['multipart_data'])) { //There is an option to specify some data to be posted. $options['method'] = 'post'; $url_parts['query'] = $options['multipart_data']; /* This array consists of a name-indexed set of options. For example, 'name' => array('option' => value) Available options are: filename: the name to report when uploading a file. type: the mime type of the file being uploaded (not used with curl). binary: a flag to tell the other end that the file is being uploaded in binary mode (not used with curl). contents: the file contents. More efficient for fsockopen if you already have the file contents. fromfile: the file to upload. More efficient for curl if you don't have the file contents. Note the name of the file specified with fromfile overrides filename when using curl. */ } ///////////////////////////// Curl ///////////////////////////////////// //If curl is available, use curl to get the data. if(function_exists("curl_init") and (!(isset($options['use']) and $options['use'] == 'fsocketopen'))) { //Don't use curl if it is specifically stated to use fsocketopen in the options if(isset($options['post_data'])) { //There is an option to specify some data to be posted. $page = $url; $options['method'] = 'post'; if(is_array($options['post_data'])) { //The data is in array format. $post_data = array(); foreach($options['post_data'] as $key=>$value) { $post_data[] = "$key=" . urlencode($value); } $url_parts['query'] = implode('&', $post_data); } else { //Its a string $url_parts['query'] = $options['post_data']; } } else { if(isset($options['method']) and $options['method'] == 'post') { $page = $url_parts['scheme'] . '://' . $url_parts['host'] . $url_parts['path']; } else { $page = $url; } } if($options['session'] and isset($GLOBALS['_binget_curl_session'])) $ch = $GLOBALS['_binget_curl_session']; //Session is stored in a global variable else $ch = curl_init($url_parts['host']); curl_setopt($ch, CURLOPT_URL, $page) or die("Invalid cURL Handle Resouce"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //Just return the data - not print the whole thing. curl_setopt($ch, CURLOPT_HEADER, true); //We need the headers curl_setopt($ch, CURLOPT_NOBODY, !($options['return_body'])); //The content - if true, will not download the contents. There is a ! operation - don't remove it. $tmpdir = NULL; //This acts as a flag for us to clean up temp files if(isset($options['method']) and $options['method'] == 'post' and isset($url_parts['query'])) { curl_setopt($ch, CURLOPT_POST, true); if(is_array($url_parts['query'])) { //multipart form data (eg. file upload) $postdata = array(); foreach ($url_parts['query'] as $name => $data) { if (isset($data['contents']) && isset($data['filename'])) { if (!isset($tmpdir)) { //If the temporary folder is not specifed - and we want to upload a file, create a temp folder. // :TODO: $dir = sys_get_temp_dir(); $prefix = 'load'; if (substr($dir, -1) != '/') $dir .= '/'; do { $path = $dir . $prefix . mt_rand(0, 9999999); } while (!mkdir($path, $mode)); $tmpdir = $path; } $tmpfile = $tmpdir.'/'.$data['filename']; file_put_contents($tmpfile, $data['contents']); $data['fromfile'] = $tmpfile; } if (isset($data['fromfile'])) { // Not sure how to pass mime type and/or the 'use binary' flag $postdata[$name] = '@'.$data['fromfile']; } elseif (isset($data['contents'])) { $postdata[$name] = $data['contents']; } else { $postdata[$name] = ''; } } curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata); } else { curl_setopt($ch, CURLOPT_POSTFIELDS, $url_parts['query']); } } //Set the headers our spiders sends curl_setopt($ch, CURLOPT_USERAGENT, $send_header['User-Agent']); //The Name of the UserAgent we will be using ;) $custom_headers = array("Accept: " . $send_header['Accept'] ); if(isset($options['modified_since'])) array_push($custom_headers,"If-Modified-Since: ".gmdate('D, d M Y H:i:s \G\M\T',strtotime($options['modified_since']))); curl_setopt($ch, CURLOPT_HTTPHEADER, $custom_headers); if($options['referer']) curl_setopt($ch, CURLOPT_REFERER, $options['referer']); curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/binget-cookie.txt"); //If ever needed... curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_MAXREDIRS, 5); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $custom_headers = array(); unset($send_header['User-Agent']); // Already done (above) foreach ($send_header as $name => $value) { if (is_array($value)) { foreach ($value as $item) { $custom_headers[] = "$name: $item"; } } else { $custom_headers[] = "$name: $value"; } } if(isset($url_parts['user']) and isset($url_parts['pass'])) { $custom_headers[] = "Authorization: Basic ".base64_encode($url_parts['user'].':'.$url_parts['pass']); } curl_setopt($ch, CURLOPT_HTTPHEADER, $custom_headers); $response = curl_exec($ch); if(isset($tmpdir)) { //rmdirr($tmpdir); //Cleanup any temporary files :TODO: } $info = curl_getinfo($ch); //Some information on the fetch if($options['session'] and !$options['session_close']) $GLOBALS['_binget_curl_session'] = $ch; //Dont close the curl session. We may need it later - save it to a global variable else curl_close($ch); //If the session option is not set, close the session. //////////////////////////////////////////// FSockOpen ////////////////////////////// } else { //If there is no curl, use fsocketopen - but keep in mind that most advanced features will be lost with this approch. if(!isset($url_parts['query']) || (isset($options['method']) and $options['method'] == 'post')) $page = $url_parts['path']; else $page = $url_parts['path'] . '?' . $url_parts['query']; if(!isset($url_parts['port'])) $url_parts['port'] = ($url_parts['scheme'] == 'https' ? 443 : 80); $host = ($url_parts['scheme'] == 'https' ? 'ssl://' : '').$url_parts['host']; $fp = fsockopen($host, $url_parts['port'], $errno, $errstr, 30); if ($fp) { $out = ''; if(isset($options['method']) and $options['method'] == 'post' and isset($url_parts['query'])) { $out .= "POST $page HTTP/1.1\r\n"; } else { $out .= "GET $page HTTP/1.0\r\n"; //HTTP/1.0 is much easier to handle than HTTP/1.1 } $out .= "Host: $url_parts[host]\r\n"; foreach ($send_header as $name => $value) { if (is_array($value)) { foreach ($value as $item) { $out .= "$name: $item\r\n"; } } else { $out .= "$name: $value\r\n"; } } $out .= "Connection: Close\r\n"; //HTTP Basic Authorization support if(isset($url_parts['user']) and isset($url_parts['pass'])) { $out .= "Authorization: Basic ".base64_encode($url_parts['user'].':'.$url_parts['pass']) . "\r\n"; } //If the request is post - pass the data in a special way. if(isset($options['method']) and $options['method'] == 'post') { if(is_array($url_parts['query'])) { //multipart form data (eg. file upload) // Make a random (hopefully unique) identifier for the boundary srand((double)microtime()*1000000); $boundary = "---------------------------".substr(md5(rand(0,32000)),0,10); $postdata = array(); $postdata[] = '--'.$boundary; foreach ($url_parts['query'] as $name => $data) { $disposition = 'Content-Disposition: form-data; name="'.$name.'"'; if (isset($data['filename'])) { $disposition .= '; filename="'.$data['filename'].'"'; } $postdata[] = $disposition; if (isset($data['type'])) { $postdata[] = 'Content-Type: '.$data['type']; } if (isset($data['binary']) && $data['binary']) { $postdata[] = 'Content-Transfer-Encoding: binary'; } else { $postdata[] = ''; } if (isset($data['fromfile'])) { $data['contents'] = file_get_contents($data['fromfile']); } if (isset($data['contents'])) { $postdata[] = $data['contents']; } else { $postdata[] = ''; } $postdata[] = '--'.$boundary; } $postdata = implode("\r\n", $postdata)."\r\n"; $length = strlen($postdata); $postdata = 'Content-Type: multipart/form-data; boundary='.$boundary."\r\n". 'Content-Length: '.$length."\r\n". "\r\n". $postdata; $out .= $postdata; } else { $out .= "Content-Type: application/x-www-form-urlencoded\r\n"; $out .= 'Content-Length: ' . strlen($url_parts['query']) . "\r\n"; $out .= "\r\n" . $url_parts['query']; } } $out .= "\r\n"; fwrite($fp, $out); while (!feof($fp)) { $response .= fgets($fp, 128); } fclose($fp); } } //Get the headers in an associative array $headers = array(); if($info['http_code'] == 404) { $body = ""; $headers['Status'] = 404; } else { //Seperate header and content $header_text = substr($response, 0, $info['header_size']); $body = substr($response, $info['header_size']); foreach(explode("\n",$header_text) as $line) { $parts = explode(": ",$line); if(count($parts) == 2) { if (isset($headers[$parts[0]])) { if (is_array($headers[$parts[0]])) $headers[$parts[0]][] = chop($parts[1]); else $headers[$parts[0]] = array($headers[$parts[0]], chop($parts[1])); } else { $headers[$parts[0]] = chop($parts[1]); } } } } if(isset($cache_file)) { //Should we cache the URL? file_put_contents($cache_file, $response); } if($options['return_info']) return array('headers' => $headers, 'body' => $body, 'info' => $info, 'curl_handle'=>$ch); return $body; } ?>

[/php]

This is my index.php

EasyAuction.com <?php

/* Login Form*/

if(isset($_POST[‘submit_login’]))
{
$name = $_POST[‘name’];
$password = $_POST[‘password’];

/* Checking with the database*/

require(‘db.info.php’);

$sql = “SELECT * FROM users WHERE LOGIN_NAME=’$name’”;
$result = mysql_query($sql);
$num = @mysql_num_rows($result);

if($num==1)
{
$row = mysql_fetch_assoc($result);
if($row[‘USER_PASSWORD’]== $password)
{
print"login succesfull…
";
session_start();
$_SESSION[‘user_logged_in’] = true;
$_SESSION[‘user_name’] = $name;
echo ‘Authenticated!’;
header (“location:Biditems.php”);
die();
}
else
{
?>


We recognize your name, But the password is wrong, Please Re-enter the Password Or Use Forgot Password Option.

LOGIN

Please Enter a Valid Username and Password
Username:
Password
  Forgot your password?
 
Do you want to be a member? Register here
<?php } } else{ ?>
<form name="login" class="login active" method="post" action="index.php" /><br>
<center> <b>SORRY...</b><br/>
<b>Please fill the form correctly or Register First</b>
</center>

LOGIN

Please Enter a Valid Username and Password
Username:
Password
  Forgot your password?
 
Do you want to be a member? Register here
<?php } } else { ?>

LOGIN

Username:
Password
  Forgot your password?
 
Do you want to be a member? Register here

Make a stronghold of your home market and prepare for worldwide expansion. Meizu didn't invent the wheel with this strategy but is using it to great success. One would think a market as vast as China - and with huge potential for growth at that...

With the Galaxy S III busy grabbing the headlines, a midrange smartphone has been making its way to a number of markets without much fanfare. But you can bet the Samsung Galaxy Ace 2 won't settle for the role of just another sequel. It has a chance to prove the Galaxy S III is...

Sony was the talk of town during CES 2012 back in January and the Xperia ion for AT&T was among the main reasons why. Launched alongside the Xperia S, the Sony Xperia ion took the great honor of being the company’s first LTE smartphone. To make the matters even...

Toshiba announces REGZA T-02D Android smartphone for Japan

2 days ago, comments (55)

Comes with a 13.1 megapixel camera and, 4.3-inch qHD display and 1.5GHz dual-core processor.

<?php } ?> <?php ?>

buddy i said inside the php block

This is biditems.php file

[php]<?php
session_start();

if(isset($_SESSION[‘user_name’]))
{
$loged_user = $_SESSION[‘user_name’];
?>


<?PHP if (isset( $_GET['limit']) == NULL){ $limit = 5; } else { $limit = $_GET['limit']; } if(isset($_GET['start'])==NULL){ $start = 0; } else { if(isset($_GET['start']) < 0){ $start = 0; } else { $start = $_GET['start']; } } require('db.info.php'); $query = "SELECT * FROM items ORDER BY ITEM_ID DESC LIMIT $start, $limit"; $results=mysql_query($query) or die("Error on Table Selection: ".mysql_error()); while($row=mysql_fetch_assoc($results)) { $itemid = $row['ITEM_ID']; $iowner = $row['OWNER']; $ititle = $row['ITEM_TITLE']; $closing_date = $row['CLOSING_DATE']; $abc = settype($closing_date, 'string'); $description = $row['DESCRIPTION']; $highest_bid=$row['HIGHEST_BID']; $item_image=$row['ITEM_IMAGE']; $query1= mysql_query("SELECT COUNT(*) AS NumberOfItems FROM bids WHERE ITEM_ID = $itemid"); $resut_set= mysql_fetch_assoc($query1); $number_of_bids = $resut_set['NumberOfItems']; ?>

Sony Ericsson Xperia Play

Sony Ericsson Xperia Play Ntelos Playstation Android Smartphone Returns: Not accepted Place Your Bid Here
Rs.
Rs.15,000+
Closing Date
July 31st

Item specifics

     
Condition: Used: An item that has been used previously. The item may have some signs of cosmetic wear, but is fully operational and functions as intended. This item may be a floor model or store return that has been used. See the seller’s listing for full details and description of any imperfections. Brand: Sony Ericsson
Operating System: Android Carrier: nTelos
Features: 3G Data Capable, Bluetooth Enabled, GPS, Internet Browser, Music Player, Touch Screen, Wi-Fi Capable, Speakerphone Contract: With Contract
Phone specifics

Nokia Lumia 900

Nokia Lumia 900 - 16GB - Matte Black (AT&T) Smartphone Place Your Bid Here
Rs.
Rs.45,000+
Closing Date
August 1st

Item specifics

     
Condition: New: A brand-new, unused, unopened, undamaged item in its original packaging (where packaging is applicable). Packaging should be the same as what is found in a retail store, unless the item is handmade or was packaged by the manufacturer in non-retail packaging, such as an unprinted box or plastic bag. See the seller's listing for full details. Brand: Nokia
Camera: 8.0 MP Family Line: Nokia Lumia
Cellular Band: GSM/GPRS/EDGE 850/900/1800/1900 (Quadband) WCDMA (UMTS)/HSPA 850/1900/2100 Carrier: AT&T
Operating System: Microsoft Windows Phone 7.5 Storage Capacity: 16 GB
Contract: Without Contract Color: Matte Black
Bundled Items: Retail Box, Home Charger, Data Cable, Documentation Style: Bar
Phone specifics

[/php]

Oops, sorry, here it is

[php]

EasyAuction.com

<?php /* Login Form*/ if(isset($_POST['submit_login'])) { $name = $_POST['name']; $password = $_POST['password']; /* Checking with the database*/ require('db.info.php'); $sql = "SELECT * FROM users WHERE LOGIN_NAME='$name'"; $result = mysql_query($sql); $num = @mysql_num_rows($result); if($num==1) { $row = mysql_fetch_assoc($result); if($row['USER_PASSWORD']== $password) { print"login succesfull..
"; session_start(); $_SESSION['user_logged_in'] = true; $_SESSION['user_name'] = $name; echo 'Authenticated!'; header ("location:Biditems.php"); die(); } else { ?>
We recognize your name, But the password is wrong, Please Re-enter the Password Or Use Forgot Password Option.

LOGIN

Please Enter a Valid Username and Password
Username:
Password
  Forgot your password?
 
Do you want to be a member? Register here
<?php } } else{ ?>
<form name="login" class="login active" method="post" action="index.php" /><br>
<center> <b>SORRY...</b><br/>
<b>Please fill the form correctly or Register First</b>
</center>

LOGIN

Please Enter a Valid Username and Password
Username:
Password
  Forgot your password?
 
Do you want to be a member? Register here
<?php } } else { ?>

LOGIN

Username:
Password
  Forgot your password?
 
Do you want to be a member? Register here

Make a stronghold of your home market and prepare for worldwide expansion. Meizu didn't invent the wheel with this strategy but is using it to great success. One would think a market as vast as China - and with huge potential for growth at that...

With the Galaxy S III busy grabbing the headlines, a midrange smartphone has been making its way to a number of markets without much fanfare. But you can bet the Samsung Galaxy Ace 2 won't settle for the role of just another sequel. It has a chance to prove the Galaxy S III is...

Sony was the talk of town during CES 2012 back in January and the Xperia ion for AT&T was among the main reasons why. Launched alongside the Xperia S, the Sony Xperia ion took the great honor of being the company’s first LTE smartphone. To make the matters even...

Toshiba announces REGZA T-02D Android smartphone for Japan

2 days ago, comments (55)

Comes with a 13.1 megapixel camera and, 4.3-inch qHD display and 1.5GHz dual-core processor.

<?php } ?> <?php ?>[/php]

If you need other files, please let me know.

ok this is what we gonna do buddy do u have skype and teamviewer installed on your computer?

private me message me here with your skype name

Sent a PM.

Thanks

Thank you Wilson for your help and for your time. I really appreciate it.

Irosh

Sponsor our Newsletter | Privacy Policy | Terms of Service