Jump to content

briangroce

Members
  • Posts

    17
  • Joined

  • Last visited

Everything posted by briangroce

  1. I have narrowed this down a little bit. It seems that until I visit the direct url with the SSL on in (which registers that on my computer I guess?) I cannot store any $session variables (including the $user) The variables are stored on that page, but as soon as it goes to a different page, those variables are not accepted. I tested this using: $session->hello = "Hello World"; // Placed on the first page echo $session->hello; // Placed on the second page I get no output on the second page.
  2. horst, Thank You for your reply! I had a script in the htaccess file similar to that, but your thoughts got me thinking so I searched Google for edits I could make in the htaccess file. I came across this: RewriteCond %{HTTPS} !=on RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] Forcing the request to be a https like this seems to work great! My only problem now though is that it acts like the certificate isn't actually processed or downloaded when the request comes through the iFrame. The site doesnt work when you look at it through the iFrame, but if I visit the URL directly, it gives me no message about trusting, etc... then when I go back to the iFrame it works. So basically, I have to visit the direct URL to get the certificate to take effect. Has you ever come across this? - Brian
  3. Ryan, Thank your for your response. I went ahead and did that and it fixes the problem I was having of accessing the $user. I am having another problem though... This script does not automatically log some users in. Processwire logs the user in, then redirects to a page but thinks it is still a guest. I have repeatedly solved the issue by visiting the child site directly (https://www.childsite.com) and the site comes up with a request that wants you to manually "Trust" the SSL certificate. If I manually trust it and return to the parent site, it automatically logs in no problem. The SSL certificate is for https://childdomainname.com and not https://www.childdomainname.com. The browsers accepts the certificate for the non www version. It seems that maybe somewhere, the site is trying to access the www version and is being blocked for not having a valid SSL for it. Can I make ProcessWire always use https://childdomainname.com and is it is possible that it might be trying to access the www version at some point? Thank You for your help! Brian
  4. Hi guys, I am having trouble with a script on a website I built. Here is the scenario: The site that I built (in ProcessWire) runs inside of an iframe on a page within a members only section of another website. I'm going to call the Members Only site (not ProcessWire) that is holding the iframe the parent site. I will call the ProcessWire site that I am working on that runs inside of the iFrame the child site. When a user logs into their account on the parent page, they can navigate to a "Tools" page. This tools page has the child site running in an iFrame. The parent site sets a few variables and submits it to the child site as $POST. The child site should take that post data and lookup a user. If it finds the user in ProcessWire matching that same information, it needs to log them in and redirect them to a dashboard page. Here is the script on the parent site that sends the variables: <form action="https://domainnamehere.com" method="post" target="section"> <input type="hidden" name="usid" value="Identifier Here that Relates to PW died" /> <input type="hidden" name="firstname" value="Brian" /> <input type="hidden" name="lastname" value="Groce" /> <input type="hidden" name="email" value="Email Address" /> </form> <body onload="document.forms[0].submit()"></body> <iframe id="section" name="section" src="about:blank" frameborder="0" scrolling="no" style="width:100%; min-height:1600px; height:3000px; margin 0 auto"></iframe> On the ProcessWire page, here is what the code looks like: $asmUserID = $input->post("usid"); $email_address = $sanitizer->name($input->post("email")); if ($asmUserID!="") { if ($session->login($email_address, $asmUserID)){ if ($user->id!="40") { if ($user->active) { $url = $pages->get("/dashboard/")->url; } else { $url = $pages->get("/account-setup/")->url; } header("Location: ".$url); // $session->redirect($url); } } else { if ($user->isLoggedin()) {$session->logout();} $changePass = $users->get($email_address); if ($changePass->id!="") { $changePass->setOutputFormatting(false); $changePass->pass = $asmUserID; $changePass->asmUser = $asmUserID; $changePass->save(); $changePass->setOutputFormatting(true); } else { if ($email_address!="") { $changePass = new User(); $changePass->name = $email_address; $changePass->asmUser = $asmUserID; $changePass->pass = $asmUserID; $changePass->membership_level = $pages->get(95165); $changePass->addRole("member"); $changePass->save(); } } if ($session->login($changePass->name,$asmUserID)){ if ($user->active) { $url = $pages->get("/dashboard/")->url; } else { $url = $pages->get("/account-setup/")->url; } header("Location: ".$url); // $session->redirect($url); } } } I am trying to find the user in ProcessWire, then log them in. I want to check to make sure the user is not the guest, then redirect them to the page. If login fails, I want it to change the password to the correct value, then log them, check if it is the guest, then redirect. If that still fails, then ProcessWire needs to create an account, log in, then redirect. This is working fine for many people, but some people are having trouble getting ProcessWire to let them in. There are a few things that I noticed. I noticed some inconsistencies on some people browsers with SSL Certificates. We need to manually "Trust" some of the SSL certificates and it worked better. Also, sometimes when you visit the parent site and the child site is loaded nothing happens, but if you reload the page, then it redirects you like expected. I have found that when I do this: if ($session->login($email_address, $asmUserID)){ if ($user->id!="40") { ProcessWire is not giving me access to the $user variable that quick. Is this possible? Also maybe the $session->redirect() is not working. I know this is a lot, but any help/suggestions would be GREATLY appreciated. Thank You, Brian
  5. Hi Guys, I am looking for a ProcessWire expert that can help me write a script to log in users. I know this sounds like something super simple, but I am having trouble with it. Basically, in this actual situation, the Processwire Application is running inside of an iFrame within a members only area of another site. When someone accesses the page where the Processwire iFrame is, Processwire needs to automatically log that user in and redirect to a page in Processwire. If the user does not exist, it needs to create a user. This particular task is as usual something that I need very quickly. If interested, there will be other tasks to be done as well. Let me know if you are interested, Thank You, Brian
  6. apesia and ryan, Thank you for your thoughts. I took a look at those just now, but it is going to take me a while to wrap my head around what those do... They look cool, but I'm not sure how to implement that. Ryan, I think is what I might do, then when the app really does need additional help, I can implement some sort of system that helps manage it. The only thing that concerns me with the overlap is that I will need to overlap quite a bit to make sure that I don't miss anything. Also, I want to get the information updated as fast as possible. hopefully it at least will have everything updated 1 time per hour... Another thing that I thought about using once there are people using the application is the LazyCron module, that might help speed things along as long as I can put something in the code that regulates requests to Amazon (because they will only allow a certain amount per sec and per hour) Anyhow, I am going to run with these suggestions and see what I can put together. Thank you guys!
  7. Hi guys, So, I've been working with ProcessWire quite a bit now and have pretty much transferred most all of the development work that I possible can to PW and it is doing a GREAT job! It is so easy to do complicated tasks. I have a new project that I am working on. I am building some integrations from the Amazon MWS SDK. I have built a queue system to send emails through Amazon's Simple Email Service API so that way the email is coming from their servers... The purpose of the application for now is to store new orders that come in to a sellers account, When that order ships, I want to trigger an email for different time periods (24 hours later, 48 hours later, etc...) Anyways, I have set up 3 pages in ProcessWire. Scheduled Emails Email to Send Sent Emails I have 3 Cron Jobs Set Up A script that runs every 10 minutes and grabs all orders that were placed in the last 15 MINUTES from an Amazon Sellers account and stores it under a page in ProcessWire that I call "Orders" if it isn't there already. If it finds an order that has just shipped, it looks at another script that gives instructions about when to send an email to that person. After this, the script creates a page under "Scheduled Emails" with a few fields including the email that should be sent and the time that it should be sent. The second Cron Job is checking the Scheduled Emails page for children that the current time is greater than the time to send field. If the time to send has passed, then that page is added to the Emails To Send page. The Third Cron Job grabs the emails pages from Emails to Send and loops through them sending the emails from the page fields. This script regulates the rate at which this email is sent via the Amazon API, etc.. With all of that said, the issue I am having here is this: I'm having a scalability dilemma. If this system had say 3,000 users who are Amazon Sellers, I have a major timing problem. I cannot grab data for all 3,000 users from the API at the same time. If I get a portion of them every few minutes with the Cron instead, then I may miss orders because my query for orders in the last 15 minutes might not work. Plus if I looped through like that, there might be a big delay on when orders are actually updated. I would like to have the most up-to-date information possible! If you guys have any suggestions or direction to be able to download data from an API at the same time with this many users and keep everything running smooth, I would really, really appreciate it! Thank You in advance! - Brian
  8. Hi there, I'm trying to get a script to work in process wire that loads a class dynamically if that class is not found. Do you know if there is something I need to do in Processwire to get the function __autoload() {} to work correctly? Here is the code I am using that would include the class: function __autoload($className){ echo "<h1>called.</h1>"; echo "<h2>".$className."</h2>"; $filePath = stuff/here.php; if(file_exists($filePath)){ require_once $filePath; return; } } I'm putting the echo statement in there just to see if it is loading anything. I don't get anything. Any ideas? Thanks guys! http://php.net/manual/en/language.oop5.autoload.php
  9. OK, so I found where I can have set up a cron job on the server. Since there are lots of Processwire classes called in the script, I have to call a particular URL without a .php (The URL that runs the script is http://www.someurl.com/myPage/ ) In this case, is running curl http://www.someurl.com/myPage/ reasonable?
  10. Hi guys, I have a script that takes quite a LONG time to process (10 min or so) and requires a few loops within loops. (That's a whole separate issue that I am trying to optimize better) In some of the loops, I am scraping some information off of another website also so this script takes a while to run. Anyways, I need this script to run once a day at 2AM or so. I know about LazyCron, but I don't want it to have to be user initiated. I need it to run the script at the same time every day. The script is grabbing Pages in ProcessWire, then scraping data, then updating the ProcessWire Page. What do you guys suggest as the best way to have a script like this run efficiently?
  11. WOW. You guys are awesome. I used net carvers solution of just querying the db directly. It works great.
  12. netcarver, Thank you for your help with this. I can see how this would work. I had not thought about doing it that way. It seems that would be quite a process for the server. What I have is about 2,000 pages all under the same template, but some of the pages have a field that will have the same value (maybe like 60 different values total). Do you think it would work OK to loop through all 2,000 pages and assign a group in this way?
  13. Hi there, I am trying to get a group of pages from Processwire, but I want to group all of the similar pages and show a count next to them. Is there something I can do in Processwire to achieve this? I know I can get all of the pages and sort them like this and I can add ->count() to count them, but I want to achieve something like the SQL command GROUP_BY $pages->find("template=template, sort=sort") Thank you for any help here...
  14. Ryan, Thank you for your help! It ended up being something different. I changed my form tag to the following at it works now. hooray! <form action="" method="POST" enctype=multipart/form-data> I didn't originally have the enctype=multipart/form-data in there. I don't know what I was thinking.
  15. Thank you WillyC and Ryan for the fast help! I have played around with the solutions that you guys have offered... and I am now not getting an error. That is both a great thing and a frustrating thing. Even though I am not getting an error, the image is not making it into the page either. This is what I have now: if ($input->post("imagesend") == "1") { $l->setOutputFormatting(false); // instantiate the class and give it the name of the HTML field $u = new WireUpload('userfile'); // tell it to only accept 1 file $u->setMaxFiles(1); // tell it to rename rather than overwrite existing files $u->setOverwrite(false); // have it put the files in their final destination. this should be okay since // the WireUpload class will only create PW compatible filenames $u->setDestinationPath($l->images->path()); // tell it what extensions to expect $u->setValidExtensions(array('jpg', 'jpeg', 'gif', 'png')); // execute() returns an array, so we'll foreach() it even though only 1 file foreach($u->execute() as $filename) { $l->images->add($filename); } // save the page $l->save(); } I updated "files" to "images" as well because I realized that I do not actually have a files field on that page. I want the images that are uploaded to make it into the "images" field My file field looks like this: <input type="file" name="userfile" /> Does anything here look out of the ordinary? Thanks!
  16. Hi there. First of all, thank you for all of your work on ProcessWire, it is truly an amazing piece of work. I can't imagine developing on anything else anymore... I am having a bit of trouble uploading images through the API. I want users of the site to be able to upload images into their page. Here is the code that I have: Get the page that belongs to that user: $l = $pages->find("user_account={$user}, template=listing")->first(); Then this is the code that I am using to upload the image: if ($input->post("imagesend") == "1") { $l->setOutputFormatting(false); // instantiate the class and give it the name of the HTML field $u = new WireUpload('userfile'); // tell it to only accept 1 file $u->setMaxFiles(1); // tell it to rename rather than overwrite existing files $u->setOverwrite(false); // have it put the files in their final destination. this should be okay since // the WireUpload class will only create PW compatible filenames $u->setDestinationPath($l->files->path); // tell it what extensions to expect $u->setValidExtensions(array('jpg', 'jpeg', 'gif', 'png')); // execute() returns an array, so we'll foreach() it even though only 1 file foreach($u->execute() as $filename) $l->files->add($filename); // save the page $page->save(); } The error that I am getting is: Exception: You must set the destination path for WireUpload before executing it Any ideas? Thanks!
×
×
  • Create New...