Jump to content

Ch0cu3r

Staff Alumni
  • Posts

    3,404
  • Joined

  • Last visited

  • Days Won

    55

Everything posted by Ch0cu3r

  1. Its is lagging because you have an onkeypress event being triggered as the user types into the field. This event is performing an ajax request to update-status.php for every key press Not sure why you want this for when a person is registering to your site? You would only want to do this when a person is editing their own details when they are logged in to their own account. Event then you would not want an onkeypress event, instead an onblur event would be more suitable - this is triggered when a user clicks away from the form field.
  2. Seems to work ok when using the /u pattern modifier and changing a-z0-9+ to be \w+ New regex /(\w+|[^\s\w])/iu
  3. Try using regex $text = 'This is, the text of my String!!! Contain numbers like 200 and other items like %.'; // matches, whole words and number, and splits on non space/word characters preg_match_all('/(([a-z0-9]+)|([^\s\w]))/i', $text, $matches); // see what it matches printf('<pre>%s</pre>', print_r($matches[0], 1));
  4. Have a look at this thread http://forums.phpfreaks.com/topic/11572-multi-column-results/
  5. No, it only outputs the name, email, id etc when the visitor id does change The if statement is comparing the visitor id from the previous row. I set $prev_id to 0 as the initial stating value. At the end of the while loop $prev_id is being set to the current rows visitor id ($row['visitor_id']). After the first iteration of the while loop, it will be checking the current rows visitors id ($row['visitor_id']) with the previous rows id ($prev_id). When they do not match then it will output the name, email and id again.
  6. You need to add logic to your while to prevent the duplicate data from being outputted, example $prev_id = 0; //fetch tha data from the database while ($row = mysqli_fetch_array($query)) { // if the vistor id does not equal the vistor id from previous row, // output vistor id, name and email only once if($row['visitor_id'] != $prev_id) { echo $row['visitor_id']; echo "<br>"; echo $row ['visitor_name']; echo "<br>"; echo $row ['visitor_email']; } // output the neweal dates echo "<br>"; echo $row ['description'] . " expiry date: " . $row['datedue'] . "\n"; // set current rows vistor id to previous id $prev_id = $row['visitor_id']; }
  7. You will need to output the form within the while loop and set the id as a hidden input field. while($linha = mysql_fetch_array($sql)) { $id = $linha['id']; .... echo '<form name="searchform" method="post" action="?a=ok"> <input type="text" name="newrastreio" /> <input type="hidden" name="id" value="' . $id . '" /> <input type="submit" value="Novo Rastreamento" /> </form>'; } When updating the record you get the id value from $_POST['id']
  8. You dont need to modify it. You need to pass the path to your db.json on startup. As Quoted from the github. Change --watch db.json to something like --watch /full/path/to/db.json or use relative path eg --watch ../db.json
  9. Use return in the numRows method public function numRows() { return $this->_statement->num_rows; }
  10. What configuration options did you use for sessions? If you have not configured any options then it most likely is set to never expire. See following pages for config options http://php.net/manual/en/session.configuration.php Also see http://php.net/manual/en/function.session-set-cookie-params.php
  11. Either use group_concat again for the image ids Or instead of using group_concat in the query, when you get the results from the query build an array of results, grouping the images into a sub array. Example code $prep_stmt = " SELECT s.id , s.name , s.description , i.id as image_id , CONCAT(i.image_path, i.image) as image FROM services s LEFT JOIN images i ON i.service_id = s.id"; ... prepare stmt here ... // bind results $stmt->bind_result($id, $name, $description, $image_id, $image); $services = array(); while ($stmt->fetch()) { // store service info in array if(!isset($services[$id])) { $services[$id] = array( 'name' => $name, 'description' => $description, 'images' => array(); ); } // group the service images into a sub array $services[$id]['images'][] = array( 'id' => $image_id, 'path' => $image_path ); } // now loop through and display each service foreach($services as $service_id => $service) { $html = "<tr>\n"; $html .= " <td><input type='checkbox'></td>\n"; $html .= " <td>\n"; $html .= " <a href='' class='name'>{$service['name']}</a>\n"; $html .= " </td>\n"; $html .= " <td class='view_html'>{$service['description']}</td>\n"; $html .= " <td>\n"; // loop image for service foreach($service['images'] as $image) { $html .= 'Image ID: ' . $image['id'] . '<img src="'.$image['path'].'" /><br />'; } $html .= " </td>\n"; $html .= "</tr>\n"; //Add output to array $output[] = $html; }
  12. You cannot pass the binary contents of the zip file to $extract->open. As its expects a filename to be given. So you will need to download and store the zip file on the server and then use $extract->open
  13. Been googling and it is this login script here you are using https://github.com/ivannovak/jpmaster77-s-Login-System- That login script uses the session id as the user id, this is why the userid field is changing upon login If the userid field in the users table keeps changing then this is going to destroy the relationship between the two tables. You have a couple of options set the userid field in the users table to have foreign key constraints to the userid field in the visitors table or insert a new field in your users table, call it id and set it to be auto increment. You would insert that fields value in to your visitors userid field when adding the users personal details.
  14. Is this BitWasp you are using? Their github page clearly states this is not a production ready script, it still being (unactively) developed - Although it does appear to be an abandoned project from googling. We will only help with your own code, not for fixing third party scripts. If you want someone to fix it for you then are free to advertise in our Freelance section.
  15. Umm.. why? Seeing as the userid field is VARCHAR(32) I'm guessing it is being md5 hashed for some reason. This will cause a problem yes
  16. There should be a Best Answer button at the bottom right handside of each post
  17. When you define $name it is defined as (space)sara(space) the elseif will never match due to the name being padded with spaces. == does an exact match. Either remove the spaces or apply trim to $name
  18. mac_gver has explained why the id is not being passed and what changes you need to do your code to fix your issue. If you are stuck I suggest you study the code he linked to, look at line 110 onward to see how he is processing the pagination links.
  19. In that case you do not want to have the visitor id stored in the users table. Instead you should store the users id in the visitors table.
  20. The vistor id is never inserted in to your users table as the variable $vistor_id is not defined in the addNewUser() function, this will be inserting a blank value into the visitor_id column $query = "INSERT INTO ".TBL_USERS." SET username = :username, password = :password, usersalt = :usersalt, userid = 0, userlevel = $ulevel, email = :email, timestamp = $time, actkey = :token, ip = '$userip', regdate = $time, visitor_id = $visitor_id"; This will result in your your JOIN query returning no results. What is the purpose of these two tables?
  21. Could you show us your table structure for the users and visitors tables.
  22. Users on your computer will be able to read your files yes. But someone accessing your website will not be able to see the PHP source within the .php files, they will only see the output. If you do not want users of your computer from accessing your files, then I recommend you change Apaches config (I recommend setup a new virtual hosts) so it serves your websites from your home directory. Then you can set your home directory (or your websites document root directory) file permissions as 0750. This will prevent other users from accessing your files.
  23. The two functions I linked to, their documentation is available in Bulgarian here http://php.net/manual/bg/function.file-put-contents.php http://php.net/manual/bg/function.implode.php
  24. Have go at using the following functions file_put_contents and implode
  25. it is only checking the first row (returned by the query) because mysql_fetch_array() only returns 1 row a time, each time it is called the next row in the result is returned. You need to perform your check within a while loop while($a5 = mysql_fetch_array($r5)) { // perform check here }
×
×
  • 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.