Jump to content

Ch0cu3r

Staff Alumni
  • Posts

    3,404
  • Joined

  • Last visited

  • Days Won

    55

Everything posted by Ch0cu3r

  1. No. But you still need to give the correct password to phpmyadmin. You misunderstood what requinix meant by alter table. He meant users should not be able to alter the structure of the table (ie, add/remove columns from the table). A simple read/write user should only be allowed todo select, insert, update and delete operations.
  2. Overall your code is fine in filemultiple.txt. The issue is to do with line 68 through to line 70. This is because the code will upload the first file and then it will redirect the user to photos.php after its details have been inserted into the database. You want the code to continue looping over the remaining uploaded files. To prevent this you need to move these three lines so they are not inside the for loop. So line 68 through to line 71 should read as follows } // this closes the for loop. We do want the following lines inside the loop mysqli_close($db_conx); header("location: ../photos.php?u=$log_username"); exit();
  3. Then that rewriterule is most likely interfering with your other rewriterule. Try changing your .htaccess to. I tested with the following and it worked well for me RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^id/([0-9]+)/name/([a-zA-Z-]+)/?$ test.php?id=$1&name=$2 [L,QSA] # this should always be the last rewrite rule! RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)$ $1.php [L]
  4. I am not familiar with C so not sure what the C99 standards are. I only wrote the regex so it matched the example function declarations you had posted.
  5. I have a feeling the .htaccess is not being read. Add some garbage text to the htaccess file. You should get a 500 Internal Server error when you trying to access your site. If no error is shown then Apache is not reading the htaccess file. Can you tell me how you installed Apache?
  6. Yes that is what you will need to do. If the id should be a number then you must make sure it is a number before you use it in your query. You can use the function is_numeric to check to see if it is in a number. Then I would use intval when you to use it. if(isset($_GET['id']) && is_numeric($_GET['id'])) { $id = intval($_GET['id']); ... } else { // id is not provided or is not numeric } If the id is not an integer then do not use it. Either issue a 404 error message or a generic error message informing the user the id is invalid
  7. Tested this should work fine now RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^id/([0-9]+)/name/([a-zA-Z-]+)/?$ record.php?id=$1&name=$2 [L,QSA] Make sure the files record.php and .htaccess are both in the same directory.
  8. Ohh dear. just realized your url is wrong still, Did not notice this earlier. It should not start with record.php. It needs to be like this <a href="/id/<?php echo $id; ?>/name/<?php echo $name; ?>">Link to record page</a> And change name=$1 to name=$2 in the htaccess. Otherwise the id will passed as the category name.
  9. Include it in the the character class for the name ../name/([a-zA-Z-]+)/$
  10. Works fine for me. Use curl_error to see why you are getting false
  11. Try // header file $linesInCode = file('yourheaderfile.h'); // function data will be stored in this array $functions = array(); // loop over the lines in the file foreach($linesInCode as $line) { // if a function signature has been found if(preg_match('~(\w+)\s+(\w+)\(([^\)]+)\);~i', $line, $match)) { // grab the function type, name and parameters into an array $function = array(); $function['type'] = $match[1]; $function['name'] = $match[2]; $function['params'] = explode(',', $match[3]); // split the function parameters by the comma // append function info to $functions array $functions[] = $function; } } // display structure of $functions array printf('<pre>%s></pre>', print_r($functions, 1)); Output with your test code Array ( [0] => Array ( [type] => void [name] => initContext [params] => Array ( [0] => Context *pt ) ) [1] => Array ( [type] => void [name] => deleteContext [params] => Array ( [0] => Context *pt ) ) )
  12. Why are you doing this to the passwords? $currentpass = htmlspecialchars($currentpass, ENT_QUOTES); $currentpass = mysqli_real_escape_string($con, $currentpass); $currentpass = strip_tags($currentpass, ENT_QUOTES); $currentpass = filter_var($currentpass, FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_HIGH); $currentpass = htmlentities($currentpass, ENT_QUOTES); This is not needed. There is no need to sanitize the password provided by the user. You should convert it to a hash as soon as you get their password. The hash will only contain alphanumeric characters. Shouldn't you be passing $currentpass to the hash function here? $currentpass = hash('ripemd128', $cpass); Where is the variable $password defined? $oldpasswd = "SELECT password FROM users WHERE username='$username' AND password='$password'"; You only have variables called $cpass, $currentpass and $newpass defined
  13. This is because curl is returning this error message (returned from calling curl_error) When you use https:// urls curl needs to verify the security certificate. By default curl does not do this. You can set the CURLOPT_SSL_VERIFYPEER option to false to get around this. But that is not the correct solution. The correct way is explained here
  14. The rewriterule you posted will not match the url for the record page. The rewriterule will need to be RewriteRule ^id/([0-9]+)/name/([a-zA-Z]+)/$ record.php?id=$1&name=$1 [L,QSA] Note, only names that contain only letters will be matched. If the user has non-letter characters their name then the rewriterule will fail again.
  15. I see no issue with that code. It returns the the lat and long for me after I add echo "$lat, $long"; What does the following return? printf('<pre>%S</pre>', print_r($response, 1));
  16. Yes you can but then mod rewrite will not know which rewriterule will apply to those urls (for example it will not know that /shrubs should go to the rewriterule for cat.php or /amalanchier_canadensis should go to the rewriterule for product_info.php). It currently only knows which rewriterule applies due to the the C_ and P_ prefixes. If you don't like the C_ and P_ prefixes then maybe change your urls to something like site.com/category/shrubs site.com/product/amalanchier_canadensis
  17. Yes. You will need to edit your (HTML/PHP) code so your urls are in the new format. mod_rewrite does not edit the urls for you. mod_rewrite is used to map the fake urls site.com/P_namehere to your old url site.com/product_name.php?name=namehere
  18. Provided the constant _LICENSE_KEY_ is set to the string UNEMEXADUWEWUFENAWUGAD then that line of code you posted should be setting the $name variable to the value of that session variable. When are you using print_r? Directly before the use of that session variable? Do you have error reporting enabled or have you checked your servers error logs?
  19. This is no what mod_rewrite does! You have to change the links yourself to the new url format.
  20. This is because this else is in the wrong place. else{ echo '<div class="signals"><p class="bg-warning text-center warning"><button type="button" class="close" aria-label="Close"><span aria-hidden="true">×</span></button>INVALID USERNAME OR PASSWORD again</div></p>'; } You have have after the if/elseif strcmp statements. It should be after the if (password_verify($password, $hash)) block. if(isset($_POST['login'])) { $username = stripslashes($_POST['username']); $password = stripslashes($_POST['password']); $stmt = $pdo->prepare("SELECT password FROM table WHERE username=:username"); $stmt->bindValue(':username', $username, PDO::PARAM_STR); $stmt->execute(); if($stmt->rowCount()<1) { echo '<div class="signals"><p class="bg-warning text-center warning"><button type="button" class="close" aria-label="Close"><span aria-hidden="true">×</span></button>INVALID USERNAME OR PASSWORD</div></p>'; } else { $password = $_POST['password']; list($hash) = $stmt->fetch(PDO::FETCH_NUM); if (password_verify($password, $hash)) { $_SESSION['username'] = $username; $status1 = "COMPLETED"; $status2 = "UNCOMPLETED"; $stmt = $pdo->query("SELECT status FROM table WHERE username ='$_SESSION[username]'"); $check = $stmt->fetch(PDO::FETCH_ASSOC); $status = $check['status']; if(strcmp($status, $status1) == 0) { header("location: completed/index.php"); exit(); } elseif(strcmp($status, $status2) == 0) { header("location: uncompleted/index.php"); exit(); } } else { echo '<div class="signals"><p class="bg-warning text-center warning"><button type="button" class="close" aria-label="Close"><span aria-hidden="true">×</span></button>INVALID USERNAME OR PASSWORD again</div></p>'; } } }
  21. It would be helpful if you could post this array structure
  22. $rows['last_post'] contains a timestamp you can pass it as the second argument to date to convert it to a english readable format.
  23. Basically you query is failing and is not returning a result resource (this what mysql_fetch_assoc requires, hense the error message). The solution is to add error checking tn your code. You will find many topics discussing this exact issue if you search your error message on this forum.
  24. Yes. I know that. What I want you to do is post the full HTML structure (including your CSS code) by right clicking the page and selecting view source. I am not interested in your PHP code as I said earlier is not the cause of the problem. I have a feeling it something in the HTML/CSS code which causing the ads to be displayed on top of each other which is why you are only seeing one "ad" being shown.
×
×
  • 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.