Jump to content

SaCH

Members
  • Posts

    43
  • Joined

  • Last visited

    Never

Everything posted by SaCH

  1. Thanks Agian.... I hope someone's new replies against this.
  2. Thanks for your knowledge. that means the working condition of it without bracket and with the bracket is same.
  3. Dear friends, I have a class to validate a form. This is not my own class & i got it from some where. This is my class <?php class validation { function email_validation($email, $email_label) { //E-mail validation: We use regexp to validate email. $email = trim($email); if (strlen($email) >= 1 ) { if(preg_match("/^[a-zA-Z]\w+(\.\w+)*\@\w+(\.[0-9a-zA-Z]+)*\.[a-zA-Z]{2,4}$/", $email) === 0) $error = 'You have to enter a valid '.$email_label; else $error = null; }else $error = 'You have to enter your '.$email_label; return $error; } } ?> My question is in this function consider this line of code if(preg_match("/^[a-zA-Z]\w+(\.\w+)*\@\w+(\.[0-9a-zA-Z]+)*\.[a-zA-Z]{2,4}$/", $email) === 0) $error = 'You have to enter a valid '.$email_label; else $error = null; here we do not using this "{" and "}" inside the if statement but is working without it. Iam confused about it and anyone can clear it out ?? Why we do not using that on the function & why did it does not producing the error ?? Thanks In Advance!!
  4. I think it will not solve the issue.Check out http://proxy4free.com it provides list of proxy sites based on different countries. Then how can we trace the area ? But I think this answers your own question. It is difficult to ban someone because there is no way to uniquely identify them on the web all the time. So this means that banned users should have as many loops to jump through. Ban their IP, ban their email, validate a phone (if possible, text is easiest), make the registration process as long as possible, log IPs in a certain region if it contains a user banned in the past week. You want to keep banned users away, and honestly it's a gimmick. How badly do you want the banned user to be kept off? The more you try to do to keep the banned process automated, the higher amounts of hoops everyone has to jump through. I worked customer support for eBay for a couple years until just last month. A banned user could usually get back onto the site with little work. EBay would flag the account and someone would usually take a look at it. Truth is bans require a staff or a person (depending on the scale of operation) to enforce. At least in my eyes. Very sad to hear the sound. I think the verification process (Require the Voter ID Proof / Passport copy) will be safe but its too complicated & our system must be secure to deal with these features. Anyway thank you for sharing your experiences.
  5. I think it will not solve the issue.Check out http://proxy4free.com it provides list of proxy sites based on different countries. Then how can we trace the area ?
  6. Hello Friends, Iam in a little bit confused matter. Iam developing a website & it requires a user's banning system too so my question begin here that if i use user's IP to ban but they can easy access the website by using different proxy sites & almost ip address are dynamic not static. Banning their email is waste thing because they can create a new email within 1min. Anyone have experiences in these things ? How we can ban a user permanently from accessing the website ?
  7. Actually where is the problem ? In your test.php or post.php & what is the response you are getting ?
  8. That means we should use the function unset() to clear the session data. Else if we simply set it like this $_SESSION['value'] = ''; rather than using unset() function it will consider there is a session value existing. We can understand this thing from "scootstah" post.
  9. Try something like this <?php //this is the email id which you pull form your database. $to = $slide[email]; //this is the another email that you want to send the email. $another = "example@example.com"; //sending the email with php mail() function //1st sending the mail to the email id which you pull from database. if(mail($to,$subject,$message,$headers)) { //2nd sending the mail to the email id which you given as $another variable if the 1st mail is success. mail($another,$subject,$message,$headers); } else { echo 'Email not sent to'; } ?> [/code]
  10. Ok.. can you post your full code here ?
  11. Ok.. then what is the problem with my way ? Is there is any problem if i return the function with completely detached use of of <pre> tag ?
  12. yes you are right because //this variable contains only the directory path which the image file to be stored. So you don't need to put the "/" end of the path. $path = "/pics"; //this variable contains the joining of file name with its directory path to get the real path of the image file. So you don't have to edit this. $mysql_path = $path."/".$filename; //if you echo this line. echo $mysql_path; //the result will be. /pics/somefile.jpg
  13. Yes with your example the output will be similar to the "scootstah" opinion. But with my example its displaying the same output for both function. Why it happen & scootstah opinion is right or anything else ? Just try with this code & see the output. <?php echo "var_dump:<br>"; $name = array('muddy', 'funster', 'frogger', 'packman'); echo '<pre>'; var_dump($name); echo '</pre>'; echo "<br><br><br>print_r:<br>"; $name = array('muddy', 'funster', 'frogger', 'packman'); echo '<pre>'; print_r($name); echo '</pre>'; ?> Confused !!
  14. Its very simple to store the image path into your mysql database. please consider this example. <?php //getting the filename of the image file. $filename = $_FILES["image"]["name"]; //directory name to be stored. $path = "data/mydata"; //uploading the image file with the image file name into the directory. if(move_uploaded_file($_FILES["image"]["tmp_name"],$path."/".$filename) { //if the image is stored success into the directory then we are going to store into database. //the real path with the filename. $mysql_path = $path."/".$filename; //sql query to be executed. $sql = "INSERT INTO `tablename`(`filename`,`path`) VALUES ('$filename','$mysql_path')"; //executing the query. if(mysql_query($sql)) { echo 'path inserted into database'; } else { echo 'path not inserted into database'; } } else { echo 'file not uploaded'; } ?>
  15. @scootstah Sir, Consider the above code & its output. <?php $arr = array(range(0,5)); echo '<pre>'; var_dump($arr); echo '</pre>'; ?> Output : array(1) { [0]=> array(6) { [0]=> int(0) [1]=> int(1) [2]=> int(2) [3]=> int(3) [4]=> int(4) [5]=> int(5) } } Then what is the difference between var_dump() and print_r() using with the <pre> tag ? I tried the <pre> tag with both function var_dump() and print_r() and i got the same output.
  16. What is the value which is adding in every time ? I mean the productqtyid value
  17. Let me know how the urls are to be created dynamically ?
  18. Got it ! var_dump() is used to get the details such as Data Types,its value also it will return the length of string in a variable. The function is very useful to know more details by a small code. Means If we consider this code $val = "SacH"; echo var_dump($val); the output will be string(4) "SaCH" The result explain that - The variable contains a string value. - The value of variable is "SaCH" - The length of the string is 4 Thanks For Assistance.........
  19. So what is the purpose of keeping the htmlentites() with it ? can you just clear it ?
  20. The actual name of the function is "mysql_real_escape_string()". So yes, it does only make sense in the case for a string. You can escape other data, but it is better to validate that data with what it should be vs doing a "catch all". Or even better yet, to just use Prepared statements and not have to worry about escaping. Oh sorry for my spell mistakes i was mean mysql_real_escape_string() but i made the mistakes due to my fast typing..
  21. No, do not do that. You want to use both nl2br and htmlentities for your preview area. htmlentities to prevent XSS and nl2br to insert a <br> tag and the end of each line so they are visible in the html. The nl2br should not be used when you output them to the <textarea> though, as the newlines will be properly rendered there without needing the br tags. Continue using htmlentities however even in the textarea output. if we use htmlentities() function while outputting the string & i think it won't work the break line (<br/>) it will just out put the <br/> tag with the string. ?
  22. Hello guys, i had seen the function var_dump() is used in many coding but even i don't know about the function. Can anybody explain what is the purpose of var_dump() function ? if you can explain it with examples then it will be more easy to save it my memory.
  23. The function nl2br() is used to insert new html line breaks in front of new line in a string. In your case you should use this function because if user enter their comments in one more lines it will be displayed together if you don't use the function. else your user must define the line breaks in their comment itself. The function htmlentities() convert the string into HTML entities so if you use htmlentities() function with the nl2br() function it will display the line break code (<br/>) with the output then your code will be <textarea id="comments" name="comments" cols="50" rows="15"><?php if (isset($comments)){echo nl2br($comments, ENT_QUOTES);} ?></textarea>
×
×
  • 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.