Jump to content

roopurt18

Staff Alumni
  • Posts

    3,746
  • Joined

  • Last visited

    Never

Everything posted by roopurt18

  1. Indexes increase the speed at which MySQL can find data when you issue it a query. It doesn't matter who or what generated the query. Open source, widely available, lots of support, easy to get started, etc.
  2. Almost every major reporting platform I've encountered requires Java.
  3. Install FireFox with the Firebug add-on. Open firefox and then open firebug. Click on the Net tab in firebug. Now as you browse the site firebug will display all of the network communications sent back and forth. Browse to the page in question. Wait for it to load entirely. Then click the Clear button in firebug. This erases all of the traffic thus far. Now click on the link in question. Firebug will display what the link actually does. It will tell you: 1) Which URL was accessed 2) The type of request (POST or GET) 3) If the request was a POST you can also view any POST data that was sent. Now you can write a simple script using HttpRequest or libCurl that will access the same URL in the same manner with the same passed data. HttpRequest (or libCurl) will give you the output, which is your CSV file. You can then use the mail() function to e-mail it. I'd recommend using PHPMailer() instead though. It has many nice features.
  4. glob() is useful as well.
  5. Nobody took into account that the array might not be evenly divisible by three. In which case all of the code provided will dump invalid markup. IMG tags are self-closing, which nobody seemed to mention either. Also, nobody noticed the OP's typo: Here is my version, I've added extra white space so I could eyeball that things were closed correctly. Feel free to delete it. <?php $content = array( "http://www.somewebsite0.com|imagename0.jpg" , "http://www.somewebsite1.com|imagename1.jpg" , "http://www.somewebsite2.com|imagename2.jpg" , "http://www.somewebsite3.com|imagename3.jpg" , "http://www.somewebsite4.com|imagename4.jpg" , "http://www.somewebsite5.com|imagename5.jpg" , "http://www.somewebsite6.com|imagename6.jpg" , "http://www.somewebsite7.com|imagename7.jpg" #, "http://www.somewebsite8.com|imagename8.jpg" #, "http://www.somewebsite9.com|imagename9.jpg" ); shuffle($content); echo "<table>\n <tbody>\n"; $max = count( $content ); for( $i = 0; $i < $max; $i += 1 ) { list( $site, $img ) = explode( '|', $content[$i] ); if( $i % 3 === 0 ) { if( $i > 0 ) { echo " </tr>\n"; } echo " <tr>\n"; } echo " <td>\n <a href=\"{$site}\">\n <img src=\"images/{$img}\" />\n </a>\n </td>\n"; } while( $i % 3 !== 0 ) { echo " <td> </td>\n"; $i += 1; } if( $i % 3 === 0 ) { echo " </tr>\n"; } echo " <tbody>\n<table>\n"; ?>
  6. It sounds like you are creating this for users of a company? If the users and the application are installed on the same internal network, you can make the application internal use only by adding the following to your apache configuration: <VirtualHost ...> # vhost stuff <Directory ...> Order Allow,Deny Allow from 192.168 127.0.0.1 </Directory> </VirtualHost> That will tell apache to only serve requests coming from localhost or the network 192.168.
  7. Your `ribbon_criteria` table is similar to the one I suggested. I'm not sure why you've used `ribbon_name` and `achievement_name` as linking columns; the related tables have `id` columns so you should use that instead. ribbon_criteria id, ribbon_id, achievement_id, required_exp, reward I've also dropped the extra `ribbon_` on some of the column names. The table itself is called `ribbon_` so it's sort of implied the columns are related to ribbons. Additionally, the requirement is experience, which is not stated in the column name `ribbon_requirement`. And the reward is money, which is (again) not stated by `ribbon_reward`. The way they are named now, the implication is the requirement is some sort of ribbon and the reward is some type of ribbon as well. So IMO you're relating them fine as long as there is ever only one requirement and only ever one bonus / reward. Should you later decide to add additional requirements and / or bonuses, you'll need to break `ribbon_criteria` into a many-to-many relationship design.
  8. Web servers send a response back to the browser. The response is plain-text and broken into two sections. The first section is the header section. It contains all sorts of meta information, where meta information means general info about the response. The other section is the content. The content is the actual web page. The rules for how this information is organized is very strict. 1) The headers must come first, one header per line 2) Two empty lines must be inserted 3) The content is inserted Any errors in regards to Cannot modify header information - headers already sent by are occurring because you are sending #3 before you have finished sending #1. This occurs when you echo text from PHP and then call functions like header() or try to set cookies in the browser. You code looks like this: <html> <head> <title>Rogers ESC RMA Portal</title> <link rel=stylesheet type="text/css" href="style.css"> ...SNIP... </p> <p align="center"><img src="img/login.jpg" width="102" height="102" align="middle"></p> <?php ob_start(); Everything before the <?php is sent to the browser exactly as if you had echoed it with PHP.. This might fix it: <?php ob_start(); ?> <html> <head> <title>Rogers ESC RMA Portal</title> <link rel=stylesheet type="text/css" href="style.css"> <style type="text/css"> <!-- .style3 { font-family: Arial, Helvetica, sans-serif; font-weight: bold; } .style4 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: small; } --> </style> </head> <body bottommargin="0" leftmargin="0" rightmargin="0" topmargin="0" background="img/background.jpg"> <table height="123" width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"> <!----- insert logo below ------------------------------------------> <td><img src="img/backer.jpg" width="574" height="123"></td> <!------------------------------------------------------------------> <td width="75%" background="img/topbg.jpg"><p><img src="img/logo_Rogers.jpg" width="300" height="100" align="right"></p> </td> </tr> </table> <table height="40" width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"> <td width="75" background="img/topbar.jpg"> </td> </tr> </table> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"> <td width="201"><p><BR> <!----- menu, insert links below ------------------------------------------> » <a href="http://www.rogers-esc.com/index.html">Home</a><BR> <img src="img/menubar.jpg" width="201" height="11" border="0" alt=""><BR> » <a href="form.html">Process RMA </a><BR> <img src="img/menubar.jpg" width="201" height="11" border="0" alt=""><BR> » <a href="http://www.rogers-esc.com">Submit</a><BR> <img src="img/menubar.jpg" width="201" height="11" border="0" alt=""><BR> </p> <p align="center"><img src="img/login.jpg" width="102" height="102" align="middle"></p> <?php // Connects to your Database mysql_connect("localhost", "root", "escrma") or die(mysql_error()); mysql_select_db("rma_portal") or die(mysql_error()); //Checks if there is a login cookie if(isset($_COOKIE['ID_my_site'])) //if there is, it logs you in and directes you to the members page { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($pass != $info['Password']) { } else { ob_start(); header("Location: form.html"); ob_end_flush(); } } } //if the login form is submitted if (isset($_POST['submit'])) { // makes sure they filled it in if(!$_POST['username'] | !$_POST['pass']) { die('You did not fill in a required field.'); } // checks it against the database - Email if (!get_magic_quotes_gpc()) { $_POST['username'] = addslashes($_POST['username']); } $check = mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die(mysql_error()); //Gives error if user doesnt exist $check2 = mysql_num_rows($check); if ($check2 == 0) { die('That user does not exist in our database. <a href=add.php>Click Here to Register</a>'); } while($info = mysql_fetch_array( $check )) { $_POST['pass'] = stripslashes($_POST['pass']); $info['Password'] = stripslashes($info['Password']); $_POST['pass'] = md5($_POST['pass']); //gives error if the password is wrong if ($_POST['pass'] != $info['Password']) { die('Incorrect password, please try again.'); } else { // if login is ok then we add a cookie $_POST['username'] = stripslashes($_POST['username']); $hour = time() + 3600; setcookie(ID_my_site, $_POST['username'], $hour); setcookie(Key_my_site, $_POST['pass'], $hour); //then redirect them to the members area ob_start(); header("Location: form.html"); ob_end_flush(); } } } else { // if they are not logged in ?> <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> <table border="0"> <tr><td>Username:</td><td> <input type="text" name="username" maxlength="15"> </td></tr> <tr><td>Password:</td><td> <input type="password" name="pass" maxlength="15"> </td></tr> <tr><td colspan="2" align="right"><center> <input type="submit" name="submit" value="Login"> </center> </td></tr> </table> </form> <?php } ?> </td> <td width="100%"> <table width="100%" cellpadding="10" cellspacing="0" border="0"> <tr valign="top"> <td> <!----- content, insert text and content below ------------------------------------------> <h2>Welcome to Rogers Wireless RMA Portal </h2> <p align="left">Thank you for visiting the Rogers RMA Portal - your one stop solution for all of your device return needs.</p> <p align="left">If you are a corporate customer and you have a defective device that is still under warranty, you can quickly submit the RMA (<em>Returned Merchandise Authorization</em>) information through the portal and go back to your day. Rogers will process your request and your replacement device will be on it's way to you in no time. </p> <p align="left">It's quick and easy to use. Follow these steps to submit your RMA.</p> <p align="left"> 1. Before you start, make sure that you have all the information that you'll need. This includes: </p> <p align="left"> a) your company and contact information, the make and model of the device,</p> <p align="left"> b) the IMEI # for the device </p> <p align="left"> c) a brief description of the issue with the device</p> <p align="left"> d) a description of any steps taken to try to resolve the issue </p> <p align="left"> e) Shipping and contact information </p> <p align="left"> 2. Login to the site with the Userid and password provided by Rogers ESC.</p> <p align="left"> 3. Click on the Process RMA link from the navigation links on the left of the page.</p> <p align="left"> 4. Complete the form being sure to provide complete and detailed information </p> <p align="left"> 5. Click on the submit link to send the information and finish the process</p> <p align="left">You will receive an email from Rogers once the request has been processed. If there is any reason that prevents us from processing the RMA, a Rogers agent will contact you to discuss the issue. </p> <p align="left"> </p> <!---------------------------------------------------------------------------------------> <BR><BR> <BR><BR><BR><BR><BR> <BR><BR><BR><BR><BR><BR><BR> <p align="center"> </p> </td></tr> </table></td> </tr> </table> </body> </html> <?php echo ob_get_clean(); ?> I noticed you had some other ob_starts() in your code. Typically you need only one if you handle things correctly.
  9. I'm assuming that you're attaching these to registered users or players. In that case you'd have the joining table: user_achievements_and_ribbons user_id, achievement_id, ribbon_id
  10. Everything from your first line of the file to the <?php counts as output.
  11. I assume you can write PHP code that hits the database. If that's the case you can query the information_schema for the tables and columns in this database and therefore don't need a management software. If I were in your shoes I'd create a PHP script that dumps the database to text files in a lossless fashion. Then I'd go about writing the code to import these text files into your target database. I'll tell you now though, database migration is a huge pain in the ass.
  12. When money is concerned you can never be too anal about correctness. You never, ever want the blame finger to land on you when money goes missing from the company's coffers. Interestingly enough there doesn't seem to be a simple way to be sure that update statements work correctly. 1) Checking for errors is not enough. Sure if errors occur you can assume the update did not work. But just because there are no errors doesn't mean it worked either! For example if you filtered on the wrong column or value; the query will work without errors but it doesn't do what you wanted. 2) You might be tempted to use a function like mysql_affected_rows() to count the number of rows updated. But that won't necessarily work either! The reason is because it will only return rows that actually changed. If no update was necessary (and the row did not change) it won't be included in the tally returned by mysql_affected_rows(). It seems to me the only sure way to know the rows were updated is to perform count(*) queries before and after and make sure the number of final rows with those values are what you expect to them to be. You'll also want to sacrifice performance when doing financial calculations and make sure the database is not buffering writes to disk.
  13. There is a Sql Server Management application that you can use to administer the database. You may be able to download that on your local machine, assuming MS makes it available for free. Another option might be looking for an open source management software. Once you have it installed on your machine, the next step is to allow non-localhost connections to your database. If your web host doesn't provide a simple interface (like cpanel) to open up remote connections to the database, you might have to contact their support department. Another option would be some form of port forwarding.
  14. echo "Hello!"; /// tell them your message here header('Refresh: 3; url="'.$url.'"'); Unless output buffering with ob_start() has been...uh...started, that won't work. The call to header() must come before any echo's (again only if output buffering is off). I know you already mentioned ob_start() in this thread, I just don't want the OP to get confused.
  15. Ah I see. I didn't know there was a Refresh header and you never mentioned it so I thought all of your references were to Location. At any rate, causing a delay in the PHP script is pointless.
  16. 1) $_SERVER['HTTP_REFERER']; 2) Do one of the following: a) Append something to the url, such as $_SERVER['HTTP_REFERER'] . "?logout=true" and print a message based on that b) Store the logout message in $_SESSION (of course after destroying whats already there) and print a message based on that c) Use a meta refresh -- http://en.wikipedia.org/wiki/Meta_refresh d) Use a javascript refresh -- http://www.tizag.com/javascriptT/javascriptredirect.php Unless you're under some sort of contract (or homework assignment), I'd disagree.
  17. You have an error in your logic. You have errors in your logic.
  18. 1) new_page.html is the page you want to direct them to. He meant for you to substitute the page you want there. 2) The user doesn't need to see a logout message. I'm the user. I clicked logout. I don't need a message saying "You're logged out." By redirecting the user back to the home page, which should have a login form on it, the user will receive confirmation that they are logged out automagically.
  19. My coworker is extremely excited about web sockets.
  20. I watched the History channels "Universe" series and they had a lot of this info in the episode on the sun. TLDR= The sun is eventually going to knock the crap out of our planet and we'll have about 12 hours warning before all sorts of shit stops working. Better hope you're not on any long flights!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.