Jump to content

heeha

Members
  • Posts

    43
  • Joined

  • Last visited

Everything posted by heeha

  1. I am trying to echo the right answer but I always get the wrong one. <?php $gplus= 344; if($gplus >= 1){ echo "Get answer 1."; } else if($gplus >= 50) { echo " Get answer 2."; } else if ($gplus >= 100) { echo " Get answer 3."; } else if($gplus >= 200) { echo "Get answer 4"; } else if($gplus >= 500){ echo "Get answer 5."; } else if($gplus >= 1000){ echo "Get answer 5."; } else if($gplus >= 2000) { echo " Get answer 6."; } else if($gplus >= 3000) { echo " Get Answer 7."; } else { echo "We didn't find any answers."; } ?> $gplus is 344, and it should echo the anser " Get answer 4" but it always echo " Get answer 1". If i change the value of $gplus = 501, it still echo the answer "Get answer 1". What wrong am i doing?
  2. I was trying to get meta title, description,keywords in php but it works most of the website but not for codevdo.com and many others. <?php $get_tags = get_meta_tags("http://codevdo.com"); echo "this site has this description " . $get_tags['description'] . "."; echo "<br>"; echo "this site has these keywords " . $get_tags['keywords'] . "."; echo "<br>"; echo "<br>"; $url = 'http://codevdo.com'; preg_match("/<title>(.+)<\/title>/siU", file_get_contents($url), $matches); $title = $matches[1]; echo "this site has this title " . $title . "."; ?> This above code works good for most of site but it doesn't work for above site and many other. What code do i put a code that works for every website?
  3. $a = array("bing", "google", "alexa", "microsoft") // this list is very big and putting it on same is not good. Is there is way, I can place this array list in another php files and call it on the form page?
  4. Thanks, I would surely see your example. This is good for learning. But Actually i needed what Barand said, I told that I want to show the information after the form has been processed. It mean's users already have the domain name with trademark names in them. They were there to check web data. During that time I wanted to show that information. Your's is good if i want to invite people to register a domain name, which I am not.
  5. This actually worked like a charm : <html> <body> <form method="get" action="test1.php"> Name <input type="name" name="url"> <input type="submit"> </form> <?php $url = $_GET['url']; echo $url; $a= array("google", "bing", "alexa"); if($url != str_replace($a,'',$url)){ echo "$url, you have violated this trademark."; } else { echo "result faild"; } ?> </body> </html> I tried another way: <html> <body> <form method="get" action="test1.php"> Name <input type="name" name="url"> <input type="submit"> </form> <?php $url = $_GET['url']; echo $url; if(strpos($url, 'google') !==false){ echo "this is working"; } else { echo "result failed"; } //this one also works but it actually takes one "value" not many." ?> </body> </html>
  6. Thanks for suggestion. I am learning php from w3schools and I will take a look at codeacademy also. I know basics about for and foreach and strings, and few others. I will try to implement what you said in post 4 and will see if it works.
  7. I have a website developed by other. In that users can check SEO data and some of them are people who has domain name carrying words of trademark companies. Like some people has mygoogle.com. So the form always gets processed and shows SEO data like Domain authority, social shares and alike. But I want to show users another message that your domain name also contains trademark names in it and you shouldn't use such domain names. As i am not a developer so i don't know how to achieve that. I don't want my developer to do it because i want to learn myself and show the information. All i was trying to do is that I want to create a another file carrying the list of Trademark companies and when users process a domain name that has trademark names inside them, I want to print that message for them along with the SEO data processed.
  8. No, may be I wasn't able to put it the way I want to. Let me try it again. When user enters a name say "Metina", and "tina" name is already in the list. So I want to make that form still get processed but I want to show the user that your name contains word "tina" in it. We don't allow tina words therefore, we already have that word. Like, a user has "mygoogle" in his website name and i want to place a tag, that your name has "google" and we don't allow you to use that because google is others property.
  9. Hi, I am new to php and still learning. I have been not able to work for few months due to work but Now again trying to learn. I have a php form : <form method="post" action="test.php"> Name=<input type="text" name="yourname"> submit<input type="submit"> </form> I have a file called test1.php. It has many names Lets say : Ron, ronda, carl, mathew, alexa,tina, lima, soniya, viktoria. List is big but lets count to this much. Now i want that if a user puts a name form as "iviktoriana" . I want to remove this extra"i" and "na" words after form processing. I don't want to remove it while processing the form. How do i use make it work?Do i need to put these names in array in test1.php
  10. Thanks. There are few variable to check for as i m looking to get output via $dnsinfo, so I think that $dnsinfo should be placed here. But I was getting the same error. Then i tried every php variable used on coding, $host, $result, but result always shows said above error.
  11. $u992092914_trial : this is actually a database name. i used it to check if database exists/ is set or not. Am i doing it wrong?
  12. Regarding TRUE and true, which i actually did to see if anything wrong goes with the both or both are considered same. It was not like copy/paste, if it was, you would have seen more perfection or error free coding than you are seeing. Errors are so much because I m at learning phase. I checked and removed the TRUE from it ...[ if($myconn->query($user_query ===TRUE)) but i m still seeing this error I have also changed the name of columns and values and also checked if anyone of them is reserved word or not and Used only 3 columns and 3 values for that to insert data in databases but no success Warning: mysqli::query(): Empty query ... I guess the reason might be that only "url" is considered from the form to be inserted into the tables but not the dns records which i am outputting via php coding from the form itself and is trying to add insert into databases.
  13. I have added "values" by putting dns records as variables in values but now i m seeing that if(isset($u992092914_trial))// check the db exists { $host= $dnsinfo['host']; $class = $dnsinfo['class']; $ttl= $dnsinfo['ttl']; $type= $dnsinfo['type']; $pri = $dnsinfo['pri']; $target= $dnsinfo['target']; $user_query= "INSERT INTO u992092914_trial( host, class, ttl, type, ip address, rname, mname, refresh, retry, expire, min ttl, txt), VALUES('$target', '$class', '$ttl', '$type', '$pri', '$target')"; } if($myconn->query($user_query ===true)){ echo "Tables created successfully"; } else { echo "tables cant be created." .$myconn->error; } $myconn->close(); ?> Warning: mysqli::query(): Empty query in /home/u992092914/public_html/b/mysql.php on line 79 tables cant be created. I added example.com in the form and it processed it well dns record for it perfectly but it tables are not getting created.
  14. I will the best i can but i dont want to put excessive coding on my script because i wouldn't remember all at once. All i will be doing is to take or put code that are only necessary and only those i can remember and learn[that's the motive]. If i put all the coding of php like exception handling, error handling, session_start() or header() or anything like that all at once i might end up having so much in my brain that i may be not be able to grasp what i was doing and for what. I do understand that the coding i am doing is not well formed and organised but I would keep developing a habit to improve it with time.
  15. Dont you guy just see a thing here?He posted 2 posts here and his profile shows 0 posts... Bug in script?
  16. :Fatal error: Cannot use isset() on the result of an expression (you can use "null !== expression" instead) in /home/u992092914/public_html/b/mysql.php on line 60 <?php $url= $_POST['url']; if(isset($_POST['url'])) //did to check if url is there or not. { if(filter_input(INPUT_POST, 'url', FILTER_SANITIZE_URL)){ $url= trim($_POST['url']); if(substr($url, 0, 7) !='http://') { $url='http://' . $url; } if(filter_var($url, FILTER_VALIDATE_URL)) //did to check if your is valid or not { $host= str_ireplace('www.','',parse_url($url, PHP_URL_HOST)); $result= dns_get_record($host, DNS_ANY); } } } ?> <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="Post"> Enter URL : <input type="text" name="url"> Submit: <input type="submit" name="submit"> </form> <?php if(isset($result)){ $result =dns_get_record($host, DNS_ANY);//currently I have shown this so that i would get all info in array, but how will they be inserted into db, and will be fetched in a way to get information on webpage as they are in array? or DNS_A or DNS_MX putting them individually how do i create table so that i can fetch all the info from dbbase for a particular website at once? foreach($result as $dnsinfo); print_r($dnsinfo);//just to make sure that everything working } ?> <br> <?php $servername="localhost"; $username="u992092914_trial"; $password="qgOq5Sy6Us"; $dbname="u992092914_trial"; $myconn = new mysqli($servername, $username, $password, $dbname); //check connection if($myconn->connect_error){ echo ("connection failed." .$myconn->connect_error); } else { echo "connected succesfully"; } //insert data into tables if(isset(u992092914_trial))// how to i check it exists or not, i mean did put it as variable but variable $user_query is same for inserting and for creating tables { $user_query= "INSERT INTO u992092914_trial( host, class, ttl, type, ip address, rname, mname, refresh, retry, expire, min ttl, txt), VALUES()"; // this should be filled itself when users put a query inside the form and sets data according to type? /*while getting the dns records for any website there would be more than one records such as ttl would be more than 3-4 times, how do i put them so that each records get collected? */ //how do i get "value" from form itself to automatically gets added to dbase? */ if($myconn->query($user_query)===TRUE){ echo "Tables created successfully"; } else { echo "tables cant be created." .$myconn->error; } $myconn->close(); ?> <?php /* ouput would be dns records such as : Host Class TTL Type IP Address example.com IN 4 A 00.000.216.34 Host Class TTL Type IP Address example.com IN 4 A 124.000.216.34 Host Class TTL Priority Target example.com IN 4 NS my-servers.net . How to process them from form that they entered directly into databases and after which i can output them from database to my page. */ ?>
  17. Sorry that there were lot of syntax error, I have corrected them and now able to create table but rest of the queries still needs to be solved. <?php $servername="localhost"; $username="u992092914_trial"; $password="qgOq5Sy6Us"; $dbname="u992092914_trial"; $myconn = new mysqli($servername, $username, $password, $dbname); //check connection if($myconn->connect_error){ echo ("connection failed." .$myconn->connect_error); } else { echo "connected succesfully"; } //create table; $user_query= "CREATE TABLE u992092914_trial( id INT(20) AUTO_INCREMENT PRIMARY KEY, host VARCHAR(50), class VARCHAR(50), TTL VARCHAR(50), TYPE VARCHAR(50), IP_ADDRESS VARCHAR(50), RNAME VARCHAR(50), MNAME VARCHAR(50), REFRESH VARCHAR(50), RETRY VARCHAR(50), EXPIRE VARCHAR(50), MIN_TTL VARCHAR(50), TXT VARCHAR(50))"; /*while getting the dns records for any website there would be more than one records such as ttl would be more than 3-4 times, how do i put them so that each records get collected? */ //how do i get "value" from form itself to automatically gets added to dbase? */ if($myconn->query($user_query)===TRUE){ echo "Tables created successfully"; } else { echo "tables cant be created." .$myconn->error; } $myconn->close(); ?> <form action="<?php echo $_SERVER["PHP_SELF"];?> method="post"> Enter url <input tpye="text" name="url"> submit<input type="submit"> </form> <?php /* ouput would be dns records such as : Host Class TTL Type IP Address example.com IN 4 A 00.000.216.34 Host Class TTL Type IP Address example.com IN 4 A 124.000.216.34 Host Class TTL Priority Target example.com IN 4 NS my-servers.net . How to process them from form that they entered directly into databases and after which i can output them from database to my page. */ ?>
  18. <?php $servername="localhost"; $username="u992092914_trial" $password="qgOq5Sy6Us"; $dbname="u992092914_trial"; $myconn = new mysqli($servername, $username, $password, $dbname); //check connection if($myconn->connect_error){ echo "(connection failed." .$myconn->connect_error); } else { echo "connected succesfully"; } //create table; $user_query= "CREATE TABLE u992092914_trial( id HOST AUTO_INCREMENT PRIMARY KEY, class VARCHAR (50), TTL VARCHAR (50) , TYPE VARCHAR (50), IP_ADDRESS VARCHAR (50), RNAME VARCHAR (50), MNAME VARCHAR (50), REFRESH VARCHAR (50), RETRY VARCHAR (50), EXPIRE VARCHAR (50), MIN-TTL VARCHAR (50), TXT VARCHAR (50))"; //while getting the dns records for any website there would be more than one records such as ttl would be more than 3-4 times, how do i put them so that each records get collected? VALUES( )//how do i get this value from form itself? if($myconn->query($user_query)===TRUE){ echo "Tables created successfully"; } else { echo " tables cant be created." .$myconn->error); } $myconn-close(); ?> <form action="<?php echo $_SERVER["PHP_SELF"];?> method="post"> Enter url <input tpye="text" name="url"> submit<input type="submit"> </form> ouput would be dns records such as : Host Class TTL Type IP Address example.com IN 4 A 00.000.216.34 Host Class TTL Type IP Address example.com IN 4 A 124.000.216.34 Host Class TTL Priority Target example.com IN 4 NS my-servers.net . How to process them that they entered directly into databases and after which i can output them from database to my page. what did i do wrong at creating code processing that i m seeing this error.. Parse error: syntax error, unexpected '$password' (T_VARIABLE) in /home/u992092914/public_html/b/mysql.php on line 4
  19. I agree with the above statement by gizmola. Keep on making websites. I have took lesson of basic from few websites mostly from w3schools and they are so simple to understand but when you put php codes in your site you will realize that coding are not that simple for newbie but keep on working with codes can make it simple rather just learning simple lessons. I just made a site ( well havent made any design yet but that is not hard part, I think html and css is not that hard) but i will be adding more features just to make sure i keep on coding and coding so that i keep on growing my knowledge of php.
  20. heeha

    Is php easy?

    How much time it usually to takes for a newbie to start understanding php and implementing it in programming and to become a medium level coder if not expert.
  21. Yes, i meant that which codes would be best, object oriented code or procedural code for interacting with databases? What does procedural tends to mean a lot of copy and paste?
  22. I have been trying to stick an element in my website but I didnt find any position called sticky. I was on other forum and they referred me to some application to download that will do the job. Most of them required javascript, which i dont know about. So is there way to stick a div element via css or any method?
  23. For the first time i will be trying to add any databases to my site( well the website is first in php as well taking help from this forum itself), which database would be good for me( a begineer). Procedural, object orients or PDO ( im not sure all webhost offers this or not ). What is the basic difference between object oriented and procedural databases?
  24. Making a website similar to other is steal? I mean one can never get the codes exactly same, design might be in similar but even in this case getting the codes is not possible. From quite a days ,i m trying from many days to make website which tells dns information something like intodns.com and many others but i wouldnt say i would be taking their design or content or well having there code is next to impossible. I knew a clone similar is intodns.com that is at http://intodns.scriptburn.com, and planned to buy it but it carries the same design and content so i didnt buy it.
  25. few queries: when user pass a url http:// you tube.com it will still process it. but you (space) tube.com is not a correct url, there is a un-necessary space. 2. http://youtube.com/a comes output if user put "a" in form, I tried to put the above case to trim the specialcharacters or addtional words so that only http://youtube.com is taken in form but not http://youtube.com/a but doesnt work.
×
×
  • 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.