scootstah
Staff Alumni-
Posts
3,858 -
Joined
-
Last visited
-
Days Won
29
Everything posted by scootstah
-
Yes, that's all you need.
-
So you want to add a shortcode to wrap text? Or you want to wrap text before it is parsed by another shortcode?
-
You should leave the exit there, so that the script terminates immediately when the header redirect is called. Otherwise you'd just send the email anyway. On that note, I'm not seeing where you're actually sending an email. You create the variables, but I see no call to mail(). Where are you doing that?
-
So one thing I'm noticing is that the order of the data returned from your query is not the same order that you expect it to be in the code. I see this: if($enroll_data[1]['class'] == 'wobler'), but the 1th index of the data you just showed me is of class "orange".
-
In order for you to be testing the file extension, the file has already been uploaded to a temporary directory, which is enough to be able to use getimagesize() on it. You are literally checking the NAME of the file, nothing more. I can rename "some-malicious-script.php" to "pretty-flowers.jpg" and completely destroy your server. See the problem with that?
-
Assuming you just need to host the PHP and import the database, you should be able to get it going on a shared hosting account. You'll be able to set everything up with easy web-based admin tools. Or, you can pay for a managed server and you might be able to get help that way.
-
Yes, but I already gave you the code to get the mime type from getimagesize(). What problem are you having? The way you are trying to do things will allow someone to upload anything they want to your website and potentially compromise the whole server. Don't do it.
-
$count=mysqli_num_rows($result);What is the value of $count? Are you getting a query error? Check with: $result=mysqli_query($dbC, $sql) or die(mysqli_error($dbC));Also, you're not storing your passwords securely. You should be using a secure hashing algorithm with salts. PHP has a new function for it on version 5.5. If you don't have PHP5.5, there is a backwards compatible library that is good as well.
-
You're using a real key here, right? $secret_key = 'my_private_key_lives_here'; If not, you need to register your site with Google if you haven't already, and get a real key to send in the request. https://www.google.com/recaptcha/admin Also, what is now happening? Is the script stopping here? if(validCaptchaV2() === FALSE) { header('Location: captcha_unsuccessful.html'); exit; }
-
Can you show me what the output of this is: while($data = mysql_fetch_assoc($enroll_query)) { $enroll_data[] = $data; } echo '<pre>' . print_r($enroll_data, true) . '</pre>'; exit; No, I mean to use this forum's BBCode code tags when you post code snippets. Just wrap the code you post in code tags, like this: code here EDIT: go with what CroNiX said since you're probably using the WYISWYG editor See how the code I posts is all in a nice pretty syntax-highlighted box, and yours is a huge wall of text?
-
Handling PDF documents on the web: watermarks, print access, etc.
scootstah replied to BuildMyWeb's topic in Applications
If you let your users view it, there is no way to prevent them from copying it. Even if you convert it to an image there are OCR tools which can just convert it right back to text. -
It's likely that your captcha function is not working properly due to using file_get_contents() on a URL. It is probably not returning anything. The reason is because there is a PHP setting called allow_fopen_url that must be enabled in order to use a URL in some functions, including file_get_contents(). This is a somewhat dangerous setting and is usually disabled by default. Here is an alternative using CURL: function validCaptchaV2() { $secret_key = 'my_private_key_lives_here'; $ch = curl_init(sprintf( 'https://www.google.com/recaptcha/api/siteverify?secret=%s&response=%s&remoteip=%s', $secret_key, $_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR'] )); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $resp = curl_exec($ch); curl_close($ch); if (($answer = json_decode($resp)) !== null) { return $answer->success; } return false; }
-
There is no "bridge". AJAX is simply your browser performing a request to your server, just like you would do if you hit refresh or navigated to links. You would need a separate PHP script that can accept a search parameter, and return a JSON encoded list of results. Yes, they're called wildcards. There's information here: https://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html You'd probably do something like: SELECT * FROM fruits WHERE name LIKE 'a%';
-
So are you still getting "Fatal error: Call to undefined function: json_decode()" after changing to PHP 5.5?
-
Please use code tags. mysql_query("update schedule set ".$field_name." = '".$_POST['infant_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='infants' "); mysql_query("update schedule set ".$field_name." = '".$_POST['wobbler_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='wobler' "); mysql_query("update schedule set ".$field_name." = '".$_POST['orange_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='orange' "); mysql_query("update schedule set ".$field_name." = '".$_POST['green_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='green' "); mysql_query("update schedule set ".$field_name." = '".$_POST['red_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='red' "); mysql_query("update schedule set ".$field_name." = '".$_POST['blue_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='blue' "); mysql_query("update schedule set ".$field_name." = '".$_POST['purple_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='purple' "); mysql_query("update schedule set ".$field_name." = '".$_POST['yellow_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='yellow' "); mysql_query("update schedule set ".$field_name." = '".$_POST['silver_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='silver' "); mysql_query("update schedule set ".$field_name." = '".$_POST['school_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='clubhouse' "); $enroll_query = mysql_query("select * from schedule Where employee = 'Enrollment' and CURDATE() between start_date and end_date and schedule_track_id = '".$track_id."' "); while($data = mysql_fetch_assoc($enroll_query)) { $enroll_data[] = $data; } $new_field_name = $field_name.'_s'; // This is the display section// <td align="center" valign="top"><table width="90" border="1" cellpadding="0"> <tr> <td height="200" align="center" valign="middle"><label for="infant_ch"></label> <select name="infant_ch" id="infant_ch"> <?php if($enroll_data[0]['class'] == 'infants') { $data_field = $enroll_data[0][$field_name]; for($i=0;$i<=30;$i++) { ?> <option value="<?php echo $i; ?>" <?php if ($i==$data_field) { echo "selected";}?>><?php echo $i; ?></option> <?php } } else { for($i=0;$i<=30;$i++) { ?> <option value="<?php echo $i; ?>" ><?php echo $i; ?></option> <?php } } ?> </select></td> </tr> <tr> <td height="200" align="center"><label for="wobbler_ch"></label> <select name="wobbler_ch" id="wobbler_ch"> <?php if($enroll_data[1]['class'] == 'wobler') { $data_field = $enroll_data[1][$field_name]; for($i=0;$i<=30;$i++) { ?> <option value="<?php echo $i; ?>" <?php if ($i==$data_field) { echo "selected";}?>><?php echo $i; ?></option> <?php } } else { for($i=0;$i<=30;$i++) { ?> <option value="<?php echo $i; ?>" ><?php echo $i; ?></option> <?php } } ?> </select></td> </tr> <tr> <td height="200" align="center"><label for="orange_ch"></label> <select name="orange_ch" id="orange_ch"> <?php if($enroll_data[2]['class'] == 'orange') { $data_field = $enroll_data[2][$field_name]; for($i=0;$i<=30;$i++) { ?> <option value="<?php echo $i; ?>" <?php if ($i==$data_field) { echo "selected";}?>><?php echo $i; ?></option> <?php } } else { for($i=0;$i<=30;$i++) { ?> <option value="<?php echo $i; ?>" ><?php echo $i; ?></option> <?php } } ?> </select></td> </tr> <tr>Is your query failing? Try:$enroll_query = mysql_query("select * from schedule Where employee = 'Enrollment' and CURDATE() between start_date and end_date and schedule_track_id = '".$track_id."' ") or die(mysql_error());
-
Please do the following: 1. Visit your site with Google Chrome. 2. Press ctrl+shift+i, or click the hamburger menu on the top right of Chrome and go to Tools -> Developer Tools. 3. Click the Network tab, and then click the "Clear" icon right underneath the Network tab. 4. Trigger your AJAX call, so that it appears in the Network area. 5. Click on the new entry. 6. On the right hand side of the Network pane will be detailed information about the request to your server. Under request headers, it should list the cookies that were sent with the request. Please verify that your session cookie is being sent. Here is an example:
-
The JSON functions were added in PHP 5.2. Make sure that you are not running an older version of PHP. Follow this to change your default PHP version: http://help.1and1.com/hosting-c37630/scripts-and-programming-languages-c85099/php-c37728/change-the-default-version-of-php-in-the-control-panel-a792330.html
-
Who is your host? I'd suggest contacting them and see if they can fix it.
-
And yet you still haven't told us what the problem is. We can't see your computer monitor. You need to tell us what you're seeing.
-
arent Cake and ORM folders? They may be folders in this case, but namespaces do not have to have a matching directory structure. In order to follow the PSR-0 standard, namespaces do have to have a matching directory structure. I'm not sure if CakePHP follows PSR-0 or not.
-
Try putting your full domain on the AJAX method. Make sure to be consistent with the www. prefix. If you initially load your site with www., make sure to include it. If you don't, make sure not to include it.
-
Accessing global in constructor or parent class
scootstah replied to jbonnett's topic in PHP Coding Help
Can you upload your XDebug profile output file? Also, what is that block of code from? Are you extending that class anywhere? -
How to catch all PHP errors in CodeIgniter Framework
scootstah replied to lilmer's topic in Frameworks
You can use register_shutdown_function to capture (most) fatal errors. -
You can't. Make the unique ID long and generate it with a cryptographically secure random method, and you're good to go. You can do things like deactivate the token once the person views it, or require they also type in their email address when they visit the page. This will significantly reduce the chances of someone guessing a token. But, if you use a long token, the chances of someone guessing it correctly are astoundingly small anyway.
- 1 reply
-
- 2
-
Y-m-y is 4 digit year, 2 digit month, 2 digit year. You want Y-m-d