Jump to content

slipperyfish

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

Everything posted by slipperyfish

  1. i downloaded the script at that link you sent me, but im getting errors when i try to run it: [QUOTE] Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in e:\domains\s\store02.newbiestyle.co.uk\user\htdocs\ajax-example3\dl\AjaxFileUploader.inc.php on line 16 Fatal error: Cannot instantiate non-existent class: ajaxfileuploader in e:\domains\s\store02.newbiestyle.co.uk\user\htdocs\ajax-example3\dl\index.php on line 15 [/QUOTE] -------------------------------- is there actually a way of uploading/transferring/copying a file without using the $_FILES[] array? -Thanks
  2. I see, I see. Is it possibile to upload a file without using the $_FORMS variable?
  3. Well, im using this inconjunction with an AJAX script. Im passing the file location in the url, for example: [CODE] fileupload.php?loc=C:\files\file.txt [/CODE] Then letting this script take over, except it won't work? [CODE] <?php if (isset($_GET['loc'])) { $thetransfer = copy($_FILES[$_GET['loc']]['tmp_name'], 'uploads/'.$_FILES[$_GET['loc']]['name']); If (!$thetransfer) { echo 'Upload Failed!'; } else { echo "File uploaded!"; } } ?> [/CODE] Does anybody know why?? -Thanks
  4. Well I've been learning PHP for quite some time now. I've never really had to use regular expressions, but if i want to be a good web programmer i'm going to have to learn them i guess -- although they look like they are gunna make my head hurt. does anybody know a good introduction tutorial? -Thanks!
  5. hi. im trying to create a form uploader script using AJAX technology. I want it all to happen on the same page without refreshing any pages or iframes. Using AJAX to call the php script, i want to send in the filename the location in a variable. for example: uploadfile.php?loc=C:\folder\file.jpg but in the script... how do i use that in the files array? ( $_FILES[] ) -Thanks
  6. does anybody know of a javascript function that works the same as php's die() function?
  7. Well, on some forums and websites, i have noticed that the textareas have varied styled text. For example clicking a bold button will make some of the text in the textarea bold-- but not all of it! I'm assuming this is done using JavaScript. Does anybody know how to do it? -Thanks
  8. ahh, i've heard about SMART templates. It has a downlaods page, do i have to install anything into my PHP config, because I don't have access....
  9. Hey everyone. Im wanting to create a website using ".tpl" files, and have variables like: "{HEADER}". However I'm not sure how to create this, I've looked around and I can't find anything that makes it simple, or gives a complete scirpt to be able to modify. So does anybody have some links, quick tips or snippets of code I could use? -Thanks.
  10. ___Sorry, just trying to get this seen___
  11. I wrote a fairly simple procedure to work it out: [CODE] $file = "test.jpg"; $extension = substr(strrchr($file, "."), 0); [/CODE] that returns ".jpg". It's not ideal, but it works fine. And if you have an extension with 4 digits (eg jpeg) it still allows you to run IFs or/we you want on it.
  12. if that fails still, try putting the "equipment_type" into a variable be4 running the if-- but i myab e wrong in that.
  13. Unfortunately, adding the trim function didn't work. it will says: "Invalid Image Source". Anybody any more ideas why it's does that?
  14. I have a fairly simple scirpt to check if an image exists, then give back some feedback: [code] <?php print '<br />'; print '<center>'; $thesrc = $_GET['src']; If (file_exists($thesrc)) { print '<font face="Tahoma" size="2">Valid image source</font>'; print '<br /><br />'; print '<img src="' .$thesrc. '" />'; } else { print '<br />'; print '<center>'; print '<font face="Tahoma" size="2">Invalid image source</font>'; } print '</center>'; ?> [/code] .. but this just always reutnrs false... and suggestions :S ??
  15. ahh thanks. when i used that the mysql eror revealed iwas trying to get out of the table "toxic_poll_results", should have been "toxic_poll_options", silly mistake! Thankyou for your help kind sirS.
  16. Hey all. Im having a little problem creating a poll. Im running some mySQL functions, and i keep getting this error message: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/fhlinux186/t/toxicgaming.newbiestyle.co.uk/user/htdocs/postpoll.php on line 54 [/quote] Here's the code im running relative to that area: [code] <?php $db = mysql_connect("****", "****", "***") or die("Could Not Connect"); if(!$db)     die("no db"); if(!mysql_select_db("******",$db))     die("No database selected."); $totaloptions = "5"; $option = mysql_query("SELECT * FROM toxic_poll_results ORDER BY option_number ASC LIMIT " .$totaloptions. "");          while($optionarray=mysql_fetch_assoc($option)) {         $optionvotes = $optionarray['option_votes'];         $percent = ($totalvotes / 100) * $optionvotes;         print '' .$option[$x]. ': <img src="images/bar.gif" width="' .$percent. '" /> ' .$percent. '%<br /><br />';         $x++;     } mysql_close($db); ?> [/code] can any body help?
  17. well, im no PHP-whizz! but i find PHP sessions are the easiest way. I store their user information in a database when they register. and when they login, the database is checked for their info, if it exsists i set the sessions with a few vital pieces of user info, like username, password, name, status level etc. then the if i run to check if they are logged in is: [code] if (isset($_SESSION["password"])) { ... they are logged in ... } else { ... they are not logged in ... } [/code] Im not really sure how safe or decent that method is, but i do know PHP sessions cannot be editted by users in the same way cookies can. perhaps someone could let me know how safe/good it is? .. but, as a basic login system, i think that's the wya to go ;)
  18. Well when you include a page using PHP, even if in another directory as in your case, it becomes part of the page. Meaning if in the include file, you have an image src that should work, it won't when you include it because it has moved a directory.. if tht makes any sense?? :S ..basically just change the source of the images from.. (for example) [b]1.jpg[/b] to: [b]/images/1.jpg[/b]
  19. sorry, i dont think i explained properly. When they submit a shout, if they didnt enter an email, the default value "no" is put in the database. In the database, if the value of the email field is equal to "no", then the email link shouldn't be visible for that row.
  20. Hey! This is part of my shoutbox script to display the shouts. I want to run an IF within the WHILE to determine wether the email field in the db contains "no" - which means no email obviouslly. However I tried the following script, and it doesn't work? I have a few sample shouts in the db; with and without emails - and the outcome is that the email link is always there, which, altho only a small problem, I want it to function properly. Im guessing it's something to do with the IF being within the WHILE. [code]<?php include('../include/connect.php'); $sql = "SELECT * FROM ns_shouts ORDER BY time DESC";     $qr = mysql_query($sql) or die("Error communicating with database."); If ($qr) {     while($qa=mysql_fetch_array($qr)) {     $name = $qa[username];     $shout = $qa[message];     $time = $qa[time];     $email = $qa[email];     If ($email=="no") {         print '<font style="font-family: Tahoma; font-size: 10px; color: #f1f1f1;"><b>' .$name. '</b>: </font>';     } else {         print '<font style="font-family: Tahoma; font-size: 10px; color: #f1f1f1;"><a href="mailto:' .$email. '"><b>' .$name. '</b></a>: </font>';     }     print '<font style="font-family: Tahoma; font-size: 10px; color: #f1f1f1;">' .$shout. '<br /></font>';     print '<font style="font-family: Tahoma; font-size: 8px; color: #999999;">' .$time. '</font>';     print '<hr color="#999999">';     } } else {     print "<font class=\"normal\">No Shouts.</font>"; } ?>[/code] Anyone any ideas? -Thankyou
  21. Hmm, I realised afterwards I hadn't included the action, but on my real page it's there.. if you could pelase have a look it's here: [a href=\"http://www.website.newbiestyle.co.uk/exec\" target=\"_blank\"]http://www.website.newbiestyle.co.uk/exec[/a] When you click go there's an error in the stauts bar :S
  22. do you have a link? - and in tht case the problem does not lie with ur onChange function.
  23. Hi all, im trying to create an email address input validation script. I have this: [code]<html> <head> <script type="text/javascript"> function validateSubEmail() {     var str = subscribe.email.value;     if (str.indexOf(".") > 2) && (str.indexOf("@") > 0) {         subscribe.submit();     } else {         alert("Invalid Email!");     } } </script> </head> <body> <form name="subscribe" action="subscribe.php"> <input type="text" name="email" /><input type="button" onclick="validateSubEmail()" value="Go"> </form> </body> </html>[/code] ... but it's not working :S .. anyone have any idea why?? .. its not saying error in the status bar at all tho... just nothing happens :S .. try it here: [a href=\"http://www.w3schools.com/js/tryit.asp?filename=tryjs_alert\" target=\"_blank\"]http://www.w3schools.com/js/tryit.asp?filename=tryjs_alert[/a] help much appreciated!
×
×
  • 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.