Jump to content

QuickOldCar

Staff Alumni
  • Posts

    2,972
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by QuickOldCar

  1. Not enough of your code to tell exact. You do that within your loop. while($row=...................){ if($row('id') == $post_id){ echo "trending"; //$trending = true; } }
  2. Something crashed or server closed while was changing records mysql, need to do a repair on the table. http://dev.mysql.com/doc/refman/5.7/en/repair-table.html In phpmyadmin can checkmark the table and below is a dropdown that can select repair. If fails try the commandline and repair option, in some cases USE_FRM works better.
  3. You ever notice popups and ads always seem to work though?
  4. Possibly the other indexes created via the script you posted in past. To drop indexes...In phpmyadmin click the structure tab and scroll below, click the x on any no longer want.
  5. Change the users mid in the following url. Can get the mid from hovering a users name, is in the url for profile page. Me: http://forums.phpfreaks.com/index.php?app=core&module=search&do=user_activity&search_app=forums&mid=101319&sid=3713a05141dd04fe9e415b769bccc6c6&search_app_filters[forums][searchInKey]=&userMode=content You: http://forums.phpfreaks.com/index.php?app=core&module=search&do=user_activity&search_app=forums&mid=179806&sid=3713a05141dd04fe9e415b769bccc6c6&search_app_filters[forums][searchInKey]=&userMode=content Jacques: http://forums.phpfreaks.com/index.php?app=core&module=search&do=user_activity&search_app=forums&mid=167590&sid=3713a05141dd04fe9e415b769bccc6c6&search_app_filters[forums][searchInKey]=&userMode=content EDIT: The "find content" is easier
  6. If have to create and remove tables and indexes should look into database normalization Create the index once and it keeps updating to the current data.
  7. Furthermore with your script mysql_* functions are deprecated, suggest using pdo with prepared statements. Using unescaped values directly into a query could lead you to an sql attack. Check if post names are actually set and not merely the form was submitted. Those post values are not blank, data type you expect before using them. EDIT: At a minimum use the mysql_real_escape_string() function $from = mysql_real_escape_string($_POST['from']); $to = mysql_real_escape_string($_POST['to']);
  8. Could be php script is timing out. Can set the timeout limit in php.ini: max_execution_time = 600 .htaccess: php_value max_execution_time 600 top of the script: ini_set('max_execution_time',600);//in seconds,10 minutes Can set to 0 for unlimited if want to see if completes or a special circumstance you want to ensure continues. I suggest not setting to 0 entire server. This doesn't make much sense.... You don't create an array but then add to it in the loop with [], The $rows array will always have data you hard coded. Lower you are checking for a variable is not blank. Try this. <?php ini_set('max_execution_time',600); //in seconds function getbetween($string, $from, $to) { $content = explode($from, $string); //print_r($content); $seccontent = explode($to, $content[1]); return $seccontent[0]; } if (isset($_POST['submit'])) { $rows = array(); //define empty array $from = $_POST['from']; $to = $_POST['to']; $query = "select ticker, date_dt, open, high, low, close, wap, os_shares, ttq, total_trades, del_qty, sales, profit, op_assets from `stock_history` where date_t<='$to' and date_t>='$from'"; $sql = mysql_query($query); if (mysql_num_rows($sql) > 0) { //first array record created only if data returned from query $rows = array( "ticker", "date_dt", "open", "high", "low", "close", "wap", "os_shares", "ttq", "total_trades", "del_qty", "sales", "profit", "op_assets" ); while ($list = mysql_fetch_assoc($sql)) { $rows[] = $list; //add additional records to array } } if (!empty($rows)) { //check not empty array, now should only do if is actual data from query $file = fopen("stock_history.csv", "w"); foreach ($rows as $row) { fputcsv($file, $row); } fclose($file); echo '<a href="stock_history.csv" download>download</a>'; } } ?>
  9. I may as well mention http_build_query() to properly build the query string.
  10. I'm not sure what your redirect function does. If you use header(), do an exit; after so the rest of code does not continue. Seems to me it's doing this rule constantly and passing empty p parameters. Here is... $page_url_rewrite = substr(rawurldecode($_SERVER['REQUEST_URI']),1); $_SERVER['REQUEST_URI'] will hold the full request path including the query string redirect($config['server_protocol'].$config['server_name'].'/?p='.$page_url_rewrite); Going by your rules will add the p parameter and then also any directory plus additional query string $page_url = request_var('p', ''); //what is request_var() function doing? $page_url is defined as being set and blank, why add this if not using it? The $_GET or $_REQUEST array contains the parameters and values current in the url.
  11. Honestly the vanilla wordpress versions are not something want piles to be managing across your server. Can enable the wordpress multisites and have an enormous amount of more control with some very important additional plugins. When talking "professional hosting"...something like a virtualization manager using KVM, OpenVZ, Xen or VMWare. Hosting virtual OS, virtual dedicated servers, virtual private servers. Account management, help tickets and support, cpu, memory, bandwidth, storage limitations. Client picks an OS, installs own server or turnkey package Client can only have access their own containers Waaaay back I hosted using hypervm and kloxo. Required centos. Was never an easy thing to do then or even now, be prepared to get schooled with all this. Hard to find the perfect for everything and flaw free solution.
  12. Will be blunt, it may be beyond your ability? Am not trying to be rude, just realistic about this. It's not a simple or small application. Get someone who knows what are doing and save yourself an enormous amount of time. You have an error_log file, try there first Move onto any other error logs...for example the log files for the server stored in apache and mysql folders. Windows or Linux based server? Locations for these will vary depending the operating system and then even some distro's. Follow along what has in this link, will give you some information will need about your configuration. http://php.net/manual/en/function.phpinfo.php Make a file and paste this code within. Name this phpinfo.php and visit this new script in the url. Trying to run in a local server? http://localhost/phpinfo.php Have a qualified server online? http://yourdomain.com/phpinfo.php <?php phpinfo();?> Some information how you managed to have this? Was there ever a time was error free and worked? Made specific for you? Found on the roadside like an abandoned puppy and kept it? All of a sudden not working? Server updates or new host then stopped working? Would be so many questions... If felt like opening some files in an editor to make some changes like a new domain or file locations for the application...try notepad plus If you have error reporting enabled and had any specific errors feel free to post here as that could help narrow down issues. If you post a huge error log file some may not sift through it. Again..just going by how you asked the question...should probably hire someone that does this. We have a wonderful for hire jobs section .
  13. Single = to assign, double == to compare if equal, triple === to compare if equal and also same type http://php.net/manual/en/language.operators.comparison.php
  14. You would build a form and then to make easier use phpmailer to send the email.
  15. You are dealing with a large amount of data. I would first ensure you have the tables properly indexed. http://dev.mysql.com/doc/refman/5.7/en/create-index.html
  16. PHP is totally different different. PDO is a database wrapper allowing you to connect and manipulate a database. Similar to mysql or mysqli. Mysql functions are deprecated and removed in new versions of php.
  17. If post some sample data each database may be able to get more help. What should have is something like this in the end to compare train number, station number/location arrive, station number/location depart, arrive time, depart time
  18. You may have to trim if is saved as a space in database SELECT * FROM `schedules` WHERE `clientID` is NULL
  19. Do another query to that table Written so will only populate array if are results, otherwise is an empty array. I didn't know the actual name of your table so change that. $ar = array(); $sql = "SELECT offense_comment FROM comments_table"; if ($result = $conn->query($sql)) { if (mysqli_num_rows($result) > 0) { while ($row = $result->fetch_assoc()) { $ar[] = $row['offense_comment']; } } }
  20. Just for the record a user can delete a cookie file or gets deleted when closing browser. If is something you want to control and not the client use session
  21. There is just so much to explain and write about this topic. I sent you a PM and willing to give you the grand tour through teamviewer on my server of how I do it. It would be easier to explain and show it. A lot of people use oauth for their api security but am not too sure about it's current security the latest version. I build my own REST api's. The way I go about it is to make a front door script first. This would be the api.myserver.com , api.myserver.com/script/ , api.myserver.com?app=cool_app_name address or however would like to structure it. Will do all checks needed such as check if is a valid public or private key, use that key to query and find that user, if user paid up or not, domain protection and so on. If all the above criteria is met you would include your application script so they can use it, otherwise access denied message. For api systems I usually use json responses as default. Since is a REST design can do multiple header requests for which format a client would like to use. If the client wanted something like xml or html, I would fetch the json file and output their format choice. I usually cache json files to eliminate excessive usage. If no cache file exists would get live data...creates the new json cache file, otherwise use the data from json cache. Is an expire time on the file. To answer some of your questions: You would need a user registration and login system Once user pays you assign them a randomly made hashed key incorporating something such as a user id or username as salts to ensure is unique, store that under their users account in the database. You have another column for that user in your database if payment is made or not using 0/1 or n/y values.
  22. You would want to do the row count for this query $res = mysql_query("SELECT * FROM article LIMIT ".$per_page." OFFSET ".$offset); The $allrecords is being used to create pagination links all records with no offset or limit. Also check row like this...a number. if(mysql_num_rows($res) < 1){ header("Location: https://localhost/pagi/articles.php"); exit; } Can link back to the main script since you already set page to 1 if not set
  23. If is no result mysql query or row count is less than 1...do a header redirect to url with a ?page=1 Don't forget to use exit;
  24. Live online server not local. Designate a main local server with a local address changing hosts file and servername Any additional stations always connect to the local main server. These wouldn't require local servers installed. When has internet... local main server can communicate to the live server in the background and make any updates. Since all other stations access just the one main local server should work out well. Since is just one server syncing should simplify it all. I suppose the data storage is up to you. I would use mysql the live server and pass json files using curl with a cron job from the main local server. The main live server can check for any new files a cron job and update accordingly. I could mention sqlite but I don't like the file locking for writes while also trying to read. The alternate would be to install local servers every machine and do updates in the background to the live server and using cached json. Don't really know if this is a single or multiple clients pos, how many stations and amount of work setting up. Client computers puke a lot so is probably best to do less installs each one. In that same respect is hard to just rely on a single computer as well. But could always set up a backup server syncing using copy commands. There is remote mysql options in which do not need multiple copies same database. I would never copy the mysql data files directly and always run through a process for newest data with timesstamps and checks.
  25. Not all browsers work the same. You can try using media queries and detect if is safari browser make a change to your css.
×
×
  • 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.