
contra10
Members-
Posts
402 -
Joined
-
Last visited
Never
Everything posted by contra10
-
i'm having trouble updating an image in my db. my code is as follows <?php include('settings.php'); // Make sure the user actually // selected and uploaded a file if(isset($_COOKIE['ID_my_site'])) { $usernamecookie = $_COOKIE['ID_my_site']; } if(is_numeric($_GET['user'])){ $id = $_GET['user']; } $name = mysql_real_escape_string($_POST['usernamecookie']); $idpic = mysql_real_escape_string($_POST['iduser']); if (isset($_POST['submit']) && ($_FILES['image']) && $_FILES['image']['size'] > 0) { // Temporary file name stored on the server $tmpName = $_FILES['image']['tmp_name']; $fileType = $_FILES['image']['type']; // Read the file $fp = fopen($tmpName, 'r'); $data = fread($fp, filesize($tmpName)); $data = addslashes($data); fclose($fp); // Create the query and insert // into our database. $query = "UPDATE `tbl_images` SET `image` = '" . $data . "', `filetype` = '" . $fileType . "' WHERE `userid` = '" . $idpic . "'"; $results = mysql_query($query) or die(mysql_error()); // Print results print "Thank you, your file has been uploaded."; }else{ echo "no photo uploaded"; } // Close our MySQL Link mysql_close($link); ?> <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="changer"> <input name="MAX_FILE_SIZE" value="512000000000" type="hidden"> <input name="image" accept="image/jpeg" type="file"> <tr><td><?php echo "<input type='hidden' name='usernamecookie' value='$usernamecookie'>"?></tr></td> <tr><td><?php echo "<input type='hidden' name='iduser' value='$id'>"?></td> <input value="Submit" type="submit" name="submit">
-
I've looked at my css and there are no absolute values. I'm testing my website on my laptop, and all is well until i look at the same website on my desktop. more specifically the header is causing the trouble and is meshing with the content of the page. my css is like this * { margin: 0; padding: 0; } body { background: #0171AF url(background.gif) repeat-x; font-family: "Trebuchet MS" Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 17px; color: #333; } a { text-decoration: none; color: #0171AF; } a:hover { text-decoration: underline; color: #111; } #wrap { margin: 40px auto; width: 880px; background: #fff; border: 10px solid #D1E6EF; } #header { height: 150px; } #header h1 { font-size: 28px; letter-spacing: -1px; padding: 23px 0 0 20px; color: #0171AF; } #header h1 a { color: #0171AF; text-decoration: none; font-weight: 100; letter-spacing: -2px; } #header h1 a:hover { color: #111; } #header h2 { font-size: 19px; color: #ACD3E5; padding: 5px 0 0 20px; letter-spacing: -1px; font-weight: 100; } #menu { height: 80px; line-height: 80px; background: #D1E6EF; } #menu ul { list-style-type: none; padding-left: 20px; } #menu ul li { float: left; } #menu ul li a { padding: 0 20px 0 0; text-decoration: none; font-weight: 100; font-size: 14px; } #menu ul li a:hover { color: #111; text-decoration: none; } #content { padding: 15px 20px 20px 20px; } .left { float: left; width: 460px; text-align: justify; } .left h2 { font-size: 18px; font-weight: 100; padding: 15px 0 7px 0; } .left h2 a { text-decoration: none; } .left h2 a:hover { color: #111; } .right { float: right; width: 260px; padding-top: 10px; } .right h2 { margin: 10px 0 0 0; padding-left: 10px; height: 28px; line-height: 28px; background: #D1E6EF; color: #111; font-size: 13px; } .right ul { padding: 10px 0 15px 10px; list-style-type: none; } .right ul li a { color: #648CA5; text-decoration: none; font-size: 14px; font-weight: 100; } .right ul li a:hover { color: #111; } .adleft { float: left; height: 105px; width:105px; border: 10px solid #ACD3E5; font-size: 18px; color: #aaa; text-align: center; } .adright { float: right; height: 105px; width:105px; border: 10px solid #ACD3E5; font-size: 18px; color: #aaa; text-align: center; } #footer { height: 20px; line-height: 30px; background: #D1E6EF; text-align: center; font-size: 11px; } .searchbox { border: 1px solid #ffffff; background: url(sbg.gif) repeat-x; color: #ffffff; font-size: 10px; font-family: verdana; padding: 4px; } and in all pages the trouble is caused with the link buttons not being in the header bgcolor but meshing with the content div id="wrap"> <div id="header"> <img src="http://www.url.com/wireimg.png"/> <img src="http://www.url.com/headerhelp.png"/> </div> <div id="menu" align="center"> <ul> <?php include '/home/user/public_html/file11986.php'; ?> </ul> </div> <div id="content"> <div class="left"> please help this is getting really irritating as my laptop is crystal clear and the desktop shows something different
-
I was told that I should use javascript to create a live countdown timer and then send information when the timer is finish send the information using php. The question is basically how should i go about creating a timer with javascript?
-
I want to ave te ability to set a time limit for listings, much like how ebay has time limit listings in which after the limit the listing is erased, how should i go about doing this?
-
ok i got it, but the image can still be distorted... its the same result as b4
-
still experiencing trouble. im trying to get it from the url. is there another way when doing that i get this error Fatal error: Call to undefined function resamplimgimagecopyresampled() in /home/username/public_html/profile/index.php on line 79 my image url is created from the code above and i use this in profile image display $large_image = imagecreatefromjpeg( "http://www.domain.com/image/viewlarge.php?id=$id" ); ## provided the dimension of the new smaller image $x = 180;$y = 180; ## create a black blank image with provided dimension $small_image = imagecreatetruecolor($x,$y); ## Just copy the larger image into the smaller image using resamplimgimagecopyresampled($small_image,$large_image,0,0,0,0,$x,$y,imagesx($large_image),imagesy($large_image)); ## Its always better to free the memory if you don't need thisimagedestroy($large_image); ## Just ignore the file name.# imagejpeg($small_image); ## Once again, free the memeoryimagedestroy($small_image); line 79 being resamplimgimagecopyresampled($small_image,$large_image,0,0,0,0,$x,$y,imagesx($large_image),imagesy($large_image));
-
i'm looking at the code but i can't find prob
-
i'm trying to show 6 different random pics but i get 6 of the same image being echoed <?php $resultalumni1 = "SELECT * FROM users WHERE image = 'true' ORDER BY RAND() LIMIT 6"; $result = mysql_query($resultalumni1) or die(mysql_error()); while ($rowalumni1 = mysql_fetch_array($result)){ $picid1 = "{$rowalumni1['id']}"; echo "<table border='0' width='400'>"; echo "<tr>"; echo "<td WIDTH='33%' height='100' align='center'><img src='http://www.test.com/image/imagereplace.php?id=$picid1'></td></a>"; echo "<td WIDTH='33%' height='100' align='center'><img src='http://www.test.com/image/imagereplace.php?id=$picid1'></td></a>"; echo "<td WIDTH='33%' height='100' align='center'><img src='http://www.test.com/image/imagereplace.php?id=$picid1'></td></a>"; echo "</tr>"; echo "<tr>"; echo "<td WIDTH='33%' height='100' align='center'><img src='http://www.test.com/image/imagereplace.php?id=$picid1'></td></a>"; echo "<td WIDTH='33%' height='100' align='center'><img src='http://www.test.com/image/imagereplace.php?id=$picid1'></td></a>"; echo "<td WIDTH='33%' height='100' align='center'><img src='http://www.test.com/image/imagereplace.php?id=$picid1'></td></a>"; echo "</tr>"; echo "</table>"; } ?>
-
sry but kinda confused....how does it work?
-
how should i put it in this code...this is to reze for larger image <?php // Create MySQL login values and // set them to your login information. $username = "root"; $password = ""; $host = "localhost"; $database = "userimages"; // Make the connect to MySQL or die // and display an error. $link = mysql_connect($host, $username, $password); if (!$link) { die('Could not connect: ' . mysql_error()); } $connect = mysql_select_db($database) or die("Can not select the database: ".mysql_error()); $id = $_GET['id']; if(!isset($id) || empty($id)){ die("Please select your image!"); }else{ $query = mysql_query('SELECT `image` FROM `tbl_images` WHERE `userid`= "'.$id.'"'); $row = mysql_fetch_assoc($query); $content = $row['image']; $desired_width = 300; $desired_height = 225; $im = imagecreatefromstring($content)or die("Can not select the database: ".mysql_error());; $new = imagecreatetruecolor($desired_width, $desired_height)or die("Can not select the database: ".mysql_error());; $x = imagesx($im); $y = imagesy($im); imagecopyresampled($new, $im, 0, 0, 0, 0, $desired_width, $desired_height, $x, $y)or die("Can not select the database: ".mysql_error());; imagedestroy($im); header('Content-type: ' . $row['type'] .''); imagejpeg($new, null, 85); } ?>
-
I concerned about resizing images, currently i resize images by simply stretching them out or making them smaller, but sometimes if i upload a picture that is more horizontal then vertical then the image can become distored or vice versa...is there a way i can upload and resize the image so that the image isn't distorted?
-
yup absolute positioning is the problem thnks
-
ok i realized my problem with the css, but for some reason iwhile i was working on it in my localhost it seemd good, but when i put it on the web, people say the pages distorted yet from my laptop it seemed ok, on my desktop the pages were distored and i set the display as the same as my laptop... any ideas as to what it may be?
-
ok on my laptop where im writting my page webpage the page look fine and arn't distored but when i check the website on my desktop its distoreted even when i change the display to that of my laptops display... does anyone know what ould be causing it
-
<head> <title>title</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="body2"> <div id="body3"> <div id="container"> <div id="header"> <div id="headerleft"> <div id="title"><img src="eventwireimg.png"></div> </div> <div id="headerright"> <div id="flickr"></div> <div id="search"> <?php // Connects to your Database mysql_connect("localhost", "weew", "") or die(mysql_error()); mysql_select_db("registration") or die(mysql_error()); //Checks if there is a login cookie if(isset($_COOKIE['ID_my_site'])) ?> line 16 is to be exact "<?php"
-
it worked it my localhost now i cant get it on the internet my cookie does not set at all, i can acccess my other pages freely without a cookie if i type it in the url and when i enter the username and password from homepage i get this error Warning: Cannot modify header information - headers already sent by (output started at /home/weew/public_html/index.php:16) in /home/weew/public_html/index.php on line 82 line 82 being setcookie(ID_my_site, $_POST['username'], $hour, "", "weew.com"); my code <?php // Connects to your Database mysql_connect("localhost", "weew", "") or die(mysql_error()); mysql_select_db("registration") or die(mysql_error()); //Checks if there is a login cookie if(isset($_COOKIE['ID_my_site'])) //if there is, it logs you in and directes you to the members page { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($pass != $info['password']) { } else { header("Location: http://weew.com/main/"); } } } $user = mysql_real_escape_string($_POST['username']); $pas = mysql_real_escape_string($_POST['pass']); //if the login form is submitted if (isset($_POST['submit_x'])) { // if form has been submitted // 4makes sure they filled it in if(!$_POST['username'] | !$_POST['pass']) { die('You did not fill in a required field.'); } // checks it against the database if (!get_magic_quotes_gpc()) { $_POST['email'] = addslashes($_POST['email']); } $check = mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die(mysql_error()); //Gives error if user dosen't exist $check2 = mysql_num_rows($check); if ($check2 == 0) { die('That user does not exist in our database. <a href=registration.php>Click Here to Register</a>'); } while($info = mysql_fetch_array( $check )) { $verified= "{$info['verified']}"; $_POST['pass'] = stripslashes($_POST['pass']); $info['password'] = stripslashes($info['password']); $_POST['pass'] = md5($_POST['pass']); //gives error if the password is wrong if ($_POST['pass'] != $info['password']) { die('Incorrect password, please try again.'); } //gives error if the password is wrong if ($verified == 'no') { die('you have not verified yet'); } $HTTP_HOST = "http://weew.com/"; // our server's hostname // if login is ok then we add a cookie $_POST['username'] = stripslashes($_POST['username']); $hour = time() + 3600; setcookie(ID_my_site, $_POST['username'], $hour, "", "weew.com"); setcookie(Key_my_site, $_POST['pass'], $hour, "", "weew.com"); header("Location: http://weew.com/main/"); } } else { // if they are not logged in ?> and the header file on all my pages <?php mysql_connect("localhost", "weew", "") or die(mysql_error()); mysql_select_db("registration") or die(mysql_error()); //checks cookies to make sure they are logged in if(isset($_COOKIE['ID_my_site'])) { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); $in = mysql_query("SELECT username FROM users WHERE username ='$username'") or die (mysql_error()); $in2 = mysql_query("SELECT id FROM users WHERE username ='$username'") or die (mysql_error()); while($info = mysql_fetch_array( $check )) while($row = mysql_fetch_assoc($in)) while ($row2 = mysql_fetch_assoc($in2)) { //if the cookie has the wrong password, they are taken to the login page if ($pass != $info['password']) { ob_start(); // Create the URL string $url = "http://weew.com/"; // Finall Echo the meta tag echo('<meta HTTP-EQUIV="REFRESH" content="0; url='.$url.'">'); } //otherwise they are shown the admin area else{ $user = "{$row2['id']}"; $userq = "{$row['username']}"; } } } else //if the cookie does not exist, they are taken to the login screen { } mysql_close(); ?>
-
i'm trying to show an image in my email but i can't seem to view it in the email <?php $to = ($email); $subject = "Verification"; //create a boundary string. It must be unique //so we use the MD5 algorithm to generate a random hash $random_hash = md5(date('r', time())); $from = "[email protected]"; $headers = "From: $from"; //add boundary string and mime type specification $headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\""; //define the body of the message. ob_start(); //Turn on output buffering ?> --PHP-alt-<?php echo $random_hash; ?> Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 7bit <IFRAME src="http://www.test.com/image.html" width="200" height="100" FRAMEBORDER="0"></iframe> <div style="width:800px;height:400px;border:4px dashed blue;"> <?php echo "<IFRAME src= 'http://test.com/image.html' width='200' height='100' FRAMEBORDER='0'></iframe>";?> <h2>You have sucessfully registered</h2><br> <table bgcolor="#0183AE"><tr><td> <?php echo "To contine to verify your account please follow the link<a href='http://test.com/verify.php?v=$userid' target='_blank'>Verify Account</a>"; ?> </td></tr></table> </div> --PHP-alt-<?php echo $random_hash; ?>-- <?php //copy current buffer contents into $message variable and delete current output buffer $message = ob_get_clean(); //send the email $mail_sent = @mail( "$to", $subject, $message, $headers ); ?> test.com is just a spoof name, im actually testing it on a real web server
-
ok while testing in on my local host i used an iframe to capture the image that i wanted <?php $to = ($email); $subject = "Verification"; //create a boundary string. It must be unique //so we use the MD5 algorithm to generate a random hash $random_hash = md5(date('r', time())); $from = "[email protected]"; $headers = "From: $from"; //add boundary string and mime type specification $headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\""; //define the body of the message. ob_start(); //Turn on output buffering ?> --PHP-alt-<?php echo $random_hash; ?> Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 7bit <?php echo "<IFRAME src= 'http://localhost/image.html' width='200' height='100' FRAMEBORDER='0'></iframe>";?> <div style="width:800px;height:400px;border:4px dashed blue;"> <h2>You have sucessfully registered </h2><br> <table bgcolor="#0183AE"><tr><td> <?php echo "To contine to verify your account please follow the link<a href='http://localhost/verify.php?v=$userid' target='_blank'>Verify Account</a>"; ?> </td></tr></table> </div> --PHP-alt-<?php echo $random_hash; ?>-- <?php //copy current buffer contents into $message variable and delete current output buffer $message = ob_get_clean(); //send the email $mail_sent = @mail( "$to", $subject, $message, $headers ); ?> it showed in the email but now im on the web and i change localhost to my url name and it doesn't show at all, i of course tried the link and it shows and i also tried to use the more practical <img src""/> still no luck
-
but if my submit is input type "image" cause im using an image instead of a submit button could it work
-
is this a javascipt problem like should i use onclick
-
im trying to allow the user to hit enter from the keyboard instead of moving the cursor to the button and clicking submit <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="text" name="status" maxlength="30"> <br> <input type="image" value="Update" name="submit" src="cooltext415698324.png" onmouseover="this.src='coolMouseOver.png';" onmouseout="this.src='cool.png';" /> thats my submit button
-
ok i went to my database i went to operations at the bottom it says: The additional features for working with linked tables have been deactivated. To find out why click here. I click there i get this: PMA Database ... not OK[ Documentation ] General relation features Disabled i'm working with WAMP server
-
if i wanted to move one table in another db how could i do that
-
could i do something like this <?php if (isset($_POST['logout'])) { $past = time() - 3900; //this makes the time in the past to destroy the cookie setcookie("ID_my_site", $_COOKIE['ID_my_site'], $past, "/"); setcookie("Key_my_site", $_COOKIE['Key_my_site'], $past, "/"); // Create the URL string $url = "http://localhost/"; // Finall Echo the meta tag echo('<meta HTTP-EQUIV="REFRESH" content="0; url='.$url.'">'); } ?> ill try the request as well post is coming from button cause this is in the header file