Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. your converting to UTF-16LE.. $unicode_str_for_Excel = chr(255).chr(254).mb_convert_encoding( $output, 'UTF-16LE', 'UTF-8'); try removing the convert ie $unicode_str_for_Excel = chr(255).chr(254).$output;
  2. if i understand correctly just add this $rows = count($vals)-1;
  3. Heres a Quick clean up, see comments <?php $uid = (int)$row['id']; //filter $_SESSION['login'] = $uid; //no const's session_regenerate_id(); //regenerate the Session ID $sid = $session_id(); $ip = $_SERVER['REMOTE_ADDR']; $query = "INSERT INTO login (uid, ip, sid) VALUES ('$uid','$ip','$sid')"; ?> <?php if($_SESSION['login']) { //No Cont's session_regenerate_id(); //regenerate the Session ID $sid = $session_id(); $ip = $_SERVER['REMOTE_ADDR']; $uid = $_SESSION['login'];//No Cont's $query = "SELECT * FROM login WHERE uid='$uid' AND sid='$sid' AND ip='$ip' "; $result = mysql_query($query); $num_rows = mysql_num_rows($result); if($num_rows == 0) { $_SESSION['login'] = 0; //crear to be sure $session_destroy(); } } ?>
  4. <form action='***' method='post'> <input type='checkbox' name='fruit[]' value='apple' /> Apple <input type='checkbox' name='fruit[]' value='orange' /> Orange <input type='checkbox' name='fruit[]' value='banana' /> Banana </form> 1.when the form is posted, your get the data like so print_r($_POST['fruit']) this will only show the checked boxes 2. <?php foreach($_POST['fruit'] as $F) { if($F = 'orange') echo "orange Found"; } ?> 3. The array is a Type of variable.! ??? but i think you mean how do i pull it out.. $_POST['fruit'] would be an array ie array[0] = apples array[1] = orange and $_POST['fruit'][0] would be apples No Book needed, just see php.net (best manual on the web)
  5. the *SheBang isn't used by Perl when it run is run on windows, linux should be okay.. your need to look at the perl code to workout what the error levels mean, 0 normally means all is okay, you should get the returned value from the $output ie print_r($output); * AKA HashBang, SharpBang, #!
  6. echo "FILENAME: $sms_package_filename <br>"; echo "PACKAGE: $sms_package <br>"; so $upload = ftp_put($conn_id, $sms_package_filename, $sms_package, FTP_ASCII); parses to $upload = ftp_put($conn_id, '7890_20080609095235_SMS.txt', '/usr/src/rapid/uploads/7890/sms/packages/7890_20080609095235_SMS.txt', FTP_ASCII); Now '7890_20080609095235_SMS.txt' doesn't contain the FTP Path it should be like this <?php $site_root = '/path to files to be uploaded/'; $ftp_root = '/usr/src/rapid/uploads/7890/sms/packages/'; ftp_put($conn_id, $ftp_root . $sms_package_filename, $site_root . $sms_package_filename, FTP_ASCII); ?>
  7. is $sms_package_filename set correctly ? add file_exists, as i could be wrong but i think $sms_package_filename and $sms_package are around the wrong way
  8. Simple Idea have a sql table called RememberedUsers Fields UserID, Hash, timestamp the Hash is something like $UserID = 10 //the users ID $SALT = substr(md5(time()), 0, 7); $HASH = md5($Salt.$UserID); which i store in the table and in a cookie Now When the user opens the site i lookup the Hash, this gives me the UserID. very basic idea you and expland it to suite ie add 2 hashes ect
  9. Its a very easy mistake, (kicked myself a few times )
  10. Phishing warning are often linked to the sites URL.. check here and enter your URL.. see what comes up
  11. try changing the 5 seconds timeout to 15 or 30 or even 90 seconds if ($tmp=fsockopen('8.6.**.**',****,$errno,$errstr,30)) {
  12. Seams fine to me.. whats the errors ?
  13. Using the # Button if you click the # button (aka code tags) this will appear without the spaces then paste your code in ie [code ] <?php echo "this is PHP"; ?> and this is html [/code ] the result [code] <?php echo "this is PHP"; ?> and this is html
  14. What do you have so far ? can you post your code..
  15. Maybe use frames or AJAX, resizing shouldn't take long, the upload seams to be the longest part
  16. indexs start from 0 //you need to add minus 1 $stem_length = count($question_stem) - 1;//Need to find out how many elements in array
  17. thats too hard to read.. heres a clean version i updated one line $messageSend = "true"; // Changed == to = EDIT: Not really a syntax error but will not set the variable <?php require_once('Connections/GetWebContent.php'); ?> <?php if(!($_GET[start]=="false")){ // start $populateFirstName = $_POST[firstName]; $populateLastName = $_POST[lastName]; $populateEmallAddress = $_POST[emailAddress]; $populatePhoneNumber = $_POST[phoneNumber]; $populateMobileNumer = $_POST[mobileNumber]; $populateStreet = $_POST[street]; $populateSuburb = $_POST[suburb]; $populatePostalCode = $_POST[postalCode]; $populateCountry = $_POST[country]; $populateTown = $_POST[town]; $populateMessage = $_POST[message]; function validateNames($name, $errorMessage, $approvedMessage, $fieldName, $runExperssion ){// 2 global $firstNameError; global $lastNameError; global $emailAddressError; global $phoneNumberError; global $mobileNumberError; global $streetError; global $suburbError; global $postalCodeError; global $townError; global $countryError; global $messageError; global $spamError; global $firstNameSend; global $lastNameSend; global $emailAddressSend; global $phoneNumberSend; global $mobileNumberSend; global $streetSend; global $suburbSend; global $postalCodeSend; global $townSend; global $countrySend; global $messageSend; //validate first name if($name == "" && $fieldName == "firstName"){ $firstNameError = $errorMessage; }elseif(!eregi("^[a-z']{2,35}$", $_POST[firstName]) && $runExperssion == "run" && $fieldName == "firstName"){ $firstNameError = $errorMessage; $firstNameSend = "false"; }elseif(eregi("^[a-z']{2,35}$", $_POST[firstName]) && $runExperssion == "run" && $fieldName == "firstName"){ $firstNameError = $approvedMessage; $firstNameSend = "true"; }; // validate last name if($name == "" && $fieldName == "lastName"){ $lastNameError = $errorMessage; }elseif(!eregi("^[a-z']{2,35}$", $_POST[lastName]) && $runExperssion == "run" && $fieldName == "lastName"){ $lastNameError = $errorMessage; $lastNameSend = "false"; }elseif(eregi("^[a-z']{2,35}$", $_POST[lastName]) && $runExperssion == "run" && $fieldName == "lastName"){ $lastNameError = $approvedMessage; $lastNameSend = "true"; }; // validate email address if($name == "" && $fieldName == "emailAddress"){ $emailAddressError = $errorMessage; }elseif(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]{2,5}$", $_POST[emailAddress]) && $runExperssion == "run" && $fieldName == "emailAddress"){ $emailAddressError = $errorMessage; $emailAddressSend = "false"; }elseif(eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]{2,5}$", $_POST[emailAddress]) && $runExperssion == "run" && $fieldName == "emailAddress"){ $emailAddressError = $approvedMessage; $emailAddressSend = "true"; }; // valdate phone number if($name == "" && $fieldName == "phoneNumber"){ $phoneNumberError = $errorMessage; }elseif(!eregi("^[0-9()+ ]{7,25}$", $_POST[phoneNumber]) && $runExperssion == "run" && $fieldName == "phoneNumber"){ $phoneNumberError = $errorMessage; $phoneNumberSend = "false"; }elseif(eregi("^[0-9()+ ]{7,25}$", $_POST[phoneNumber]) && $runExperssion == "run" && $fieldName == "phoneNumber"){ $phoneNumberError = $approvedMessage; $phoneNumberSend = "true"; }; // validate mobile number if($name == "" && $fieldName == "mobileNumber"){ $mobileNumberError = $errorMessage; }elseif(!eregi("^[0-9()+ ]{7,25}$", $_POST[mobileNumber]) && $runExperssion == "run" && $fieldName == "mobileNumber"){ $mobileNumberError = $errorMessage; $mobileNumberSend = "false"; }elseif(eregi("^[0-9()+ ]{7,25}$", $_POST[mobileNumber]) && $runExperssion == "run" && $fieldName == "mobileNumber"){ $mobileNumberError = $approvedMessage; $mobileNumberSend = "true"; }; // validate steer name and number if($name == "" && $fieldName == "street"){ $streetError = $errorMessage; }elseif(!eregi("^[a-z0-9'. ]{2,40}$", $_POST[street]) && $runExperssion == "run" && $fieldName == "street"){ $streetError = $errorMessage; $streetSend = "false"; }elseif(eregi("^[a-z0-9'. ]{2,40}$", $_POST[street]) && $runExperssion == "run" && $fieldName == "street"){ $streetError = $approvedMessage; $streetSend = "true"; }; // validate suburb if($name == "" && $fieldName == "suburb"){ $suburbError = $errorMessage; }elseif(!eregi("^[a-z'.0-9 ]{2,35}$", $_POST[suburb]) && $runExperssion == "run" && $fieldName == "suburb"){ $suburbError = $errorMessage; $suburbSend = "false"; }elseif(eregi("^[a-z'.0-9 ]{2,35}$", $_POST[suburb]) && $runExperssion == "run" && $fieldName == "suburb"){ $suburbError = $approvedMessage; $suburbSend = "true"; }; // validate postal code if($name == "" && $fieldName == "postalCode"){ $postalCodeError = $errorMessage; }elseif(!eregi("^[0-9]{2,6}$", $_POST[postalCode]) && $runExperssion == "run" && $fieldName == "postalCode"){ $postalCodeError = $errorMessage; $postalCodeSend = "false"; }elseif(eregi("^[0-9]{2,6}$", $_POST[postalCode]) && $runExperssion == "run" && $fieldName == "postalCode"){ $postalCodeError = $approvedMessage; $postalCodeSend = "true"; }; // validate town if($name == "" && $fieldName == "town"){ $townError = $errorMessage; }elseif(!eregi("^[a-z'. ]{2,35}$", $_POST[town]) && $runExperssion == "run" && $fieldName == "town"){ $townError = $errorMessage; $townSend = "false"; }elseif(eregi("^[a-z'. ]{2,35}$", $_POST[town]) && $runExperssion == "run" && $fieldName == "town"){ $townError = $approvedMessage; $townSend = "true"; }; // validate country if($name == "0" && $fieldName == "country"){//1 $countryError = $errorMessage; $countrySend = "false"; }elseif($name <> "0" && $fieldName == "country"){ $countryError = $approvedMessage; $countrySend = "true"; }//1 // validate message box if($name == "" && $fieldName == "message"){ $messageError = $errorMessage; $messageSend = "false"; }elseif($name <> "" && $fieldName == "message"){ $messageError = $approvedMessage; $messageSend = "true"; // Changed == to = }; // validate spam number if($name == "" && $fieldName == "spam"){ $spamError = $errorMessage; $spamSend = "false"; }elseif($name <> $_POST[spamNumber]){ $spamError = $errorMessage; $spamSend = "false"; }elseif($name == $_POST[spamNumber]){ $spamError = $approvedMessage; $spamSend = "true"; }; };//2 end funtion validate Name // generated random number for spam check $spamNumber = rand(1000,9999); $approvedMark = "<img src='img/approvedMark.jpg' width='20' height='15' />"; $rejectMark = "<img src='img/rejectMark.jpg' width='15' height='15'/>"; validateNames($_POST[firstName], $rejectMark, $approvedMark, "firstName", "run"); validateNames($_POST[lastName], $rejectMark, $approvedMark, "lastName", "run"); validateNames($_POST[emailAddress], $rejectMark, $approvedMark, "emailAddress", "run"); validateNames($_POST[phoneNumber], $rejectMark, $approvedMark, "phoneNumber", "run"); validateNames($_POST[mobileNumber], $rejectMark, $approvedMark, "mobileNumber", "run"); validateNames($_POST[street], $rejectMark, $approvedMark, "street", "run"); validateNames($_POST[suburb], $rejectMark, $approvedMark, "suburb", "run"); validateNames($_POST[postalCode], $rejectMark, $approvedMark, "postalCode", "run"); validateNames($_POST[town], $rejectMark, $approvedMark, "town", "run"); validateNames($_POST[country],$rejectMark, $approvedMark, "country", "run"); validateNames($_POST[message], $rejectMark, $approvedMark, "message", "run"); validateNames($_POST[spam], $rejectMark, $approvedMark, "spam", "run"); function validateDate($fieldDay, $fieldMonth, $fieldYear, $rejectMessage, $approvedMessage){ global $dateError; global $dateSend; if($fieldDay == "0" || $fieldMonth =="0" || $fieldYear == "0"){//1 $dateError = $rejectMessage; $dateSend = "false"; return false; };//1 if($fieldMonth == "4" || $fieldMonth == "6" || $fieldMonth == "9" || $fieldMonth == "11"){//1 if($fieldDay > "30" ){//2 $dateError = $rejectMessage; $dateSend = "false"; }else{ $dateError = $approvedMessage; $dateSend = "true"; };//2 }else{ $dateError = $approvedMessage; $dateSend = "true"; };//1 if($fieldMonth == "2" && $fieldDay > "28"){//3 if($fieldYear % 4 == 0 && $fieldDay <= "29"){//4 $dateError = $approvedMessage; $dateSend = "true"; if($fieldYear % 100 == 0 && $fieldDay > "28"){//5 $dateError = $rejectMessage; $dateSend = "false"; if($fieldYear % 400 == 0 && $fieldDay <= "29"){//6 $dateError = $approvedMessage; $dateSend = "true"; }else{ $dateError = $rejectMessage; $dateSend = "false"; };//6 }else{ $dateError = $approvedMessage; $dateSend = "true"; };//5 }else{ $dateError = $rejectMessage; $dateSend = "false"; };//4 };//3 };// function validateDate end validateDate($_POST[day], $_POST[month], $_POST[year], $rejectMark, $approvedMark); //echo "firstName ".$firstNameSend."</br>"; //echo "lastName ".$lastNameSend."</br>"; //echo "date ".$dateSend."</br>"; //echo "emailAddess ".$emailAddressSend."</br>"; //echo "phoneNumber ".$phoneNumberSend."</br>"; //echo "mobileNumber ".$mobileNumberSend."</br>"; //echo "street ".$streetSend."</br>"; //echo "suburb ".$suburbSend."</br>"; //echo "postalCoce ".$postalCodeSend."</br>"; //echo "town ".$townSend."</br>"; //echo "country ".$countrySend."</br>"; echo "message ".$messageSend."</br>"; if($firstNameSend == "true" && $lastNameSend == "true" && $emailAddressSend == "true" && $phoneNumberSend == "true" && $mobileNumberSend == "true" && $streetSend == "true" && $suburbSend == "true" && $postalCodeSend == "true" && $townSend == "true" && $countrySend == "true" && $messageSend == "true" && $dateSend == "true"){ // $sendMail echo "Message will Sendddd"; }else{ echo "Mesagge not sent!!!!!!!!!!!!!!!!"; }; }; ?>
  18. Okay lets say i have a cookie called site i store this text it in Admin:' OR 1=1 you code $q = "SELECT uname, pword FROM accounts WHERE uname = '$username' AND pword = '$password'"; translates to $q = "SELECT uname, pword FROM accounts WHERE uname = 'admin' AND pword = '' OR 1=1"; Cool admin access this is problem is called SQL injection.. you need to use something like mysql_real_escape_string like so <?php function failedAuth($username, $password) { global $conn; $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $q = "SELECT uname, pword FROM accounts WHERE uname = '$username' AND pword = '$password'"; $result = mysql_query($q, $conn); return (mysql_num_rows($result) != 1 ); } ?> Now the problem we still have is you have a clear text password so solve this try MD5 this is a ONEWAY encryption this means you can NOT change the password back.. so ClearTextPass = password MD5Passw = 5f4dcc3b5aa765d61d8327deb882cf99 so when someone sets/updates their password your need to MD5 it first (more info here) Okay you could store the Hashed password (the MD5ed password) in the cookie but it can be cracked so still a bad idea.. if you may also want to ask about adding salt to the hash (its better protections, against rainbow tables) simply put you add extra data to the password ie $hash = MD5($Password."MySalt"); or $hash = MD5(MD5($Password)."MySalt");
  19. The reason its bad is due to the fact you have no security/contents control over cookies, the user can edit them, and crack the password (yours is plan/clear text that worse still), or maybe even inject code (if it isn't sanatized correctly), That would be why I'm asking... maybe elaborate on why it's bad practice, or "you shouldn't need to..." what. That kind of comment goes no where. NB: That kind of comment does help.. if you want someone to elaborate then just ask.. personally i won't elaborate on everything i type or i'll never finish the post.. why i agree blueman378 could of said more its easier just to ask, remember we are here to help you.. we are not being paid for this..
  20. Why Delete the post ? people do search for solutions before posting (yet it doesn't seam like it at times)
  21. erm.. maybe try google Redirect 301 htaccess i checked first 20 of 135,000 sites look okay
  22. post some sample data around the ">10 Minuten</option> or even try this if (preg_match('%<option value="(.*?)">10 Minuten</option>%sim', $data, $regs)) { note the sim
  23. Okay let me check the facts.. from outside your network, it parses fine (displays fine) but internal it shows the source code? if this is the case then it seams more of a network structure or apache issule, is the server at your office or at hostgator (what riole does hostgator play) EDIT: my mine is application/x-httpd-php php php3 php4 php5 php6 not application/x-httpd-php5 php php3 php4 php5 php6 also i have application/x-httpd-php-source phps phps ONLY (sorry leaving work now, will check this post when i'm at home)
×
×
  • 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.