User Profile
Collapse
-
Thanks for your comments, I will defiantly be looking into your suggestions. -
-
Wrote a MySQL function - want some feedback and criticism
I wrote this function about 2 years ago when I started in PHP, I haven't touched PHP since so im still not an expert, but I would like to know what people thought of it, and if was any good / secure / fast / easy to use ect ect
Looking for some constructive criticism really and improvements and faults.
Thanks
[PHP]<?php
// Database Function
function db($Action) {
... -
-
Google Maps quick help
Iv been searching for a way to get the distance in miles from one location to another, and thought the best way is using google maps. Back in the day I did this by using a curl command and regular expressions (I know cringe) but im looking into using googles API for it.
Searched the web and found this:
http://groups.google.c om/group/Google-Maps-API/browse_thread/thread/5c40d54ac3da139 3
Which he claims... -
Thanks and sorry for the late reply.
I will have a mess with your method after Christmas and try to implement it. I looked through the different sorts on the php website but things got confusing lol.
Thanks very much for your time :)Leave a comment:
-
Im no expert so you might want to hold out for an expert to reply but I have been doing this for a while.
When I first started I used safeHTML, which seemed to do a good job, was quick at what it done.
I'm writing a script now and im trying to stay away from it simply for the fact that I want to learn myself.
Id suggest writing a function of some sort that would get what the user is submitting, and use...Leave a comment:
-
even though this is NOT a PHP question, I did not think this was possible. In fact its not. But you can stop them pressing the F5 key.:
http://www.gklein.org/tests/js/disablekey.html
I just tested it and it stopped my pressing F5 in Firefox 3 (haven't got any lower instilled tot try it) and IE 7.Leave a comment:
-
sort() and an array. Quick question.
Hello people, just a quick question I have here.
My array looks like this:
[PHP]Array (
[0] => Array (
[id] => 15
[site_url] => example.com
[clean_url] => examplecom
[code] => NshKsi23
[success] => 1
[fail] => 1
[success_rate] => 50
[fail_rate] => 50
[description] => Free delivery.
... -
I think he is useing GD functions or imagemagic. It will help because it is a iamge hosting site. The data being sent will still be large but when all the users come to see it it will have a reduced size.Leave a comment:
-
Anthony2oo5 replied to Parse error: syntax error, unexpected T_ENCAPSED_AND WHITESPACE, expecting T_STRINGin PHPCan you post the code again without quoteing it in PHP tags so I can copy it to my editor otherwise I have numbers down the side.Leave a comment:
-
Image optimization Emergency lol
Image optimization Emergency lol
Hey guys. I have a image hosting website that seems to have taken off over the past 2 days and jumped from 6GB per day, to 25 GB and rising.
I was wondering if there is a way to help lower this bandwidth problem. I wanted to optimise images that people upload.
I found a function on this webpage that says it can do it, but it only works with jpegs.
http://nodstrum.com/2007/02/06/imagemagick_man ipulation/... -
Hey thanks both I will try these solutions later.
I have a function for getting the file extension. I used one similar to what you have wrote but it didn't work for reading the file extension inside zip files, so I made another one:
[PHP] function GetFileExt($fil ename) {
return end(explode("." , $filename));
}[/PHP]
Thanks again, I will come back and update with my progres...Leave a comment:
-
Using an array to check for valid file extensions in PHP
Hey there,
I'm trying to write a script for uploading images but only with certain file extensions. Currently I have it working by:
[PHP]if (($FileExt = "jpg") || ($FileExt = "gif"))[/PHP]
ect, but is there a way i can do:
[PHP]$allowed = array("jpg", "gif");
if $allowed[/PHP]
I tried that but the if always turned out false.... -
Just didn't want hackers knowing my script. can you censor like 4 and 40 please.
Thanks :)Leave a comment:
-
YEY, file get contents works great thanks very much for all the help.
May I have one request?, can I have the code from my second post removed please? Everything else can stay.
Once again thanks all.Leave a comment:
-
no, I have the above code in a php file, then just run the file directly. I had curl to get the image (i may have said cron before sorry), but changed it to fopen as you said.
Will have a go of file get contents....Leave a comment:
-
Ok, now it sort of works lol. But the file only seems to half download, Check here:
[ur]http://piczy.net/Image-MCTWK.gif[/url]
I changed the Cron job with the following:
[PHP]$fh = fopen($address, 'r') or die("Can't open file");
$data = fread($fh, 524288000000);
fclose($fh);[/PHP]
Note all the 0000000 at the end was me upping the limit to see if thats why it was stopping....Leave a comment:
-
Will try that in a sec, thanks.
Was going to use that but thought curl was quicker....Leave a comment:
-
[PHP]<?php
include ('includes/functions.php') ;
$Error = "";
$UploadDIR = 'images/';
$ShortenTo = 15;
function RemoteGet($addr ess) {
// Connect to the google website to find the millage
$ch = curl_init();
curl_setopt($ch , CURLOPT_URL, $address);
curl_setopt($ch , CURLOPT_HEADER, 1);
curl_setopt($ch , CURLOPT_RETURNT RANSFER, 1);
$data = curl_exec($ch);...Leave a comment:
No activity results to display
Show More
Leave a comment: