Jump to content

ident

Members
  • Posts

    37
  • Joined

  • Last visited

    Never

Everything posted by ident

  1. Just wanting to start learning php. I have always enjoyed wrox books, can any one suggest one from here for a beginner.? http://www.wrox.com/WileyCDA/Section/PHP-MySQL.id-131383.html or have any other suggestions
  2. I use dreamweaver. any better suggestions?
  3. wish i could make sites like that
  4. It's only for me and a few friends. Il have a look at that one you mentioned. thanks and happy new year
  5. any one ever attempted this? something like http://www.zend2.com/ i assume doing this would be quite hard???
  6. is there something i can read to help my impliment this? im extreamly new to php, but willing to learn
  7. u will have to forgive me i didnt build the site. it's mine but a mate did. the handle script is <?php require_once('../inc/config.inc.php'); function rand_str($length = 14, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890') { // Length of character list $chars_length = (strlen($chars) - 1); // Start our string $string = $chars{rand(0, $chars_length)}; // Generate random string for ($i = 1; $i < $length; $i = strlen($string)) { // Grab a random character from our list $r = $chars{rand(0, $chars_length)}; // Make sure the same two characters don't appear next to each other if ($r != $string{$i - 1}) $string .= $r; } // Return the string return $string; } if( (!$_FILES) || ( !is_uploaded_file($_FILES['upfile']['tmp_name']) ) ) { # nothing given to upload header('Location: Upload.htm'); } require_once('../inc/mysql.inc.php'); # check the given file extension is valid $allowed_exts = array('jpeg', 'jpg', 'gif', 'tiff', 'png', 'tif'); $infile_bits = explode('.', $_FILES['upfile']['name']); $infile_ext = strtolower( $infile_bits[count($infile_bits)-1] ); # quit if an invalid extension is given if( !in_array($infile_ext, $allowed_exts) ) { include('header.php'); echo '<div style="text-align: center;"><img src="homer.gif" width="290" height="267" /></center>'; echo '<div style="text-align: center;">'.htmlentities($infile_ext, ENT_QUOTES).' is not supported</div>'; die; } # create a random filename that isn't yet taken in the database $nametries = 0; $nameok = 0; while($nametries < 4) { $filename = rand_str(); $check_query = 'SELECT `id` FROM `images` WHERE `storedname` = \''.$filename.'.'.$infile_ext.'\''; $check_result = mysql_query($check_query); @$check_row = mysql_fetch_object($check_result); if(!$check_row->id) { # this filename isn't taken yet $nameok = 1; break; } $nametries++; } if(!$nameok) { print 'error: failed to find usable filename (this is probably a bug)'; die; } # copy the file to the storage folder if( !move_uploaded_file($_FILES['upfile']['tmp_name'], $config['uploadpath'].$filename.'.'.$infile_ext) ) { print 'error: failed to move the uploaded file'; die; } # input the new file in the database $newup_query = 'INSERT INTO `images` (`upname`, `storedname`, `fileext`, `uploaded`) VALUES (\''.addslashes($_FILES['upfile']['name']).'\', \''.$filename.'\', \''.$infile_ext.'\', NOW())'; mysql_query($newup_query); header('Location: viewpic.php?file='.$filename); ?> i dont know what htaccess file is
  8. just found 2 instances of this on my website that had been uploaded by the image upload. My sites been coded to stop anything bad happening like this and nothing did. what could it of done?
  9. Basically my site is having a few bugs with how it displays IE. It works fine in FF. while i am sorting this i added a redirction page to alert the user. <?php function ae_detect_ie() { if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) return true; else return false; } ?> <?php if (ae_detect_ie()) { ?> echo "<script language='javascript'> window.location = "http://www.url.com/Ie.php" </script>"; <?php } ?> Obviously each time they hit index.php it displays this. How can i add a varible or something so it only redirects them once. than ks
  10. oni-kun, lol i just realised that a second after i posted, Opps, fail? marcus yeh i know that ta, wrong forum /hangs head in shame cheers guys
  11. Alot of people on a forum i go onto try to do little tricks like [url=http://img405.imageshack.us/img405/6295/BADPICTURE.jpg]www.google.co.uk[/url] I know a little php. But not really sure on where to start. I would like it to be displayed as when changing the view of the web page..... www.google.co.uk Hidden Link http://img405.imageshack.us/img405/6295/BADPICTURE.jpg is this even possible? page source looks like <a href="http://img405.imageshack.us/img405/6295/BADPICTURE.jpg" class="postlink" target="_blank">www.google.co.uk</a></div> any help would be great
  12. ah dodgy varible case had it as IP thanks
  13. Hi. iv made it quite clear as picture shows. i have got this <?php // entered IP address $enteredIpaddress = $_POST['norobots']; // Actual IP address $usersIpaddress = $_SERVER['REMOTE_ADDR']; // GO COMPARE!!!!11111 if ($enteredIpaddress != $usersIPaddress) { // if wrong IP entered redirect to google or what ever! header('location: http://www.google.co.uk'); } else { // DO all this if the IP's match! //add the header include('header.php'); //define the receiver of the email $to = $_POST["to"]; //define the subject of the email $subject = htmlentities($_POST["subject"], ENT_QUOTES); //define the message to be sent. Each line should be separated with \n // http://www.simplecoders.com/showpic.php?f=IR6eC3zS2w41wA.jpg $url_bits = parse_url($_POST['rawlink']); if( !preg_match('/f=[a-z-A-Z0-9]+\.[a-z]{1,3}/', $url_bits['query']) ) { echo "bad link"; die; } $_POST['msg'] = str_replace('[iMAGE]', $_POST['rawlink'], $_POST['msg']); $message = htmlentities($_POST["msg"], ENT_QUOTES) . "\n\n\n\n******************************************\n\nFree image hosting at www.simplecoders.com\n\nThe Simple Coders Team "; $headers = "From: SimpleCoders\r\nReply-To: support@simplecoders"; //send the email $mail_sent = @mail( $to, $subject, $message, $headers ); echo $mail_sent ? "<br /><center>Mail sent" : "Mail failed"; echo "<br /><a href=\"Upload.php\">Click here to go back to the previous page</a></center>"; } ?> but it always goes to google.
  14. I'm using a textbox called norobots This page formhandler uses emailhandle.php and we seem to be getting a high number of emails sent. So to stop robots using are site i added the textbox norobots. The verification is the users ip. and the textbox says add your ip address here. My problem is i dont know how to compare the textbox input to the users ip address. my code for handle email is below. If the ip's dont match i want it to go to a error page but if it matches i want it to send <?php //add the header include('header.php'); //define the receiver of the email $to = $_POST["to"]; //define the subject of the email $subject = htmlentities($_POST["subject"], ENT_QUOTES); //define the message to be sent. Each line should be separated with \n // http://www.simplecoders.com/showpic.php?f=IR6eC3zS2w41wA.jpg $url_bits = parse_url($_POST['rawlink']); if( !preg_match('/f=[a-z-A-Z0-9]+\.[a-z]{1,3}/', $url_bits['query']) ) { echo "bad link"; die; } $_POST['msg'] = str_replace('[iMAGE]', $_POST['rawlink'], $_POST['msg']); $message = htmlentities($_POST["msg"], ENT_QUOTES) . "\n\n\n\n******************************************\n\nFree image hosting at www.simplecoders.com\n\nThe Simple Coders Team "; $headers = "From: SimpleCoders\r\nReply-To: support@simplecoders"; //send the email $mail_sent = @mail( $to, $subject, $message, $headers ); echo $mail_sent ? "<br /><center>Mail sent" : "Mail failed"; echo "<br /><a href=\"Upload.php\">Click here to go back to the previous page</a></center>"; ?>
  15. top man, was what i was looking for
  16. Hi, let me try to explain a bit more. My site hosts images. When the site displays the thumb nail, under it has a link called email. When clicked it goes to a page with 2 textboxs and a texfield. "To: Subject: Message:" this allows the user to email the image to a friend. Currently this only adds the image link to the end of the email. What i would to do is for a user when typing the message to be able to choose where in the email the image should go. using a tag <image>. "This is my email message <imagehere> and so on" where the tag is placed is where php adds the link i have saved.
  17. Totally new to php so would have a hard time coding this but sur ei could find a way. Basically i have a textfield that people enter a message in to send an email. And at the end it add's a varible.(the link to a image they have just hosted) Which works fine but some times people want to add the picture where they want to in an email. so for example. "bla bla bla, how are you. Here is Johns new car <image> bla bla bla" Can php split strings and search? this is part of the viewpicture.php, <? # ignore any invalid requests if( !ctype_alnum($_GET['file']) ) { header('Location: Upload.htm'); } require_once('../inc/mysql.inc.php'); $info_query = 'SELECT `storedname`, `fileext`, UNIX_TIMESTAMP(`uploaded`) FROM `images` WHERE `storedname` = \''.addslashes($_GET['file']).'\''; $info_result = mysql_query($info_query); $info_row = mysql_fetch_object($info_result); $fullname = $info_row->storedname.'.'.$info_row->fileext; #add header to page echo '<link href="index_files/style.css" rel="stylesheet" type="text/css">'; echo '<style type="text/css">'; echo 'a:link {'; echo 'color: #284b72;'; echo '}'; echo '.style1 {'; echo 'font-size: 0.5em'; echo '}'; echo '</style>'; echo '<link rel="SHORTCUT ICON" href="http://www.simplecoders.com/sc.ico"/>'; echo '<div id="outer">'; echo '<div id="header">'; echo '<h1><a href="">SimpleCoders</a></h1>'; echo '<h2 class="style1">The simple coders team 2009</h2>'; echo '</div>'; echo '<div id="menu">'; echo '<ul>'; echo '<li class="first"><a href="index.php" title="Home">Home</a></li>'; echo '<li><a href="About.php" title="">About Us</a></li>'; echo '<li><a href="Products.php" title="">Products</a></li>'; echo '<li><a href="Upload.php" title="">Upload</a></li>'; echo '<li><a href="Contact.php" title="Contact">Contact Us</a></li>'; echo '</ul>'; echo '</div>'; echo '<p></p>'; #echo ''.date('d/m/Y').'<br /><p></p>'; $rawlink = 'http://www.simplecoders.com/showpic.php?f='.$fullname; $bbcode = '[img='.$rawlink.']'; $htmlimg = '<img src="'.$rawlink.'" />'; echo '<div style="text-align: center;">'; echo '<br /><h2>Share This Image</h2> <br/>'; echo 'HTML for Websites:<br /><input name="html" style="width:300px;"type="text" value="'.htmlentities($htmlimg, ENT_QUOTES).'" /><br />'; echo 'IMG Code for Forums & Message Boards:<br /><input style="width:300px;" type="text" value="'.$bbcode.'" /><br />'; echo 'Direct Link for Layouts:<br /><input style="width:300px;" type="text" value="'.$rawlink.'" /><br />'; echo '<br /><a href="Upload.php"><img src="uploadMore.PNG" STYLE="position:absolute; TOP:302px; LEFT:363px;" /> </a>'; echo '</div>'; echo '<a href="./showpic.php?f='.$fullname.'"><img src="./showpic.php?f='.$fullname.'"width="150" height="150" STYLE="position:absolute; TOP:195px; LEFT:800px;" /></a><br />'; echo '<div style="position: absolute; top: 355px; left: 800px;">'; echo '<a href="'.$rawlink.'"><b><u>View Full Sized Image</b></u></a>'; echo '</div>'; echo '<div style="position: absolute; top: 380px; left: 800px;">'; echo '<a href="Email.php?file='.$info_row->storedname.'.'.$info_row->fileext.'"><b><u>E-Mail Image</b></u></a>'; echo '</div>'; $htmlLink = $_POST['html']; ?> Email.php <?php include('header.php'); if( preg_match('/[a-zA-Z0-9]+.+/', $_GET['file']) ) { $htmllink ='http://www.simplecoders.com/showpic.php?f='.$_GET['file']; } ?> <input type="hidden" name="rawlink" value="<?php echo $htmllink; ?>" /> Then the actual sending of the email <?php //add the header include('header.php'); //define the receiver of the email $to = $_POST["to"]; //define the subject of the email $subject = htmlentities($_POST["subject"], ENT_QUOTES); //define the message to be sent. Each line should be separated with \n // http://www.simplecoders.com/showpic.php?f=IR6eC3zS2w41wA.jpg $url_bits = parse_url($_POST['rawlink']); if( !preg_match('/f=[a-z-A-Z0-9]+\.[a-z]{1,3}/', $url_bits['query']) ) { echo "bad link"; die; } $message = htmlentities($_POST["msg"], ENT_QUOTES); $message .= '<br /><img src="'.$_POST['rawlink'].'" />'; $headers = "From: SimpleCoders\r\nReply-To: support@simplecoders"; //send the email $mail_sent = @mail( $to, $subject, $message, $headers ); echo $mail_sent ? "<br /><center>Mail sent" : "Mail failed"; echo "<br /><a href=\"Upload.php\">Click here to go back to the previous page</a></center>"; ?>
  18. Hi, quick out line of what i am doing. A picture is displayed once uploaded then under it is a likn saying email $htmlimg = '<img src="'.$rawlink.'" />'; echo 'HTML for Websites:<br /><input name="html" style="width:300px;"type="text" value="'.htmlentities($htmlimg, ENT_QUOTES).'" /><br />'; this displays my image into a textbox adding html tags. I click the email link and we go to another page. <input type="hidden" name="rawlink" value="<?php echo $rawlink; ?>" /> The hiddne textbox is empty in the source. Onsubmit i use handleEmail.php and this is the code i use for the email message(not sure if this is right) $message = $_POST["msg"] $_POST["rawlink"] 'domain@me.com';
  19. Hi, i found this code <?php header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate'); header('Expires: Mon, 12 Jul 1996 04:11:00 GMT'); //Any date passed. header('Pragma: no-cache'); ?> is there any way to send it other then the header? as keep getting warning header already sent
  20. back button does not call page load. The page is not loading. the page is cached.
  21. what are the solutions for this. My problem is i have a picture displayed "uploading....." when a user clicks upload <div id = "mydiv" style="display:none"> <br /><center> <img src="uploading.png" /></center> </div> and this is called on click function showImage() { document.getElementById("mydiv").style.display="block"; } but if a user clicks back the image is stil there. what work arounds r there for this?
  22. i did wonder who that come from lol. thanks i will do
  23. Hi, I have my own server that i pay alot of money for. But i have not much idea about it as my mate set it up for me. I brought it from ovh
×
×
  • 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.