Jump to content

kickassamd

Members
  • Posts

    102
  • Joined

  • Last visited

    Never

Everything posted by kickassamd

  1. redirect code: replace the echo with this... [code] header("location: http://something.com/signuppage.php?error=tooshort"); [/code] on signuppage.php [code] if ($_POST['error'] == tooshort) {      echo "The username you entered was too short"; } [/code]
  2. [code] <? $folder = 'logos';     $extList = array(); $extList['gif'] = 'image/gif'; $extList['jpg'] = 'image/jpeg'; $extList['jpeg'] = 'image/jpeg'; $extList['png'] = 'image/png'; // You don't need to edit anything after this point. // --------------------- END CONFIGURATION ----------------------- $img = null; if (substr($folder,-1) != '/') { $folder = $folder.'/'; } if (isset($_GET['img'])) { $imageInfo = pathinfo($_GET['img']); if (     isset( $extList[ strtolower( $imageInfo['extension'] ) ] ) &&         file_exists( $folder.$imageInfo['basename'] )     ) { $img = $folder.$imageInfo['basename']; } } else { $fileList = array(); $handle = opendir($folder); while ( false !== ( $file = readdir($handle) ) ) { $file_info = pathinfo($file); if (     isset( $extList[ strtolower( $file_info['extension'] ) ] ) ) { $fileList[] = $file; } } closedir($handle); if (count($fileList) > 0) { $imageNumber = time() % count($fileList); $img = $folder.$fileList[$imageNumber]; } } if ($img!=null) { $imageInfo = pathinfo($img); $contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ]; header ($contentType); readfile($img); } else { if ( function_exists('imagecreate') ) { header ("Content-type: image/png"); $im = @imagecreate (100, 100)     or die ("Cannot initialize new GD image stream"); $background_color = imagecolorallocate ($im, 255, 255, 255); $text_color = imagecolorallocate ($im, 0,0,0); imagestring ($im, 2, 5, 5,  "IMAGE ERROR", $text_color); imagepng ($im); imagedestroy($im); } } ?> [/code] Change the $folder to point to where your images are then do a standard HTML image tag... <img src="image.php">
  3. add exit(); after the echo statement and it will stop the browser Or you can have the browser redirect back to the login page with an error displayed.
  4. How stupid of me.... Such a simple thing  :-\  How did I overlook such a n00b mistake! Thanks so much drifter I feel so dumb now!
  5. Correct always use Server Side to handle registrations because anything client can always have a work around.
  6. [code] <input type='submit' value='Signup' onsubmit='DM()'> [/code] Will never work even if you have he right code... PHP is a server side language and can not be used on the client side
  7. [code] <? function checkLength($test, $minLength) { if (strlen($test) < $minLength) { return false; } else { return true; } } // Use it like this if (!checkLength($_POST['user'], 4)) { echo "Username Not Long Enough!"; } ?> [/code]
  8. For quicker help message me on AOL : circuit256 or yahoo: KickassAMD
  9. Javascript cant do it because it cant interact with server unless maybe you have PHP build JS before it goes to client with all the username's taken. Or use AJAX. Its really just easier to have the user submit the form, then have PHP see if its available.
  10. [quote author=Mythic Fr0st link=topic=117058.msg477352#msg477352 date=1165022238] thanks, i'll look into it if I continue you have bad errors O_O [/quote] I have errors???
  11. [code]<head> <style type="text/css"> body { background-image: url('SilverBG.jpg') } </style> </head> <body> <?php if ($_POST['pw1'] == $_POST['pw2']) { } ?> </body> </html> [/code] You missed the () around the IF statement, and its $_POST not $_POSTED. Id recommend using an IDE like Zend Developer to limit errors and detect errors.
  12. Try one off of PHPs site [code]<?php // multiple recipients $to  = 'aidan@example.com' . ', '; // note the comma $to .= 'wez@example.com'; // subject $subject = 'Birthday Reminders for August'; // message $message = ' <html> <head>   <title>Birthday Reminders for August</title> </head> <body>   <p>Here are the birthdays upcoming in August!</p>   <table>   <tr>     <th>Person</th><th>Day</th><th>Month</th><th>Year</th>   </tr>   <tr>     <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>   </tr>   <tr>     <td>Sally</td><td>17th</td><td>August</td><td>1973</td>   </tr>   </table> </body> </html> '; // To send HTML mail, the Content-type header must be set $headers  = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n"; $headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n"; $headers .= 'Cc: birthdayarchive@example.com' . "\r\n"; $headers .= 'Bcc: birthdaycheck@example.com' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); ?>[/code] Change the top two vars and test... if it fails then contact your host.
  13. [code] <? $yourwebsite = "http://FIF1217.no-ip.org"; // Your website $recipientname = "FIF1217 Software Admin"; // Whats your name ?! $subject="FIF1217 Software Website";  // The subject of the mail thats being sended $recipient="FIF1217Software+form@gmail.com"; // the recipient $completetion_message="Thanks for sending us your comments!"; $email = $_POST['email']; $nickname = $_POST['nickname']; /*   The headers for the e-mail, no need to change it unless you know what you're doing */ $header = "From: $nickname <$email>\r\n"; $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-Type: text/html; charset=iso-8859-1\r\n"; $header .= "X-Priority: 3\r\n"; $header .= "X-MSMail-Priority: Normal\r\n"; $header .= "X-Mailer: PHP / ".phpversion()."\r\n"; /*   You can change the text below to whatever you wish to have   for the way the mail is gonne be outputted, you can use HTML! */ $content= " Dear $recipientname, $nickname has sended you an e-mail from $yourwebsite.<br><br> <b>Message:</b> $message <hr noshade=\"true\" size=\"1\" color=\"#000000\" /> You can contact $nickname back at $email."; // Lets send the e-mail by using the mail() function, no need to change below...this can be edited above! //mail($recipient, $content, $header); if (mail($recipient, $subject, $content, $header)) { // Message the user will see if the e-mail is succesfully sended :) echo "Thanks for sending your message!"; } else { echo "Failed Sending message"; } ?>[/code] Copy paste this over email-guts.php and try!
  14. [code] <? $name = $_POST['name']; $name2 = $_POST['name2']; // Check For Match if ($name != $name2) {     echo "The username you entered does not match! Try again..."; } // Check Length elseif (strlen($name) < 4) { echo "The username you is too short. Try again..."; } ?> [/code] Try this, should work just change the second $_POST['name2'] to the name of your second form field. I'd recommend javascript though...
  15. Im having problems reading from an array via mysql_fetch_array() the function ================ [code] getBoth($result) {    while ($dbArray = @mysql_fetch_array($result, MYSQL_BOTH))    {        $returnArray[] = $dbArray;    } return $returnArray; } [/code] if i print_r(getBoth($queryResult)) i get this ============ [code] Array ( [0] => Array ( [0] => Stubbs [char_name] => Stubbs ) [1] => Array ( [0] => Ic3m4n [char_name] => Ic3m4n ) [2] => Array ( [0] => Bawlz [char_name] => Bawlz ) [3] => Array ( [0] => CrispinxLongbow [char_name] => CrispinxLongbow ) [4] => Array ( [0] => Lilice [char_name] => Lilice ) ) [/code] If i use [code] foreach ($online as $key => $name) {                   echo $name; } [/code] it just prints ============== [code] ArrayArrayArrayArrayArray [/code] So then i have to [code] foreach ($online as $key => $name) { foreach ($name as $player) { echo $player."<br>"; } } [/code] To print each name to the screen..... is there something I am doing wrong... 2 foreach loops to print an array seems wrong
  16. [code]foreach ($xoopsModuleConfig['groups_display'] as $group => $key) { $sql = "SELECT `uid` FROM `".$xoopsDB->prefix('groups_users_link')."` WHERE `groupid` = '$key'"; $result = $xoopsDB->query($sql); while($uid = mysql_fetch_array($result)) { $user[] = $uid; } for ($i = 0; $i < count($user)-1+1; $i++) { $user2[] = $user[$i]['uid']; } } print_r($user);[/code] when i echo the $user array i get [quote]Array ( [0] => Array ( [0] => 1 [uid] => 1 ) [1] => Array ( [0] => 4 [uid] => 4 ) [2] => Array ( [0] => 22 [uid] => 22 ) [3] => Array ( [0] => 45 [uid] => 45 ) )[/quote] which is ok...but when i print_r($user2) i get [quote]Array ( [0] => 1 [1] => 1 [2] => 4 [3] => 22 [4] => 45 ) [/quote] Why is coming up with 2  1's that is what i dont get...
  17. [code] <? $path = "path\to\folder"; $files = scandir($path); print_r($files); ?> [/code] Places each file and directory name with the give path into an array.
  18. [!--quoteo(post=383664:date=Jun 14 2006, 02:52 AM:name=joquius)--][div class=\'quotetop\']QUOTE(joquius @ Jun 14 2006, 02:52 AM) [snapback]383664[/snapback][/div][div class=\'quotemain\'][!--quotec--] the Smarty object refers to it and you have called the Smarty object. check what's going on on line 1108 in the smarty class file [/quote] Smarty works just fine...just not when im trying to use it within another class...
  19. I cant get this to work.... (I can extend the class from the other....but why...shouldnt have to) Class 1 is the Smarty() Template Engine Class 2 is my system class for redirecting users, processing user logins...etc etc. Thing is im trying to use the smarty class within my system for this public function redirect_header($url,$time,$message) { // Set Smarty Variables Smarty::assign('redirect_url',$url); Smarty::assign('redirect_time',$time); Smarty::assign('redirect_notice',$message); // Display Redirect Page... Smarty::display('redirect_page.tpl'); } it works just fine...until i use the display function then i get this error Fatal error: Call to undefined method core_system_factory::fetch() in c:\Inetpub\wwwroot\classes\smarty\Smarty.class.php on line 1108. I dont understand why it doesnt work.... fetch() is a smarty function not mine...so why is it looking in my class for it.... So my true question is how can i use a class function from another class within a class... with extending my system class from Smarty....
  20. Is there a way with PHP to check to see if a URL (PHP document) was manually entered into a browser or if it was requested by a webserver like a <href> or <img> tag?
  21. [!--quoteo(post=373617:date=May 13 2006, 07:40 PM:name=webdogjcn)--][div class=\'quotetop\']QUOTE(webdogjcn @ May 13 2006, 07:40 PM) [snapback]373617[/snapback][/div][div class=\'quotemain\'][!--quotec--] Andy B: I made the page in Notepad and didn't think that notepad supported 'Smart Quotes' Redarrow: what change did you make in the code I can't see any difference I don't know what you did but I copied it in there and now I get: Unable to select database [/quote] Did you spell your database name correct in $database? also does that user have access to that DB? Also had some variences with scripts on diffrent hosts mysql_select_db($database) would work on host A but host B had to be mysql_select_db("$database"); Also if you have some extra $$ I would HIGHLY recommend Zend Developer.
  22. [!--quoteo(post=373613:date=May 13 2006, 07:20 PM:name=toplay)--][div class=\'quotetop\']QUOTE(toplay @ May 13 2006, 07:20 PM) [snapback]373613[/snapback][/div][div class=\'quotemain\'][!--quotec--] This gets sent by the browser (if even a browser is used) and so it's not 100% reliable. Some browsers might not send it but most do. It also can be faked/altered by smart users/hackers. Sometimes when you're testing locally instead of the Internet, it doesn't get passed/set. But make sure you're using $_SERVER['HTTP_REFERER'] and not $HTTP_REFERER. See: [a href=\"http://us2.php.net/manual/en/reserved.variables.php#reserved.variables.server\" target=\"_blank\"]http://us2.php.net/manual/en/reserved.vari...ariables.server[/a] [/quote] I am using the $_SERVER['HTTP_REFERER'] variable, And used IE \ Maxthon \ FF, none seem to work..... Im just trying to create a simple hotlink protection script. Sense Im on windows i cant use .htaccess.
×
×
  • 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.