Jump to content

HawkCode

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Everything posted by HawkCode

  1. I'm still not getting this to work. I need to direct the user to the web site that gets created by the string stored in the database. The data base has all our webinars and based on the webinars number is will pull a differant url to be built. I'm trying to do this so I don't have to hand modify code for each webinar title. This is the registration system. $GoToUrl is set from a Session Var $GoToURL = $_SESSION['GoToURL']; And the session var is set 2 pages earlier like this: $_SESSION['GoToURL'] = $row_Sysdefaults['HostingURL']; This is the way the code will be used: if ($ResponseCode == "Approved"):{ header(sPrintf("Location: %s", $GoToURL )); } endif; I hope this helps. Rich
  2. This is not JSP, the link I have to send people to is JSP. Yes I'm storing Vars in the database. I will look at the EVAL. Thanks Rich
  3. Hi I need to put in a url like this http://test.com/events/tokenPasser.jsp?email=Rich@RAlbrecht.net&fname=Richard&lname=Albrecht&Member+Number=999999 Getting the URL form one table and when expanded gets the data from another table. I created a form to input the url, here is what I put in the field: http://test.com/events/tokenPasser.jsp?email={$row_Recordset['EMail']}&fname={$row_Recordset['FName']}&lname={$row_Recordset['LName']}&Member+Number={$row_Recordset['MemberNumber']} Here is the code $GoToURL = $row_Sysdefaults['HostingURL']; echo $GoToURL; It does not expand the vars? Is this possible. TIA Rich
  4. I tried using Absolute path using this: define ("ROOT", dirname(__FILE__)); Got this error: The requested URL /var/www/aspe.org/htdocs/AccessControl/Login.php was not found on this server. This is the code calling it: if ($MinAccessLevel > 0) { $MM_restrictGoTo = ROOT . "/AccessControl/Login.php"; if (!((isset($_SESSION['LoginID'])) && (isAuthorized("",$MinAccessLevel, $_SESSION['LoginID'], $_SESSION['AccessLevel'])))) { $MM_qsChar = "?"; $MM_referrer = $_SERVER['PHP_SELF']; if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&"; if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) $MM_referrer .= "?" . $QUERY_STRING; $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer); header(sprintf("Location: %s", $MM_restrictGoTo . SID )); exit; } This is code that was generated by Dreamweaver and I copied it. Thanks
  5. I'm getting this error: /var/www/localhost/htdocs/AccessControl/Login.php was not found on this server. Here's the line: $MM_restrictGoTo = $_SERVER['DOCUMENT_ROOT'] . "/AccessControl/Login.php"; This works: $MM_restrictGoTo = "AccessControl/Login.php"; THe file including it is in directory above AccessControl THanks
  6. Hi, I have a php file included in many differant files at all differant levels in the directory structure. The problem I have is if a condition is met, it passes control to another php file in the same directory. However that file is not found by all files in the other directorys. home/file1.php <---------- Includes inc/file2.php ----> inc/file2.php home/file2.php passes control to inc/file2.php >>>>> This works home/dir1/file1a.php <---------- Includes inc/file2.php ----> ../inc/file2.php home/file2.php passes control to inc/file2.php >>>>> This doesn't work. How can I have the include file's call to files in the same directory no matter where the file that included it is? Thanks
  7. The flush worked, no need to redirect, Yippeeeee I added: <?php $TotalCOunt++; if ($TotalCOunt % 1000 == 0) { echo '.'; ob_flush(); flush(); } ?>
  8. The session var going to new page didn't work. Runs ok on my machine locally. How do you flush the contents of the browser, I'll try any suggestion.
  9. I thought of the session var idea, I will try that and let you know.
  10. No Not solved. When the script ends it prints out stats, when I run it locally in Zend Debug it works fine. If I cut the csv down to half the size, 5,000 lines it works. When run with the full csv 11,000 lines, the script never outputs the stats, BUT IT DOES COMPLETE, because I look at the total number of records in the MySql with Navicat and it has finished inserting the proper number of records. So no it is definatly not solved. Rich
  11. I know it completed because the total number of records inserted into the table was correct. When I ran the Half sized CSV it output the stats to the browser fine.
  12. OK, after changing to code to: <?php $TotalCOunt++; if ($TotalCOunt % 1000 == 0) { echo '.'; sleep(1); } ?> It ran fast, but still no output to browser...
  13. I just realized, I made an error, the above code is wrong, I forgot the "== 0" Duh!
  14. I killed the script with that added code, after 20 minutes it had only inserted 600 records.
  15. I think it's definatly worth it, just to know what the cause is for the future! I Added: $TotalCOunt++; if ($TotalCOunt % 100) { echo '.'; sleep(1); } It is not outputting anything to server, this just slows it way down...
  16. More: I cut the 11,000 line csv in half and it took 1:39 to run AND it displayed the stats at the end. Maybe for this initial load I have to do it in pieces? Seems silly. Rich
  17. More Info: The script takes 5:40 to run. I determined this by doing a SQL Count(*) and knowing how many records would be inserted, 6,390 Records. Any ideas???? Thanks
  18. Ok here's the code. It actuall takes less than 5 minutes to run on server. When I cut down the source file I cut it down to about 25% of the original. The data goes go in ok, when I ran it on my machine I did it in Zend. function import_access () { set_time_limit(3600); global $Main; $path_to_csv = "WebSiteAccess.csv"; $csv_delimiter = ","; $NewAddedcount = 0; $Skipcount = 0; $PrimaryChangeCount = 0; $SecondaryChangeCount = 0; $AccessLevelCount = 0; $CheckSum = 0; $LastPID = 0; $PIDCount = 0; $PreviousNew = 0; echo "About to open:".$path_to_csv . "\n"; $handle = fopen ($path_to_csv,"r"); $Cnt = 0; $CharsToRemove = array(" ", "-", "'", "."); $LastLogin = ""; $LastLoginCount = 0; while (($data = fgetcsv ($handle, 1000, $csv_delimiter)) !== FALSE) { $CheckSum = $NewAddedcount + $Skipcount + $PrimaryChangeCount + $SecondaryChangeCount + $AccessLevelCount; $PeopleID = mysql_escape_string($data[0]); //tblPeople.[Person ID] //$login = ereg_replace("[^A-Za-z0-9]", "", $login); $ChapterCode = mysql_escape_string($data[1]); //tblPeople.ChapterCode, $MembershipNumber = mysql_escape_string($data[2]); //tblPeople.MemberNumber, $Address1 = mysql_escape_string($data[3]); //tblPeopleAddresses.Address1 // For xCart PW use addslashes(text_crypt($data[4])); $Address2 = mysql_escape_string($data[4]); //tblPeopleAddresses.Address2 $City = mysql_escape_string($data[5]); //tblPeopleAddresses.City $State = mysql_escape_string($data[6]); //tblPeopleAddresses.State $Zip = mysql_escape_string($data[7]); //tblPeopleAddresses.Zip $Country = mysql_escape_string($data[8]); $Title = mysql_escape_string($data[9]); //tblPeople.Title $FName = mysql_escape_string($data[10]); //tblPeople.[First Name] $LName = mysql_escape_string($data[11]); //tblPeople.[Last Name] $NameSuffix = mysql_escape_string($data[12]); //tblPeople.[Name Suffix] $EMail = mysql_escape_string($data[13]); //tblPeople.Email $Phone = mysql_escape_string($data[14]); //tblPeopleAddresses.Phone $Fax = mysql_escape_string($data[15]); //tblPeopleAddresses.Fax $AddressType = mysql_escape_string($data[16]); //tblAddressTypes.[Address Type Desc] $PrimaryAddr = mysql_escape_string($data[17]); //tblPeopleAddresses.Primary $CardSent = mysql_escape_string($data[18]); //tblPeople.CardsSent $MemStatus = mysql_escape_string($data[19]); //tblMembership.Status $AccessLevel = mysql_escape_string($data[20]); if ($AccessLevel == null) { $AccessLevel = 0; } $OldLogin = $LName . $MembershipNumber; $OldLogin = StrToLower(ereg_replace("[^A-Za-z0-9]", "", $OldLogin)); // if ($PeopleID == 31702) { // Echo "Stop\n"; // } if ($PeopleID == $LastPID) { $PIDCount++; }else { $PIDCount = 1; $PreviousNew = 0; } if ($MemStatus == 1){ $Password = $ChapterCode . $MembershipNumber; } else if ($PrimaryAddr ==1){ $Password = strtolower($LName) . $Zip; } $Password = crypt($Password,"aspe"); $sql = "SELECT * FROM accesslevel WHERE PeopleID = " . $PeopleID; $result = mysql_query($sql, $Main )or die(mysql_error()); $row_result = mysql_fetch_assoc($result); $num_rows = mysql_num_rows($result); if ($num_rows == 0):{ // New person Add to accesslevel db $NewAddedcount++; $PreviousNew = 1; $InsertSQL = "INSERT INTO accesslevel(PeopleID, EMail, Password, AccessLevel,ASPEMemberID, FName, LName, Title, NameSuffix, Phone, FirstLogin, OldLogin ) VALUES(" . $PeopleID . ", '$EMail', '$Password', '$AccessLevel', '$MembershipNumber', '$FName', '$LName', '$Title', '$NameSuffix', '$Phone', 1, '$OldLogin')"; mysql_query($InsertSQL) or die("<br>Error doing insert:".mysql_error()); if ($PrimaryAddr == 1): { $updateSQL = sprintf("UPDATE accesslevel SET PAddress1='%s', PAddress2='%s', PCity='%s', PState='%s', PZip='%s', PCountry='%s' WHERE PeopleID=%s", $Address1, $Address2, $City, $State, $Zip, $Country, $PeopleID); } else: { $updateSQL = sprintf("UPDATE accesslevel SET SAddress1='%s', SAddress2='%s', SCity='%s', SState='%s', SZip='%s', SCountry='%s' WHERE PeopleID=%s", $Address1, $Address2, $City, $State, $Zip, $Country, $PeopleID); } endif; $Result1 = mysql_query($updateSQL) or die(mysql_error()); } else: { //1st Check if Address Changed, if so update inc AccessLevel if (($PrimaryAddr == 1) and ($row_result['PAddress2'] != stripslashes($Address2)) and ($PIDCount < 3)): { $updateSQL = sprintf("UPDATE accesslevel SET PAddress1='%s', PAddress2='%s', PCity='%s', PState='%s', PZip='%s', PCountry='%s', AccessLevel=%s WHERE PeopleID=%s", $Address1, $Address2, $City, $State, $Zip, $Country, $AccessLevel, $PeopleID); if ($PreviousNew == 0) { $PrimaryChangeCount++; } $Result1 = mysql_query($updateSQL) or die(mysql_error()); } elseif ( ($row_result['SAddress2'] != stripslashes($Address2)) and ($PrimaryAddr == 0) and ($PIDCount < 3)): { $updateSQL = sprintf("UPDATE accesslevel SET SAddress1='%s', SAddress2='%s', SCity='%s', SState='%s', SZip='%s', SCountry='%s', AccessLevel=%s WHERE PeopleID=%s", $Address1, $Address2, $City, $State, $Zip, $Country, $AccessLevel, $PeopleID); if ($PreviousNew == 0) { $SecondaryChangeCount++; } $Result1 = mysql_query($updateSQL) or die(mysql_error()); } //All info same, Now check accesslevel elseif (($AccessLevel != $row_result['AccessLevel']) and ($PIDCount < 3)): { $updateSQL = sprintf("UPDATE accesslevel SET AccessLevel=%s WHERE PeopleID=%s",$AccessLevel, $PeopleID); if ($PreviousNew == 0) { $AccessLevelCount++; } $Result1 = mysql_query($updateSQL) or die(mysql_error()); } endif; } endif; $LastPID = $PeopleID; if ( $CheckSum == ($NewAddedcount + $Skipcount + $PrimaryChangeCount + $SecondaryChangeCount + $AccessLevelCount)) { if ($PreviousNew == 0) { $Skipcount++; } } } echo "Total New Added: " . $NewAddedcount ."<br>"; echo " Skipped: " . $Skipcount ."<br>"; echo " Prim Addr Chng: " . $PrimaryChangeCount ."<br>"; echo " Sec Addre Chng: " . $SecondaryChangeCount ."<br>"; echo " AccessLvl Chng: " . $AccessLevelCount ."<br>"; echo "<h3>finished Inserted: $count</h3>"; //this is more usefull than it looks fclose($handle); };
  19. Update, I added the line: set_time_limit(3600); It had no effect. Thanks Rich
  20. ??? I have a script, PHP 4, that loads an 11,000 line csv file into a MySql data base. Running it loacally It completes and gives me the stats that I echo at the end. Running on the server it does put in all the records, but never gives me the stats, there fore giving the illusion that it is in an endless loop. If I cut the file down it ends as expected? Any ideas? Thanks
  21. Hi, I have a form I'm working on where I have a Quantity Field and there is a cost for each. If an Item is $25.00 and they enter 2 how can I update another field with the result (2*25)??? Preferably the field updated should be read only. Thanks! Rich
  22. Hi, I still new to PHP Programming and have my first major app to do. We are an organization that has a convention every 2 years. Well we have one this year and I need to put on-line registration up. The problem: There are several payment options, Like 1 Person Non-Member, 2-5 From same company non-member, Over 5 from same company non-member, well you get the idea. There are like 7 of these pay structures. Figuring our what to charge for what they pick isn't hard, it's for each individual a form needs to be filled out, Name, Address etc. But there are also some additions that they can add like a golf tournament, tour or what ever. These are added to the price. After the forms data is entered it needs to be captured to a database then emailed to the office. Also needs to collect payment information and send to Authorize.Net. I'm just having a little difficulty figuring a way to do this. Of course a Dektop app would be a piece of cake, just not sure of the best way for a web app. Big Thanks In Advance!! Rich
  23. Thanks, I ended up writing my 1st php script to do it... I'vmade the summit and the rest is down hill! Rich
×
×
  • 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.