PHP - Coming Back To Php, Should I Use Oop Or Sequential?
Hi everyone reading this,
I have used PHP before as a hobby programmer but recently my boss asked me to make a webpage to accept worker's hours and store them in a database. So I realize that in the last few years object oriented style has been added into PHP. I have learnt OOP (C++) about a decade ago and understand the fundamentals of it. If I am writing this website code, am I going to be better off spending the time to get familiar with the new OOP stuff in PHP and use that or would it be better to just use an old sequential style of programming? I know this may seem like apples and oranges and that it varies based on opinion, but maybe there can be reasons for me to use OOP over sequential. For instance, if I write this code to be flexible enough that I can do a basic "worker times" table first, then I might be able to add additional functionality later, like worker details and qualifications, all of which could be brought up with the click of a button. Will it generally be easier to add onto code using OOP? Similar TutorialsI am writing a small program that generates a sequential numbering array. I need to include potentially a prefix, leading zeros, a starting number, a suffix and a quantity and also reverse the generated values. example: P-000299-001 P-000298-001 P-000297-001 P-000296-001 P-000295-001 P-000294-001 P-000293-001 P-000292-001 P-000291-001 P-000290-001 P-000289-001 Here is my code to generate: <?php $quantity = "100"; $start = "200"; $leadingzeros = "000"; $prefix = "P-"; $suffix = "-001"; $i = $start + $quantity - 1; while ($i >= $start) { echo $prefix . $leadingzeros . $i-- . $suffix . "<br />\n"; } ?> The code all seem to function correctly until I increase the quantity to say 25000 numbers to be generated or if the number string gets too long and the server will just sit and spin until a "cannot be displayed error" appears in IE. It had been suggested to abandone the array and simply write the generated sequence to a file and this is the code to generated the file it - it really works great and is really fast. <?php $startTime = time(); // this is just for measuring execution time $quantity = "25000"; $start = "26000"; $length = 6; $prefix = "P-"; $suffix = "-001"; $file = "test.txt"; $fh = fopen($file, 'w') or die("Could not open $file for writing"); for($ix = 1, $nbr = $start; $ix <= $quantity; $ix++, $nbr--) { fprintf($fh, $prefix.'%0'.$length.'d'.$suffix."\n", $nbr); } // all done, let's see how long it took: $endTime = time(); echo "Script took about " . ($endTime - $startTime) . " seconds to run."; ?> I am using this program to generate numbering files used in the printing industry. The sequential numbering works great. I had to change your code slightly in order to produce a usable numbering file, I had to subtract "1" from the $start+$quantity in order to get the correct amount of numbers. For a start of 1000 and quantity of 10 you had 1010 as your first number and it should actually be 1009 to give you 10 numbers. $fh = fopen($file, 'w') or die("Could not open $file for writing"); for($ix = 1, $nbr = $start+$quantity-1; $ix <= $quantity; $ix++, $nbr--) P-001009-001 P-001008-001 P-001007-001 P-001006-001 P-001005-001 P-001004-001 P-001003-001 P-001002-001 P-001001-001 P-001000-001 Let's think of this as an 8.5" x 11" piece of paper going through a laser printer - if each page had one number on it the sequential number will be great. Anyway, here is the next challenge: Let's say we have one 5.5" x 8.5" on an 8.5" x 11" sheet twice or two up. Each with its own number on the left and right side of the paper. That after printing will be cut and stacked on top of one another and produce a pile that is still in the right order. We need to take the $quantity+$start-1 and divide by 2 and then interleave the two sets of numbers and stop the numbering set at the starting number. easy huh!!! P-001009-001 P-001004-001 P-001008-001 P-001003-001 P-001007-001 P-001002-001 P-001006-001 P-001001-001 P-001005-001 P-001000-001 Here is the code I have for an example: <?php $quantity = "10"; $start = "1000"; $leadingzeros = "00"; $prefix = "P-"; $suffix = "-001"; $i = $start + $quantity - 1; $quantity2 = $quantity / 2; $j = (int)($i - $quantity2); while ($j >= $start) { echo $prefix . $leadingzeros . $i-- . $suffix ."<br />\n" . $prefix . $leadingzeros . $j-- . $suffix . "<br />\n"; } ?> The third option is two completely different 5.5" x 8.5" items and two different numbering schemes on an 8.5" x 11" piece of paper. Here is the code I have been using for it. <?php $quantity = "10"; $start = "1000"; $leadingzeros = "00"; $prefix = "P-"; $suffix = "-001"; $quantity2 = "10"; $start2 = "2000"; $leadingzeros2 = "000"; $prefix2 = "Q-"; $suffix2 = "-005"; $i = $start + $quantity - 1; $k = $start2 + $quantity2 - 1; while ($i >= $start) { echo $prefix . $leadingzeros . $i-- . $suffix . "<br />\n" .$prefix2. $leadingzeros2 . $k-- . $suffix2 . "<br />\n"; } ?> Which produces: P-001009-001 Q-0002009-005 P-001008-001 Q-0002008-005 P-001007-001 Q-0002007-005 P-001006-001 Q-0002006-005 P-001005-001 Q-0002005-005 P-001004-001 Q-0002004-005 P-001003-001 Q-0002003-005 P-001002-001 Q-0002002-005 P-001001-001 Q-0002001-005 P-001000-001 Q-0002000-005 Thanks in advance I have a table with an ID column which is the Primary key and auto incremented. I have another column named ORDER that contains a number. This number is used to define the order in which the row data is displayed on a page. When I delete a row, the ORDER column will have a gap and I would like to renumber the subsequent rows to remove the gap. ie: I want to renumber the rows: ID ORDER 1 1 2 2 4 3 5 4 When I insert a new row I want the ORDER row to be given the NEXT sequential number How do I do that using PHP PDO? Thanks This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=344739.0 Please, take a look to the following code.After clicking Next it goes to overview.php.Why when I click back on my browser to return to this page again, it is not returning back? When I click back I receive "Confirm Form Resubmission" message. After refreshing page it loads page. I guess problem is in "session_start();" part. Something to do with cookies. Please, help me it is very urgent for me. <?php session_start(); echo "<html> <head> <title>Hello World</title> <meta http-equiv='Content-Type' content='text/html; charset=Windows-1252'/> </head>"; require_once ('functions.inc'); if(!isset($_POST['userid'])) { echo "<script type='text/javascript'>"; echo "window.location = 'index.php'"; echo "</script>"; exit; }else{ session_register("userid", "userpassword"); $username = auth_user($_POST['userid'], $_POST['userpassword']); if(!$username) { $PHP_SELF = $_SERVER['PHP_SELF']; session_unregister("userid"); session_unregister("userpassword"); echo "Authentication failed " . "Please, write correct username or password. " . "try again "; echo "<A HREF=\"index.php\">Login</A><BR>"; exit; } } function auth_user($userid, $userpassword){ global $default_dbname, $user_tablename; $user_tablename = 'user'; $link_id = db_connect($default_dbname); mysql_select_db("d12826", $link_id); $query = "SELECT username FROM $user_tablename WHERE username = '$userid' AND password = '$userpassword'"; $result = mysql_query($query) or die(mysql_error()); if(!mysql_num_rows($result)){ return 0; }else{ $query_data = mysql_fetch_row($result); return $query_data[0]; } } echo "hello"; echo "<form method='POST' name='myform' action='overview.php'>"; echo "<input type='submit' value='Next'>"; echo "</form>"; ?> My error: Code: [Select] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key FROM applications WHERE key = '0188f'' at line 1 Code: function randomNum() { $random = substr(md5(rand(5000,300000)), -5); $query = mysql_query("SELECT key FROM applications WHERE key = $random") or die(mysql_error()); //make sure it doesn't already exist if(mysql_num_rows($query) > 0) { randomNum(); } else { return $random; } } I simply cannot seem to figure out what is happening...I've tried many solutions, but all seem to fail. Okay, so, I'm trying to pull the info from my `shop` table where the `users` table matches at x, y, z, and plane. Instead, I'm getting this: Resource id #22 Where is this coming from? I only have 1 row in my shop table, and it has: id = 7 name = admin shop x = 1 y = 0 z = admin plane = batai I'm standing in the shop right now (as my character, so my users table has the exact same x, y, z, plane)... Any help would be appreciated! $q1 = mysql_query("SELECT * FROM `shop` WHERE `x`='".$x["x"]."' AND `y`='".$x["y"]."' AND `z`='".$x["z"]."' AND `plane`='".$x["plane"]."'") or die("qry failed: ".mysql_error()); Variables: $x = $x = $player->username; (so it's pulling my username, which it is doing correctly ==> i echoed out $x and it came up with my username) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <?php // Connect to database================================================== include("connect_db.php"); // sending query =========================================================== $result = mysql_query("SELECT * FROM members Order By last") or die(mysql_error()); if (!$result) { die("Query to show fields from table failed"); } echo "<br />"; echo "<p>MEMBERS LIST</p>"; echo "<table border='10' cellpadding='3' cellspacing='2'>"; echo "<tr><th>First Name</th><th>Last Name</th>><th>Phone</th><th>Email</th></tr>"; // keeps getting the next row until there are no more to get ================ while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table ========================== echo "<tr><td>"; echo $row['first']; echo "</td><td>"; echo $row['last']; echo "</td><td>"; echo $row['phone']; echo "</td><td>"; echo $row['email']; echo "</td></tr>"; } echo "</table>"; ?> </body> </html> This is the output. MEMBERS LIST > First Last Phone Email data data data data ect............................................................... I cannot find where the > (greater than) sign is coming from. There is a space after MEMBERS LIST but I could not get it to work in this display. Hi, I just started learning PHP... Below is my first programme infact.. Out put is not coming when i type some thing in input boxes... Can somebody suggest where is the error... Index.php <html> <head> <title>Welcome to our site</title> </head> <body> <form method="POST" action="submit.php"> <label for ="business_name">Business name</label> <input type="text" id="business_name" \><br/> <label for ="contact_person">Contact person</label> <input type="text" id="contact_person" \><br/> <label for ="Telephone">Telephone</label> <input type="text" id="Telephone" \><br/> <label for ="FAX">FAX</label> <input type="text" id="FAX" \><br/> <label for ="Mobile">Mobile</label> <input type="text" id="Mobile" \><br/> <label for ="Addres_line_1">Addres_line_1</label> <input type="text" id="Addres_line_1" \><br/> <label for ="Addres_line_2">Addres_line_2</label> <input type="text" id="Addres_line_2" \><br/> <label for ="Addres_line_3">Addres_line_3</label> <input type="text" id="Addres_line_3" \><br/> <label for ="Addres_line_4">Addres_line_4</label> <input type="text" id="Addres_line_4" \><br/> <label for ="City">City</label> <input type="text" id="City" \><br/> <label for ="Pin_code">Pin_code</label> <input type="text" id="Pin_code" \><br/> <label for ="State">State</label> <input type="text" id="State" \><br/> <label for ="email">email</label> <input type="text" id="email" \><br/> <input type="submit" value="Please submit the details" name="submit"/> </form> </body> </html> submit.php <head><title>Your submission details</title></head> <body> <H3>YOU HAVE SUBMITTED THE FOLLOWING DETAILS</H3> <?php $business_name= $_POST["business_name"]; $contact_person = $_POST["contact_person"]; $Telephone = $_POST["Telephone"]; $fax = $_POST["FAX"]; $mobile = $_POST["Mobile"]; $address1 = $_POST["Addres_line_1"]; $address2 = $_POST["Addres_line_2"]; $address3 = $_POST["Addres_line_3"]; $address4 = $_POST["Addres_line_4"]; $city = $_POST["City"]; $pincode = $_POST["Pin_code"]; $state = $_POST["State"]; $email = $_POST["email"]; echo "Your business name".$business_name.'<br/>'; echo "Contact person".$contact_person.'<br/>'; echo "Telephone no.".$Telephone.'<br/>'; echo "Fax No.".$fax.'<br/>'; echo "Mobile No.".$mobile.'<br/>'; echo "Address line one".$address1.'<br/>'; echo "Address line two".$address2.'<br/>'; echo "Address line three".$address3.'<br/>'; echo "Address line four".$address4.'<br/>'; echo "Your City".$city.'<br/>'; echo "Your Pincode".$pincode.'<br/>'; echo "Your State".$state.'<br/>'; echo "Your email".$email.'<br/>'; ?> <a href=index.php>Home</a> </body> </html> Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\page\verify_security.php on line 170
earlier the code has been running fine and now it is showing error to me , can you tell something more about it ???
Hello all, I am trying to create a PHP CLi Script that will help me setup new config and server files / directories for every new web project i get instead of me having to manually create everything with each project. The script accepts the project name, and y/n for whether i want to create subdomains for css, jss and image files. After it has that, it must create a new http config file under sites-available (in Linux), by pasting the config file text. Problem : If I output regular text to the file, it displays exactly in the format that I write the string variable. But when I use a printf, or try to use variables directly in the config text, it starts formatting the text in the config file in a strange way. I just want the variables to just be replaced and the text to appear in the exact format below. The text displays perfectly as i typed below in the config file if I don't use any variables. $subDomainConfig .= '<VirtualHost *:80> ServerAdmin webmaster@%1$s ServerName %1$s.%2$s ServerAlias %1$s.%2$s # Indexes + Directory Root. DirectoryIndex index.html index.php DocumentRoot /var/www/%2$s/public_html/ # CGI Directory ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Location /cgi-bin> Options +ExecCGI </Location> # Logfiles ErrorLog /var/www/%2$s/logs/apache/error.log CustomLog /var/www/%2$s/logs/apache/access.log combined </VirtualHost> '.PHP_EOL; $httpConfigFileText = sprintf($subDomainConfig, $subDomain, $shortProjectName); The above code outputs text in this way in the file : <VirtualHost *:80> ServerAdmin webmaster@images ServerName images.mysite ServerAlias images.mysite # Indexes + Directory Root. DirectoryIndex index.html index.php DocumentRoot /var/www/mysite /public_html/ # CGI Directory ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Location /cgi-bin> Options +ExecCGI </Location> # Logfiles ErrorLog /var/www/mysite /logs/apache/error.log CustomLog /var/www/mysite /logs/apache/access.log combined </VirtualHost> hello, I have a search that matches users ISBN with two databases....code is below $query_search_exact_match = mysql_query("SELECT nvc_site.title, nvc_site.id, nvc_site.description, nvc_site.search_text, nvc_site.image, nvc_site.date, nvc_site.price, nvc_site.location_city, nvc_site_ads_extra.name, nvc_site_ads_extra.value, nvc_site_ads_extra.classified_id FROM nvc_site,nvc_site_ads_extra WHERE name = 'ISBN%3A' AND live=1") or die(mysql_error()); then i take the ISBN that the user entered and match that with the isbn's in the DB while ($fetch_extra = mysql_fetch_array($query_search_exact_match)) { $value = ereg_replace( "[^0-9]", "", $fetch_extra['value'] ); $to_find_isbn = mysql_real_escape_string(ereg_replace( "[^0-9]", "",$_POST['szs'])); if($value == $to_find_isbn) { echo "Match Found"; } else { echo "No Match Found"; } //ELSE doesn't work here.....it displays both the if and else at the same time } i need it to display no match found if there was no match found.....I am soo lost right now!! please help thank you if any body copy and paste anything from word to editor some unwanted css also coming with that pasting. when we request the data same css also coming with that. so how to clean data when we request $desc =$_request['contents']; how to solve this issue. please help me. Hi i need help iv create an event upload on the back-end of a website where a user can enter name, location and date of an event into sql database which works fine, the problem is that i want to display only current and up and coming events and not display the events that have passed if anyone can help that would be great 0
What is the best way to store this data coming from the api into a csv file to later put into the db. Output: rank, level, xp, rank, level, xp, etc. This api produces about 60 rows of data per name ran and x that by about roughly 300 names that equals a lot of data. Pretty much with my current code I am pretty much creating a endless loop almost that would take a long time to execute so updating said data would be a nightmare i would think. Is there a way to accomplish the same thing without the loop or I am not sure how to go about this. My current code is a mess that much I know I am gonna be told. This code works, just not efficiently. I am thinking there may be a better way to do this. $query = $conn->prepare("SELECT name FROM users LIMIT 1"); $query->execute(); while($row = $query->fetch(PDO::FETCH_ASSOC)){ $name = $row['name']; $url = 'https://secure.runescape.com/m=hiscore/index_lite.ws?player='. $name . '';//api that the csv data is coming from $highscores = file_get_contents($url); $fields = array("Name", "Rank", "Level", "Xp");//this is to add the headers // for the csv files $implode1 = implode($fields, ",");//turn into csv format, not sure this is //even needed $implode1 .= "\n";/*this is to add a line break so that the explode below will properly put it into its own element*/ //otherwise data starts joining togather $extra_data = array("$name");/*This is to add the name that the data pertains too*/ $implode2 = implode($extra_data, ",");//turn into csv format $highscores = $implode1 . $implode2 . $highscores;//join as one array $highscores = explode("\n", $highscores);//turn each csv into an element of //its own element a bunch of unsets to remove unwanted data. Omitted them to condense the code $i = 1; header('Content-Type: text/csv'); header('Content-Disposition: attachment; filename="name.csv"'); $data = $highscores; $fp = fopen('highscores/' . $name . '.csv', 'wb'); foreach ( $data as $line ) { $val = explode(",", $line); fputcsv($fp, $val); } fclose($fp); The pdo part I was gonna include but the way I have it setup now wouldn't work. I was thinking that I would use mysql's LOAD DATA INFILE to insert the csv data to database. The end goal here is to be able to search for player stats and to use said data to keep track of xp earned during a xp competition. I PRAY that i have included enough info... I would really appreciate any feedback if possible. Hi I have a form that is popluated from the database now I am trying to get the switch case to be based on the option the user selects is this possible to make a case a variable popluated by the drop down if so can someone show me what am i missing? the value I am trying to get from the form to the switch case is the ( $val->slug) but the value not been set help please here the form Code: [Select] <form method="post"> <select name="deal-locations" onChange="this.form.submit()"> <?php while(list($key,$val) = each($locations)) { ?><option value="<?php echo $val->slug; ?>"><?php echo $val->slug; ?></option><?php } ?> </select> <input type="submit" value="submit"> </form> Here the switch case Code: [Select] switch ($_POST['deal-locations']) { case " $val->slug": echo "<h3>deal-locations: ASC</h3>"; $args = array( 's' => $_GET['s'], 'post_type' => 'deals', 'deal-locations' => ' $val->slug', 'where' => ' $val->slug', 'paged' => 'paged' ); break; } I am using the classic Code: [Select] ini_set("display_errors","2"); ERROR_REPORTING(E_ALL); but I am getting a notice that is posting on my page. I preffer not to remove the reporting yet since the site is still new and is there any way I can hide the notice but keep the fail errors the error is Code: [Select] Notice: Undefined index: HTTPS in /var/www/website/visitors.php on line 20 line 20 is Code: [Select] if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} Hi there I have a problem here, I think I may know what it is but just wanted some guidance on this issue. I took the logic from a previous help from the people on this forum and here is my landing page: <?php // ini_set("display_errors", 1); // randomly starts a session! session_name("jeremyBasicLogin"); session_start(); if(isset($_SESSION['username'])) { // display whatever when the user is logged in: echo <<<ADDENTRY <html> <head> <title>User is now signed in:<title> </head> <body> <h1>You are now signed in!</h1> <p>You can do now what you want to do!</p> </body> </html> ADDENTRY; } else { // If anything else dont allow access and send back to original page! header("location: signin.php"); } ?> This is where the user goes to when they go to this system (not a functional system, ie it doesnt actually do anything its more for my own theory. As you wont have a session on the first turn to this page it goes to: signin.php which contains: <?php // ini_set("display_errors", 1); require_once('func.db.connect.php'); if(array_key_exists('submit',$_POST)) { dbConnect(); // connect to database anyways! // Do a procedure to log the user in: // Santize User Inputs $username = trim(stripslashes(mysql_real_escape_string($_POST['username']))); // cleans up with PHP first! $password = trim(stripslashes(mysql_real_escape_string(md5($_POST['password'])))); // cleans up with PHP first! $sql = "SELECT * FROM users WHERE username='$username' AND password='$password'"; $result = mysql_query($sql); if(mysql_num_rows($result) == 1) { session_name("jeremyBasicLogin"); session_start(); $_SESSION['is_logged_in'] = true; $_SESSION['username'] = $username; //print_r($_SESSION); // debug purposes only! $_SESSION['time_loggedin'] = time(); // this is adding to the array (have seen the output in the SESSION vars! // call function to update the time stamp in MySQL? header("location: index.php"); } else if(mysql_num_rows($result) != 1) { $message = "You typed the wrong password or Username Please retry!"; } } else { $message = ""; } // displays the login page: echo <<<LOGIN <html> <body> <h1>Example Login</h1> <form id="login" name="login" action="{$_SERVER['PHP_SELF']}" method="post"> <label for="username">Username: </label><input type="text" id="username" name="username" value="" /><br> <label for="password">Password: </label><input type="text" id="password" name="password" value="" /><br> <input type="submit" id="submit" name="submit" value="Login" /> </form> LOGIN; echo "<p>" . $message . "</p>"; echo <<<LOGIN <p>Please Login to View and Edit Your Entries</p> <p><a href="register.php">Click Here To Signup</a><p> </body> </html> LOGIN; ?> This checks through user inputs and hopefully logs them in, when Ive inserted the data into the database itself it works, if I try and login but if a user fills in this form: signup.php: <?php //ini_set("display_errors", 1); $message =''; require_once('func.db.connect.php'); if(array_key_exists('submit',$_POST)) { dbConnect(); // connect to database anyways! // do some safe protecting of the users variables, apply it to all details! $username = trim(stripslashes(mysql_real_escape_string($_POST['username']))); // cleans up with PHP first! $email = trim(stripslashes(mysql_real_escape_string($_POST['email']))); // cleans up with PHP first! $password = trim(stripslashes(mysql_real_escape_string(md5($_POST['password'])))); // does as above but also encrypts it using the md5 function! $password2 = trim(stripslashes(mysql_real_escape_string(md5($_POST['password2'])))); // does as above but also encrypts it using the md5 function! if($username != '' && $email != '' && $password != '' && $password2 != '') { // do whatever when not = to nothing/empty fields! if($password === $password2) { // do database stuff to enter users details $sql = "INSERT INTO `test`.`users` (`id` ,`username` ,`password`) VALUES ('' , '$username', MD5( '$password' ));"; $result = mysql_query($sql); if($result) { $message = 'You may now login by clicking <a href="index.php">here</a>'; } } else { // echo out a user message says they got their 2 passwords incorrectly typed: $message = 'Pleae re enter your password'; } } else { // they where obviously where empty $message = 'You missed out some required fields, please try again'; } } echo <<<REGISTER <html> <body> <h1>Register Form</h1> <p>Please fill in this form to register</p> <form id="register" name="register" action="{$_SERVER['PHP_SELF']}" method="post"> <table> <tr> <td><label for="username">Username: </label></td> <td><input type="text" id="username" name="username" value="" /></td> </tr> <tr> <td><label for="email">Email: </label></td> <td><input type="text" id="email" name="email" value="" /></td> </tr> <tr> <td><label for="password">Password: </label></td> <td><input type="text" id="password" name="password" value="" /></td> </tr> <tr> <td><label for="password">Confirm Password: </label></td> <td><input type="text" id="password2" name="password2" value="" /></td> </tr> <tr> <td><input type="submit" id="submit" name="submit" value="Register" /></td> </tr> <table> REGISTER; echo "<p>" . $message . "</p>"; echo <<<REGISTER </form> </body> </html> REGISTER; ?> As I said when the user signs up when submitting the above form, it doesnt work, keeps coming up with a different value for the password, so I am about 99% certain its the password, but I have been maticulous about copying in the sanitize function for SQL injections and it just doesnt still work, really puzzled now. Any helps appreciated, Jeremy. This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=351137.0
For example with an IDE to run a program is there a way to put some code in the path and let it tell me where it came from like a referral? $ref = $_SERVER['HTTP_REFERER']; echo("$ref<br>"; Result: https://www.mydomain.com/wp-admin/admin.php?page=lambo As you can clearly see the page that we have entered the code in is referred by the URL here. It tells me that it was last at a word press page /wp-admin/admin-php and I can go to that page and it will be the last page it was at.. So bottom line then if i add this code to the admin page and click the same button i had before.. it will tell me the file that called out the admin page. Baslcaly I am looking for ideas on how to track the page i am now all the way back to the page with the button on it and all intermediate pages that it passes thru to get to the final destination. It seems that to succesfully troubleshoot a fault is to follow the path of the entire job and see if any breaks... Any thoughts or suggestions on how to best do this would greatly be appreciated.
I have the following code. Before back button was working. Now don't understand what happend but when I click Back button I receive "Webpage has expired" window in my browser. What may be the reason? Code: [Select] <html> <head> <title>Økern Frukt og Grønt</title> <link href="calendar/calendar.css" rel="stylesheet" type="text/css" /> <script language="javascript" src="calendar/calendar.js"></script> <style type="text/css"> textarea { resize: none; } </style> <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252"/> </head> <?php if(!isset($_POST['userid'])) { echo "<script type='text/javascript'>"; echo "window.location = 'login.html'"; echo "</script>"; exit; } require_once ('functions.inc'); require_once('calendar/classes/tc_calendar.php'); global $default_dbname; $link_id = db_connect($default_dbname); mysql_select_db("okern", $link_id); $letters1 = array ("A1", "B1", "C", "D","E", "F", "G", "H","I", "J", "K", "L", "M", "N", "O", "P","Q", "R", "S", "T","U", "V", "W", "X", "Y", "Z", "&#198", "&#216", "&#197"); $letters = array_merge(range("A", "Z"), array("&#38;#198", "&#38;#216", "&#38;#197")); echo "<table border='0' align='center'> <tr> <td colspan=3><b><center>Du har valgt f&#248lgende produkter</center></b></td> </tr> <tr> <th align=left>Produkt</th> <th align=left>Antall</th> <th align=left>Enhet</th> </tr>"; echo "<form method='POST' action='order.php'>"; $userid = $_POST['userid']; echo "<INPUT TYPE='hidden' NAME='userid' VALUE='$userid'>"; foreach($letters as $letter) { if(isset($_POST[$letter])) { $selected = $letter . '1'; $antall = $letter . '2'; $enhet = $letter . '3'; echo "<tr>"; echo "<td>" . "<INPUT TYPE='hidden' NAME='$selected' VALUE='$_POST[$selected]'>" . "$_POST[$selected]" . "</td>"; echo "<td>" . "<INPUT TYPE='hidden' NAME='$antall' VALUE='$_POST[$antall]'>" . "$_POST[$antall]" . "</td>"; echo "<td>" . "<INPUT TYPE='hidden' NAME='$enhet' VALUE='$_POST[$enhet]'>" . "$_POST[$enhet]" . "</td>"; echo "</tr>"; } } for ($i = 1; $i < 400; $i++) { if (isset($_POST[$i])){ $selected = 'a' . $i; $antall = 'antall' . strval($i); $enhet = 'enhet' . strval($i); echo "<tr>"; echo "<td>" . "$_POST[$selected]" . "</td>"; echo "<td>" . "$_POST[$antall]" . "</td>"; echo "<td>" . "$_POST[$enhet]" . "</td>"; echo "</tr>"; } } echo "<tr height=10></tr> <tr><td colspan=2>Velg dato for bestillingen:</td> <td colspan=1>"; $myCalendar = new tc_calendar("date5", true, false); $myCalendar->setIcon("calendar/images/iconCalendar.gif"); $myCalendar->setDate(date('d'), date('m'), date('Y')); $myCalendar->setPath("calendar/"); $myCalendar->setYearInterval(2000, 2015); $myCalendar->dateAllow('2008-05-13', '2015-03-01'); $myCalendar->setDateFormat('j F Y'); $myCalendar->setAlignment('left', 'bottom'); $myCalendar->setSpecificDate(array("2011-04-01", "2011-04-04", "2011-12-25"), 0, 'year'); $myCalendar->writeScript(); echo "<INPUT TYPE='hidden' NAME='date' VALUE='this.form.date5.value'>"; echo "</td></tr>"; echo "<tr height=10></tr><tr> <td colspan=3>Skrive din melding nedenfor:</td> </tr>"; echo "<tr> <td colspan=3><textarea name='melding' cols='50' rows='5' resize=none></textarea></td> </tr>"; echo "<tr> [b]<td><center><input type='button' value='Tilbake' onClick='history.go(-1)'></center></td>[/b] <td colspan=2><center><input type='submit' value='Bestil'></center></td> </tr>"; echo "</form>"; echo "</table>"; ?> </html> |