Jump to content

web_master

Members
  • Posts

    419
  • Joined

  • Last visited

Posts posted by web_master

  1. you should really be checking your SQL for errors.

     

    you have double-quotes around your variables instead of single-quotes:

     

    $sql = 'SELECT * FROM `user` WHERE `user_nick` = "' . $myusername . '" AND `user_password` = "' . $mypassword . '" AND `user_onoff` = "1" AND `user_delete` = "0" ';

     

    should be:

     

    $sql = "SELECT * FROM `user` WHERE `user_nick` = '" . $myusername . "' AND `user_password` = '" . $mypassword . "' AND `user_onoff` = 1 AND `user_delete` = 0 "

     

    Ill try it but still dont work ... :(

     

    ill check the loginf form too...

     

    <form action="<?php echo 'CheckLogin.php';?>" method="post">
    	<div class="LoginHead">
    		<p class="LinkHead">Login</p></div>
    	<div class="LoginLeft"><p class="LoginLeft"><label for="NickName">Nick:</label></p></div>
    	<div class="LoginRight"><input type="text" id="NickName" name="nick" class="Login" /></div>
    
    	<div class="LoginLeft"><p class="LoginLeft"><label for="PassWord">Password:</label></p></div>
    	<div class="LoginRight"><input type="password" id="PassWord" name="password" class="Login" /></div>
    
    	<div class="LoginLeft1"><!-- --></div>
    	<div class="LoginRight1"><input type="submit" id="UserSubmit" name="user_submit" value="LOGIN" class="RegSubmit" /></div>
    	<div class="ClearBoth"><!-- --></div>
    </form>
    

  2. Hi,

     

    I got some login problem, some users can login, some dont

     

    <?php 
    
    // Connect to MySQL
    include ( '../MySQLconnect.php' );
    error_reporting ( E_ERROR );
    @ini_set ( 'display_errors', '1' );
    
    // username and password sent from form
    $myusername = $_POST[ 'nick' ];
    $mypassword = md5 ( $_POST[ 'password' ] );
    
    
    
    // To protect MySQL injection
    $myusername = stripslashes ( $myusername );
    $mypassword = stripslashes ( $mypassword );
    $myusername = mysql_real_escape_string ( $myusername );
    $mypassword = mysql_real_escape_string ( $mypassword );
    
    $sql = 'SELECT * FROM `user` WHERE `user_nick` = "' . $myusername . '" AND `user_password` = "' . $mypassword . '" AND `user_onoff` = "1" AND `user_delete` = "0" ';
    $result = mysql_query( $sql );
    
    
    
    $count = mysql_num_rows ( $result );
    $UsrId = mysql_fetch_array ( $result );
    
    
    
    if ( $count == '1' ) {
    
    
    
    	session_register ( 'myusername' );
    	session_register ( 'mypassword' );
    
    
    
    	setcookie ( 'nick', $myusername, NULL );
    	setcookie ( 'pass', $mypassword, NULL );
    	setcookie ( 'user_id', $UsrId[ 'user_id' ], NULL );
    
    	header ( 'location:IndexInput.php' );
    
    } else {
    	echo 'BAD login';
    }
    ?>
    

     

    If the names (or password) contain numbers, than I can't login... :(

     

    Thanks in advanced!

     

    T

  3. Hi,

     

    is some possibilty to cache someones mac-address, like as can cache the IP address  getenv( 'REMOTE_ADDR' ) ?

     

    When someone log in, than to log from a different ip address, but only with his mac-address...

     

    thnax

  4. Hi,

     

    I made an shoutbox, I want to ban some IP-s, and after that list the banned IP-s but, if there is a more than one of a same IP, I want to list one of each IP. My code is looks like this:

     

    <?php 
    // Reload from dBase
    $QueryReturn = mysql_query ( 'SELECT DISTINCT
    	`shout_id`,
    	`shout_ip`,
    	`shout_ban`,
    	`shout_ban_datetime`
    FROM
    	`shout`
    WHERE `shout_ban` = "1" 
    ORDER BY `shout_id` DESC
    ' );
    
    // Check query
    if ( !$QueryReturn ) { echo mysql_error(); exit; }
    
    // Request query
    while ( $REQUEST = mysql_fetch_array ( $QueryReturn ) ) {
    
    echo $REQUEST[ 'shout_ip' ];
    }
    ?>
    
    
    

     

    what am I wrong, because that list everything not only one IP...

  5. Hi web_master,

     

    On your form you are using "valud" instead of "value" for both the "ShoutID" and "ShoutReload" input fields.  Change the last to lines of your form to read:

     

    <div><input type="hidden" id="ShoutID" name="shout_id" value="<?php echo $REQUEST[ 'shout_id' ];?>" /></div>
    <div><input type="hidden" id="ShoutReload" name="reload" value="<?php echo $Reload;?>" /></div>
    

     

    Hope this helps.

     

    Oh, what an amateur mistake, thanks, maybe Im tired... THANX Bricktop !!!!!!!!!!!!

  6. hi,

     

    well, I try to find what I'm I done wrong... the "reload" don't work, and I don't know why? The code is:

     

    <?php 
    // Connect to MySQL
    include ( '../MySQLconnect.php' );
    error_reporting(E_ALL);
    @ini_set( 'display_errors', '1' );
    $Reload = $_REQUEST[ 'reload' ];
    ++$Reload;
    ?>
    
    
    <?php 
    if ( $Reload == '2' ) {
    
    
    // No Preg
    $Preg = $_POST[ 'shout_txt' ];
    
    $Replacement['0'] = '/\\\"(.*?)\\\"/';
    $Replacement['1'] = '/\\\'/';
    
    $Replaced['0'] = '„$1”';
    $Replaced['1'] = '’';
    
    $NoPregText = preg_replace($Replacement, $Replaced, $Preg);
    
    
    // Insert into dBase
    $Query = mysql_query(' INSERT INTO `shout` (
    	`shout_nick`,
    	`shout_txt`,
    	`shout_datetime`,
    	`shout_ip`,
    	`shout_host`
    ) VALUES (
    	"' . $_POST[ 'shout_nick' ] . '",
    	"' . $NoPregText . '",
    	"' . date( 'Y-m-d H:i:s' ) . '",
    	"' . getenv( 'REMOTE_ADDR' ) . '",
    	"' . gethostbyaddr( getenv( 'REMOTE_ADDR' ) ) . '"
    )' );
    
    // Check query
    if ( !$Query ) { echo mysql_error(); exit; }
    
    // Retrieves the last ID
    $shout_id = mysql_insert_id();
    
    // Reload from dBase
    $QueryReturn = mysql_query( 'SELECT * FROM `shout` WHERE `shout_id` = "' . $shout_id . '" ' );
    
    // Check query
    if ( !$QueryReturn ) { echo mysql_error(); exit; }
    
    // Request query
    $REQUEST = mysql_fetch_array ( $QueryReturn );
    
    }
    ?>
    
    <div><form id="ShoutForm" action="<?php echo $_SERVER[ 'REQUEST_URI' ];?>" method="post">
    <div><input type="text" id="ShoutNick" name="shout_nick" value="<?php echo $REQUEST[ 'shout_nick' ];?>" maxlength="8" class="Nick" /></div>
    <div><textarea id="ShoutTxt" name="shout_txt" cols="55" rows="4" class="ShoutTxt"><?php echo $REQUEST[ 'shout_txt' ];?></textarea></div>
    <div><input type="submit" id="ShoutSubmit" name="shout_submit" value="ELKÜLD" class="Submit" /></div>
    <div><input type="hidden" id="ShoutID" name="shout_id" valud="<?php echo $REQUEST[ 'shout_id' ];?>" /></div>
    <div><input type="hidden" id="ShoutReload" name="reload" valud="<?php echo $Reload;?>" /></div>
    </form></div>
    

  7. OK, I will try to explain,

     

    I made a site on domain with name example: www.black.com

    the customer who order the site watch my work, mean how I build the site and if he want some changes, he tell me. The customer is the provider, that mean when I finish the site he will "simple rename" the domain into www.white.com. So, if I use full links in files, I will need to change all the links after rename of domainname...

     

    I hope is understble...

     

  8. Hi,

     

    I got a script for a image Watermark.

     

    <?php  
    
    header('content-type: image/jpeg');  
    
    
    
    
    $watermark = imagecreatefrompng('watermark.png');  
    $watermark_width = imagesx($watermark);  
    $watermark_height = imagesy($watermark);  
    $image = imagecreatetruecolor($watermark_width, $watermark_height);  
    $image = imagecreatefromjpeg($_GET['src']);  
    $size = getimagesize($_GET['src']);  
    $dest_x = $size[0] - $watermark_width - 5;  
    $dest_y = $size[1] - $watermark_height - 5;  
    imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100);  
    imagejpeg($image);  
    imagedestroy($image);  
    imagedestroy($watermark);  
    
    ?>
    

     

    It can Use it like this, write to browser link:

    http://localhost/fotoneis/test.php?src=photoalbums/1_photoalbum/1_photo_big.jpg

     

    And its work perfect.

     

    BUT

     

     

    how can I use a same script in my script:

     

    <?php 
    $PhotoBigDestination = 'photoalbums/' . $_GET['AlbID'] . '_photoalbum/' . $_GET['PhotoG'] . '_photo_big.jpg';
    if ( file_exists( $PhotoBigDestination ) ) {
    		$PhotoBigPrint = '<img src="' . $PhotoBigDestination . '" alt=" " class="BigIMG" /><br /><br />';
    }
    
    ?>

     

     

    If I replace $PhotoBigDestination with $image Ive got print image on the screen like this: "...JFIFCREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality..."

     

    <?php 
    $PhotoBigDestination = 'photoalbums/' . $_GET['AlbID'] . '_photoalbum/' . $_GET['PhotoG'] . '_photo_big.jpg';
    
    
    header('content-type: image/jpeg');  
    
    
    
    
    $watermark = imagecreatefrompng('watermark.png');  
    $watermark_width = imagesx($watermark);  
    $watermark_height = imagesy($watermark);  
    $image = imagecreatetruecolor($watermark_width, $watermark_height);  
    $image = imagecreatefromjpeg($PhotoBigDestination);  // HERE IS THE CHANGE $_GET['src'] to $PhotoBigDestination
    $size = getimagesize($PhotoBigDestination);  // HERE IS THE CHANGE TOO $_GET['src'] to $PhotoBigDestination
    $dest_x = $size[0] - $watermark_width - 5;  
    $dest_y = $size[1] - $watermark_height - 5;  
    imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100);  
    imagejpeg($image);  
    imagedestroy($image);  
    imagedestroy($watermark);  
    
    
    
    if ( file_exists( $PhotoBigDestination ) ) {
    		$PhotoBigPrint = '<img src="' . $image . '" alt=" " class="BigIMG" /><br /><br />';
    }
    ?>
    

     

    So, I dont know how can I use the script in my script? :(

     

    in advanced thanxs

     

    T

     

  9. hi,

     

    I got a table and one column is column of the years. Well there is lots of different years in rows but there is a lots of same years.

     

    My question is, how can I list years but if in table more than one of the same "year" list only one time.

     

    Exaple:

     

    in table is:

    2008

    2008

    2008

    1976

    2007

     

    Listed:

    2008

    2007

    1976

     

     

    <?php 
    $query_return = mysql_query("SELECT `years` FROM `text` ORDER BY `id`");
    
    while($request = mysql_fetch_array($query_return)) {
    
    //
    
    }
    ?>
    

     

    thanxs in advanced,

     

    T

  10. Try this:

    <?php
    $sql = "SELECT COUNT(*) AS `phone_count` FROM `request` WHERE `request_tel` = '" . $_POST['request_tel'] . "'";
    $rs = mysql_query($sql) or die(mysql_error());
    $row = mysql_fetch_assoc($rs);
    mysql_free_result($rs);
    if ( $row['phone_count'] >= 3 ) {
       echo 'Phone number <strong>' . $_POST['request_tel'] . '</strong> entered more then 3 times.';
    }
    ?>
    

     

    Put this code above the INSERT SQL statement and do the required checks in it.

     

    Hope this will help.

     

     

    ITS WORK, THANKX PEOPLE!!! GREAT

  11. Hi,

     

    I put into database:

    <?php 
    $Query = mysql_query('INSERT INTO `request` (
    	`request_year`,
    	`request_month`,
    	`request_day`,
    	`request_date`,
    	`request_ip`,
    	`request_tel`,
    	`request_txt`,
    	`request_artist`,
    	`request_title`,
    	`request_datetime`,
    	`request_ipp`
    
    ) VALUES (
    	"'.$_POST['request_year'].'",
    	"'.$_POST['request_month'].'",
    	"'.$_POST['request_day'].'",
    	"'.$_POST['request_year'].$_POST['request_month'].$_POST['request_day'].'",
    	"'.$_POST['request_ip'].'",
    	"'.$_POST['request_tel'].'",
    	"'.$NoPregText.'",
    	"'.$_POST['request_artist'].'",
    	"'.$_POST['request_title'].'",
    	"'.date('Y-m-d H:i:s').'",
    	"'.getenv('REMOTE_ADDR').'"
    )');
    
    ?>

     

    But! Before put the data into database I want to check is there in database same phonenumber 3 times (`request_tel`)?

     

    How can I check this?

     

    (if in database same phonenumber more than 3 times the data can't be put into dbase)

     

    thanx

  12. Hi,

     

    I have a form, and in a form submit for a delete picture.

     

    form is like this:

     

    <div><form id="UplAboutForm" action="<?php echo $_SERVER['REQUEST_URI'];?>" method="post" enctype="multipart/form-data">
    
    <div><input name="PhotoDelete" type="submit" class="Submit" value="DELETE" /></div>
    
    <div><input type="hidden" name="reload" value="<?php echo $Reload;?>" /></div>
    
    <div><input type="hidden" name="aboutus_id" value="<?php echo $Request['aboutus_id'];?>" /></div>
    
    </form></div>
    

     

    I want One pop-up window to confirm delete with confirm text "are You..." and with two buttons YES and NO.

    If they push the YES button

     

    If the YES button is pushed the code is like this for deleting picture:

     

    <?php 
    if($_POST['PhotoDelete']) {
    
    $photo_th = "../r_photoalbum/".$_POST['aboutus_id']."_photo_th.jpg";
    $photo = "../r_photoalbum/".$_POST['aboutus_id']."_photo.jpg";
    	if(is_file($photo_th)) {unlink($photo_th);}
    	if(is_file($photo)) {unlink($photo);}
    
    } // End of PhotoDelete
    ?>
    

     

    So, I know that can be a javascript but I dont find anywhere the "mixed" script with javascript/php to do what I want...

     

    thanx in adwanced.

×
×
  • 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.