-
Posts
2,527 -
Joined
-
Last visited
Everything posted by DeanWhitehouse
-
echo '<object type="application/x-shockwave-flash" data="http://www.sharingizcaring.com/button/musicplayer.swf?&song_url=http://www.sharingizcaring.com/REPOSITORY/'.$key.'" width="17" height="17">'; echo '<param name="movie" value="http://www.sharingizcaring.com/button/musicplayer.swf?&song_url=http://www.sharingizcaring.com/REPOSITORY/'.$key.'"/>'; I think that's what thorpe meant. Edit: Or not
-
I don't think those can be embedded, but have you tried google?
-
Did you write the code your self? And yes, post the code it seems that you need to open PHP tags there.
-
[SOLVED] Adding data to array, in While loop
DeanWhitehouse replied to DeanWhitehouse's topic in PHP Coding Help
thanks -
Need help with ptc script ( large script :P)
DeanWhitehouse replied to viko20's topic in PHP Coding Help
Ok, but i don't really think any one will read through the code. -
I have a while loop for mysql_fetch_assoc(); , and i want to put a certain thing into an array should i do it this way or will mysql_fetch_array(); do it? $sqk = "SELECT * FROM guestbook"; $sqk = mysql_query($sqk); $arr = array(); /*while($wir = mysql_fetch_assoc($sqk)) { $arr .= $wir['en_avatar']; }*/ $arr = mysql_fetch_array($sqk); //echo $arr; echo $arr['1']; Edit: I need to put all the avatar images into one array , to make my image preloader
-
hang on, what do you want to do? send an email or have a mail to link, and I don't think its possible to have HTML code in the link its self, not that there is a reason to , rephrase the question more clearly
-
$result = mysql_query("SELECT * FROM TABLE WHERE blog.id = '$blog_id'") or die(mysql_error()); if(mysql_num_rows($result) == 0) { echo "This post is non-existant";//post not there }
-
[SOLVED] help please, add phone number to the code to work.
DeanWhitehouse replied to madox's topic in PHP Coding Help
wtf? mail("email address", $subject, $message, $from, $phone); mail(To,Subject,Message,Additional Headers); Nothing else allowed, try putting the $phone in the $message Edit: Beat me to it, but use code tags This will help http://uk2.php.net/function.mail -
[SOLVED] help please, add phone number to the code to work.
DeanWhitehouse replied to madox's topic in PHP Coding Help
where are you trying to add the number? -
Possible to pass PHP array to JS function?
DeanWhitehouse replied to ninedoors's topic in PHP Coding Help
Ok, then i believe it is your JS as the php is working -
Possible to pass PHP array to JS function?
DeanWhitehouse replied to ninedoors's topic in PHP Coding Help
where is $vals ? also view the source and see if the javascript is there properly -
Where does it say mail? or anything like that, please put the code in tags
-
Possible to pass PHP array to JS function?
DeanWhitehouse replied to ninedoors's topic in PHP Coding Help
try mine -
Possible to pass PHP array to JS function?
DeanWhitehouse replied to ninedoors's topic in PHP Coding Help
@barrand <?php echo " <script type=\"text/javascript\"> var vals = new array(".join(',' , $vals)." ); put_picker(vals); </script>"; ?> Beat me to it again, lolz -
Need help with ptc script ( large script :P)
DeanWhitehouse replied to viko20's topic in PHP Coding Help
Can you show us the lines where and around the problem, its to long to expect us to read it. -
Possible to pass PHP array to JS function?
DeanWhitehouse replied to ninedoors's topic in PHP Coding Help
My idea would be doing something like <script> var Arr = new array ( <?php $value = array('1','2','3'); //etc foreach($value as $val) { echo "'".$val"',"; } ?> ); </script> Edit: Beat me to it -
This is a management site i made for myself, can people test out the site and tell me what you think. http://webstatus.awardspace.info/main.php The username is Test and the password is test
-
Upload form, not allowing certain images.
DeanWhitehouse replied to DeanWhitehouse's topic in PHP Coding Help
New problem , file_exist doesnt seem to be working, yet im on PHP 5.2.6. Is it only avaible in later ones. I have this code now, how can i change the file name if the file exists, my way produces errors (i think becuase of the file name change , but not the temp name) <?php function file_present($var) { if (@fclose(@fopen($var, "r"))) { return true; } else { return false; } } require_once 'header.php'; if(!isset($_SESSION['advert'])) { header("Location:http://".$_SERVER['HTTP_HOST']."/advertise.php"); } if(isset($_GET['logout'])) { session_unset(); session_destroy(); header("Location:http://".$_SERVER['HTTP_HOST']."/advertise.php"); } $email = $_SESSION['email']; if(isset($_POST['upload'])) { $target = "img/logos/"; $name = mysql_real_escape_string($_FILES['uploaded']['name']); $image = $target.$name; $location = "http://".$_SERVER['HTTP_HOST']."/".$image; if (file_present($location) == true) { $image = $target.$name.rand(1,100); } $target = $target . basename( $_FILES['uploaded']['name']) ; $size = $_FILES['uploaded']['size']; $extension = $_FILES["uploaded"]["type"]; $location = "http://".$_SERVER['HTTP_HOST']."/".$target; if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "<br>The file " . $_FILES['uploaded']['name']." has been uploaded.<br />"; echo "Upload: " . $_FILES["uploaded"]["name"] . "<br />"; echo "Type: " . $_FILES["uploaded"]["type"] . "<br />"; echo "Size: " . ($_FILES["uploaded"]["size"] / 1024) . " Kb<br />"; echo "Stored in: " . $_FILES["uploaded"]["tmp_name"]."<br>"; mysql_query("UPDATE Companies SET logo_url = '$location' WHERE email = '$email'"); } else { echo "Sorry, there was a problem uploading your file."; } } ?> -
This is my code: <?php require_once 'header.php'; if(!isset($_SESSION['advert'])) { header("Location:http://".$_SERVER['HTTP_HOST']."/advertise.php"); } if(isset($_GET['logout'])) { session_unset(); session_destroy(); header("Location:http://".$_SERVER['HTTP_HOST']."/advertise.php"); } $email = $_SESSION['email']; if(isset($_POST['upload'])) { $target = "img/logos/"; $name = mysql_real_escape_string($_FILES['uploaded']['name']); $image = $target.$name; //if(file_exists($image)) //{ //$image = $target.$name.rand(1,100); //} $target = $target . basename( $_FILES['uploaded']['name']) ; //$size = $_FILES['uploaded']['size']; //$extension = substr($name, strrpos($name, "."), strlen($name)); $location = "http://".$_SERVER['HTTP_HOST']."/".$target; echo "Upload: " . $_FILES["uploaded"]["name"] . "<br />"; echo "Type: " . $_FILES["uploaded"]["type"] . "<br />"; echo "Size: " . ($_FILES["uploaded"]["size"] / 1024) . " Kb<br />"; echo "Stored in: " . $_FILES["uploaded"]["tmp_name"]."<br>"; echo "Error: ".$_FILES['uploaded'] ['error']; if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "<br>The file " . $_FILES['uploaded']['name']." has been uploaded.<br />"; echo "Upload: " . $_FILES["uploaded"]["name"] . "<br />"; echo "Type: " . $_FILES["uploaded"]["type"] . "<br />"; echo "Size: " . ($_FILES["uploaded"]["size"] / 1024) . " Kb<br />"; echo "Stored in: " . $_FILES["uploaded"]["tmp_name"]."<br>"; mysql_query("UPDATE Companies SET logo_url = '$location' WHERE email = '$email'"); echo "Error: ".$_FILES['uploaded'] ['error']; } else { echo "Sorry, there was a problem uploading your file."; } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>All About Weddings</title> <meta name="author" content=""> <link rel="stylesheet" href="weddings.css" type="text/css"> </head> <body> <form enctype="multipart/form-data" action="<?php $_SERVER['PHP_SELF'] ?>" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="30000" /> Please choose a file: <input name="uploaded" type="file"/><br /> <input type="submit" value="Submit" name="upload" /> </form> <?php echo ini_get('post_max_size')."<br>".ini_get('upload_max_filesize'); mysql_close(); ?> </body></html> for some reason its not allowing most images to even get stored in the temp files. So far the largest image that has reached the temp file, is just under 5kb. The ini post_max_size is 8mb, and the upload_max_filesize is 2mb. Most of the code is just trying to debug this problem, but from the above code it shows that the file is isnt being stored temporarily while i perfrom checks(unless its really small), any one know why? Btw , i have tried changing the hidden max size, and that doesnt do anything. Scrap that, it now seems to be working.
-
Solved this is my code <?php $config_file = "hits.php"; include($config_file); $home_page = $home_page; $wine_page = $wine_page; $menu = $menu; $recipes = $recipes; $about = $about; $functions = $functions; $contact = $contact; $hits = $hits; $hits .= "IP: ".$_SERVER['REMOTE_ADDR']." Site: ".$_SERVER['HTTP_REFERER']."<br>"; $fw = fopen($config_file,"w+"); $home_page = "\$home_page = \"".$home_page."\";\n"; $wine_page = "\$wine_page = \"".$wine_page."\";\n"; $menu = "\$menu = \"".$menu."\";\n"; $recipes = "\$recipes = \"".$recipes."\";\n"; $about = "\$hits = \"".$about."\";\n"; $functions = "\$hits = \"".$functions."\";\n"; $contact = "\$hits = \"".$contact."\";\n"; $hits = "\$hits = \"".$hits."\";\n"; $config_write = $home_page.$wine_page.$menu.$recipes.$about.$functions.$contact.$hits; fwrite($fw, "<?php\n".$config_write."\n?>"); ?>
-
Ok, i have tried 4 ways of getting the data from the file and only the last one did. <?php $config_file = "hits.php"; $fw = fopen($config_file,"r") or die("Problem opening log"); file_get_contents($config_file); file($config_file); include($config_file); //these are the four ways, the file just has 2 vars in it with data stored in them. But only using include , was the var present in my below code. if(isset($test)) { echo "present"; } else { echo "not"; } ?>
-
Calm down, only asking a question. Does anyone know if there is a more effiecent way, using flat file.
-
Using f(open,write,close), using them dont i have to write all the contents each time, instead of just updating one?
-
Ok, i havent made a flat file system before so i could use some help. What i need to do is count how many hits the site pages get, each page seperatly would be good, and then i will need there IP and there refferer. I know how to do all this db style, the start to the code would be <?php $ip = $_SERVER['REMOTE_ADDR']; $hits = //this would be the current hits the page has $hits++; $refferer = $_SERVER['HTTP_REFERER']; ?> Any help please.