Jump to content

Mateobus

Members
  • Posts

    95
  • Joined

  • Last visited

    Never

Everything posted by Mateobus

  1. Hello, I am having a very difficult time getting my errors to show on my page, particularly parse errors. I have a big script that has a parse error (i don't know where), and it would be much easier to test my script with error reports telling me what the problem is, but instead i just get a white page. I have played around with various settings, and I have had no luck. Here is a snippet of the script which is having problems. error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); ini_set('safe_mode', ''); Also, when I run phpinfo(), i get 6143 --not sure what that means. Thanks in advance
  2. yeah thats what i needed, thanks
  3. Hello I have a list of websites which i wish to "prefix", by truncating them at the third occurence of '/' (including the 2 for http://) so like: $str = 'http://www.google.com/analytics/blah/blah.html'; function truncate($str) { } echo truncate($str); //would print http://www.google.com thanks in advance. -Matt
  4. have you tried changing the last line to: return $for_name;
  5. Great, thanks for the help. I was wondering why you would not suggest saving the images first?
  6. Hey all, I am trying to implement a captcha on my website. Rather than creating the image on the fly, I would like to have a database of the captcha codes, and a thousand or so associated images. I was wondering if anyone knew how to save an image to a directory on the server, after it has been created with the imagecreatefrompng or imagecreatefromjpg function. Here is the code i found from a tutorial <?php /* Now for the GD stuff, for ease of use lets create the image from a background image. */ $captcha = imagecreatefrompng("./captcha.png"); /* Lets set the colours, the colour $line is used to generate lines. Using a blue misty colours. The colour codes are in RGB */ $black = imagecolorallocate($captcha, 0, 0, 0); $line = imagecolorallocate($captcha,233,239,239); /* Now to make it a little bit harder for any bots to break, assuming they can break it so far. Lets add some lines in (static lines) to attempt to make the bots life a little harder */ imageline($captcha,0,0,39,29,$line); imageline($captcha,40,0,64,29,$line); ?> so, i was planning on putting that in a loop and saving the images in a folder. Maybe not the most secure way, but its the most efficient. Does anyone know how to move that file to a non-temporary directory on the server?
  7. The error in the firefox console is: request.responseXML has no properties. This leads me to believe that my xml is not valid. I do know that the file is reaching the server though. Here is my code... var request = new XMLHttpRequest(); request.open("POST", "script.php", true); request.onreadystatechange = function() { if (request.readyState == 4) { if (request.status == 200) { document.getElementById('status').firstChild.data = request.responseXML.documentElement.getElementsByTagName("compname")[0].childNodes[0].nodeValue; }else { document.getElementById('status').firstChild.data ="The server was unable to process your request"; } } }; request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); request.setRequestHeader("Content-length", 17); request.setRequestHeader("Connection", "close"); request.send(qs); and the script.php file is just this: $RETURN_XML = "<?xml version='1.0' encoding='ISO-8859-1'?>"; $RETURN_XML .= "<company>"; $RETURN_XML .= "<compname>asdf</compname>"; $RETURN_XML .= "<contname>asfd</contname>"; $RETURN_XML .= "<address>asdf</address>"; $RETURN_XML .= "<city>asdfff</city>"; $RETURN_XML .= "<country>asdfff</country>"; $RETURN_XML .= "</company>"; echo $RETURN_XML; Any help is appreciated here...thanks a bunch.
  8. Hello, I have a sports website, and I would like to create a query that computes a team's record based on querying a table of games. The function will be given a team's id and year and will query the table which is set up as follow: homeid | awayid | home_score | away_score | year ----------------------------------------------------------- i can get the wins like such: select count(*) as wins from gamesm where (homeid='958' && home_score>away_score && year='2006') || (awayid='958' && away_score>home_score && year='2006') ideally i would do this as a single query. it is pretty important that this is efficient because it will get used a lot. But how would i do something like this (though i know its not right): select count(*) as wins from gamesm where (homeid='958' && home_score>away_score && year='2006') || (awayid='958' && away_score>home_score && year='2006'), count(*) as losses from gamesm where (homeid='958' && home_score<away_score && year='2006') || (awayid='958' && away_score<home_score && year='2006'), count(*) as ties from gamesm where (homeid='958' || awayid='958') && home_score=away_score I know that doesnt work, but is there a way of doing something like that. If not, I would probably need some sort of stored procedure, correct?
  9. is there a way to calculate the 3rd monday of september for a given year with php? Any help is appreciated.
  10. Very Tough Query Hey all I have a tough query here. Basically I am making a top 25 poll, and I am trying to use two tables. The first table is the votes table and is set up as follows: voterid | place | teamid The second table should contain the number of points for each team from the votes table as well as the number of first place votes. Points can be calculated by the equation 26-place. So a first place vote gets 25 points, 2nd 24... The second table is set up as follows teamid | points | first_place_votes The query should incorporate all of the votes from the first table into the second one. If anyone can help I would greatly appreciate it. I could use php to rig this up with arrays and such, but I would rather have it done more efficiently.
  11. I really appreciate your help, thanks a lot.
  12. Hello, I am trying to run kind of a tough query for me. Here is how my tables are set up: I have a table called games with an id, and then homeid, and awayid for the two teams. Then I have a table called team, with a column called teamid and name. I would like to run a query that returns the game id, home team name, and away team name of all the games for a given team with id=x. Any help is greatly appreciated thanks in advance.
  13. Hey all, I am getting an error validating my website for xhtml 1.1 and I think it has something to do with my databases. This is the exact error: non SGML character number ... Does anyone know if there is a quick fix to this. It seems to not recognize characters like ' apostrophes within the html. Any help is appreciated.
  14. Hello, I am trying to write a script to delete a file using unlink, but it is not working at all. here is how the directories are set up, also, i would like to be able to delete the file relatively from the current directory as opposed to starting from the very beginning if that makes any sense. the script is called script.php in: home/admins/script.php the file (delete_me.del) i want to delete is in home/deletables/delete_me.del this is what i have, but it isn't working: unlink("../../deletables/delete_me.del"); Thanks for your time and help.
  15. Hey all, when i first made my CMS, i kept all of the uploaded images as files on the server, and created links to them in the database. I have been changing things around now (especially directories) and I am thinking of storing the images in the actual database. I read somewhere that this can be considered a bad practice, so i was wondering what the consensus here was. In my opinion, modifying all of the code to point to the correct directories everytime a page location changes seems like a pain in the a**.
  16. Is there a way for php to get the name of the file that it is currently in? For example a function that would return "index.php" for this page which I am currently typing in? Thanks guys
  17. Id like to buy you a coke spfoonnewb, thanks!
  18. Hello all, I am getting the following error when i run my script on my school's given webspace: Warning: copy(files/1171413168.jpg) [function.copy]: failed to open stream: Permission denied I am assuming that this means that the folder permissions aren't set to the correct settings. For our project we have to keep the main directory set at 711. Can I have a directory inside of the main directory set to something else that would allow me to upload files from the web? If so, what does it need to be set to? I am not too familiar with folder permission so any help is appreciated.
  19. Hello, I am having trouble automatically refreshing a page in IE 7. It seems to work fine in firefox... Here is the code that I am using: header("Refresh: 5;"); I have also tried <META HTTP-EQUIV="REFRESH" CONTENT="5"> to no success. Does it matter if the code is in the head section of the web page? I have tried them both together and separate, and it doesn't seem to work in internet explorer.
  20. Hello all, I am trying to maintain a clock in a database and I am having trouble doing so. I have tried reading the php manuals for various functions but its all a bit over my head.  I am wondering how you would take a timestamp (perhaps from mysql, or perhaps php time) and subtract a certain amount of time from it. In the end, I just want to update a variable that is of type time in mysql: 00:00:00. [code] $timenew = now $timeold = get_time_from_database $difference = timenew - timeold update database time=difference [/code] Sorry for my pseudocode, but any help is appreciated
  21. Hello all, I have a a form for the various types of results that can happen when someone shoots (for a soccer match). So if they, miss, or if its saved by the goalie. But if it is a goal, I want to show a drop down box for who got the assist. Can anyone do this with javascript? Any help is appreciated. [code] <form action="admin.php" method="post"> <select name="player" id="player"> <option>1</option><option>2</option> </select> <select name="type" id="type"> <option>Miss</option> <option>Save</option> <option>Goal</option> </select> <select name="assist" id="assist"> <option>1</option><option>2</option></select> <input name="home_shot" type="submit" id="home_shot" value="Shot" /> </form> [/code]
×
×
  • 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.