Jump to content

QuickOldCar

Staff Alumni
  • Posts

    2,972
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by QuickOldCar

  1. ternary operator Same as an if/else, shortened
  2. Can't output anything along with gd image display. Pass a value with get to gd script with no additional html output and iframe it. Better off saving images a folder and then linking to them as files. imagepng($image, "/images/".$image_name.".png");
  3. You most likely never got an answer to this because is no best cms because of SEO. Could be similar to asking which cms has the best theme. If any cms has it built in could work fine, mostly all of them have additional plugins or modules to add more seo and fine tune it.
  4. Actually? http://php.net/manual/en/control-structures.foreach.php Can iterate an arrays index of keys and values. If you want more levels deeper needs more foreach or a recursive function made. If you want the underlying of how actually works...an array is storing a pile of data in lists where is a numbered or associated value, parents and childs. An array could be better viewed as a tree pattern of data. Foreach is a way to loop any of those. As for the actual function I assume the php developers keep splitting into each chunk of data using matching patterns within brackets and noting it's specific key and value.
  5. Not all devices and browsers work the same. If can do what you need using css and media queries will be better off. Here's something I did a few years back for a client for saving some sizes dealing with video content areas. <?php if(isset($_COOKIE["screen_width"]) && trim($_COOKIE["screen_width"]) !=''){ $screen_width = trim($_COOKIE["screen_width"]); $screen_width = calc_res($screen_width, 66, 2); $screen_height = round($screen_width / 1.78); }else{ ?> <script type="text/javascript"> var winW = ''; if (document.body && document.body.offsetWidth) { winW = document.body.offsetWidth; } if (document.compatMode=='CSS1Compat' && document.documentElement && document.documentElement.offsetWidth ) { winW = document.documentElement.offsetWidth; } if (window.innerWidth) { winW = window.innerWidth; } var winH = ''; if (document.body && document.body.offsetHeight) { winH = document.body.offsetHeight; } if (document.compatMode=='CSS1Compat' && document.documentElement && document.documentElement.offsetHeight ) { winH = document.documentElement.offsetHeight; } if (window.innerHeight) { winH = window.innerHeight; } if(window.innerWidth <= 800 && window.innerHeight <= 600) { winW="640"; winH="480"; } function setCookie(c_name,value,exdays,domain,path){ var exdate=new Date(); exdate.setDate(exdate.getDate() + exdays); var c_value=escape(value) + ((exdays==null) ? "" : ("; expires="+exdate.toUTCString())); cookie=c_name + "=" + c_value; if (domain){ cookie += "domain=" + domain + ";"; } if (path){ cookie += "path=" + path + ";"; } document.cookie=cookie; } setCookie("screen_width",winW,60,"/",".site.com"); setCookie("screen_height",winH,60,"/",".site.com"); </script> <?php $screen_width = "100%"; $screen_height = "600"; }//end set screen size cookie ?>
  6. No idea if have any current code, the form names and values data types...form method type are using. Use the $_GET['id'] or $_POST['id'] value from your form. If your id's are a digit can check with ctype_digit() Do your query to obtain their website url. Use a header redirect with the url value. header('Location: http://www.example.com/'); exit; Something like this, Do this code top of the script and do not output anything before it. PDO with prepared statements used and written so can modify a bit to your needs, in case need to check something or add more columns. (use your credentials and values of course) <?php if (isset($_POST['id']) && trim($_POST['id']) != '') { $id = $_POST['id']; try { $db = new PDO("dbtype:host=yourhost;dbname=yourdbname;charset=utf8", "username", "password"); $query = $db->prepare('SELECT url FROM providers_table WHERE id = :provider_id'); $query->bindParam(':provider_id', $id); $query->execute(); while ($row = $query->fetchAll(PDO::FETCH_ASSOC)) { $url = $row['url']; if ($url) { header('Location: ' . $url); exit; } } } catch (PDOException $e) { echo "Error: " . $e; } } ?>
  7. PM or email each other personal matters. I don't want to lock the topic in case someone possibly wants to help the OP.
  8. You are correct but seems to work that way for me on linux and windows boxes that way. Seems to work with or without the first slash for directory or file. It still even works going up directories both ways.
  9. Is other code included or prior to this creating the $playlist array. Try doing a print_r($playlist); before the foreach loop and see what the array actually contains. If there is duplicates it's the coding prior and how is fetching or building the array.
  10. If you are concerned with duplicate file names try adding a timestamp to the beginning using time()
  11. Hello Stu, Once you break away from using dreamweaver you will find it gets easier. Ask away.
  12. Have a look at $_SERVER['DOCUMENT_ROOT'] or dirname() If you set the include path and is the correct location is fine. PEAR comes with php as an extension. an example adding the separator so PEAR doesn't toss messages $directory_path = dirname(__FILE__) . DIRECTORY_SEPARATOR; require_once($directory_path . "/include/functions.php");
  13. Try using http://jsonlint.com/ and validate your json
  14. You should use the method type of form such as POST or GET if know it, although REQUEST can work is extra may not need in it. Your biggest issue was the name value has to match. <?php if(isset($_REQUEST['name']) && trim($_REQUEST['name']) != ""){ $BillingSurname = $_REQUEST['name']; } else { $BillingSurname = ""; } ?> <input type="hidden" name="name" value="<?php echo $BillingSurname;?>">
  15. Nobody should be using php 5.2, at a minimum some hosts using 5.4, really should be 5.5+ and php7 is here.
  16. Jacques didn't write the forum software or has the ability to rewrite it, maybe IPBoard will read this. @mikeleege Do as Jacques suggested, not many developers want to make the net even more insecure. If you want to copy/paste code try this tutorial, is a better direction for you to take. https://daveismyname.com/login-and-registration-system-with-php-bp Scootash already explained there is no way to tie a user to a specific or uniquely identify a device. Best can do is use ip's and not reliable. That's why a developer makes a login system to distinguish that user. Limiting the ability to login more than once is not the right path to take, especially via ip's. The session system you have is poorly done, should check if a session for user is set first, is no need to constantly connect to a db and fetch this information if already set in session. If want to secure a page you check if a certain page is only for that user, you can assign them as owner in a database to a specific page. Using page id's and auto-increment in the database is the best way. Can also do something like wildcard subdomains... bob.mydomain.com or user pages mydomain.com/user/bob that can only be viewed by user named bob or admin, the only user besides admin that has ability to make changes. You check the current user with one stored in session.
  17. You should be storing comments in another table and associating it by it's article id, can also assign it's parent comment/reply id. Add whatever relative data you need, but here is a simple table structure comment_id|article_id|comment_or_reply_parent_id|comment_data|comment_timestamp|comment_owner|comment_status Query to see if article_id has any comments, from each of those results query the replies to each comment or reply to each reply. (consider all a comment and belongs under the comments parent id) You can do it all in a single JOIN query but I explained it out above. Do a layout and style however desire, but the data should exist to be able to do that and display in the order they need to be in the correct locations.
  18. As maxxd stated need to see your code. About the hooks, are you adding the action to both admin area and then another the location you desire within the frontend? add_action() add_action('admin_menu', 'admin_menu_function'); add_action('wp_head', 'show_something_in_header_function'); add_action('the_content', 'show_something_in_content_function');
  19. Digital marketing is a more technical term to state is using electronic based media to get the exposure.
  20. As for clearing it can make a href link to a new script, whatever suits your needs...destroy the entire session with session_destroy(), unset any session variables, assign them zero values. Then set a header to return to original referring location <a href="reset.php">Reset</a> reset.php examples <?php session_start(); session_destroy(); header('Location: ' . $_SERVER['HTTP_REFERER']); ?> <?php session_start(); unset($_SESSION['conted']); unset($_SESSION['contper']); header('Location: ' . $_SERVER['HTTP_REFERER']); ?> <?php session_start(); $_SESSION['conted'] = 0; $_SESSION['contper'] = 0; header('Location: ' . $_SERVER['HTTP_REFERER']); ?>
  21. Before trying to use something first check if it exists. You are doing addition on the session values that won't exist the first time or until the first one was set using the form. Can set them to a default value of zero the first view <?php session_start(); if (!isset($_SESSION['conted'])) { $_SESSION['conted'] = 0; } if (!isset($_SESSION['contper'])) { $_SESSION['contper'] = 0; } if (isset($_POST['btn1'])) { $_SESSION['conted'] = $_SESSION['conted'] + $_REQUEST['ed']; $_SESSION['contper'] = $_SESSION['contper'] + 1; echo "El contador de edad va en " . $_SESSION['conted']; echo '<br>'; echo "El contador de personas va en " . $_SESSION['contper']; } ?>
  22. http://www.plus2net.com/php_tutorial/ajax_drop_down_list.php
  23. I usually refer people to ovh.com . Cheaper vps or a bit more serious dedicated servers.
  24. Wrapping with double quotes in the query is exact matches. +(\"Credit Rating\") https://dev.mysql.com/doc/refman/5.5/en/fulltext-boolean.html
  25. No, but it created a few.
×
×
  • 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.