Jump to content

Digitizer

Members
  • Posts

    46
  • Joined

  • Last visited

Posts posted by Digitizer

  1. @jacques1: He may have turned off warnings/errors reporting so to him, the error

    //The line below was formatted according to html style he defined
    The username 
    Notice: Undefined variable: username in <file_path>.php on line 5
    already exists.
    

    he is getting just the line

    The username already exists
    

    You are right. he may not have defined $username.

     

    @IHaveAQuestion: Can you post the full code you wrote? and please write them in code section (using <> icon in this editor)

  2. Ever since I came across NotePad++, i never used any other,

     

    It is fast, updated regularly, language support of almost all languages with a user defined language support

     

    It does miss auto-suggest, but i rarely used it anyway, its like flow of fingers on keys, hitting enter when I am not supposed to (as in case of selecting auto suggested word), just breaks the flow ... i know its just me.. lolzz 

  3. Hello guys,

     

    I require a suggestion about how shall I proceed as when I am about to set a goal for my future in programming world, Just so that you could suggest me better, I urge you to please read about a little background history of mine.  And please stay neutral in regards of language, dont say PHP because you are a PHP developer and dont say Java because you are a Java developer.

     

    Thanks.

     

    I stepped into programming when I was in school (below A-levels at 14, now I am 29) and I started to bunk school and went to internet cafe and would sit there reading sources of HTML pages in year 2000. I would observe their programming styles, I would learn about the tags they used and then search internet (it was IE6 then and Yahoo searching at its peak) so I could learn about it.

     

    Years passed, and having my family related to medical professions, I took admission in Pharmacy in University and quit after 2 years and entered working class.  My development slowed down but passion always stayed the same.

     

    Now I am in Spain and working as a technician of mobile repairing with a company, but I still have this passion of programming and when I learn that etc etc friend of mine now is working with CISCO in Germany, now is working as a game developer in America, I become really sad. I could have been one of those. But the fact is that I am not. So I restarted again with development and started learning PHP on my work desk using online resources and tutorials and asking silly questions.

     

    Nothing I could become but an obsolete language programmer with a mess.

     

    Now when I havent been able to become someone, till now, I still have passion and I want to be somewhere.

     

    -----------------------------

    I am confused for some days now, shall I continue with PHP (apart from the fact that i am a MYSQL learner, haven't learned PDO or MYSQLi till now) or shall I step into Java learning, using the online resources ofCourse, but if I step into Java, It will be a fresh start and I will be able to organize it better on my way with guidance of professionals like you.

     

    The Things confusing me: (as I am imagining in my mind)

     

    PHP:

    A great web development language being used on billions of website, have an extraodinary support, well documented, World is moving online, so future is e-commerce in these terms.

     

    JAVA:

    Feels a giant to me, and impresses me at times, a myth to me, I am speaking illogical I know, and after android, I see a great potential in this language.

  4. you might be amazed the way I do it.. lolz

     

    I use this desk:

    1. While I am at work repairing mobile phones

    2. While I am practicing programming

    3. While I am playing games

     

    I dont use this desk when

    1. I am not at this desk and probably on my bed (i took this picture from my bed lolzz)

     

     

    post-172637-0-39931900-1409264299_thumb.jpg

  5. Forgiving you all the laziness in your coding practices to date, I ask "What happens when password <> savedpassword"?  You don't go that far but that seems to be the problem.

     

    1 - don't use MySQL.  Stop trying to learn it.

    2 - Always sanitize user input and don't use them directly in queries

    3 - Don't save a password value in a db without encrypting it.

     

    And a personal tip: Since php is a case sensitive language try not to use both upper and lower case letters in your var names.  It will only cause you trouble as you go on when you accidentally mis-type a name and then have to figure out why your code isn't working.  Stick to all lowercase.

    Thanks for the tip brother, Humbly answering,

    1. I have started learning mysqli_* which i personally prefer over PDO for mysqli_* being almost similar in syntax and can enter my (nowadays) rusted out mind

    2. I have learnt about sanitizing but since i am writing codes on local xampp server, i dont feel necessary to use them atm. (no offence)

    3. I usually use md5 hash for passwords, but this code was, as i said, just a hint out of what I was facing in processing.

    4. if password is <> savedPassword, the "else" section will handle this. or shall I use "xor" for such comparison?

    5. I am very much used to write variables in Camel format (ever since i started learning programming), so this is not an issue for me that I will miss :/ (just saying)

     

    What do you practice then? Writing bad, obsolete code?  ::)

    Let me confess, that I am a messy lazy a$$ programmer who dont even know anything about OOP, even after practicing it for a little while, i dont even know how so called exampled "setName" and "getName" functions work. Well, I am trying hard,

     

    1. to get organized

    2. build patterns in coding

    3. lets start learn mysqli and start moving to OOP approach rather than a messy programming.

     

    If you ever saw my style of writing, if you require i can pass you this whole script for you to take a look, but nothing will happen and I will find you once day looking for me with a chainsaw in your hands.. lolzz..

     

    Edit: The problem has always been that I never went to any school college to learn programming. It was my passion, and has been ever since when I used to bunk school and sit in an internet cafe reading sources of HTML pages back in 2000 so i could learn something off it.. then I moved to PHP... and digging my way out real slow with online turorials and finally landed here with you guys. So before I offend you with my non-pro style of writing, just think once that i have been able to learn with minimal resources and it is my passion that brought me until here... and will take me forward :)

  6. Hello,

    I am recently starting to have this problem. I have a script which send variables in header back to index  based on If/Else conditions, But if condition change, the sent headers in URL bar dont get cleared but they get added. My code is as follows

     

    index.php

    // The usernames are stored in array named $username, e-g $username = array();
    foreach($username as $user){
    
    // Display div if password is not correct or success
    if(isset($_GET['action']) && $_GET['user'] == $user){
      $action= $_GET['action'];
      echo "<div class='error'>".$lang[$action]."</div>";
    }
    
    // display form for login
     echo ("
       <div class='divBlock'>
        <form name='doStuff' method='post' action='checkin.php'>
           <input type='hidden' name='username' value=".$user."
           <input type='password' name='password' />
           <input type='submit' name='submitLogin' />
        ");
       </div>
    }
    

    and my checkin.ph file contains

    if(isset($_POST['submitLogin'])){
       $username = $_POST['username'];
       $password = $_POST['password'];
    
       $getSavedPass = mysql_query("SELECT * FROM passwords WHERE username='$username'");
       //not using while loop as only one row will be returned
       $showSavedPass = mysql_fetch_array($getSavedPass);
       $savedPassword = $showSavedPass['password'];
    
       // If passwords match
       if($password == $savedPassword){
          header("Location: " . $_SERVER['HTTP_REFERER'] . "?action=Success&user=".$username);
       } else {
          header("Location: " . $_SERVER['HTTP_REFERER'] . "?action=PASSWORD_INCORRECT&user=$username");
       }
    }
    

    I have rewritten script here in simple format and using mysql_*, I am gonna stay with it for a while and I am not using escape_strings as it is just practice, not any production thing.

     

    How can I fix it? I will be very thankful to you

  7. I am not very good with PDO, but see if i can be of some help or idea :/

    try to get count of returned rows and put dynamic rowspan on TR

    	$giftCard = $db->prepare($giftCardQuery);
    	$giftCard->bindValue(':cardStatus', 'Enabled', PDO::PARAM_STR);
    	$giftCard->execute();
    	$count = $giftCard->rowCount(); // get count in a variable
    

    and change the html like this

    <tr>
      <td rowspan='".$count."'>".$nameOrImage."</td> // here
      <td style=\"text-align:center\">".$giftCardRow['currency'].$giftCardRow['amount']."</td>
      <td style=\"text-align:center\">".$giftCardRow['pointsPrice']."</td>
      <td style=\"text-align:center\">".$gCardsAvailable."</td>
      <td style=\"text-align:center\">".$gCardsRedeemed."</td>
      <td style=\"text-align:center\">".$redeemAction."</td>
    </tr>";
    
  8. Hello guys,

     

    I am an intermediate level PHP programmer and digging my way through this giant universe of programming,

     

    During this term, I have been able to build logics for problems (simple ones though) using my own thinking etc etc..

     

    Anyway, I fully understand that I still have a lot to learn and I dont have any teachers to guide me through. So I wanted to request that If i submit an application for a quick review, like what I missed, how should I do it next time and guidance like this will seriously help me through.

     

    I know it will be a pain reviewing someone else's apps but i dont have elsewhere to go..

  9. Android is a Java based platform.

    You will need to download and install Google SDK and Eclispe to start.

    You will need to practice a lot.

     

    I did the same and fell back to PHP coding... because i got myself seriously confused with what I wanted to do.

     

    Set a goal for yourself and chase it like crazy... dont  mix yourself with new languaue unless you really want to do it

  10. Ok, as you are saying if you were to build a form yourself, and check for number format correctly,

     

    Here is how I would do it using PHP only, anyway, i doubt that to understand even what I am going to write, you will need to understand PHP, but I am here to help, so will I :)

    <?php
    
    	if(isset($_POST['submitForm'])){
    		$phNum = $_POST['phoneNumber'];
    		
    		// Lets first check its validity
    		// We wanted it to start from 138 and have 16 numbers lets say
    		
    		//Check length first (if it not 12, throw error else keep on)
    		$phNumLength = strlen($phNum);
    		
    		if($phNumLength != '12'){
    			die("You have given " . $phNumLength . "numbers. It must be 12. Please go back and change");
    		}
    		
    		//Check format (it must start from 138)
    		$phNumFormat = substr($phNum,0,3);
    		if($phNumFormat != '138'){
    			die("
    				Your phone Number is in wrong format, e-g it is 
    				starting from " . $phNumFormat . ". It must be
    				starting from 138
    			");
    		}
    		
    		// If these two conditions are met, the code will continue to do its job
    		// further on
    	}
    
    ?>
    
    	<form name="myForm" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    		<input type="text" name="phoneNumber" placeholder="138xxxxxxxxx" />
    		<input type="submit" name="submitForm" />
    	</form>
    
    

    Well, if you have any more questions about this?? 

    Well, if you have any more questions about this??

  11. Everyone is right here, they do not have that chunk of code to explain.. anyway, let say you somehow found where it needs to be changed and you saw that there is a form field with <input></input> just change its value to be as follows

    <input type="text" name="whatevert it could be" value="138"></input>
    
    //thats the best I can do without having your code
    
  12. You might be imagining this part of PHP wrong, 

     

    PHP is Pre HyperText Processor, means, anything to do with PHP on page, will be processed before displaying HTML to user.

    If you were to use PHP inside forms or let say, you wanted the form to be PHPized,

     

    There could be two ways, as in my humble opininon,

    <?php
    
    	/* suppose we have some variables or data coming from PHP
    	and we want to use them in HTML form - I am using hardcoding
    	for simplicity and better understanding */
    	
    	$username = "theUser";
    	$group = "admin";
    	
    	if($group == 'admin'){$isAdmin = true;} else {$isAdmin = false;}
    	
    	/* One way is as follows, to use the HTML inside PHP
    	------------------------------------------------------------------------------
    	I want so set a condition that if username is declared and user 
    	group is admin, display the following form */
    	
    	if($isAdmin){
    		echo("
    			<form name='myForm' method='post' action='" . $_SERVER['PHP_SELF'] . "'>
    				<input type='text' name='username' value = '" . $username . "' />
    				<input type='submit' name='submitForm' value='Go' />
    			</form>
    		");
    	} else {
    		echo "You do not have permission to do blah blah";
    	}
    	
    	/* Note that we have been doing everyhting of this inside <?php  ?> tag
    	Now we will try to use the same form outside <?php tag */
    ?>
    
    	<!--
    		The Other way is outside php tag and using html straight
    		Please not that how I am using <?php //code ?> tags inside
    		the form to get data from PHP
    	-->
    	
    	<?php if($isAdmin){ ?>
    	<form name="myForm" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    		<input type="text" name="username" value="<?php echo $username; ?>" />
    		<input type="submit" name="submitForm" value="Go" />
    	</form>
    	<?php } else { ?>
    	<span>You do not have permission to do blah blah</span>
    	<?php } ?>
    

    I hope you will get it. :)

  13. Try to change your code as this and see if this is what you wanted

    div#search_bar_container
    {
    	width: 85%;
    	height:80px;
    	margin-left: auto;
            margin-right: auto;
    	position:relative;
    	float: left;
    	padding: 10px;
    	clear: both; /* So The parent div after this div will come into next line */
    }
    
    div#search_bar_container #logo
    {
    	float: left;
            background-image: url('logo.png'); 
    	height: 80px; 
    	width: 220px;
    }
    
    div#search_bar_container #search-bar
    {
    	float: left;
    	width: 50%;
    	margin-top: 25px; /* Adjust this height to your need*/
    }
    
    input#search
    {
    	
    	position: relative;
    	width: 40%;
    	border: 1px solid #080808;
    	height: 30px;
    	border-radius: 20px;
    	font-family: Verdana,Arial,sans-serif;
    	font-size: 14px;
    	color: #000;
    	vertical-align: middle;
    	padding-left: 10px; /* Added this one so text will actually look inside */
    }
    
    div#search_bar_container #quick-links
    {
    	float: right;
    	margin-top: 25px; /* Adjust this height to your need*/
    	font: normal 8pt 'Verdana',Arial,sans-serif;
    	color: #000;
    
    }
    
    

    and @Cornix is right, you should use "percentage" for container sizing rather than hard coded PXs.  Random users always have difference resolutions on their screens and your page might not look good .. e-g a 1920px widescreen, where it will land your page?

  14. Hello Guys,

    This is Muneeb from Spain, an intermediate level PHP student coming from StackOverFlow, I was forced to leave the webssite because everyone there has become so professional that they have started bullying you.

     

    So here I am landed now, hoping to meet "actually" nice knowledge givers :)

     

     

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