Jump to content

leon_nerd

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

leon_nerd's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi Guys, I am working on an application where we need to have each user input unique email id. Now, the problem is with gmail IDs. In gmail username@gmail is same as user.name@gmail.com which is again same as use.r.name@gmail.com. Now, how to make sure that only one of a kind of email id is allowed. I am storing the email IDs in the database. Should, I be using a query involving LIKE ? Please suggest.
  2. Echoing $comment_from_db->date_posted shows 2011-05-29 11:44:50 I was thinking about maybe the timezone is a problem. I am in GMT: -5. I will try to adjust GMT time in my php code and see if it works.
  3. Hi, I am trying to get the difference in time in mins, hours etc thingy. Now, for some reason I cannot get the right minutes or hours difference between two time stamps. Here is my code: $postedTime=strtotime($comment_from_db->date_posted); $currentTime=time(); $mins=floor(($currentTime-$postedTime)/60); if($mins<=1){ echo $mins." minute ago by"; }elseif($mins>1){ if($mins>60){ $hrs=floor($mins/60); if($hrs>24){ }else{ if($hrs<2){ echo $hrs. " hour ago by"; }else{ echo $hrs. " hours ago by"; } } }else{ echo $mins." minutes ago by"; } } Now, for a comment posted like 25 mins ago it shows it was posted 4 hours ago. For a comment posted around 10 hours ago it shows it was posted 16 hours ago. What is the problem here? I was doing a test and checked the time in seconds after an interval of 2 mins. Here are the results: Comment posted: 1306669490 Current time: 1306683920 The difference is around 14430. This is not equal to 2 minutes. So, I am starting to think if the time I am getting is wrong? Should it have 10 digits? or less? I am not sure what is going on. Please, advice. Thanks.
  4. Thanks. I tried this code but it is inserting the new node at the end of the XML file, outside the XML structure. I am using the following code: $xml = new DomDocument(); $xml->preserveWhitespace = false; $xml->load('myXMLFile.xml'); $newNode = $xml->createElement('tryimage'); $xpath = new DOMXpath($xml); $elements = $xpath->query('/myvalues/image[name="img01"]'); $refNode = $elements->item(0); $xml->insertBefore($newNode, $refNode->nextSibling); header('Content-Type: text/plain'); echo $xml->saveXML(); and the output is: <xml....> <myvalues> <image name="01"> </image> . . . </myvalues> <tryimage />
  5. Hi Guys, I want to insert a node with children at a specific location in the XML file. How do I do it? For eg. If I have an XML like: <myvalues> <image name="img01"> <src>test</src> </image> <image name="img02"> <src>test</src> </image> <image name="img03"> <src>test</src> </image> </myvalues> I want to insert: <image name="img11"> <src>test</src> </image> between <image name="img01"> & <image name="img02">. How do I do this? I am using SimpleXML right now to read the XML. Thanks.
  6. Have you defined $con anywhere? I can see you have used $con but you haven't defined it anywhere.
  7. If I have to use a CMS then I would probably go with Joomla, since it is the one I have worked a little bit with.
  8. Hi Guys, I am not quite sure what is the best for me which is why I am trying to find out (1) What do I need: Framework or CMS? (2) Which one? Now, I am a PHP developer and recently got engaged in a major project. The development part is yet to start, and in the meanwhile I am trying to get some answers on how to setup the dev environment. Now, while I understand that a Framework is basically used to setup the architecture of the application while the CMS is used to control the content, I have not practically worked on them. So, I need your thoughts. 1.) I need to be able to able to develop and deploy the modules quickly. 2.) I will be developing the modules myself, of course. While, the CMS will give me lots of modules but do I really need them? I mean wouldn't they be an overhead for me to manage those non-required modules? I will have to disable them etc etc? I hope I make some sense here. I am not sure what else should I be telling here. So, shoot your questions if you need to know more. I will be looking forward to hear your thoughts and helping me in deciding what I need and which one I need. Thanks.
  9. Thanks a lot salathe . That worked. It was kind of silly of me to forget this simple function. Thanks everyone for putting in your views. I was not expecting this kind of turnaround time for my problem. Just amazing to see this kind of response. Will be around. Thanks
  10. I am making an AJAX call. So, I am building up the string using the javascript "+" to concatenate various variables for POST. Then I am using . So, how can I use the urlencode() here since I am creating the parameter string in javascript?
  11. Hi Guys, I am making some AJAX calls and passing some POST variables. The POST parameters happen to contain "+" character. It is something like prod1=A4+&prod2=fullsize. When I try to read the $_POST[prod1] it returns "A4 ". There is no + sign and it replaced by a white space. Am I doing something wrong? How can I read POST variables that contains "+" character. Thanks in advance.
  12. Hello, I have been working on an architecture for quite some time and one problem that I have not been able to find a suitable solution is being mentioned here. I have multiple domains but they all have to run using a single application. For example www.123.com, www.456.com, www.abc.com, all of these applications are going to use a single set of application files. My problem is: Whenever the user types in a domain name say www.123.com, it will be redirected to the central application. Now, this application is stored in an other folder. So, the URL will change. So, if I type in like www.123.com/home.php then it will access the home.php in the application folder and will change the URL to something like www.centralapplication.com/home.php. I want to keep the URL same. I don't want the URL to change. So, the user should be able to use the applicaiton as www.123.com/ rather than www.centralapplication.com/ Now, I have been researching on this issue. Someone suggested me to keep all the files in a folder and write APIs that I will place in each domain folder. So, whenever a user types in a site name the APIs stored in its folder will access the files from the application folder. I am not sure how this will work. Any idea? Another approach suggested was to use $_SERVER['HTTP_HOST'] to determine which site it is, and get the request through $_SERVER['REQUEST_URI']. So if we make the request http://www.example.com/user/login then you'll have: HTTP_HOST = www.example.com REQUEST_URI = /user/login I am not sure how this approach works. So, can you please help me out in deciding the best solution for this problem. I really don't have much idea about this since I am doing it for first time. Thanks a lot in advance.
  13. Hello, I am in the process of developing a PHP application/system. As per the client requirement this application should be supplied a logo, color scheme and few other information and it should output a website with those settings. He wants to create website everyday using this system. One of the main requirements of the client is that in future whenever there is a change (additions, appending, removal) of feature(s) in this system then it should reflect the changes in all the websites that have been created from this system. Now, the first idea that hit my mind was to create websites and upload them on their respective ftp server. In future whenever there was a change in the parent Application/system, then we will manually transfer the files to every ftp server. This of course becomes a tedious job when the site number increases. Today another architecture hit my mind and this one seems to be more logical in terms of meeting the client requirements, specially the updating part. I am thinking of developing one application and host it on a server. Now, whenever we want to create a site then we will create a website profile table in a the database with every setting necessary to run the application like name, logo, colors, database information etc. Now this way I will have only one application running with several website profiles existing in the database. Whenever a user wants to open a site www.abc.com then it will redirect it to my main application with user entered URL as POST and then using this value I will fetch the website profile information from the database, substitute the values in the application and show it to the user. So if another user types www.xyz.com then it will take it to the main application with xyz as the site name. I will then pull out the website profile from the database, fetch the values, substitute them in the main application and show it to the user. So this way I will have to maintain only one application and the variations will actually take place using the various website profile info that exists in the database. Now, I have few queries with this: 1.) Do you think this will work? 2.) When the user is directed to the main application then the browser addess bar URL will change. Is there any way through which I can display the user entered URL in the browser so as to make the user feel that he/she is browsing (say) www.abc.com and not www.parentapplication.com? 3.) What do you think about its performance? Will the performance get affected? I mean the load time and query running times? 4.) What are the downsides of this approach? One of them which I can think right now is the overhead of fetching the database info on every page. But, I think I can solve this problem by using the session variables. Please let the thoughts flow in. I really believe in this second approach and I would want honest suggests, advices and criticism for this approach. Thanks.
  14. Thanks a lot guys for your valuable replies. Let me try things out based on the suggestions given here and update you how it went .
  15. I have a PHP based application running. I have a messageboard in it. Earlier there was no security feature and I was getting lot of spams. Then I implemented the image verification to submit new threads and replies. But the spams still kept in coming. Then I changed the password of my database. But I still face the same problem. Now, I have few questions: 1.) How come even after implementing the Image text verification, spams are able to post themselves? :-\ 2.) Why the problem exists when I have changed the password of my database? :-\ 3.) Is this SQL Injection? Should I use sprintf while writing and executing queries? ??? Please suggest me. Any urgent help will be highly appreciated. Thanks, Anurag
×
×
  • 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.