Jump to content

Ch0cu3r

Staff Alumni
  • Posts

    3,404
  • Joined

  • Last visited

  • Days Won

    55

Everything posted by Ch0cu3r

  1. Do you understand what $dom->getElementsByTagName('descriptions'); is doing? It is trying find tags such as <descriptions></descriptions>, these do not exist in HTML. What specific tag are you looking for, post example html code you're wanting to find and what you want it to do with it.
  2. sitio.com/index.php?option=com_xmap&view=xml&tmpl=component&id=1 returns XML data, not HTML. So the HTML you're echp'ing in the foreach loop wont do anything.
  3. You have spaces padding your field names. This is because of this line $fields=' ` '.implode(' ` , ` ' , $func_get_args).' ` '; It is padding your field names as `(space)field_name(space)`. Change the above line to $fields='`'.implode('`, `', $func_get_args).'`';
  4. Remove the error suppression operator (the @ sign) from infront of any mssql_*() function calls. Set error error_reporting to E_ALL and display_errors to On within the php.ini. Add mssql_get_last_message() to or die() $conn = mssql_connect( "SERVER", "username", "password" ) or die( "Err:conn - " . mssql_get_last_message()); $rs = mssql_select_db( "database", $conn) or die( "ERR:Db- " . mssql_get_last_message()); Post all error messages in full here.
  5. I'm assuming your submitting the form using POST. To preserve the selected values you'll need to see if the current option you are making exists within the $_POST['formProvinces'] array. If it is then add the selected attribute to the <option> tag. <legend> Preferences</legend> <label for='formProvinces[]'>Province (Multiple Select) *</label><br> <select size = 12 multiple="multiple" name="formProvinces[] /> <?php foreach ($PROVINCES as $province){ $selected = ''; if(isset($_POST['formProvinces']) && in_array($provinces, $_POST['formProvinces'])) $selected = ' selected'; ?> <option value="US"<?php echo $selected; ?>><?php echo $province; ?></option> <?php } ?> </select> You need to check the selected options value. The value of the selected option is what is stored in the $_POST['formProvinces'] array.
  6. This is not a PHP Math problem posted in wrong place. But to answer you question There are two problems with the user_data function, You're not constructing the SQL query properly $data=mysqli_query($dbc," SELECT '$fields' FROM `users` WHERE `user_id` = '$user_id'"); Remove the quotes around $fields, this will treat the value of $fields as a string not as individual fields listed within $fields. The other problem is you need to uncomment (remove the //) the last line in user_data function //return $data; Now your script should work as you expect. Also please post your code within code tags (by hitting the <> button in the reply box) This makes your code alot clear to read
  7. To check if _POST data is being sent use printf('<pre>POST %s</pre>', print_r($_POST, true)); If the post data is shown then the problem is in the $obj->write() method If no post data is shown then you'll have to debug the jquery code.
  8. if you're naming the file input fields as file[] then you have a few problems with the for loop that processes the uploaded files. $tempName = $_FILES['file']['tmp_name'][$i]; $i above should be $x. Your for loop increments $x not $i. Next $file_ext = strtolower(end(explode('.', $filename))); use pathinfo to reliably get the file extension $file_ext = pathinfo($filename, PATHINFO_EXTENSION); To check the uploaded files size you need to check the $_FILES['file']['size][$x] variable, not filesize($filename). if ((filesize($filename) > 1048576) && (in_array($file_ext, $allowed_ext) == false)) If you're naming the fields as vinny42 suggests then you'll need to use a foreach loop instead of a for loop. replacing the for loop construct with this foreach construct may work. foreach($_FILES['file']['name'] as $x => $value)
  9. Have you added C:\php to windows PATH variable? mbstirng.dll may rely on other .dll libraries located in C:\PHP. The extension wont be able to find these if php folder is not in windows PATH. Also make sure extension_dir directive is set to the full path to the extension folder (C:/PHP/ext). You may also want to enable display_startup_errors directive so errors are displayed when Apache goes to load PHP. The version of php_mbstring.dll must be the same version that came with your PHP release, using .dll files from different releases of PHP will not work.
  10. The actual PHP code from where the error is coming from. The error is from the file named config.inc.php on line 84. So Post lines 1 - 90 here from config.inc.php, we don't have your code in front of us so we cant tell you what to do other than ask for more details. Before posting code make sure you sensor out any sensitive data, like username, passwords. Do you know where Tools class is located?
  11. Not sure, but you're not closing the <img> tag correctly
  12. Why not post more details about your problem here. This is what the forum is here for. The error is very clear what the problem is, it cannot find the Tools class within the /var/www/siti_consegnati/BestChoice.it/config directory.
  13. if ( $_POST ) will always return true. To see if post data has been sent you'll want to check the $_SERVER['REQUEST_METHOD'] You'll also want to check that $obj->write($_POST); returned false. This method returns false when no data has been added to the database So change if ( $_POST ) $obj->write($_POST); to if ( $_SERVER['REQUEST_METHOD'] == 'POST') { if($obj->write($_POST) === false) { echo 'Sorry, no data added to database'; } else { echo 'data has been added to database'; } }
  14. You'll could add product A to the $_SESSION, for now we'll call this var $_SESSION['recently_viewed']. So when the user is viewing a product, add its data to this variable. $_SESSION['recently_viewed'] = <products data here> To display recently viewed item you'd do something like if(isset($_SESSION['recently_vieweded'])) { // display recently viewed item data here }
  15. Your code relies on the $_POST['name'] value, this is coming from the form you submitted to edit.php. Now it will work fine on the first page as this value is present. But it is not when you click on any of the page links as this value is not being carried over. If you don't pass it back to edit.php $name will be empty and your sql query $sql = " SELECT * FROM budget where NAME=\"$name\" LIMIT ".$sf.",16 ";wont return any data and thus you get the sorry no data found message To preserve the value you'll need to pass the name within your page links to edit.php echo "<a href='edit.php?name=".$name."&page=".$i."'>".$i."</a> "; Now change $name = $_POST['name']; to $name = isset($_POST['name']) ? $_POST['name'] : isset($_GET['name']) ? $_GET['name'] : ''; if(empty(trim($name))) echo 'Name required'; The above code will first check to see if the name has been submitted by _POST (from your form). If it is it'll set $name to that value. If _POST['name'] doesn't exits it'll see if it is in the url (values passed in the url is retrieved using _GET). If that value is found it'll set $name to $_GET['name']. Otherwise it'll set $name to emtpy. The if statement checks to make sure $name is not empty and if it is displays a message saying name required.
  16. Change the html page to a php page (by changing the file extension to .php). Then change the forms submit action to submit to itself. And include the php page below the form using include (like my example above)
  17. So the form and database code are in two separate files? For example the the html form is in form.php and it submits the form to add_to_database.php. But what you're wanting it do is display the form and database results on same page? If so make the form in form.php submit to itself (<form action="form.php" method="post">) Then just include add_to_database.php in form.php where you want the results to appear. Example <?php include 'add_to_database.php'; ?> <form action="form.php" method="post"> // your form fields here </form>
  18. Nothing, as PHP code is not executed within strings. Unless you use eval() echo '<?php echo "danger"; ?>'; Will output <?php echo 'danger'; ?> and the web browser will interpret it as as XML code thought.
  19. First make sure your form has valid html <textarea id="recap" rows="10" readonly></textarea><br /> <form> <select name="order" id="selection"> <option>Shirt</option> <option>Shoes</option> <option>Pants</option> </select><br /> <input type="submit" value="Select"> </form> Then change the <form> tag to <form onsubmit="return clothing(this)"> Now add return false; after xmlhttp.send(); change xmlhttp.onreadystatechange = create() to xmlhttp.onreadystatechange = function()
  20. Well somewhere you're either calling htmlentities(), htmlspecialchars() or another function somewhere is converting the < and > to < and >. strip_tags() will do as it says it do, remove (raw) html markup. If your html markup is <a href="www.google.ce">google</a> then that is not raw html, but html converted to its entities. Does the following $text = '<p><b>Hello</b> <a href="www.google.ce">google</a> World<p>'; echo strip_tags($text); produce the same result?
  21. For a test, comment out the header line, by adding two forward slashes at the start of the header line. Run your code. Do you get the email now? Also make sure you're checking your spam filter too.
  22. Somewhere you're requesting the file twice if it is incrementing by 2 instead of 1. How are you calling the file that creates the image? Where/how are you displaying the image in page_counter.html? Nothing in your code I can see will cause it to increment by 2. I have tested it and it is incrementing fine.
  23. Have you sorted the issue now? as the test.php at peoplespropertyshop.co.uk appears to be working fine now.
  24. It appears it loads the custom fields/values from eb_fields and eb_field_values tables dynamically. How it retrieves the custom field/values is whatever is set in the custom_field_ids column within the eb_events table that corresponds to the current event_id (this is retrieved from JRequest::getInt('event_id')). So maybe add your custom field id to the custom_field_ids column in the eb_events table that corresponds to the current event_id.
  25. You need top check if $softwaresize exists before using it. You can do this using the isset function if(isset($softwaresize)) { // variable exists. We can use it with out error echo $softwaresize; /* listen - new feature */ } Now It'll only echo out the $softwaresize variable if it exists and wont display a notice error for undefined variable $softwaresize. That doesn't make any sense to me. Where is bro aaa and aa coming from?
×
×
  • 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.